git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@85 e2b1556b-49f8-d141-9351-52d6861a72d9
194 lines
6.8 KiB
PHP
194 lines
6.8 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");
|
|
include_once("Objects/CapacidadProfesional.php");
|
|
$html=new HTML($locale);
|
|
$mensaje="";
|
|
$errores=array();
|
|
$errores_capacidad="";
|
|
|
|
$action="";
|
|
if(!Empty($_POST['action'])){
|
|
$action=$_POST['action'];
|
|
} else {
|
|
if(!Empty($_GET['action'])){
|
|
$action=$_GET['action'];
|
|
}
|
|
}
|
|
|
|
$id_capacidad="";
|
|
if(!Empty($_POST['id'])){
|
|
$id_capacidad=$_POST['id'];
|
|
} else {
|
|
if(!Empty($_GET['id'])){
|
|
$id_capacidad=$_GET['id'];
|
|
}
|
|
}
|
|
|
|
$capacidad=new CapacidadProfesional($id_capacidad,"candidato");
|
|
$camposCapacidad = $capacidad->getCampos();
|
|
|
|
switch ($action) {
|
|
case "edit":
|
|
$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_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_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']="";
|
|
$tecnologias=array_diff_assoc($tecnologias,$vacio);
|
|
foreach($camposInsertar as $nombre_campo => $valor){
|
|
if($valor!="")
|
|
$arrayInsert[$nombre_campo]=$valor;
|
|
}
|
|
|
|
// Modificamos la capacidad profesional
|
|
try{
|
|
$errorInsert=false;
|
|
$capacidad->modificarCapacidad($arrayInsert);
|
|
//El proceso es eliminar todas las tecnologias de la capacidad y volverlas a insertar
|
|
//por lo que a las tecnologias nuevas pasados por el POST hay que añadir las ya existentes con sus meses
|
|
$tec_aux = $capacidad->getTecnologias();
|
|
foreach ($tec_aux as $fila){
|
|
$tecnologias[]=$fila["id_tecnologia"];
|
|
}
|
|
//Metemos los meses de cada tecnologia si los tuviera
|
|
for ($i=0; $i < count($tecnologias); $i++){
|
|
$caption="meses_".$tecnologias[$i];
|
|
$tecnologias[$i]=$tecnologias[$i]."-".$_POST[$caption];
|
|
}
|
|
if (count($tecnologias)>0)
|
|
$capacidad->addTecnologias($tecnologias);
|
|
|
|
$mensaje=$locale['Capacidades010'];
|
|
$tipomsg="ok";
|
|
} catch (Exception $e){
|
|
$tipomsg="error";
|
|
$mensaje=$e->getMessage();
|
|
}
|
|
} else {
|
|
$tipomsg="error";
|
|
$mensaje=$errores_persona;
|
|
}
|
|
break;
|
|
|
|
case "dellTec":
|
|
$idTec=$_GET['id_tec'];
|
|
$capacidad->removeTecnologia($id_capacidad, $idTec);
|
|
$mensaje=$locale['1064'];
|
|
$tipomsg="ok";
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
//Refrescamos la clase para que se recogan los posibles cambios realizados en el switch
|
|
$capacidad = new CapacidadProfesional($id_capacidad,"candidato");
|
|
$camposCapacidad = $capacidad->getCampos();
|
|
|
|
|
|
echo "<h2>".$locale['Capacidades011']."</h2>";
|
|
if($mensaje!=""){
|
|
// Mostramos el mensaje
|
|
echo "<div class=\"aviso ".$tipomsg."\">".$mensaje."</div>";
|
|
}
|
|
echo $locale['286'];
|
|
|
|
echo "<form action=\"gestionCapacidadProfesional.php\" method=\"POST\" enctype=\"multipart/form-data\">";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"edit\" />";
|
|
echo "<input type=\"hidden\" name=\"id\" value=\"".$id_capacidad."\" />";
|
|
|
|
echo '<div class="encabezado">'.$locale['Capacidades005'].'</div>';
|
|
echo '<table align="center" width="100%">';
|
|
|
|
echo '<tr align="left">';
|
|
echo '<td width="50%"';
|
|
if(in_array("23",$errores)) echo " class=\"errorcampo\"";
|
|
echo '>'.$locale['121'].'<br>';
|
|
echo $html->listaSelect("perfil","oid","id","id_perfil_tecnico",array("",$locale['ns']),array($camposCapacidad['id_perfil_tecnico'],""),true,false,"1");
|
|
echo '</td>';
|
|
|
|
//MESES_TECNICO
|
|
echo '<td>'.$locale['Capacidades008'].'<br><input type="text" name="meses_tecnico" value="'.$camposCapacidad['meses_tecnico'].'" size="10" maxlength="10"></td>';
|
|
echo '</tr>';
|
|
|
|
echo '<tr align="left">';
|
|
echo '<td>'.$locale['122'].'<br>';
|
|
$tecnologias=$capacidad->getTecnologias();
|
|
$arrayseleccion=array();
|
|
echo $html->listaSelect("tecnologia","oid","id","tecnologias",array("",$locale['ns']),$arrayseleccion,true,true,"15");
|
|
echo '</td>';
|
|
echo '<td>';
|
|
foreach ($tecnologias as $tecnologia) {
|
|
$arrayseleccion[] = array($tecnologia['id_tecnologia'], $tecnologia['id']);
|
|
echo '<input type="text" name="meses_'.$tecnologia["id_tecnologia"].'" value="'.$tecnologia['meses'].'" size="10" maxlength="10"> ';
|
|
echo $tecnologia['id']." <a href=\"gestionCapacidadProfesional.php?id=".$id_capacidad."&action=dellTec&id_tec=".$tecnologia['id_tecnologia']."\">Borrar</a><br />";
|
|
}
|
|
echo '</td>';
|
|
echo '</tr>';
|
|
|
|
echo '</table>';
|
|
|
|
echo '<div class="encabezado">'.$locale['Capacidades007'].'</div>';
|
|
echo '<table align="left" width="100%">';
|
|
echo '<td width="50%">'.$locale['Capacidades002_0'].'<br>';
|
|
echo $html->listaSelect("perfil_funcional","oid","id","id_perfil_funcional",array("",$locale['ns']),array($camposCapacidad['id_perfil_funcional'],""),true,false,"1");
|
|
echo '</td>';
|
|
|
|
//MESES_FUNCIONAL
|
|
echo '<td>'.$locale['Capacidades008'].'<br><input type="text" name="meses_funcional" value="'.$camposCapacidad['meses_funcional'].'" size="10" maxlength="10"></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"">'.$camposCapacidad['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>
|
|
|