git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@1 e2b1556b-49f8-d141-9351-52d6861a72d9
265 lines
12 KiB
PHP
265 lines
12 KiB
PHP
<?php
|
|
/**
|
|
* Página que ofrece un formulario para agregar candidatos y contiene la lógica
|
|
* para agregar un candidato
|
|
*
|
|
* Hay que tener cuidado porque todas las variables que se le pasan por post son agregadas.
|
|
*/
|
|
include("seguridad.php");
|
|
include("functions.php");
|
|
|
|
if(!$usuario->tieneRol("4")
|
|
&& !$usuario->tieneRol("1")){
|
|
header("Location: aplicacion.php?e=permiso");
|
|
exit;
|
|
}
|
|
|
|
|
|
|
|
$errores=array();
|
|
|
|
if(stripinput($_POST['action'])=="add"){
|
|
$errores_persona = "";
|
|
include_once("campos_persona.php");
|
|
if(count($provincia_deseada)==0){
|
|
$errores_persona .= $locale['1708']."<br />";
|
|
$errores[]="22";
|
|
}
|
|
|
|
if((count($perfil)==1) && ($perfil["0"]=="")){
|
|
$errores_persona .= $locale['1705']."<br />";
|
|
$errores[]="23";
|
|
}
|
|
include_once("verificar_usuario.php");
|
|
if(count($errores)==0){
|
|
$arrayInsert=array();
|
|
include_once("Objects/ListaEmpleados.php");
|
|
$listaEmpleados=new ListaEmpleados($usuario,"","","10");
|
|
$fecha_nacimiento_ini = stripinput($_POST['anyonac'])."-".stripinput($_POST['mesnac'])."-".stripinput($_POST['dianac']);
|
|
$fecha_alta = stripinput($_POST['anyoalta'])."-".stripinput($_POST['mesalta'])."-".stripinput($_POST['dianac']);
|
|
$camposQuitar=array();
|
|
$camposQuitar["dianac"]=stripinput($_POST['dianac']);
|
|
$camposQuitar["mesnac"]=stripinput($_POST['mesnac']);
|
|
$camposQuitar["anyonac"]=stripinput($_POST['anyonac']);
|
|
$camposQuitar["diaalta"]=stripinput($_POST['diaalta']);
|
|
$camposQuitar["mesalta"]=stripinput($_POST['mesalta']);
|
|
$camposQuitar["anyoalta"]=stripinput($_POST['anyoalta']);
|
|
$camposQuitar["MAX_FILE_SIZE"]=stripinput($_POST['MAX_FILE_SIZE']);
|
|
$camposQuitar["tecnologia"]=stripinput($_POST['tecnologia']);
|
|
$camposQuitar["idiomas"]=stripinput($_POST['idiomas']);
|
|
$camposQuitar["titulaciones"]=stripinput($_POST['titulaciones']);
|
|
$camposQuitar["provincia_deseada"]=stripinput($_POST['provincia_deseada']);
|
|
$camposQuitar["perfil"]=stripinput($_POST['perfil']);
|
|
$camposQuitar["action"]=stripinput($_POST['action']);
|
|
|
|
$camposInsertar=array_diff_assoc($_POST,$camposQuitar);
|
|
$camposInsertar["fecha_nacimiento"]=$fecha_nacimiento_ini;
|
|
$camposInsertar["fecha_alta"]=$fecha_alta;
|
|
$vacio=array();
|
|
$vacio['0']="";
|
|
$_POST['tecnologia']=array_diff_assoc($_POST['tecnologia'],$vacio);
|
|
$_POST['idiomas']=array_diff_assoc($_POST['idiomas'],$vacio);
|
|
$_POST['titulaciones']=array_diff_assoc($_POST['titulaciones'],$vacio);
|
|
foreach($camposInsertar as $nombre_campo => $valor){
|
|
if($valor!="")
|
|
$arrayInsert[$nombre_campo]=$valor;
|
|
}
|
|
// Insertamos el nuevo empleado
|
|
try{
|
|
$errorInsert=false;
|
|
$idEmpleadoNew=$listaEmpleados->addEmpleado($arrayInsert);
|
|
if($idEmpleadoNew!="-1"){
|
|
include_once("Objects/Empleado.php");
|
|
$empleadoNew=new Empleado($usuario,$idEmpleadoNew);
|
|
$empleadoNew->addTecnologias($_POST['tecnologia']);
|
|
$empleadoNew->addIdiomas($_POST['idiomas']);
|
|
$empleadoNew->addTitulaciones($_POST['titulaciones']);
|
|
if($_POST['provincia_deseada']==""){
|
|
$_POST['provincia_deseada']=array();
|
|
}
|
|
$empleadoNew->addProvinciasDeseadas($_POST['provincia_deseada']);
|
|
$empleadoNew->addPerfiles($_POST['perfil']);
|
|
$empleadoNew->addCurriculum($_FILES['userfile']);
|
|
header("Location: detalle_empleado.php?oid=".$idEmpleadoNew);
|
|
} else {
|
|
$tipomsg="error";
|
|
$mensaje="No se ha podido insertar";
|
|
}
|
|
} catch (Exception $e){
|
|
$tipomsg="error";
|
|
$mensaje=$e->getMessage();
|
|
}
|
|
} else {
|
|
$tipomsg="error";
|
|
$mensaje=$errores_persona;
|
|
}
|
|
}
|
|
include_once("html/cabecera.php");
|
|
include_once("Objects/HTML.php");
|
|
$html=new HTML($locale);
|
|
$html->menuEmpleados();
|
|
echo "<h2>".$locale['807']."</h2>";
|
|
if($mensaje!=""){
|
|
// Mostramos el mensaje
|
|
echo "<div class=\"aviso ".$tipomsg."\">".$mensaje."</div>";
|
|
}
|
|
|
|
echo $locale['286'];
|
|
$tipo="usuario";
|
|
|
|
if($errorInsert){
|
|
|
|
}
|
|
|
|
echo "<form action=\"addEmpleado.php\" method=\"POST\" enctype=\"multipart/form-data\">";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"add\" />";
|
|
//Datos personales:
|
|
echo '<input type="submit" value="'.$locale['807'].'" class="button">';
|
|
echo '<div class="encabezado">'.$locale['1548'].'</div>';
|
|
echo '<table align="center" width="100%">';
|
|
echo '<tr>
|
|
<td ';
|
|
if(in_array("2",$errores)) echo " class=\"errorcampo\"";
|
|
echo $en.' width="25%" textalign="right">'.$locale['100'].'<br><input type="text" name="nombre" value="'.$_POST['nombre'].'" size="20" maxlength="50"><br></td>
|
|
<td ';
|
|
if(in_array("3",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' width="25%" textalign="right">'.$locale['101'].'<br><input type="text" name="apellidos" value="'.$_POST['apellidos'].'" size="30" maxlength="150"></td>
|
|
<td width="25%" textalign="right">'.$locale['116'].'<br>';
|
|
rellena_fecha_select($fecha_nacimiento, "nac");
|
|
echo '</td>';
|
|
echo '<td ';
|
|
if(in_array("4",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' width="25%" '.$edni.' textalign="right">'.$locale['1539'].'<br><input type="text" name="dni" value="'.$_POST['dni'].'" size="9" maxlength="9"></td></tr>';
|
|
echo '<tr>
|
|
<td ';
|
|
if(in_array("1",$errores)) echo ' class="errorcampo"';
|
|
echo ' width="25%">'.$locale['103'].'<input type="text" name="email" value="'.$_POST['email'].'" size="30" maxlength="50"></td>
|
|
<td ';
|
|
if(in_array("6",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' width="25%" '.$etm.' textalign="right" width=20%>'.$locale['107'].'<input type="text" name="t_movil" value="'.$_POST['t_movil'].'" size="9" maxlength="9"></td>
|
|
<td ';
|
|
if(in_array("7",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' width="25%" '.$etc.' textalign="right" width=20%>'.$locale['108'].'<input type="text" name="t_casa" value="'.$_POST['t_casa'].'" size="9" maxlength="9"></td>
|
|
<td ';
|
|
if(in_array("8",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' width="25%" '.$ett.' textalign="right" width=20%>'.$locale['109'].'<input type="text" name="t_trabajo" value="'.$_POST['t_trabajo'].'" size="9" maxlength="9"></td>
|
|
</tr>';
|
|
echo '<tr>
|
|
<td ';
|
|
if(in_array("17",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' textalign="right">'.$locale['114'.$tipo.''].'';
|
|
rellena_desplegable_localidad($_POST['localidad'], "localidad");
|
|
echo '</td>
|
|
<td '.$dir.' textalign="right">'.$locale['128'].'';
|
|
$auxiliar = '<option value="">-</option>';
|
|
rellena_desplegable_select("tipo_via","tipo_via",$auxiliar,$_POST['tipo_via']);
|
|
echo '<br>'.$locale['110'].'<input type="text" name="direccion" value="'.$_POST['direccion'].'" size="20" maxlength="50"></td>
|
|
<td textalign="right" '.$enum.'>'.$locale['111'].'
|
|
<input type="text" name="numero" value="'.$_POST['numero'].'" size="5" maxlength="25"><br>
|
|
'.$locale['112'].'
|
|
<input type="text" name="piso" value="'.$_POST['piso'].'" size="5" maxlength="25"><br>
|
|
'.$locale['113'].'
|
|
<input type="text" name="puerta" value="'.$_POST['puerta'].'" size="5" maxlength="25">
|
|
</td>
|
|
<td ';
|
|
if(in_array("12",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' textalign="right" '.$ecp.'>'.$locale['115'].'
|
|
<input type="text" name="cp" value="'.$_POST['cp'].'" size="3" maxlength="5">
|
|
</td>
|
|
</tr>';
|
|
echo '<tr>
|
|
<td colspan="4" align="center">'.$locale['126'].'<br><textarea name="descripcion" rows="4" cols="40" style="overflow: auto;">'.$_POST['descripcion'].'</textarea></td></tr></table>';
|
|
|
|
//Datos laborales:
|
|
echo '<input type="submit" value="'.$locale['807'].'" class="button">';
|
|
echo '<div class="encabezado">'.$locale['1550'].'</div>';
|
|
echo '<table align="center" width="100%">';
|
|
echo '<tr>';
|
|
echo '<td ';
|
|
if(in_array("20",$errores)) echo " class=\"errorcampo\"";
|
|
echo 'width="33%" textalign="right">'.$locale['1800'].'* : ';
|
|
$auxiliar = '<option selected value="">'.$locale['ns'].'</option>';
|
|
rellena_procedencias("procedencia",$auxiliar,$_POST['procedencia']);
|
|
echo '<td width="33%" textalign="right">';
|
|
echo $locale['1800']." ".$locale['1091'].":";
|
|
echo $html->listaSelect("procedencia_cv","id","nombre","procedenciaCV",array("","-"),array($_POST['procedenciaCV']),true,false,"1");
|
|
echo '</td>
|
|
<td ';
|
|
if(in_array("14",$errores)) echo " class=\"errorcampo\"";
|
|
echo 'textalign="right">'.$locale['1618'].'<input type="text" name="salario" value="'.$_POST['salario'].'" size="10" maxlength="25"><br></td>
|
|
|
|
</tr>';
|
|
echo '</tr>';
|
|
|
|
|
|
echo '<tr>
|
|
<td ';
|
|
if(in_array("5",$errores)) echo " class=\"errorcampo\"";
|
|
echo 'textalign="right">'.$locale['105usuario'].'<input type="text" name="seguridad_social" value="'.$_POST['seguridad_social'].'" size="12" maxlength="12"><br></td>
|
|
<td ';
|
|
if(in_array("9",$errores)) echo " class=\"errorcampo\"";
|
|
echo 'textalign="right">'.$locale['106'].'<input type="text" name="cuenta_corriente" value="'.$_POST['cuenta_corriente'].'" size="20" maxlength="20"><br></td><td></td>
|
|
</tr>';
|
|
|
|
|
|
echo '<tr>';
|
|
echo '<td ';
|
|
if(in_array("23",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' textalign="right" '.$eper.'><div style="float:left ">'.$locale['121'].'</div><div style="float:left ">';
|
|
$auxiliar = '<option selected value="">'.$locale['ns'].'</option>';
|
|
echo $html->listaSelect("perfil","oid","id","perfil",array("",$locale['ns']),$_POST['perfil'],true,true,"15");
|
|
|
|
echo '</div></td>';
|
|
echo '<td ';
|
|
if(in_array("22",$errores)) echo " class=\"errorcampo\"";
|
|
echo ' width="33%" textalign="right" '.$ldes.'><div style="float:left ">'.$locale['1590'].'* </div><div style="float:left ">';
|
|
|
|
echo $html->listaSelect("provincias","oid","id","provincia_deseada",array("",$locale['ns']),$_POST['provincia_deseada'],true,true,"15");
|
|
|
|
echo '</div></td>';
|
|
|
|
echo '<tr>
|
|
<td colspan="3" align="center">'.$locale['135'].'<br><textarea name="observaciones" rows="7" cols="50" style="overflow: auto;">'.$_POST['observaciones'].'</textarea></td></tr><tr>';
|
|
echo '</tr></table>';
|
|
|
|
echo '<input type="submit" value="'.$locale['807'].'" class="button">';
|
|
// CURRICULUM
|
|
echo '<div class="encabezado">'.$locale['1549'].'</div>';
|
|
echo '<table align="center" width="100%">';
|
|
echo '<tr align="center">
|
|
<td textalign="right">'.$locale['122'].'</td><td>';
|
|
$auxiliar = '<option selected value="">'.$locale['ns'].'</option>';
|
|
|
|
echo $html->listaSelect("tecnologia","oid","id","tecnologia",array("",$locale['ns']),$_POST['tecnologia'],true,true,"15");
|
|
|
|
echo '</td>
|
|
|
|
<td align="right">'.$locale['123'].'</td><td>';
|
|
$auxiliar = '<option selected value="">'.$locale['ns'].'</option>';
|
|
|
|
echo $html->listaSelect("idiomas","oid","id","idiomas",array("",$locale['ns']),$_POST['idiomas'],true,true,"15");
|
|
|
|
echo '</td>
|
|
|
|
<td align="right">'.$locale['124'].'</td><td>';
|
|
$auxiliar = '<option selected value="">'.$locale['ns'].'</option>';
|
|
|
|
echo $html->listaSelect("titulaciones","oid","id","titulaciones",array("",$locale['ns']),$_POST['titulaciones'],true,true,"15");
|
|
|
|
echo '</td>
|
|
|
|
</tr>';
|
|
echo '<tr><td colspan="6">';
|
|
menu_curriculums($_GET['oid'], "candidato");
|
|
echo '</td></tr><tr>';
|
|
echo '<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
|
|
<td colspan="6" textalign="right">'.$locale['125'].'<br>';
|
|
echo '<input name="userfile" type="file">';
|
|
echo '</td></tr></table>';
|
|
|
|
echo '</table>';
|
|
echo '<input type="submit" value="'.$locale['807'].'" class="button">';
|
|
echo "</form>";
|
|
include_once("html/pie.php");
|
|
?>
|