Incam_Intranet/ver_oferta.php
2011-06-01 18:24:45 +00:00

272 lines
10 KiB
PHP

<?php
include_once("Objects/Oferta.php");
include_once("seguridad.php");
$usuario = $_SESSION['usuario'];
$oferta = new Oferta($idOferta, $usuario);
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);
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("nombre"); ?></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;
?>
<table width="100%">
<tr><td>
<table width="100%">
<tr>
<td class="nombre"><?php echo $locale['5106']; ?></td>
<td><?php echo $oferta->getValor("referencia"); ?></td>
</tr>
<tr>
<td class="nombre"><?php echo $locale['1025']; ?></td>
<td><?php echo $oferta->getValor("nombre_solicitud"); ?></td>
</tr>
<tr>
<td class="nombre"><?php echo $locale['132']; ?></td>
<td><?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>
<tr>
<td class="nombre"><?php echo $locale['5107']; ?></td>
<td><?php echo nl2br($oferta->getValor("nombre_candidato")); ?></td>
</tr>
<tr>
<td class="nombre"><?php echo $locale['135']; ?></td>
<td><?php echo nl2br($oferta->getValor("observaciones")); ?></td>
</tr>
</table>
</td></tr>
</table>
<br/>
<?php
if (($oferta->getValor("estado") == 110)) {
?>
<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['202']; ?></th>
<th><?php echo $locale['1052']; ?></th>
<th><?php echo $locale['203']; ?></th>
<th><?php echo $locale['206']; ?></th>
</tr>
</thead>
<?php
echo "<tbody>";
$final = count($listaCandidatos);
for ($i = 0; $i < $final; $i++) {
$candidato = $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->getValor("oid")."')\">";
}
else {
echo "<a href='oferta.php?idOferta=".$oferta->getValor("oid")."&action=aceptar&idCand=".$candidato->getValor("oid")."'>";
}
?>
<img src='css/accept.png' title="<?php echo $locale['1047']; ?>" />
</a>
</td>
<td>
<a href="detalle_persona.php?oid=<?php echo $candidato->getValor("oid"); ?>" target=popup onclick=window.open('', 'popup', ',',',',',',',','width = 600, height = 800')><?php echo $candidato->getValor("nombre") . " " . $candidato->getValor("apellidos"); ?></a>
</td>
<td>
<?php
$perfiles = $candidato->getPerfiles();
$keylocalidades = array_values($perfiles);
// Mostramos la lista para borrar
foreach ($perfiles as $nombre => $valor) {
echo "- " . $nombre . "<br />";
}
?>
</td>
<td><?php echo $candidato->getValor("nombre_estado"); ?></td>
<td><?php
$tecnologias = rellena_lista_oid("tecnologia_usuario", "tecnologia", "tecnologia", $candidato->getValor("oid"));
if (gettype($tecnologias) != "NULL") {
foreach ($tecnologias as $tecno) {
echo $tecno . ",";
}
}
?></td>
<td>&nbsp;<?php
$idiomas = rellena_lista_oid("idioma_usuario", "idiomas", "idioma", $candidato->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
?>
<?php
}
?>
<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"); ?>