2011-05-27 18:47:51 +00:00
< ? php
//FICHERO DE IDIOMAS
define ( " LOCALE " , " idiomas/ " );
define ( " LOCALESET " , " sp/ " );
include LOCALE . LOCALESET . " lenguaje.php " ;
?>
2011-06-01 18:24:45 +00:00
2011-05-27 18:47:51 +00:00
<! 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 );
$errores = array ();
$id_candidato = $_GET [ 'id_candidato' ];
//En el caso de añadir
if ( stripinput ( $_POST [ 'action' ]) == " add " ){
$id_candidato = $_POST [ " id_candidato " ];
$perfil = $_POST [ " id_perfil_tecnico " ];
$tecnologia = $_POST [ " tecnologia " ];
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' ]);
2011-06-01 18:24:45 +00:00
$camposQuitar [ " id_perfil_funcional " ] = stripinput ( $_POST [ 'id_perfil_funcional' ]);
$camposQuitar [ " tecnologia " ] = $_POST [ 'tecnologia' ];
2011-05-27 18:47:51 +00:00
$camposInsertar = array_diff_assoc ( $_POST , $camposQuitar );
$camposInsertar [ " id_usuario " ] = $_POST [ 'id_candidato' ];
$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
2011-06-01 18:24:45 +00:00
$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 );
2011-05-27 18:47:51 +00:00
foreach ( $camposInsertar as $nombre_campo => $valor ){
if ( $valor != " " )
$arrayInsert [ $nombre_campo ] = $valor ;
}
// Insertamos la nueva capacidad
try {
$errorInsert = false ;
2011-06-01 18:24:45 +00:00
include_once ( " Objects/CapacidadProfesional.php " );
$CapacidadProfesional = new CapacidadProfesional ( - 1 , " candidato " );
$idCapacidadNew = $CapacidadProfesional -> addCapacidad ( $arrayInsert );
$CapacidadProfesional = new CapacidadProfesional ( $idCapacidadNew , " candidato " );
if ( $idCapacidadNew != " -1 " ){
$CapacidadProfesional -> addTecnologias ( $_POST [ 'tecnologia' ]);
} else {
$tipomsg = " error " ;
$mensaje = " No se ha podido insertar " ;
}
2011-05-27 18:47:51 +00:00
} catch ( Exception $e ){
$tipomsg = " error " ;
$mensaje = $e -> getMessage ();
}
}
}
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="center">' ;
echo '<td ' ;
if ( in_array ( " 23 " , $errores )) echo " class= \" errorcampo \" " ;
2011-06-01 18:24:45 +00:00
echo ' textalign="right"><div style="float:left ">' . $locale [ '121' ] . ' </div><div style="float:left ">' ;
2011-05-27 18:47:51 +00:00
$auxiliar = '<option selected value="">' . $locale [ 'ns' ] . '</option>' ;
echo $html -> listaSelect ( " perfil " , " oid " , " id " , " id_perfil_tecnico " , array ( " " , $locale [ 'ns' ]), $_POST [ 'id_perfil_tecnico' ], true , false , " 1 " );
2011-06-01 18:24:45 +00:00
echo '</div></td>' ;
//MESES_TECNICO
echo '<td textalign="right">' . $locale [ 'Capacidades008' ] . '<br><input type="text" name="meses_tecnico" value="' . $_POST [ 'meses_tecnico' ] . '" size="10" maxlength="10"><br></td>' ;
echo '</tr>' ;
2011-05-27 18:47:51 +00:00
echo '<tr align="center">' ;
2011-06-01 18:24:45 +00:00
echo '<td colspan="2" textalign="right" ><div style="float:left ">' . $locale [ '122' ] . ' </div><div style="float:left ">' ;
2011-05-27 18:47:51 +00:00
$auxiliar = '<option selected value="">' . $locale [ 'ns' ] . '</option>' ;
echo $html -> listaSelect ( " tecnologia " , " oid " , " id " , " tecnologia " , array ( " " , $locale [ 'ns' ]), $_POST [ 'tecnologia' ], true , true , " 15 " );
echo '</div></td></tr>' ;
2011-06-01 18:24:45 +00:00
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 ">' ;
$auxiliar = '<option selected value="">' . $locale [ 'ns' ] . '</option>' ;
echo $html -> listaSelect ( " perfil_funcional " , " oid " , " id " , " id_perfil_funcional " , array ( " " , $locale [ 'ns' ]), $_POST [ '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="' . $_POST [ '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"">' . $_POST [ 'observaciones' ] . '</textarea></td></tr>' ;
2011-05-27 18:47:51 +00:00
echo '</table>' ;
echo '<input type="submit" value="' . $locale [ 'gu' ] . '" class="button">' ;
echo " </form> " ;
?>
</ body >