223 lines
7.9 KiB
PHP
223 lines
7.9 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);
|
||
|
|
|
||
|
|
$action="";
|
||
|
|
if($_POST['action']!=""){
|
||
|
|
$action=$_POST['action'];
|
||
|
|
} else {
|
||
|
|
if($_GET['action']!=""){
|
||
|
|
$action=$_GET['action'];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$id_capacidad="";
|
||
|
|
if($_POST['id']!=""){
|
||
|
|
$id_capacidad=$_POST['id'];
|
||
|
|
} else {
|
||
|
|
if($_GET['id']!=""){
|
||
|
|
$id_capacidad=$_GET['id'];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$errores=array();
|
||
|
|
$capacidad=new CapacidadProfesional($id_capacidad,"candidato");
|
||
|
|
$camposCapacidad = $capacidad->getCampos();
|
||
|
|
//echo "0.clase> ".$id_capacidad ."id_perfil_funcional>".$camposCapacidad['id_perfil_funcional'];
|
||
|
|
|
||
|
|
switch ($action) {
|
||
|
|
case "edit":
|
||
|
|
/*{ $perfil = stripinput($_POST["perfil"]);
|
||
|
|
$meses_tecnico = stripinput($_POST["meses_tecnico"]);
|
||
|
|
$tecnologia = $_POST["tecnologia"];
|
||
|
|
$perfil_funcional = stripinput($_POST["perfil_funcional"]);
|
||
|
|
$meses_funcional = stripinput($_POST["meses_funcional"]);
|
||
|
|
$meses_observaciones = stripinput($_POST["observaciones"]);
|
||
|
|
*/
|
||
|
|
//VERIFICAR
|
||
|
|
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["tecnologia"]=$_POST['tecnologia'];
|
||
|
|
$camposInsertar=array_diff_assoc($_POST,$camposQuitar);
|
||
|
|
$camposInsertar["id_perfil_tecnico"]=$_POST['id_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"]=$_POST['id_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['tecnologia']=array_diff_assoc($_POST['tecnologia'],$vacio);
|
||
|
|
foreach($camposInsertar as $nombre_campo => $valor){
|
||
|
|
if($valor!="")
|
||
|
|
$arrayInsert[$nombre_campo]=$valor;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Modificamos la capacidad profesional
|
||
|
|
try{
|
||
|
|
$errorInsert=false;
|
||
|
|
$capacidad->modificarCapacidad($arrayInsert);
|
||
|
|
|
||
|
|
$tec = array();
|
||
|
|
$tec = $_POST['tecnologia'];
|
||
|
|
$tec_aux = $capacidad->getTecnologias();
|
||
|
|
foreach ($tec_aux as $fila){
|
||
|
|
$tec[]=$fila["id_tecnologia"];
|
||
|
|
}
|
||
|
|
|
||
|
|
for ($i=0; $i < count($tec); $i++){
|
||
|
|
$caption="meses_".$tec[$i];
|
||
|
|
$tec[$i]=$tec[$i]."-".$_POST[$caption];
|
||
|
|
}
|
||
|
|
|
||
|
|
print_r ($tec);
|
||
|
|
$capacidad->addTecnologias($tec);
|
||
|
|
|
||
|
|
//Es para que refreque los datos ya que al asignar lo que hace es hacer una copia de la clase y no asignacion de punteros
|
||
|
|
$capacidad = new CapacidadProfesional($id_capacidad,"candidato");
|
||
|
|
$camposCapacidad = $capacidad->getCampos();
|
||
|
|
$mensaje=$locale['Capacidades010'];
|
||
|
|
$tipomsg="ok";
|
||
|
|
} catch (Exception $e){
|
||
|
|
$tipomsg="error";
|
||
|
|
$mensaje=$e->getMessage();
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
$tipomsg="error";
|
||
|
|
$mensaje=$errores_persona;
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
|
||
|
|
case "dellTec":
|
||
|
|
echo ">>>>>ENTRO EN dellTEC";
|
||
|
|
$idCap=$_GET['id_cap'];
|
||
|
|
$idTec=$_GET['id_tec'];
|
||
|
|
$capacidad->removeTecnologia($idCap, $idTec);
|
||
|
|
//Es para que refreque los datos ya que al asignar lo que hace es hacer una copia de la clase y no asignacion de punteros
|
||
|
|
$capacidad = new CapacidadProfesional($idCap,"candidato");
|
||
|
|
$camposCapacidad = $capacidad->getCampos();
|
||
|
|
$mensaje=$locale['1064'];
|
||
|
|
$tipomsg="ok";
|
||
|
|
break;
|
||
|
|
|
||
|
|
default:
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
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=\"".$camposCapacidad['id']."\" />";
|
||
|
|
|
||
|
|
echo '<div class="encabezado">'.$locale['Capacidades005'].'</div>';
|
||
|
|
echo '<table align="center" width="100%">';
|
||
|
|
|
||
|
|
|
||
|
|
echo '<tr align="center">';
|
||
|
|
echo '<td ';
|
||
|
|
if(in_array("23",$errores)) echo " class=\"errorcampo\"";
|
||
|
|
echo ' textalign="right"><div style="float:left ">'.$locale['121'].' </div><div style="float:left ">';
|
||
|
|
echo $html->listaSelect("perfil","oid","id","id_perfil_tecnico",array("",$locale['ns']),array($camposCapacidad['id_perfil_tecnico'],""),true,false,"1");
|
||
|
|
echo '</div></td>';
|
||
|
|
|
||
|
|
//MESES_TECNICO
|
||
|
|
echo '<td textalign="right">'.$locale['Capacidades008'].'<br><input type="text" name="meses_tecnico" value="'.$camposCapacidad['meses_tecnico'].'" size="10" maxlength="10"><br></td>';
|
||
|
|
|
||
|
|
echo '</tr>';
|
||
|
|
|
||
|
|
|
||
|
|
echo '<tr align="center">';
|
||
|
|
echo '<td colspan="2" textalign="right" ><div style="float:left ">'.$locale['122'].' </div><div style="float:left ">';
|
||
|
|
$tecnologias=$capacidad->getTecnologias();
|
||
|
|
$arrayseleccion=array();
|
||
|
|
foreach ($tecnologias as $tecnologia) {
|
||
|
|
$arrayseleccion[] = array($tecnologia['id_tecnologia'], $tecnologia['id']);
|
||
|
|
echo $tecnologia['id']." <a href=\"gestionCapacidadProfesional.php?id_cap=".$camposCapacidad['id']."&action=dellTec&id_tec=".$tecnologia['id_tecnologia']."\">Borrar</a><br />";
|
||
|
|
echo '<input type="text" name="meses_'.$tecnologia["id_tecnologia"].'" value="'.$tecnologia['meses'].'" size="10" maxlength="10">';
|
||
|
|
}
|
||
|
|
echo $html->listaSelect("tecnologia","oid","id","tecnologia",array("",$locale['ns']),$arrayseleccion,true,true,"15");
|
||
|
|
echo '</div></td></tr>';
|
||
|
|
|
||
|
|
|
||
|
|
/*
|
||
|
|
echo '<tr align="center">
|
||
|
|
<td textalign="right">'.$locale['122'].'</td><td align="left">';
|
||
|
|
$tecnologias=$candidato->getTecnologias();
|
||
|
|
$keytecnologias=array_values($tecnologias);
|
||
|
|
// Mostramos la lista para borrar
|
||
|
|
foreach ($tecnologias as $nombre =>$valor) {
|
||
|
|
echo $nombre." <a href=\"gestion_candidato.php?oid=".$candidato->getValor("oid")."&action=dellTec&id=".$valor."\">Borrar</a><br />";
|
||
|
|
}
|
||
|
|
|
||
|
|
echo $html->listaSelect("tecnologia","oid","id","tecnologia",array("",$locale['ns']),$candidato->getTecnologias(),false,true,"15");
|
||
|
|
|
||
|
|
echo '</td>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
</tr>';
|
||
|
|
*/
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
echo '</table>';
|
||
|
|
|
||
|
|
echo '<div class="encabezado">'.$locale['Capacidades007'].'</div>';
|
||
|
|
echo '<table align="center" width="100%">';
|
||
|
|
echo '<td textalign="right"><div style="float:left ">'.$locale['Capacidades002'].' </div><div style="float:left ">';
|
||
|
|
echo $html->listaSelect("perfil_funcional","oid","id","id_perfil_funcional",array("",$locale['ns']),array($camposCapacidad['id_perfil_funcional'],""),true,false,"1");
|
||
|
|
echo '</div></td>';
|
||
|
|
|
||
|
|
//MESES_FUNCIONAL
|
||
|
|
echo '<td textalign="right">'.$locale['Capacidades008'].'<br><input type="text" name="meses_funcional" value="'.$camposCapacidad['meses_funcional'].'" size="10" maxlength="10"><br></td>';
|
||
|
|
|
||
|
|
echo '</tr>';
|
||
|
|
|
||
|
|
// CAMPO OBSERVACIONES
|
||
|
|
echo '<tr><td colspan="2" align="center">'.$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 "</form>";
|
||
|
|
|
||
|
|
|
||
|
|
?>
|
||
|
|
|
||
|
|
</body>
|
||
|
|
|