git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@85 e2b1556b-49f8-d141-9351-52d6861a72d9
153 lines
5.7 KiB
PHP
153 lines
5.7 KiB
PHP
<?php
|
|
//FICHERO DE IDIOMAS
|
|
define("LOCALE", "idiomas/");
|
|
define("LOCALESET", "sp/");
|
|
include LOCALE.LOCALESET."lenguaje.php";
|
|
?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title><?php echo $locale['Capacidades004'];?></title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
<link rel="shortcut icon" href="css/favicon.ico">
|
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
|
<link rel="stylesheet" type="text/css" href="css/tablas.css" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
/**
|
|
* Página que ofrece un formulario para agregar capacidades profesionales
|
|
*
|
|
* Hay que tener cuidado porque todas las variables que se le pasan por post son agregadas.
|
|
*/
|
|
include("functions.php");
|
|
include_once("Objects/HTML.php");
|
|
$html=new HTML($locale);
|
|
$mensaje="";
|
|
$errores=array();
|
|
$errores_capacidad="";
|
|
|
|
//Al ser añadir sabemos siempre que viene de la pantalla del candidato con el id del canidato pasado por get
|
|
$id_candidato = $_GET['id_candidato'];
|
|
|
|
//Cuando se da a guardar todo viene por POST
|
|
if(stripinput($_POST['action'])=="add"){
|
|
$id_candidato = $_POST["id_candidato"];
|
|
$perfil_tecnico = $_POST["id_perfil_tecnico"];
|
|
$perfil_funcional = $_POST["id_perfil_funcional"];
|
|
$tecnologias = $_POST["tecnologias"];
|
|
|
|
//VALIDACIONES
|
|
include("verificarCapacidadProfesional.php");
|
|
|
|
if(count($errores)==0){
|
|
$arrayInsert=array();
|
|
$camposQuitar=array();
|
|
$camposQuitar["action"]=stripinput($_POST['action']);
|
|
$camposQuitar["id_candidato"]=stripinput($_POST['id_candidato']);
|
|
$camposQuitar["id_perfil_tecnico"]=stripinput($_POST['id_perfil_tecnico']);
|
|
$camposQuitar["id_perfil_funcional"]=stripinput($_POST['id_perfil_funcional']);
|
|
$camposQuitar["tecnologias"]=$_POST['tecnologias'];
|
|
$camposInsertar=array_diff_assoc($_POST,$camposQuitar);
|
|
$camposInsertar["id_usuario"]=$_POST['id_candidato'];
|
|
$camposInsertar["id_perfil_tecnico"]=$perfil_tecnico[0]; //Sabemos que siempre va a tener un unico elemento el array ya que no le dejamos seleccionar mas de uno
|
|
$camposInsertar["id_perfil_funcional"]=$perfil_funcional[0]; //Sabemos que siempre va a tener un unico elemento el array ya que no le dejamos seleccionar mas de uno
|
|
$vacio=array();
|
|
$vacio['0']="";
|
|
$_POST['tecnologias']=array_diff_assoc($_POST['tecnologias'],$vacio);
|
|
|
|
foreach($camposInsertar as $nombre_campo => $valor){
|
|
if($valor!="")
|
|
$arrayInsert[$nombre_campo]=$valor;
|
|
}
|
|
|
|
// Insertamos la nueva capacidad
|
|
try{
|
|
$errorInsert=false;
|
|
include_once("Objects/CapacidadProfesional.php");
|
|
$CapacidadProfesional = new CapacidadProfesional(-1,"candidato");
|
|
$idCapacidadNew= $CapacidadProfesional->addCapacidad($arrayInsert);
|
|
$CapacidadProfesional = new CapacidadProfesional($idCapacidadNew,"candidato");
|
|
if($idCapacidadNew!="-1"){
|
|
//Este proceso se hace para que se agregen bien las tecnologías ya que en la edicion se espera despues del id de la tecnologia -meses de la misma
|
|
for ($i=0; $i < count($tecnologias); $i++)
|
|
$tecnologias[$i]=$tecnologias[$i]."-";
|
|
$CapacidadProfesional->addTecnologias($tecnologias);
|
|
header("Location: gestionCapacidadProfesional.php?id=".$idCapacidadNew);
|
|
} else {
|
|
$tipomsg="error";
|
|
$mensaje="No se ha podido insertar";
|
|
}
|
|
} catch (Exception $e){
|
|
$tipomsg="error";
|
|
$mensaje=$e->getMessage();
|
|
}
|
|
} else {
|
|
$tipomsg="error";
|
|
$mensaje=$errores_capacidad;
|
|
}
|
|
}
|
|
|
|
echo "<h2>".$locale['Capacidades014']."</h2>";
|
|
if($mensaje!=""){
|
|
// Mostramos el mensaje
|
|
echo "<div class=\"aviso ".$tipomsg."\">".$mensaje."</div>";
|
|
}
|
|
echo $locale['286'];
|
|
|
|
echo "<form action=\"addCapacidadProfesional.php\" method=\"POST\" enctype=\"multipart/form-data\">";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"add\" />";
|
|
echo "<input type=\"hidden\" name=\"id_candidato\" value=\"".$id_candidato."\" />";
|
|
|
|
echo '<div class="encabezado">'.$locale['Capacidades005'].'</div>';
|
|
echo '<table align="center" width="100%">';
|
|
|
|
echo '<tr align="left">';
|
|
echo '<td width="75%" ';
|
|
if(in_array("1",$errores)) echo " class=\"errorcampo\"";
|
|
echo '>'.$locale['121'].'<br>';
|
|
echo $html->listaSelect("perfil","oid","id","id_perfil_tecnico",array("",$locale['ns']),$_POST['id_perfil_tecnico'],true,false,"1");
|
|
echo '</td>';
|
|
|
|
//MESES_TECNICO
|
|
echo '<td>'.$locale['Capacidades008'].'<br><input type="text" name="meses_tecnico" value="'.$_POST['meses_tecnico'].'" size="10" maxlength="10"><br></td>';
|
|
echo '</tr>';
|
|
|
|
echo '<tr align="left">';
|
|
echo '<td colspan="2" >'.$locale['122'].'<br>';
|
|
echo $html->listaSelect("tecnologia","oid","id","tecnologias",array("",$locale['ns']),$_POST['tecnologias'],true,true,"15");
|
|
echo '</td></tr>';
|
|
|
|
echo '</table>';
|
|
|
|
echo '<div class="encabezado">'.$locale['Capacidades007'].'</div>';
|
|
echo '<table align="left" width="100%">';
|
|
echo '<tr>';
|
|
echo '<td width="75%"';
|
|
if(in_array("2",$errores)) echo " class=\"errorcampo\"";
|
|
echo '>'.$locale['Capacidades002_0'].'<br>';
|
|
echo $html->listaSelect("perfil_funcional","oid","id","id_perfil_funcional",array("",$locale['ns']),$_POST['id_perfil_funcional'],true,false,"1");
|
|
echo '</td>';
|
|
|
|
//MESES_FUNCIONAL
|
|
echo '<td>'.$locale['Capacidades008'].'<br><input type="text" name="meses_funcional" value="'.$_POST['meses_funcional'].'" size="10" maxlength="10"><br></td>';
|
|
echo '</tr>';
|
|
|
|
// CAMPO OBSERVACIONES
|
|
echo '<tr><td colspan="2">'.$locale['135'].'<br><textarea name="observaciones" rows="7" cols="50" style="overflow: auto;width:100%; height:100px"">'.$_POST['observaciones'].'</textarea></td></tr>';
|
|
|
|
echo '</table>';
|
|
|
|
echo '<input type="submit" value="'.$locale['gu'].'" class="button">';
|
|
echo ' ';
|
|
echo '<input type="button" value=" '.$locale['cerrar'].' " class="button" onclick="window.close()">';
|
|
echo "</form>";
|
|
|
|
|
|
?>
|
|
|
|
</body>
|