Incam_Intranet/ver_oferta.php

487 lines
20 KiB
PHP

<?php
include_once("Objects/Oferta.php");
include_once("Objects/Pedido.php");
include_once("Objects/Candidato.php");
include_once("seguridad.php");
$usuario = $_SESSION['usuario'];
$oferta = new Oferta($idOferta, $usuario);
//Cargamos la solicitud
$idPedido = $oferta->getValor("pedido");
$pedido = new Pedido($idPedido, $usuario);
//Cargamos el candidato
$candidato = null;
$idCandidato = $oferta->getValor("candidato");
if (!empty($idCandidato))
$candidato = new Candidato($usuario, $idCandidato);
include_once("html/cabecera.php");
include_once("Objects/Administracion.php");
$administracion = new Administracion($usuario, $locale);
$constantes = $administracion->getItem("constantes");
$mostrarTabla = $constantes['candPagina'];
$altoScroll = 83 / 2 * $mostrarTabla;
?>
<?php
include_once("Objects/HTML.php");
$html = new HTML($locale);
// Comprogamos si hay error de semaforo activo
if (isset($_GET["msgSem"]) && ($_GET["msgSem"] != "")) {
$mensajeSemaforo = $semaforo->getMensaje($_GET["msgSem"]);
echo "<div class=\"aviso semaforo\">" . $mensajeSemaforo . "</div>";
}
$action = (isset($_GET['action']) && ($_GET['action'] != "")) ? $_GET['action'] : "";
if (!empty($action)) {
$error = false;
$mensaje = "";
switch ($action) {
case "aceptar":
if (!empty($_GET['idCand'])) {
try {
$idCand = $_GET['idCand'];
$estado = $oferta->asignarCandidato($idCand);
$candidato = new Candidato($usuario, $idCand);
if ($estado) {
$tipo = "ok";
$mensaje = "El candidato se ha asignado a la oferta";
} else {
$tipo = "error";
$mensaje = "No se ha podido asignar el candidato a la oferta";
}
} catch (Exception $e) {
$mensaje = $e->getMessage();
$tipo = "error";
}
} else {
$tipo = "error";
$mensaje = $locale['1053'];
}
break;
case "cambEst": if (!empty($_GET['idEst'])) {
$idEstado = $_GET['idEst'];
try {
$camb = $oferta->transita($idEstado, "");
if ($camb) {
$tipo = "ok";
$mensaje = $locale['1072'];
} else {
$tipo = "error";
$mensaje = $locale['1073'];
}
} catch (Exception $e) {
$mensaje = $e->getMessage();
$tipo = "error";
}
}
break;
default: $error = true;
$mensaje = $locale['1057'];
break;
}
if ($mensaje != "") {
// Mostramos el mensaje
echo "<div class=\"aviso " . $tipo . "\">" . $mensaje . "</div>";
}
}
if (($oferta->getValor("estado") == 110) || ($oferta->getValor("estado") == 120)) {
echo $html->menuOfertas($usuario, array(""));
} else
echo $html->menuOfertas($usuario, "gestionar");
?>
<h2><?php echo $oferta->getValor("referencia") ." - ". $oferta->getValor("nombre_solicitud")?></h2>
<?php
// Comprobamos mensajes que pueden llegar hasta aqui
if (isset($_GET["msg"])) {
switch ($_GET['msg']) {
case "1": $mensaje = "<div class=\"aviso ok\">" . $locale['1061'] . "</div>";
break;
default:
break;
}
} else {
$mensaje = "";
}
echo $mensaje;
?>
<div class="encabezado"><?php echo $locale['Solicitudes005']?></div>
<table width="100%">
<tr>
<td class="sinborde">
<span class="resaltado"><?php echo $locale['1010']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo ver_fecha_larga($oferta->getValor("fecha")); ?><br/>
<span class="resaltado"><?php echo $locale['Solicitudes001']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("num_solicitud_cliente"); ?><br/>
<span class="resaltado"><?php echo $locale['1043_1']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("denominacion_cliente"); ?><br/>
<span class="resaltado"><?php echo $locale['1024_1']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("empleados"); ?><br/>
</td>
<td class="sinborde">
<span class="resaltado"><?php echo $locale['Ofertas002']; ?></span>&nbsp;&nbsp;&nbsp;
<?php
if (!empty($candidato))
echo $candidato->getValor("dni");
?><br/>
<span class="resaltado"><?php echo $locale['Ofertas003']; ?></span>&nbsp;&nbsp;&nbsp;
<?php
if (!empty($candidato))
echo $candidato->getValor("nombre") ." ". $candidato->getValor("apellidos");
?><br/>
<span class="resaltado"><?php echo $locale['132']; ?></span>&nbsp;&nbsp;&nbsp;
<?php
if (!empty($candidato))
echo $candidato->getValor("nombre_estado");
?><br/>
<span class="resaltado"><?php echo $locale['Ofertas006']; ?></span>
</td>
<td>
//FOTO
</td>
</tr>
<tr>
<td colspan="3" class="sinborde">
<span class="resaltado"><?php echo $locale['135']; ?></span>&nbsp;<?php echo nl2br($oferta->getValor("observaciones")); ?>
</td>
</tr>
</table>
<div class="encabezado"><?php echo $locale['Ofertas004']?></div>
<table width="100%">
<tr>
<td class="sinborde">
<span class="resaltado"><?php echo $locale['132']; ?></span>
<?php echo $oferta->getValor("nombre_estado"); ?>
<div id="obsCambioEst" class="obsCambioEst">
<form id="formCambEst" action="oferta.php?idOferta=<?php echo $oferta->getValor("oid"); ?>&action=cambEstObs" method="post" >
<input type="hidden" name="action" value="cambEstObs" />
<input type="hidden" name="idEstado" id="idEstado" />
</form>
</div>
<?php
if ($oferta->getValor("msgEstado") != "") {
echo " -> " . $oferta->getValor("msgEstado");
}
echo "<br />";
$estadosSiguientes = $oferta->getSiguientes();
foreach ($estadosSiguientes as $codEstado => $nombreEstado) {
?>
<input class="button" name="cambEstado" type="button" value="<?php echo $locale['2104'] . $nombreEstado; ?>"
onClick="javascript:document.location='oferta.php?idOferta=<?php echo $oferta->getValor("oid"); ?>&action=cambEst&idEst=<?php echo $codEstado; ?>'"
style="width:200px; margin-bottom:5px"><br />
<?php
}
?>
</td>
</tr>
</table>
<div class="encabezado"><?php echo $locale['Ofertas005']?></div>
<table width="100%">
<tr><td>
<div class="encabezado"><?php echo $locale['1550']?></div>
<table width="100%">
<tr class='encabezado'>
<td><?php echo $locale['Ofertas007']; ?></td>
<td><?php echo $locale['Ofertas008']; ?></td>
</tr>
<tr>
<td>
<span class="resaltado"><?php echo $locale['209']; ?></span>
<?php
$tecnologias = $pedido->getProvincias();
if (count($tecnologias) > 0) {
foreach ($tecnologias as $nombre => $codigo) {
echo $nombre . ", ";
}
} else {
}
echo nl2br($pedido->getValor("observaciones_direccion"));
?>
<br/><span class="resaltado"><?php echo $locale['Solicitudes008']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("direccion_solicitud"); ?>
</td>
<td>
<span class="resaltado"><?php echo $locale['1561']; ?></span>
<?php
if (!empty($candidato)) {
$localidadesDeseadas = $candidato->getProvinciasDeseadas();
$keylocalidades = array_values($localidadesDeseadas);
// Mostramos la lista
foreach ($localidadesDeseadas as $nombre => $valor) {
echo $nombre . ", ";
}
echo nl2br($candidato->getValor("observaciones_prov_deseada"));
}
?>
<br/><span class="resaltado"><?php echo $locale['5001']; ?></span>
<?php
if (!empty($candidato)) {
$localidadesNoDeseadas = $candidato->getProvinciasNoDeseadas();
$keylocalidades = array_values($localidadesNoDeseadas);
// Mostramos la lista
foreach ($localidadesNoDeseadas as $nombre => $valor) {
echo $nombre . ", ";
}
echo nl2br($candidato->getValor("observaciones_prov_nodeseada"));
}
?>
</td>
</tr>
<tr>
<td>
<span class="resaltado"><?php echo $locale['129']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("nombre_salario_max"); ?><br/>
<span class="resaltado"><?php echo $locale['130']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("nombre_salario_min"); ?><br/>
<span class="resaltado"><?php echo $locale['Solicitudes007']; ?></span>&nbsp;&nbsp;&nbsp;<?php echo $pedido->getValor("tasa_economica"); ?><br/>
</td>
<td>
<span class="resaltado"><?php echo $locale['129']; ?></span><?php if (!empty($candidato)) echo $candidato->getValor("nombre_salario_min"); ?><br>
<span class="resaltado"><?php echo $locale['130']; ?></span><?php if (!empty($candidato)) echo $candidato->getValor("nombre_salario_max"); ?><br>
<span class="resaltado"><?php echo $locale['100118']; ?></span><?php if (!empty($candidato)) echo $candidato->getValor("tarifa"); ?>
</td>
</tr>
<tr>
<td>
<span class="resaltado"><?php echo $locale['Candidato003']; ?></span>
<?php
if ($pedido->getValor("viajar") != "") {
echo "SI&nbsp;&nbsp;(".$pedido->getValor("viajar").")";
} else {
echo "NO";
}
?><br/>
<span class="resaltado"><?php echo $locale['Candidato004']; ?></span>
<?php
if ($pedido->getValor("internacional") != "") {
echo "SI&nbsp;&nbsp;(".$pedido->getValor("internacional").")";
} else {
echo "NO";
}
?><br/>
<span class="resaltado"><?php echo $locale['Candidato002']; ?></span>
<?php
if ($pedido->getValor("guardias") != "") {
echo "SI&nbsp;&nbsp;(".$pedido->getValor("guardias").")";
} else {
echo "NO";
}
?><br/>
<span class="resaltado"><?php echo $locale['Solicitudes009']; ?></span>
<?php
if ($pedido->getValor("turnos") != "") {
echo "SI&nbsp;&nbsp;(".$pedido->getValor("turnos").")";
} else {
echo "NO";
}
?>
</td>
<td>
<span class="resaltado"><?php echo $locale['Candidato003']; ?></span>
<?php
if (!empty($candidato)) {
if ($candidato->getValor("viajar") != "") {
echo "SI&nbsp;&nbsp;(".$candidato->getValor("viajar").")";
} else {
echo "NO";
}
}
?><br/>
<span class="resaltado"><?php echo $locale['Candidato004']; ?></span>
<?php
if (!empty($candidato)) {
if ($candidato->getValor("internacional") != "") {
echo "SI&nbsp;&nbsp;(".$candidato->getValor("internacional").")";
} else {
echo "NO";
}
}
?><br/>
<span class="resaltado"><?php echo $locale['Candidato002']; ?></span>
<?php
if (!empty($candidato)) {
if ($candidato->getValor("guardias") != "") {
echo "SI&nbsp;&nbsp;(".$candidato->getValor("guardias").")";
} else {
echo "NO";
}
}
?><br/>
<span class="resaltado"><?php echo $locale['Candidato001']; ?></span>
<?php
if (!empty($candidato)){
if ($candidato->getValor("entrevistas") != "") {
echo "SI&nbsp;&nbsp;(".$candidato->getValor("entrevistas").")";
} else {
echo "NO";
}
}
?><br/>
<span class="resaltado"><?php echo $locale['Candidato005']; ?></span>
<?php
if (!empty($candidato)){
if ($candidato->getValor("carnet") != "") {
echo "SI&nbsp;&nbsp;(".$candidato->getValor("carnet").")";
} else {
echo "NO";
}
}
?>
</td>
</tr>
</table>
<div class="encabezado"><?php echo $locale['Capacidades001']?></div>
<table width="100%">
<tr class='encabezado'>
<td><?php echo $locale['Ofertas007']; ?></td>
<td><?php echo $locale['Ofertas008']; ?></td>
</tr>
<tr>
<td>
<?php
///////////////////////////////
//CAPACIDADES PROFESIONALES SO
//////////////////////////////
echo '<div id="capacidades" name="capacidades" class="encabezado">'.$locale['Capacidades001'].'</div>';
//echo '<input language="javascript" type="button" value="'.$locale['Capacidades003'].'" class="button" onclick="if(popup(\'addCapacidadProfesional.php?id_solicitud='.$pedido->getValor("oid").'&entidad=solicitud\', \'notes\')) window.location.reload()">';
$CapacidadesProfesionales = $pedido->getCapacidadesProfesionales();
VerListaCapacidadesProfesionales($CapacidadesProfesionales, "ver_oferta");
?>
</td>
<td>
<?php
//////////////////////////////////////
//CAPACIDADES PROFESIONALES CANDIDATO
/////////////////////////////////////
echo '<div id="capacidades" name="capacidades" class="encabezado">'.$locale['Capacidades001'].'</div>';
//echo '<input language="javascript" type="button" value="'.$locale['Capacidades003'].'" class="button" onclick="if(popup(\'addCapacidadProfesional.php?id_solicitud='.$pedido->getValor("oid").'&entidad=solicitud\', \'notes\')) window.location.reload()">';
if (!empty($candidato)){
$CapacidadesProfesionales = $candidato->getCapacidadesProfesionales();
VerListaCapacidadesProfesionales($CapacidadesProfesionales, "ver_oferta");
}
?>
</td>
</tr>
</table>
</td></tr>
</table>
<br/>
<table width="100%">
<?php
$listaCandidatos = $oferta->getCandidatosDisponibles()->getCandidatos();
if (!empty($listaCandidatos)) {
?>
<tr> <!-- Tabla de candidatos -->
<td>
<h3><span class="nombre">Candidatos disponibles</span></h3>
<table width="100%" class="listaPropuestos">
<thead>
<tr class="nombre">
<th><?php echo $locale['2014']; ?></th>
<th><?php echo $locale['704']; ?></th>
<th><?php echo $locale['1052']; ?></th>
<th><?php echo $locale['Capacidades001']; ?></th>
<th><?php echo $locale['206']; ?></th>
</tr>
</thead>
<?php
echo "<tbody>";
$final = count($listaCandidatos);
for ($i = 0; $i < $final; $i++) {
$candidato_aux = $listaCandidatos[$i];
?>
<tr>
<td class="centrado">
<?php
$candActual = $oferta->getValor("candidato");
if (!empty($candActual)) {
echo "<a href=\"#\" onclick=\"cambiarCandidato('oferta.php?idOferta=".$oferta->getValor("oid")."&action=aceptar&idCand=".$candidato_aux->getValor("oid")."')\">";
}
else {
echo "<a href='oferta.php?idOferta=".$oferta->getValor("oid")."&action=aceptar&idCand=".$candidato_aux->getValor("oid")."'>";
}
?>
<img src='css/accept.png' title="<?php echo $locale['1047']; ?>" />
</a>
</td>
<td>
<a href="detalle_persona.php?oid=<?php echo $candidato_aux->getValor("oid"); ?>" target=popup onclick=window.open('', 'popup', ',',',',',',',','width = 600, height = 800')><?php echo $candidato_aux->getValor("nombre") . " " . $candidato_aux->getValor("apellidos"); ?></a>
</td>
<td><?php echo $candidato_aux->getValor("nombre_estado"); ?></td>
<td>
<?php
//////////////////////////////////////
//CAPACIDADES PROFESIONALES CANDIDATO
/////////////////////////////////////
echo '<div id="capacidades" name="capacidades" class="encabezado">'.$locale['Capacidades001'].'</div>';
//echo '<input language="javascript" type="button" value="'.$locale['Capacidades003'].'" class="button" onclick="if(popup(\'addCapacidadProfesional.php?id_solicitud='.$pedido->getValor("oid").'&entidad=solicitud\', \'notes\')) window.location.reload()">';
if (!empty($candidato_aux)){
$CapacidadesProfesionales = $candidato_aux->getCapacidadesProfesionales();
VerListaCapacidadesProfesionales($CapacidadesProfesionales, "ver_oferta");
}
?>
</td>
<td>&nbsp;<?php
$idiomas = rellena_lista_oid("idioma_usuario", "idiomas", "idioma", $candidato_aux->getValor("oid"));
if (gettype($idiomas) != "NULL") {
foreach ($idiomas as $tecno) {
echo $tecno . ",";
}
}
?></td>
</tr>
<?php
} // for
?>
</tbody>
</table>
<div id="cronopaginacion"><?php echo $html->paginacion($numPaginas, $pagAcept, "pedido.php", "idPedido=" . $oferta->getValor("oid"), "pagAcept"); ?></div>
</td>
</tr>
<?php
} // if
?>
<tr align="center"> <!-- HISTORIAL -->
<td ><a name="historial"><?php echo $locale['127']; ?></a><br />
<textarea name="historial" readonly rows="8" cols="90" maxlength="300" style="overflow: auto;width:100%"><?php echo $oferta->getHistorial(); ?></textarea>
</td>
</tr>
</table>
<?php include_once("html/pie.php"); ?>