Tarea #647 -> Nueva entrada de menú para ver la lista de ofertas

Tarea #646 -> Crear la acción "Creación de oferta" que cree una oferta relacionada con la solicitud de oferta que se está mostrando.
Tarea #607 -> Nueva entidad 'Oferta' con estados nuevos
Tarea #606 -> Nuevos estados y transiciones para una solicitud de oferta
Tarea #601 -> Nuevos estados y transiciones para un candidato
Tarea #599 -> Repasar los registros que se meten en el historial de cambios
Tarea #586 -> Cuando una solicitud tiene varios perfiles, hay que visualizarlos ocupando las menos filas posibles
Tarea #585 -> Cuando un candidato tiene varios perfiles, hay que visualizarlos ocupando las menos filas posibles

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@65 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
David Arranz 2011-05-19 08:46:58 +00:00
parent ec58065e0c
commit 9e87e5eb38
30 changed files with 3693 additions and 3025 deletions

View File

@ -17,10 +17,12 @@ include_once("Conexion.php");
function execQuery($query){ function execQuery($query){
$res = mysql_query($query); $res = mysql_query($query);
//$mensaje = $query." - ".$res."\r\n";
//$fichero = fopen("querys.log","a"); /*$mensaje = $query." - ".$res."\r\n";
//fputs($fichero,$mensaje); $fichero = fopen("querys.log","a");
//fclose($fichero); fputs($fichero,$mensaje);
fclose($fichero);*/
return $res; return $res;
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* Clase Candidato * Clase Candidato
* *
@ -7,26 +8,28 @@
* 2008-10-06 (diego): Se crea el objeto con los métodos necesarios para gestionar candidatos. * 2008-10-06 (diego): Se crea el objeto con los métodos necesarios para gestionar candidatos.
* *
*/ */
include_once("BD.php"); include_once("BD.php");
include_once("Persona.php"); include_once("Persona.php");
class Candidato extends Persona{ include_once("Automata.php");
class Candidato extends Persona {
private $usuario; private $usuario;
function Candidato($usuario, $oid){ function Candidato($usuario, $oid) {
$consulta = "SELECT oid FROM usuarios WHERE oid = '".$oid."' AND tipo='candidato'"; $consulta = "SELECT oid FROM usuarios WHERE oid = '" . $oid . "' AND tipo='candidato'";
$bd = new BD(); $bd = new BD();
$num = $bd->numFilas($consulta); $num = $bd->numFilas($consulta);
if($num > 0){ if ($num > 0) {
parent::Persona($oid); parent::Persona($oid);
$this->usuario = $usuario; $this->usuario = $usuario;
}else{ } else {
$error = "Candidato no encontrado."; $error = "Candidato no encontrado.";
throw new Exception($error); throw new Exception($error);
} }
} }
function setCampo($nombre, $valor){ function setCampo($nombre, $valor) {
//PERMISOS: //PERMISOS:
/* /*
* Admin (1) - Todos * Admin (1) - Todos
@ -34,13 +37,13 @@
* Otro - Excepción * Otro - Excepción
*/ */
$sesion = $this->usuario->getValor("oid"); $sesion = $this->usuario->getValor("oid");
if($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)){ if ($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)) {
return parent::setCampo($nombre, $valor); return parent::setCampo($nombre, $valor);
}else{ } else {
//Campos que se pueden editar por el gerente, ya sea directamente o mediante una transición. //Campos que se pueden editar por el gerente, ya sea directamente o mediante una transición.
if(($nombre == "observaciones" || $nombre == "msgEstado" || $nombre = "diasEspera" || $nombre == "estado") && $this->usuario->tieneRol(3)){ if (($nombre == "observaciones" || $nombre == "msgEstado" || $nombre = "diasEspera" || $nombre == "estado") && $this->usuario->tieneRol(3)) {
return parent::setCampo($nombre, $valor); return parent::setCampo($nombre, $valor);
}else{ } else {
$error = "El usuario no tiene permisos para editar al candidato."; $error = "El usuario no tiene permisos para editar al candidato.";
throw new Exception($error); throw new Exception($error);
return false; return false;
@ -49,7 +52,7 @@
} }
} }
function addCurriculum($fichero){ function addCurriculum($fichero) {
//PERMISOS: //PERMISOS:
/* /*
* Admin (1) - Todos * Admin (1) - Todos
@ -57,9 +60,9 @@
* Otro - Excepción * Otro - Excepción
*/ */
$sesion = $this->usuario->getValor("oid"); $sesion = $this->usuario->getValor("oid");
if($this->usuario->tieneRol(3) || $this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)){ if ($this->usuario->tieneRol(3) || $this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)) {
return parent::addCurriculum($fichero, $this->usuario->getValor("nombre")); return parent::addCurriculum($fichero, $this->usuario->getValor("nombre"));
}else{ } else {
$error = "El usuario no tiene permisos para asociar CV al candidato."; $error = "El usuario no tiene permisos para asociar CV al candidato.";
throw new Exception($error); throw new Exception($error);
return false; return false;
@ -67,7 +70,7 @@
} }
} }
function removeCurriculum($curriculum, $fecha){ function removeCurriculum($curriculum, $fecha) {
//PERMISOS: //PERMISOS:
/* /*
* Admin (1) - Todos * Admin (1) - Todos
@ -75,15 +78,15 @@
* Otro - Excepción * Otro - Excepción
*/ */
$sesion = $this->usuario->getValor("oid"); $sesion = $this->usuario->getValor("oid");
if($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)){ if ($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)) {
parent::removeCurriculum($curriculum, $fecha, $this->usuario->getValor("nombre")); parent::removeCurriculum($curriculum, $fecha, $this->usuario->getValor("nombre"));
}else{ } else {
$error = "El usuario no tiene permisos para eliminar un CV al candidato."; $error = "El usuario no tiene permisos para eliminar un CV al candidato.";
throw new Exception($error); throw new Exception($error);
} }
} }
/*SQL que da los pedidos en el que está un candidato dependiendo del estado /* SQL que da los pedidos en el que está un candidato dependiendo del estado
En el ejemplo En el ejemplo
estado -> 20 estado -> 20
@ -91,12 +94,13 @@
@param $estado - Estado del pedido. @param $estado - Estado del pedido.
@return array codPedido => nombre o vacío. @return array codPedido => nombre o vacío.
*/ */
function getPedidosByEstado($estado){
/*SELECT P.oid,P.nombre function getPedidosByEstado($estado) {
/* SELECT P.oid,P.nombre
FROM pedidos P,candidato_pedido CP FROM pedidos P,candidato_pedido CP
WHERE CP.candidato='12' WHERE CP.candidato='12'
AND CP.estado='20' AND CP.estado='20'
AND P.oid=CP.pedido*/ AND P.oid=CP.pedido */
$idC = $this->getValor("oid"); $idC = $this->getValor("oid");
$consulta = "SELECT P.oid as oid,P.nombre as nombre $consulta = "SELECT P.oid as oid,P.nombre as nombre
FROM pedidos P,candidato_pedido CP FROM pedidos P,candidato_pedido CP
@ -107,7 +111,7 @@
return $bd->keyValueQuery($consulta, "oid", "nombre"); return $bd->keyValueQuery($consulta, "oid", "nombre");
} }
function eliminar(){ function eliminar() {
//PERMISOS: //PERMISOS:
/* /*
* Admin (1) - Todos * Admin (1) - Todos
@ -116,28 +120,28 @@
$sesion = $this->usuario->getValor("oid"); $sesion = $this->usuario->getValor("oid");
//Nos declaramos un array de estados eliminables: //Nos declaramos un array de estados eliminables:
$estados_eliminables = array(10, 20, 50, 40, 60); $estados_eliminables = array(10, 20, 50, 40, 60);
if($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)){ if ($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)) {
$estado = $this->getValor("estado"); $estado = $this->getValor("estado");
if(in_array($estado, $estados_eliminables)){ if (in_array($estado, $estados_eliminables)) {
return parent::eliminar(); return parent::eliminar();
}else{ } else {
$nombre_estado = $this->getValor("nombre_estado"); $nombre_estado = $this->getValor("nombre_estado");
$error = "No se pueden eliminar candidatos en estado ".$nombre_estado."."; $error = "No se pueden eliminar candidatos en estado " . $nombre_estado . ".";
throw new Exception($error); throw new Exception($error);
return false; return false;
} }
}else{ } else {
$error = "El usuario no tiene permisos para eliminar al candidato."; $error = "El usuario no tiene permisos para eliminar al candidato.";
throw new Exception($error); throw new Exception($error);
return false; return false;
} }
} }
function actualizarHistorial($mensaje){ function actualizarHistorial($mensaje) {
parent::actualizarHistorial($mensaje, $this->usuario->getValor("nombre")); parent::actualizarHistorial($mensaje, $this->usuario->getValor("nombre"));
} }
function getSiguientes(){ function getSiguientes() {
$estado = $this->getValor("estado"); $estado = $this->getValor("estado");
$idioma = $this->usuario->getValor("idioma"); $idioma = $this->usuario->getValor("idioma");
$rol = $this->usuario->getValor("rol"); $rol = $this->usuario->getValor("rol");
@ -146,33 +150,35 @@
return $siguientes; return $siguientes;
} }
function transita($destino, $argumentos){ function transita($destino, $argumentos) {
$origen = $this->getValor("estado"); $origen = $this->getValor("estado");
$idioma = $this->usuario->getValor("idioma"); $idioma = $this->usuario->getValor("idioma");
$rol = $this->usuario->getValor("rol"); $rol = $this->usuario->getValor("rol");
$a = new Automata("candidatos", $idioma, $rol); $a = new Automata("candidatos", $idioma, $rol);
$transita = $a->getTransicion($origen,$destino);
if(($transita == "") || !($transita >= 0)){ $transita = $a->getTransicion($origen, $destino);
if (($transita == "") || !($transita >= 0)) {
return false; return false;
}else{ } else {
$res = $this->ejecutaTransicion($transita, $argumentos); $res = $this->ejecutaTransicion($transita, $argumentos);
if($res){ if ($res) {
$total = explode("#&dias;", $argumentos); $total = explode("#&dias;", $argumentos);
$msj = $total[0]; $msj = $total[0];
$diasEspera = $total[1]; $diasEspera = $total[1];
$this->setCampos(array("msgEstado" => $msj, "diasEspera" => $diasEspera, "estado" => $destino)); $this->setCampos(array("msgEstado" => $msj, "diasEspera" => $diasEspera, "estado" => $destino));
/*$this->setCampo("msgEstado", $msj); /* $this->setCampo("msgEstado", $msj);
$this->setCampo("diasEspera", $diasEspera); $this->setCampo("diasEspera", $diasEspera);
$this->setCampo("estado", $destino);*/ $this->setCampo("estado", $destino); */
} }
return $res; return $res;
} }
} }
private function ejecutaTransicion($codigo, $argumentos){ private function ejecutaTransicion($codigo, $argumentos) {
//Si no hace nada al transitar salimos sin más. //Si no hace nada al transitar salimos sin más.
if($codigo == 0) return true; if ($codigo == 0)
return true;
$funcion = "ejecutar$codigo"; $funcion = "ejecutar$codigo";
$res = call_user_func(array("Candidato", $funcion), $argumentos); $res = call_user_func(array("Candidato", $funcion), $argumentos);
@ -194,9 +200,9 @@
y el pedido esté pendiente, asignado o contratado y el pedido esté pendiente, asignado o contratado
y comprobar transiciones a otros pedidos. y comprobar transiciones a otros pedidos.
*/ */
private function ejecutar1020($mensaje){ private function ejecutar1020($mensaje) {
if($mensaje == ""){ if ($mensaje == "") {
echo '<script type="text/javascript"> echo '<script type="text/javascript">
<!-- <!--
alert("Debe introducir un motivo para pasar al candidato a No disponible"); alert("Debe introducir un motivo para pasar al candidato a No disponible");
@ -222,10 +228,10 @@
POSTCONDICIONES: POSTCONDICIONES:
- Almacenar en la BD la fecha de la entrevista. - Almacenar en la BD la fecha de la entrevista.
*/ */
private function ejecutar1050($mensaje){ private function ejecutar1050($mensaje) {
$fechaAntEntrevista=$this->getValor("fecha_entrevista"); $fechaAntEntrevista = $this->getValor("fecha_entrevista");
if(($fechaAntEntrevista=="2008-1-1") || ($fechaAntEntrevista=="0000-00-00")){ if (($fechaAntEntrevista == "2008-1-1") || ($fechaAntEntrevista == "0000-00-00")) {
$fecha = date(Y."-".m."-".d); $fecha = date(Y . "-" . m . "-" . d);
$this->setCampos(array("fecha_entrevista" => $fecha)); $this->setCampos(array("fecha_entrevista" => $fecha));
} }
@ -247,8 +253,8 @@
y el pedido esté pendiente, asignado o contratado y el pedido esté pendiente, asignado o contratado
y comprobar transiciones a otros pedidos. y comprobar transiciones a otros pedidos.
*/ */
private function ejecutar3020($mensaje){ private function ejecutar3020($mensaje) {
if($mensaje == ""){ if ($mensaje == "") {
echo '<script type="text/javascript"> echo '<script type="text/javascript">
<!-- <!--
alert("Debe introducir un motivo para pasar al candidato a No disponible"); alert("Debe introducir un motivo para pasar al candidato a No disponible");
@ -265,13 +271,13 @@
//Para cada candidatura en la que no esté rechazado compruebo si el sacarle //Para cada candidatura en la que no esté rechazado compruebo si el sacarle
//de ella supone un cambio en el pedido: //de ella supone un cambio en el pedido:
foreach($pedidos as $idP){ foreach ($pedidos as $idP) {
$pedido = new Pedido($idP); $pedido = new Pedido($idP);
$estado = $pedido->getEstado("estado"); $estado = $pedido->getEstado("estado");
//Si está asignado o contratado tiene que transitar a pendiente //Si está asignado o contratado tiene que transitar a pendiente
//(la transición se encarga ya de comprobar si cumple las precondiciones //(la transición se encarga ya de comprobar si cumple las precondiciones
//de este cambio de estado) //de este cambio de estado)
if(($estado == '20') || ($estado == '30')){ if (($estado == '20') || ($estado == '30')) {
$pedido->transita(10, ""); $pedido->transita(10, "");
} }
} }
@ -289,7 +295,7 @@
- Calcular la afinidad del candidato con todos los pedidos para que - Calcular la afinidad del candidato con todos los pedidos para que
puedan aparecer en ellos como "Propuestos por el sistema". puedan aparecer en ellos como "Propuestos por el sistema".
*/ */
private function ejecutar2010(){ private function ejecutar2010() {
$this->setCampos(array("estado" => "10")); $this->setCampos(array("estado" => "10"));
$this->calculaAfinidad(); $this->calculaAfinidad();
return true; return true;
@ -306,13 +312,13 @@
- El usuario no se encuentra aceptado en ningún proceso de selección. - El usuario no se encuentra aceptado en ningún proceso de selección.
*/ */
private function ejecutar3010(){ private function ejecutar3010() {
$id = $this->getValor("oid"); $id = $this->getValor("oid");
$bd = new BD(); $bd = new BD();
$consulta = "SELECT * FROM candidato_pedido WHERE candidato='.$id.' AND estado='20'"; $consulta = "SELECT * FROM candidato_pedido WHERE candidato='.$id.' AND estado='20'";
$res = $bd->numFilas(($consulta)); $res = $bd->numFilas(($consulta));
//No se cambia si está en más procesos. //No se cambia si está en más procesos.
if($res > 0){ if ($res > 0) {
return false; return false;
} }
return true; return true;
@ -329,15 +335,15 @@
candidato que no ha sido entrevistado. candidato que no ha sido entrevistado.
- Se cambia el estado del candidato de disponible a enproceso - Se cambia el estado del candidato de disponible a enproceso
*/ */
private function ejecutar1030(){ private function ejecutar1030() {
//Enviar un mail a RRHH con los datos pidiendo incorporación. //Enviar un mail a RRHH con los datos pidiendo incorporación.
$nombre = $this->getValor("nombre")." ".$this->getValor("apellidos"); $nombre = $this->getValor("nombre") . " " . $this->getValor("apellidos");
$oid = $this->getValor("oid"); $oid = $this->getValor("oid");
$asunto = "Candidato aceptado por pedido no entrevistado"; $asunto = "Candidato aceptado por pedido no entrevistado";
$direccion = constante("email"); $direccion = constante("email");
$path = "http://portal.selforsistemas.net"; $path = "http://portal.selforsistemas.net";
//$link = "<a href='".$path."/detalle_candidato.php?oid=".$oid."'>".$nombre."</a>"; //$link = "<a href='".$path."/detalle_candidato.php?oid=".$oid."'>".$nombre."</a>";
$email = "El candidato ".$nombre." no entrevistado ha sido aceptado para un pedido."; $email = "El candidato " . $nombre . " no entrevistado ha sido aceptado para un pedido.";
envia_correo($direccion, $asunto, $email); envia_correo($direccion, $asunto, $email);
$this->setCampos(array("estado" => "30")); $this->setCampos(array("estado" => "30"));
@ -359,18 +365,19 @@
- Se añade el campo "Fecha alta". - Se añade el campo "Fecha alta".
- Se transita automáticamente a "Esperando proyecto". - Se transita automáticamente a "Esperando proyecto".
*/ */
private function ejecutar5080($mensaje){ private function ejecutar5080($mensaje) {
$fecha = date(Y."-".m."-".d); $fecha = date(Y . "-" . m . "-" . d);
$nombre = md5($this->getValor("nombre")); $nombre = md5($this->getValor("nombre"));
$this->setCampos(array("tipo" => "usuario", "estado" => "90", "password" => $nombre, "rol" => 6, "fecha_alta" => $fecha, "salario" => $mensaje)); $this->setCampos(array("tipo" => "usuario", "estado" => "90", "password" => $nombre, "rol" => 6, "fecha_alta" => $fecha, "salario" => $mensaje));
/*$this->setCampo("estado", "90"); /* $this->setCampo("estado", "90");
$this->setCampo("password", $nombre); $this->setCampo("password", $nombre);
$this->setCampo("rol", 6); $this->setCampo("rol", 6);
$this->setCampo("fecha_alta", $fecha); $this->setCampo("fecha_alta", $fecha);
$this->setCampo("salario", $mensaje);*/ $this->setCampo("salario", $mensaje); */
return false; return false;
} }
/** /**
* Entrevistado a En proceso(entrevistado). * Entrevistado a En proceso(entrevistado).
* Admin, RRHH * Admin, RRHH
@ -380,12 +387,12 @@
EFECTOS: EFECTOS:
- Se cambia el estado del candidato de en proceso(entrevistado) - Se cambia el estado del candidato de en proceso(entrevistado)
*/ */
private function ejecutar5070() {
private function ejecutar5070(){
$this->setCampos(array("estado" => "70")); $this->setCampos(array("estado" => "70"));
$this->campos["estado_usuario"]="70"; $this->campos["estado_usuario"] = "70";
return true; return true;
} }
} }
?> ?>

View File

@ -81,6 +81,32 @@
echo '<a href="pedido.php?idPedido='.$_GET['idPedido'].'" class="menuOption" style="color:#000000">'.$this->locale['1077'].'</a>'; echo '<a href="pedido.php?idPedido='.$_GET['idPedido'].'" class="menuOption" style="color:#000000">'.$this->locale['1077'].'</a>';
} }
} }
if(in_array("nueva_oferta",$opcionesThis)){
echo '<a href="addOferta.php" class="menuOption" style="color:#000000">'.'Nueva oferta'.'</a>';
}
}
function menuOfertas($usuario, $opciones){
if(!is_array($opciones)){
$opcionesThis = array();
} else {
$opcionesThis = $opciones;
}
echo '<a href="lista_ofertas.php" class="menuOption" style="color:#000000">'.$this->locale['5100'].'</a>';
if($usuario->tieneRol("3") ||$usuario->tieneRol("1")){
echo '<a href="addOferta.php" class="menuOption" style="color:#000000">'.$this->locale['5101'].'</a>';
}
/*echo '<a href="buscar_oferta.php" class="menuOption" style="color:#000000">'.$this->locale['5102'].'</a>';*/
if(!in_array("gestionar", $opcionesThis)){
if(substr_count($_SERVER['REQUEST_URI'],"/oferta.php?idOferta")==1){
echo '<a href="gestion_oferta.php?idOferta='.$_GET['idOferta'].'" class="menuOption" style="color:#000000">'.$this->locale['284'].'</a>';
}
if(substr_count($_SERVER['REQUEST_URI'],"/gestion_oferta.php?idOferta")==1){
echo '<a href="oferta.php?idOferta='.$_GET['idOferta'].'" class="menuOption" style="color:#000000">'.$this->locale['5103'].'</a>';
}
}
} }
function menuCandidatos(){ function menuCandidatos(){
@ -211,10 +237,15 @@
if (!strcmp($opcion, "Gestión de candidatos")) { if (!strcmp($opcion, "Gestión de candidatos")) {
echo '<li><a title="'.$opcion.'" href="lista_candidatos.php">'.$opcion.'</a></li>'; echo '<li><a title="'.$opcion.'" href="lista_candidatos.php">'.$opcion.'</a></li>';
} elseif (!strcmp($opcion, "Mis datos")) { } elseif (!strcmp($opcion, "Mis datos")) {
$PonerAlFinal = '<li><a title="'.$opcion.'" href="administracion_principal.php?rol='.$opcion.'">'.$opcion.'</a></li>'; $PonerAlFinal .= '<li><a title="'.$opcion.'" href="administracion_principal.php?rol='.$opcion.'">'.$opcion.'</a></li>';
} elseif (!strcmp($opcion, "Mantenimiento del sistema")) {
$PonerAlFinal .= '<li><a title="'.$opcion.'" href="administracion_principal.php?rol='.$opcion.'">'.$opcion.'</a></li>';
} elseif (!strcmp($opcion, "Solicitudes de oferta")) { } elseif (!strcmp($opcion, "Solicitudes de oferta")) {
// Ticket 640 -> Entrada automatica a la lista de solicitudes de oferta. // Ticket 640 -> Entrada automatica a la lista de solicitudes de oferta.
echo '<li><a title="'.$opcion.'" href="lista_pedidos.php">'.$opcion.'</a></li>'; echo '<li><a title="'.$opcion.'" href="lista_pedidos.php">'.$opcion.'</a></li>';
} elseif (!strcmp($opcion, "Ofertas")) {
// Ticket 647 -> Nueva entrada de menú para ver la lista de ofertas
echo '<li><a title="'.$opcion.'" href="lista_ofertas.php">'.$opcion.'</a></li>';
} else { } else {
echo '<li><a title="'.$opcion.'" href="administracion_principal.php?rol='.$opcion.'">'.$opcion.'</a></li>'; echo '<li><a title="'.$opcion.'" href="administracion_principal.php?rol='.$opcion.'">'.$opcion.'</a></li>';
} }

View File

@ -1,4 +1,5 @@
<?php <?php
/* /*
* Clase ListaCandidatos * Clase ListaCandidatos
* *
@ -6,14 +7,11 @@
* *
*/ */
include_once("ListaPersonas.php"); include_once("ListaPersonas.php");
class ListaCandidatos extends ListaPersonas{
class ListaCandidatos extends ListaPersonas {
//Atributos: //Atributos:
//Constructor: //Constructor:
//Funciones: //Funciones:
/** /**
@ -22,17 +20,17 @@
* @param orden - parámetros por los que ordenar la lista. * @param orden - parámetros por los que ordenar la lista.
* @param sql - consulta de búsqueda. * @param sql - consulta de búsqueda.
*/ */
function ListaCandidatos($usuario,$orden,$sql,$estado){ function ListaCandidatos($usuario, $orden, $sql, $estado) {
parent::ListaPersonas($usuario, $orden, $sql); parent::ListaPersonas($usuario, $orden, $sql);
$this->tipo = "candidato"; $this->tipo = "candidato";
$this->estado=$estado; $this->estado = $estado;
} }
/** /**
* Devuelve la query de la consulta usada en la búsqueda para crear la lista. * Devuelve la query de la consulta usada en la búsqueda para crear la lista.
* @return una cadena de texto con la query. * @return una cadena de texto con la query.
*/ */
function getSQL(){ function getSQL() {
return $this->sql; return $this->sql;
} }
@ -40,7 +38,7 @@
* Devuelve una lista de los posibles estados en los que se puede encontrar un candidato * Devuelve una lista de los posibles estados en los que se puede encontrar un candidato
* como Key => value, donde key es el cod del estado y value es el nombre del estado. * como Key => value, donde key es el cod del estado y value es el nombre del estado.
*/ */
function getEstados(){ function getEstados() {
$consulta = "SELECT cod, nombre FROM candidatos_estados WHERE tipo='candidato'"; $consulta = "SELECT cod, nombre FROM candidatos_estados WHERE tipo='candidato'";
$bd = new BD(); $bd = new BD();
return $bd->keyValueQuery($consulta, "cod", "nombre"); return $bd->keyValueQuery($consulta, "cod", "nombre");
@ -50,7 +48,7 @@
* Inserta un nuevo candidato en la lista de candidatos. * Inserta un nuevo candidato en la lista de candidatos.
* @param campos - datos del candidato. * @param campos - datos del candidato.
*/ */
function addCandidato($campos){ function addCandidato($campos) {
$campos["estado"] = 510; $campos["estado"] = 510;
$id = parent::addPersona($campos); $id = parent::addPersona($campos);
$candidato = new Candidato($this->usuario, $id); $candidato = new Candidato($this->usuario, $id);
@ -58,5 +56,51 @@
$candidato->actualizarHistorial($mensaje); $candidato->actualizarHistorial($mensaje);
return $id; return $id;
} }
/**
* Devuelve los candidatos
*/
function getCandidatos() {
$candidatos = array();
if ($this->sql != "") {
// metemos el estado si es > 0
if ($this->estado > 0) {
if (stripos($this->sql, "WHERE") > 0) {
$sqlAntesWhere = substr($this->sql, 0, stripos($this->sql, "WHERE"));
$sqlDespuesWhere = substr($this->sql, stripos($this->sql, "WHERE") + 5, strlen($this->sql));
$sqlConEstado = "WHERE usuarios.estado='" . $this->estado . "' and ";
$sqlNueva = $sqlAntesWhere . $sqlConEstado . $sqlDespuesWhere;
} else {
$sqlConEstado = "WHERE usuarios.estado='" . $this->estado . "' ";
$sqlNueva = $this->sql . $sqlConEstado;
} }
} else {
$sqlNueva = $this->sql;
}
$consulta = $sqlNueva . " " . $this->order_by;
} else {
if ($this->estado > 0) {
$consulta = "SELECT oid from usuarios WHERE tipo='" . $this->tipo . "' and estado='" . $this->estado . "'" . $this->orden;
} else {
$consulta = "SELECT oid from usuarios WHERE tipo='" . $this->tipo . "'" . $this->orden . "";
}
}
$bd = new BD();
$resultado = $bd->execQuery($consulta);
//Procesamos los candidatos.
if (mysql_num_rows($resultado) != 0) {
while ($rows = mysql_fetch_array($resultado)) {
$p = new Candidato($this->usuario, $rows["oid"]);
$candidatos[] = $p;
}
}
return $candidatos;
}
}
?> ?>

150
Objects/ListaOfertas.php Normal file
View File

@ -0,0 +1,150 @@
<?php
/*
* Clase ListaOfertas
*/
include_once("Objects/Oferta.php");
class ListaOfertas {
// Atributos:
/* Una lista de pedidos. */
private $ofertas = array();
/* Gestor dueño de la lista. */
private $gestor;
/* Campos por los que ordenar la lista. */
private $orden;
/* Condiciones para búsquedas. */
private $condiciones;
// Constructor:
/**
* Crea una lista de ofertas.
*
* @param usuario $ - gestor dueño de la lista.
* @param orden $ - parámetros por los que ordenar la lista.
* @param sql $ - consulta de búsqueda.
*/
function ListaOfertas($usuario, $condiciones=array(), $orden=array()) {
$this->gestor = $usuario;
$this->orden = $orden;
$this->condiciones = $condiciones;
}
/**
* Busca y devuelve todos los pedidos del usuario.
*/
function getOfertas() {
// sacado de http://patrickallaert.blogspot.com/2007/09/building-dynamic-sql-queries-elegant.html
$consulta = "SELECT * FROM candidato_pedido";
if (count($this->condiciones)) {
$consulta .= ' WHERE ' . implode(' AND ', $this->condiciones);
}
if (count($this->orden)) {
$consulta .= ' ORDER BY ' . implode(' , ', $this->orden);
}
$bd = new BD();
$resultado = $bd->execQuery($consulta);
// Procesamos las ofertas.
if (mysql_num_rows($resultado) == 0) {
$this->ofertas = array();
} else {
while ($rows = mysql_fetch_array($resultado)) {
$p = new Oferta($rows["oid"], $this->gestor);
$this->ofertas[] = $p;
}
}
return $this->ofertas;
}
/**
* Devuelve una lista de los posibles estados en los que se puede encontrar un pedido
* como Key => value, donde key es el cod del estado y value es el nombre del estado.
*/
function getEstadosOfertas() {
$consulta = "SELECT cod, nombre FROM candidaturas_estados";
$bd = new BD();
return $bd->keyValueQuery($consulta, "cod", "nombre");
}
/**
* Busca una oferta en función de su identificador.
*
* @return el pedido, en caso de encontrarlo y null en
* caso contrario.
*/
function buscarOferta($id) {
$lista = $this->getOfertas();
if ($lista) {
foreach ($lista as $elem) {
if ($elem->getValor("oid") == $id) {
return $elem;
}
}
}
return null;
}
function addOferta($campos) {
if (!$this->gestor->tieneRol(1) && !$this->gestor->tieneRol(3)) {
$error = "El usuario no tiene permisos para crear ofertas.";
throw new Exception($error);
}
// Calculamos el id
$referencia = $this->calculaReferencia($campos["pedido"]);
$inserto = "fecha, referencia";
$fecha = "'" . date("Y-m-d") . "'";
$valores = "$fecha, $referencia";
// Procesamos los datos
foreach ($campos as $key => $value) {
$inserto .= ", $key";
$valores .= ", '$value'";
}
// Insertamos en la BD
$consulta = "INSERT INTO candidato_pedido ($inserto) VALUES ($valores)";
$bd = new BD();
if (!$bd->execQuery($consulta)) {
return "-1";
} else {
$id = mysql_insert_id();
$p = new Oferta($id, $this->gestor);
$mensaje = "Nueva oferta";
$p->actualizarHistorial($mensaje);
}
return $id;
}
function calculaReferencia($solicitud) {
$bd = new BD();
$consulta = "select referencia from candidato_pedido where pedido = '$solicitud' order by oid desc limit 1";
if ($resultado = $bd->execQuery($consulta)) {
$rows = mysql_fetch_array($resultado);
echo "########################<br/>";
print_r($rows);
echo "########################<br/>";
$num = 1;
if (!empty($rows[0])) {
$num = substr($rows[0], strpos($rows[0], '/') + 1, strlen($rows[0]));
$num += 1;
}
return sprintf('\'%s/%s\'', $solicitud, $num);
} else {
return sprintf('\'%s/%s\'', $solicitud, 1);
}
}
}
?>

View File

@ -96,7 +96,7 @@ include_once("Objects/Pedido.php");
if($estado > 0){ if($estado > 0){
$consulta = "SELECT * from pedidos WHERE estado='".$estado."'".$this->orden ; $consulta = "SELECT * from pedidos WHERE estado='".$estado."'".$this->orden ;
}else{ }else{
$consulta = "SELECT * from pedidos WHERE estado IN (10, 20, 30) ".$this->orden.""; $consulta = "SELECT * from pedidos ".$this->orden."";
} }
} }
}else if($this->gestor->tieneRol(3)){ }else if($this->gestor->tieneRol(3)){
@ -123,7 +123,7 @@ include_once("Objects/Pedido.php");
if($estado > 0){ if($estado > 0){
$consulta = "SELECT * FROM pedidos WHERE gerente = '$id' AND estado='$estado'".$this->orden; $consulta = "SELECT * FROM pedidos WHERE gerente = '$id' AND estado='$estado'".$this->orden;
}else{ }else{
$consulta = "SELECT * FROM pedidos WHERE estado IN (10, 20, 30) AND gerente = '$id'".$this->orden; $consulta = "SELECT * FROM pedidos WHERE gerente = '$id'".$this->orden;
} }
} }
}else{ }else{
@ -188,6 +188,7 @@ include_once("Objects/Pedido.php");
//Insertamos en la BD //Insertamos en la BD
$consulta = "INSERT INTO pedidos ($inserto) VALUES ($valores)"; $consulta = "INSERT INTO pedidos ($inserto) VALUES ($valores)";
$bd = new BD(); $bd = new BD();
if(!$bd->execQuery($consulta)){ if(!$bd->execQuery($consulta)){
return -1; return -1;

View File

@ -154,7 +154,7 @@ include_once("Empleado.php");
//Insertamos en la BD //Insertamos en la BD
$consulta = "INSERT INTO usuarios ($inserto) VALUES ($valores)"; $consulta = "INSERT INTO usuarios ($inserto) VALUES ($valores)";
echo $consulta;
$bd = new BD(); $bd = new BD();
if(!$bd->execQuery($consulta)){ if(!$bd->execQuery($consulta)){
$error = "Campos del candidato incorrectos. Por favor, avise al webmaster de este error."; $error = "Campos del candidato incorrectos. Por favor, avise al webmaster de este error.";

298
Objects/Oferta.php Normal file
View File

@ -0,0 +1,298 @@
<?php
/*
* Clase Oferta
*/
include_once("BD.php");
include_once("Automata.php");
include_once("ListaCandidatos.php");
include_once("Candidato.php");
class Oferta {
// Atributos:
/* Usuario que tiene activa la sesión. */
private $usuario;
protected $campos = array();
// Constructores:
function Oferta($oid, $usuario) {
$this->usuario = $usuario;
$consulta = "SELECT oid FROM candidato_pedido WHERE oid = '$oid'";
$bd = new BD();
$num = $bd->numFilas($consulta);
if ($num > 0) {
$this->campos['oid'] = $oid;
} else {
$error = "Oferta no encontrada.";
throw new Exception($error);
}
}
function actualizarHistorial($mensaje) {
$oid = $this->getValor("oid");
$usuario = $this->usuario->getValor("nombre");
$consulta = "INSERT INTO historial_oferta (oid_h, fecha_h, persona_h, texto_h) VALUES('$oid', now(), '$usuario', '$mensaje')";
$bd = new BD();
return $bd->execQuery($consulta);
}
function getValor($nombre) {
if (array_key_exists($nombre, $this->campos)) {
// El campo ya lo habíamos recuperamos, lo mostramos
return $this->campos[$nombre];
} else {
switch ($nombre) {
case "nombre_estado":
$idEstado = $this->getValor("estado");
$idioma = $this->usuario->getValor("idioma");
$consulta = "SELECT nombre FROM candidaturas_estados WHERE cod=\"" . $idEstado . "\" AND idioma=\"" . $idioma . "\"";
break;
case "nombre_solicitud":
$oidPedido = $this->getValor("pedido");
$consulta = "SELECT nombre FROM pedidos WHERE oid=\"" . $oidPedido . "\"";
break;
case "nombre_candidato":
$oidCandidato = $this->getValor("candidato");
$consulta = "SELECT concat(nombre, ' ', apellidos) FROM usuarios WHERE oid=\"" . $oidCandidato . "\"";
break;
default: $consulta = "SELECT " . $nombre . " FROM candidato_pedido WHERE oid=\"" . $this->campos['oid'] . "\"";
break;
}
// Lo insertamos para nosotros
$bd = new BD();
$valor = $bd->getCampo($consulta);
// Lo insertamos para nosotros
$arrayAct = array($nombre => $valor);
$this->campos = $this->campos + $arrayAct;
return $valor;
}
}
/**
* Acceso a los campos del pedido.
*
* @return los campos del pedido.
*/
function getCampos() {
return $this->campos;
}
function getSiguientes() {
$estado = $this->getValor("estado");
$idioma = $this->usuario->getValor("idioma");
$rol = $this->usuario->getValor("rol");
$a = new Automata("candidaturas", $idioma, $rol);
$siguientes = $a->getSiguientes($estado);
return $siguientes;
}
function transita($destino, $argumentos) {
$origen = $this->getValor("estado");
$idioma = $this->usuario->getValor("idioma");
$rol = $this->usuario->getValor("rol");
$a = new Automata("candidaturas", $idioma, $rol);
$transita = $a->getTransicion($origen, $destino);
if (($transita == "") || !($transita >= 0)) {
return false;
} else {
$res = $this->ejecutaTransicion($transita, $argumentos);
if ($res) {
$this->setAutomatico = true;
$this->setCampo("msgEstado", $argumentos);
$this->setCampo("estado", $destino);
$this->setAutomatico = false;
}
return $res;
}
}
private function ejecutaTransicion($codigo, $argumentos) {
// Si no hace nada al transitar salimos sin más.
if ($codigo == 0)
return true;
$funcion = "ejecutar$codigo";
$res = call_user_func(array("Oferta", $funcion), $argumentos);
return $res;
}
/**
* En configuración -> Configurada
*/
private function ejecutar110120() {
// Comprobamos que haya un candidato asignado.
$candidato = $this->getValor("candidato");
if (!empty($candidato)) {
return true;
} else {
$error = "No se puede cambiar de estado porque no hay ningún candidato asignado a esta oferta";
throw new Exception($error);
return false;
exit;
}
}
function setCampo($nombre, $valor) {
// PERMISOS:
/*
* Admin (1) - Todos
* Gestor (3) - Los suyos
* Otro - Excepción
*/
$gerente = $this->getValor("gerente");
$sesion = $this->usuario->getValor("oid");
if ($this->usuario->tieneRol(1) || ($this->usuario->tieneRol(3) && $sesion == $gerente) || $this->setAutomatico) {
$viejo = $this->getValor($nombre);
if ($viejo != $valor) {
// Comprobamos multivaluado y casos especiales antes del cambio:
$viejo = $this->getValorMulti($nombre, $viejo);
$this->campos[$nombre] = $valor;
$oid = $this->getValor("oid");
$consulta = "UPDATE candidato_pedido SET $nombre = '$valor' WHERE oid='$oid'";
$bd = new BD();
if ($bd->execQuery($consulta)) {
// Guardar en el historial
$valor = $this->getValorMulti($nombre, $valor);
if ($viejo == "" && $valor != "") {
$historial = "$nombre (de - a $valor)";
} else {
$historial = "$nombre (de $viejo a $valor)";
}
if ($nombre = "estado") {
$this->actualizarHistorial($historial);
}
}
}
} else {
$error = "El usuario no tiene permisos para editar la solicitud de oferta.";
throw new Exception($error);
}
}
private function getValorMulti($nombre, $antiguo) {
switch ($nombre) {
/* case "procedencia":
$valor = nombre_procedencia($antiguo);
break;
case "estado":
$valor = nombre_estado_pedido($antiguo);
break;
case "localidad":
$valor = nombre_localidad($antiguo);
break;
case "perfil":
$valor = nombre_perfil($antiguo);
break;
case "cliente":
$valor = nombre_cliente($antiguo);
break; */
default:
$valor = $antiguo;
break;
}
return $valor;
}
/**
* Devuelve una lista de candidatos disponibles para una oferta
*/
function getCandidatosDisponibles() {
return $this->getCandidatos("540");
}
/**
* Devuelve una lista de candidatos de un estado dado
*/
private function getCandidatos($estado) {
$lista = new ListaCandidatos($this->usuario, "", "", $estado);
return $lista;
}
function getHistorial() {
$historial = "";
$oid = $this->getValor("oid");
$consulta = "SELECT * FROM historial_oferta WHERE oid_h='$oid' ORDER BY fecha_h DESC";
$bd = new BD();
$resultado = $bd->execQuery($consulta);
while ($rows = mysql_fetch_array($resultado)) {
$fecha = $rows["fecha_h"];
$persona = $rows["persona_h"];
$texto = $rows["texto_h"];
$historial .= "[$fecha] $persona - $texto\n";
}
return $historial;
}
function quitarCandidato() {
$idCand = $this->getValor("candidato");
if (!empty($idCand)) {
$candidato = new Candidato($this->usuario, $idCand);
$estadoCand = $candidato->getValor("estado");
switch ($estadoCand) {
case "560":
$candidato->transita("540", "");
$nombre_candidato = $candidato->getValor("nombre") . " " . $candidato->getValor("apellidos");
$mensaje = "Eliminado el candidato ".$nombre_candidato;
$this->actualizarHistorial($mensaje);
return true;
break;
default:
$error = "[quitarCandidato]. El candidato tiene un estado no permitido ('" . $estadoCand . "')";
throw new Exception($error);
}
}
}
function colocarCandidato($idCandidato) {
$idCand = $this->getValor("candidato");
if (!empty($idCand)) {
if (!$this->quitarCandidato()) {
return false;
}
}
$candidato = new Candidato($this->usuario, $idCandidato);
$estadoCand = $candidato->getValor("estado");
switch ($estadoCand) {
case "540":
if ($candidato->transita("560", "")) {
$this->setCampo("candidato", $idCandidato);
$nombre_candidato = $candidato->getValor("nombre") . " " . $candidato->getValor("apellidos");
$mensaje = "Asignado el candidato ".$nombre_candidato;
$this->actualizarHistorial($mensaje);
return true;
}
else {
dbug("error");
}
break;
default:
$error = "El candidato tiene un estado no permitido ('" . $candidato->getValor("estado") . "')";
throw new Exception($error);
}
echo dbug('print');
}
}
?>

File diff suppressed because it is too large Load Diff

133
addOferta.php Normal file
View File

@ -0,0 +1,133 @@
<?php
include("seguridad.php");
include("functions.php");
include_once("Objects/ListaOfertas.php");
include_once("Objects/Oferta.php");
include_once("Objects/HTML.php");
$html = new HTML($locale);
$errores = array();
// Todas las variables
if (!empty($_POST)) {
print_r($_POST);
$solicitud = "";
if (!empty($_POST['solicitud'])) {
$solicitud = $_POST['solicitud'][0];
}
/*
$nombre=$_POST['nombre'];
$prioridad=$_POST['prioridad'];
$empleados=$_POST['empleados'];
$duracion=$_POST['duracion'];
$clientes=$_POST['clientes'];
$perfiles=$_POST['perfil'];
$salario_min=$_POST['salario_min'];
$salario_max=$_POST['salario_max'];
$procedencia=$_POST['procedencia'];
$tecnologias=$_POST['tecnologia'];
$idiomas=$_POST['idiomas'];
$provincias=$_POST['provincias']; */
$observaciones = $_POST['observaciones'];
/* $pesoTec=$_POST['pesoTec'];
$pesoIdi=$_POST['pesoIdi'];
$pesoPer=$_POST['pesoPer'];
if($usuario->tieneRol("1")){
$gerente=$_POST['gerente'];
} else {
$gerente=$usuario->getValor("oid");
}
*/
if ($_POST['action'] == "add") {
// Comprobamos campos obligatorios
if (empty($solicitud)) {
$errores[] = "1";
}
// Si no hay errores insertamos el pedido
if (count($errores) == 0) {
$listaOfertas = new ListaOfertas($usuario, "", "", "0");
$arrayInsert = array();
$arrayInsert["pedido"] = $solicitud;
$arrayInsert["obsGerente"] = $observaciones;
$arrayInsert["estado"] = "110";
/* $arrayInsert["prioridad"]= $prioridad;
$arrayInsert["empleados"]=$empleados;
$arrayInsert["duracion"]=$duracion;
$arrayInsert["gerente"]=$gerente;
$arrayInsert["cliente"]=$clientes;
$arrayInsert["salario_min"]=$salario_min;
$arrayInsert["salario_max"]=$salario_max;
$arrayInsert["procedencia"]=$procedencia;
$arrayInsert["estado"]="110";
$arrayInsert["pesoIdioma"]=$pesoIdi;
$arrayInsert["pesoPerfil"]=$pesoPer;
$arrayInsert["pesoTecno"]=$pesoTec; */
$idOferta = $listaOfertas->addOferta($arrayInsert);
if ($idOferta == "-1") {
// Se he producido un fallo al insertar
$errores[] = "0";
$msg = "No se ha podido agregar la oferta";
$tipo = "error";
} else {
$oferta = $listaOfertas->buscarOferta($idOferta);
header("Location: oferta.php?idOferta=" . $idOferta . "&msg=1");
}
}
}
} else {
$referencia = "";
$solicitud = "";
$observaciones = "";
}
include("html/cabecera.php");
echo $html->menuOfertas($usuario, "");
echo "<h2>" . $locale['5105'] . "</h2>";
if (isset($msg) && ($msg != "")) {
echo "<div class=\"aviso " . $tipo . "\">" . $msg . "</div>";
}
echo '<form method="POST" action="addOferta.php" name="form_registro" enctype="multipart/form-data">';
echo "<input type=\"hidden\" name=\"action\" value=\"add\" />";
echo "<table id=\"addOferta\">" .
"<tr>" .
" <td";
if (in_array("1", $errores))
echo " class=\"errorcampo\"";
echo ">" . $locale['1025'] . ":<br/>";
rellena_desplegable_pedidos_estado("solicitud", "130", array($solicitud));
echo " </td>";
echo "</td></tr>";
echo "<tr>";
echo "</tr>";
echo '<tr>' .
'<td colspan="3" align="center">' . $locale['135'] .
'<br><textarea name="observaciones" rows="10" cols="120" style="overflow: auto; width:100%;">' . nl2br($observaciones) . '</textarea></td>' .
'</tr>';
// Botones de guardar y restablecer
echo "<tr><td colspan=\"3\" align=\"center\">";
echo '<input type="submit" value="' . $locale['gu'] . '" onclick="return comprobar_registro(this)" class="button">';
echo '<input type="reset" value="' . $locale['res'] . '" class="button"></td>';
echo "</tr></table>";
echo "</form>";
include_once("html/pie.php");
?>

View File

@ -84,7 +84,7 @@ if(!empty($_POST)) {
$arrayInsert["salario_max"]=$salario_max; $arrayInsert["salario_max"]=$salario_max;
$arrayInsert["procedencia"]=$procedencia; $arrayInsert["procedencia"]=$procedencia;
$arrayInsert["observaciones"]=$observaciones; $arrayInsert["observaciones"]=$observaciones;
$arrayInsert["estado"]="10"; $arrayInsert["estado"]="110";
$arrayInsert["pesoIdioma"]=$pesoIdi; $arrayInsert["pesoIdioma"]=$pesoIdi;
$arrayInsert["pesoPerfil"]=$pesoPer; $arrayInsert["pesoPerfil"]=$pesoPer;
$arrayInsert["pesoTecno"]=$pesoTec; $arrayInsert["pesoTecno"]=$pesoTec;
@ -96,7 +96,6 @@ if(!empty($_POST)) {
$tipo="error"; $tipo="error";
} else { } else {
$pedido=$listaPedidos->buscarPedido($idPedido); $pedido=$listaPedidos->buscarPedido($idPedido);
print_r($perfiles);
$pedido->addPerfiles($perfiles); $pedido->addPerfiles($perfiles);
$pedido->addTecnologias($tecnologias); $pedido->addTecnologias($tecnologias);
$pedido->addIdiomas($idiomas); $pedido->addIdiomas($idiomas);
@ -172,7 +171,7 @@ echo "</td><td";
if(in_array("5",$errores)) echo " class=\"errorcampo\""; if(in_array("5",$errores)) echo " class=\"errorcampo\"";
echo ">".$locale['121']."<br/>"; echo ">".$locale['121']."<br/>";
// Ticket #565 -> En una solicitud de oferta, se deben poder indicar varios perfiles técnicos // Ticket #565 -> En una solicitud de oferta, se deben poder indicar varios perfiles técnicos
echo $html->listaSelect("perfil","oid","id","perfil",array("",$locale['ns']),$tecnologias,true,true,"15"); echo $html->listaSelect("perfil","oid","id","perfil",array("",$locale['ns']),$perfiles,true,true,"15");
echo "</td><td>".$locale['132'].": ".$locale['2100']; echo "</td><td>".$locale['132'].": ".$locale['2100'];
echo "</td></tr>"; echo "</td></tr>";

View File

@ -8,7 +8,7 @@ if(!$_SESSION["oid"]){
//$consulta = "select usuarios.nombre as nombre,usuarios.apellidos as apellidos, pedidos.nombre as pedido, estado_candidatura.id as estado from usuarios,candidato_pedido,pedidos,estado_candidatura where usuarios.oid='".$persona->getValor("oid")."' and candidato_pedido.candidato='".$persona->getValor("oid")."' and candidato_pedido.pedido = pedidos.oid and candidato_pedido.estado <> 6 "; //$consulta = "select usuarios.nombre as nombre,usuarios.apellidos as apellidos, pedidos.nombre as pedido, estado_candidatura.id as estado from usuarios,candidato_pedido,pedidos,estado_candidatura where usuarios.oid='".$persona->getValor("oid")."' and candidato_pedido.candidato='".$persona->getValor("oid")."' and candidato_pedido.pedido = pedidos.oid and candidato_pedido.estado <> 6 ";
$consulta = "SELECT U.oid as idCandidato,P.oid as idPedido, U.nombre,U.apellidos,P.nombre AS pedido, CE.nombre AS estado, P.oid,CP.obsRRHH,CP.obsGerente $consulta = "SELECT U.oid as idCandidato,P.oid as idPedido, U.nombre,U.apellidos,P.nombre AS pedido, CE.nombre AS estado, P.oid,CP.obsRRHH,CP.obsGerente
FROM usuarios U,pedidos P,candidato_pedido CP,candidaturas_estado CE FROM usuarios U,pedidos P,candidato_pedido CP,candidaturas_estados CE
WHERE U.oid='".$persona->getValor("oid")."' WHERE U.oid='".$persona->getValor("oid")."'
AND CP.candidato=U.oid AND CP.candidato=U.oid
AND P.oid=CP.pedido AND P.oid=CP.pedido

View File

@ -75,6 +75,6 @@ if ($link=conectar()){
} }
}else { }else {
//si no existe le mando otra vez a la portada //si no existe le mando otra vez a la portada
header("Location: index.php?errorusuario=si"); // header("Location: index.php?errorusuario=si");
} }
?> ?>

View File

@ -102,15 +102,30 @@ INSERT INTO `candidatos_estados` (`cod`, `idioma`, `nombre`, `tipo`) VALUES
(523, 'sp', 'Rechazado 3', 'candidato'), (523, 'sp', 'Rechazado 3', 'candidato'),
(530, 'sp', 'No disponible', 'candidato'), (530, 'sp', 'No disponible', 'candidato'),
(540, 'sp', 'Disponible sin asignar', 'candidato'), (540, 'sp', 'Disponible sin asignar', 'candidato'),
(550, 'sp', 'Disponible asignado a solicitud histórica', 'candidato'), (550, 'sp', 'Disponible asignado a solicitud cerrada', 'candidato'),
(560, 'sp', 'Disponible asignado a solicitud abierta', 'candidato'); (560, 'sp', 'Disponible asignado a solicitud abierta', 'candidato');
-- -------------------------------------------------------- -- --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `candidaturas_transiciones` (
`inicial` int(10) unsigned NOT NULL,
`final` int(10) unsigned NOT NULL,
`transicion` bigint(20) unsigned NOT NULL,
`rol` text NOT NULL,
PRIMARY KEY (`inicial`,`final`),
KEY `final` (`final`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `candidaturas_transiciones`
ADD CONSTRAINT `candidaturas_transiciones_ibfk_1` FOREIGN KEY (`inicial`) REFERENCES `candidaturas_estado` (`cod`),
ADD CONSTRAINT `candidaturas_transiciones_ibfk_2` FOREIGN KEY (`final`) REFERENCES `candidaturas_estado` (`cod`);
-- --
-- Estructura de tabla para la tabla `candidatos_transiciones` -- Estructura de tabla para la tabla `candidatos_transiciones`
-- --
CREATE TABLE IF NOT EXISTS `candidatos_transiciones` ( CREATE TABLE IF NOT EXISTS `candidatos_transiciones` (
`inicial` int(10) NOT NULL, `inicial` int(10) NOT NULL,
`final` int(10) NOT NULL, `final` int(10) NOT NULL,
@ -167,7 +182,8 @@ INSERT INTO `candidatos_transiciones` (`inicial`, `final`, `transicion`, `rol`)
CREATE TABLE IF NOT EXISTS `candidato_pedido` ( CREATE TABLE IF NOT EXISTS `candidato_pedido` (
`oid` int(10) unsigned NOT NULL AUTO_INCREMENT, `oid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`candidato` bigint(20) unsigned NOT NULL, `referencia` varchar(12) COLLATE latin1_spanish_ci NOT NULL,
`candidato` bigint(20) unsigned,
`pedido` varchar(8) COLLATE latin1_spanish_ci NOT NULL, `pedido` varchar(8) COLLATE latin1_spanish_ci NOT NULL,
`afinidad` float NOT NULL, `afinidad` float NOT NULL,
`estado` int(10) unsigned NOT NULL, `estado` int(10) unsigned NOT NULL,
@ -190,10 +206,10 @@ CREATE TABLE IF NOT EXISTS `candidato_pedido` (
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Estructura de tabla para la tabla `candidaturas_estado` -- Estructura de tabla para la tabla `candidaturas_estados`
-- --
CREATE TABLE IF NOT EXISTS `candidaturas_estado` ( CREATE TABLE IF NOT EXISTS `candidaturas_estados` (
`cod` int(10) unsigned NOT NULL, `cod` int(10) unsigned NOT NULL,
`idioma` varchar(3) COLLATE latin1_spanish_ci NOT NULL, `idioma` varchar(3) COLLATE latin1_spanish_ci NOT NULL,
`nombre` varchar(50) COLLATE latin1_spanish_ci NOT NULL, `nombre` varchar(50) COLLATE latin1_spanish_ci NOT NULL,
@ -201,10 +217,10 @@ CREATE TABLE IF NOT EXISTS `candidaturas_estado` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
-- --
-- Volcar la base de datos para la tabla `candidaturas_estado` -- Volcar la base de datos para la tabla `candidaturas_estados`
-- --
INSERT INTO `candidaturas_estado` (`cod`, `idioma`, `nombre`) VALUES INSERT INTO `candidaturas_estados` (`cod`, `idioma`, `nombre`) VALUES
(10, 'sp', 'Descartado'), (10, 'sp', 'Descartado'),
(20, 'sp', 'Aceptado'), (20, 'sp', 'Aceptado'),
(30, 'sp', 'En proceso'), (30, 'sp', 'En proceso'),
@ -359,10 +375,6 @@ CREATE TABLE IF NOT EXISTS `historial_pedido` (
KEY `oid_h` (`oid_h`) KEY `oid_h` (`oid_h`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
--
-- Volcar la base de datos para la tabla `historial_pedido`
--
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -378,10 +390,22 @@ CREATE TABLE IF NOT EXISTS `historial_usuario` (
KEY `oid_h` (`oid_h`) KEY `oid_h` (`oid_h`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
-- --
-- Volcar la base de datos para la tabla `historial_usuario` -- Estructura de tabla para la tabla `historial_oferta`
-- --
CREATE TABLE IF NOT EXISTS `historial_oferta` (
`oid_h` bigint(20) unsigned NOT NULL,
`fecha_h` varchar(20) CHARACTER SET latin1 COLLATE latin1_spanish_ci NOT NULL,
`persona_h` varchar(20) CHARACTER SET latin1 COLLATE latin1_spanish_ci NOT NULL,
`texto_h` text CHARACTER SET latin1 COLLATE latin1_spanish_ci NOT NULL,
KEY `oid_h` (`oid_h`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -759,9 +783,9 @@ INSERT INTO `pedidos_transiciones` (`inicial`, `final`, `transicion`, `rol`) VAL
(110, 120, 0, '1.3'), (110, 120, 0, '1.3'),
(110, 130, 110130, '1.3'), (110, 130, 110130, '1.3'),
(120, 110, 0, '1.3'), (120, 110, 0, '1.3'),
(130, 110, 0, '1.3'), (130, 110, 130110, '1.3'),
(130, 140, 0, ''), (130, 140, 130140, ''),
(140, 130, 0, ''); (140, 130, 140130, '');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -1469,7 +1493,7 @@ ALTER TABLE `candidatos_estados`
ALTER TABLE `candidato_pedido` ALTER TABLE `candidato_pedido`
ADD CONSTRAINT `candidato_pedido_ibfk_1` FOREIGN KEY (`candidato`) REFERENCES `usuarios` (`oid`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `candidato_pedido_ibfk_1` FOREIGN KEY (`candidato`) REFERENCES `usuarios` (`oid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `candidato_pedido_ibfk_2` FOREIGN KEY (`pedido`) REFERENCES `pedidos` (`oid`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `candidato_pedido_ibfk_2` FOREIGN KEY (`pedido`) REFERENCES `pedidos` (`oid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `candidato_pedido_ibfk_3` FOREIGN KEY (`estado`) REFERENCES `candidaturas_estado` (`cod`) ON UPDATE CASCADE; ADD CONSTRAINT `candidato_pedido_ibfk_3` FOREIGN KEY (`estado`) REFERENCES `candidaturas_estados` (`cod`) ON UPDATE CASCADE;
-- --
-- Filtros para la tabla `clientes` -- Filtros para la tabla `clientes`

View File

@ -1,7 +1,8 @@
<?php <?php
/* Devuelve el nombre de un estado */ /* Devuelve el nombre de un estado */
function nombre_estado($oid){ function nombre_estado($oid)
{
$consulta = "select nombre from candidatos_estados where cod='$oid'"; $consulta = "select nombre from candidatos_estados where cod='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -9,7 +10,8 @@ function nombre_estado($oid){
} }
/* Devuelve el nombre de un estado de candidatura */ /* Devuelve el nombre de un estado de candidatura */
function nombre_estado_candidatura($orden){ function nombre_estado_candidatura($orden)
{
$consulta = "select id from estado_candidatura where oid='$orden'"; $consulta = "select id from estado_candidatura where oid='$orden'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -17,15 +19,25 @@ function nombre_estado_candidatura($orden){
} }
/* Devuelve el nombre de un estado de pedido */ /* Devuelve el nombre de un estado de pedido */
function nombre_estado_pedido($oid){ function nombre_estado_pedido($oid)
{
$consulta = "select nombre from pedidos_estados where cod='$oid'"; $consulta = "select nombre from pedidos_estados where cod='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
return $rows["nombre"]; return $rows["nombre"];
} }
function nombre_estado_oferta($oid)
{
$consulta = "select nombre from candidaturas_estados where cod='$oid'";
$resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado);
return $rows["nombre"];
}
/* Devuelve el nombre de una procedencia */ /* Devuelve el nombre de una procedencia */
function nombre_procedencia($id){ function nombre_procedencia($id)
{
$consulta = "select id from procedencia where num='$id'"; $consulta = "select id from procedencia where num='$id'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -33,7 +45,8 @@ function nombre_procedencia($id){
} }
/* Devuelve el nombre de una procedencia */ /* Devuelve el nombre de una procedencia */
function nombre_procedencia_cv($id){ function nombre_procedencia_cv($id)
{
$consulta = "select nombre from procedencia_cv where id='$id'"; $consulta = "select nombre from procedencia_cv where id='$id'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -41,7 +54,8 @@ function nombre_procedencia_cv($id){
} }
/* Devuelve el nombre de una localidad */ /* Devuelve el nombre de una localidad */
function nombre_localidad($oid){ function nombre_localidad($oid)
{
$consulta = "select id from localidades where oid='$oid'"; $consulta = "select id from localidades where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -49,7 +63,8 @@ function nombre_localidad($oid){
} }
/* Devuelve el nombre de una provincia */ /* Devuelve el nombre de una provincia */
function nombre_provincia($oid){ function nombre_provincia($oid)
{
$consulta = "select id from provincias where oid='$oid'"; $consulta = "select id from provincias where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -57,7 +72,8 @@ function nombre_provincia($oid){
} }
/* Devuelve el nombre de un perfil */ /* Devuelve el nombre de un perfil */
function nombre_perfil($oid){ function nombre_perfil($oid)
{
$consulta = "select id from perfil where oid='$oid'"; $consulta = "select id from perfil where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -65,7 +81,8 @@ function nombre_perfil($oid){
} }
/* Devuelve el nombre de un rol */ /* Devuelve el nombre de un rol */
function nombre_rol($oid){ function nombre_rol($oid)
{
$consulta = "select id from rol where oid='$oid'"; $consulta = "select id from rol where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -73,7 +90,8 @@ function nombre_rol($oid){
} }
/* Devuelve el nombre de un cliente */ /* Devuelve el nombre de un cliente */
function nombre_cliente($oid){ function nombre_cliente($oid)
{
$consulta = "select id from clientes where oid='$oid'"; $consulta = "select id from clientes where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -81,7 +99,8 @@ function nombre_cliente($oid){
} }
/* Devuelve el perfil de un pedido */ /* Devuelve el perfil de un pedido */
function perfil_pedido($oid){ function perfil_pedido($oid)
{
$consulta = "select perfil from pedidos where oid='$oid'"; $consulta = "select perfil from pedidos where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -89,7 +108,8 @@ function perfil_pedido($oid){
} }
/* Devuelve el nombre de un pedido */ /* Devuelve el nombre de un pedido */
function nombre_pedido($oid){ function nombre_pedido($oid)
{
$consulta = "select nombre from pedidos where oid='$oid'"; $consulta = "select nombre from pedidos where oid='$oid'";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
@ -97,12 +117,13 @@ function nombre_pedido($oid){
} }
/* Devuelve el nombre de un salario */ /* Devuelve el nombre de un salario */
function nombre_salario($id){ function nombre_salario($id)
{
$consulta = "SELECT nombre FROM salario WHERE id='$id'"; $consulta = "SELECT nombre FROM salario WHERE id='$id'";
if($resultado = mysql_query($consulta)){ if ($resultado = mysql_query($consulta)) {
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
return $rows["nombre"]; return $rows["nombre"];
}else{ } else {
return ""; return "";
} }
} }

View File

@ -201,7 +201,7 @@ carpeta antiword en el ra
/* Devuelve la lista de currículums */ /* Devuelve la lista de currículums */
function menu_curriculums($oid, $tipo){ function menu_curriculums($oid, $tipo){
include LOCALE.LOCALESET."lenguaje.php"; include_once LOCALE.LOCALESET."lenguaje.php";
$consulta = "select * from curriculum_usuario where oid='$oid' order by fecha"; $consulta = "select * from curriculum_usuario where oid='$oid' order by fecha";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$num = @mysql_num_rows($resultado); $num = @mysql_num_rows($resultado);
@ -224,7 +224,7 @@ function menu_curriculums($oid, $tipo){
/* Muestra la lista de currículums */ /* Muestra la lista de currículums */
function ver_curriculums($oid, $tipo){ function ver_curriculums($oid, $tipo){
include LOCALE.LOCALESET."lenguaje.php"; include_once LOCALE.LOCALESET."lenguaje.php";
$consulta = "select * from curriculum_usuario where oid='$oid' order by fecha"; $consulta = "select * from curriculum_usuario where oid='$oid' order by fecha";
$resultado = mysql_query($consulta); $resultado = mysql_query($consulta);
$num = @mysql_num_rows($resultado); $num = @mysql_num_rows($resultado);

View File

@ -3,10 +3,45 @@
ini_set("memory_limit", "32M"); ini_set("memory_limit", "32M");
//require_once ('Excel/reader.php'); //require_once ('Excel/reader.php');
// Función para imprimir cosas
// Sacado de http://php.net/manual/de/debugger.php
// USO:
// > dbug(<loquesea>);
// > " "
// > echo dbug('print');
function dbug() {
static $output = '', $doc_root;
$args = func_get_args();
if (!empty($args) && $args[0] === 'print') {
$_output = $output;
$output = '';
return $_output;
}
// do not repeat the obvious (matter of taste)
if (!isset($doc_root)) {
$doc_root = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
}
$backtrace = debug_backtrace();
// you may want not to htmlspecialchars here
$line = htmlspecialchars($backtrace[0]['line']);
$file = htmlspecialchars(str_replace(array('\\', $doc_root), array('/', ''), $backtrace[0]['file']));
$class = !empty($backtrace[1]['class']) ? htmlspecialchars($backtrace[1]['class']) . '::' : '';
$function = !empty($backtrace[1]['function']) ? htmlspecialchars($backtrace[1]['function']) . '() ' : '';
$output .= "<b style='color: red;'>$class$function =&gt;$file #$line</b><pre style='color: red;'>";
ob_start();
foreach ($args as $arg) {
var_dump($arg);
}
$output .= htmlspecialchars(ob_get_contents(), ENT_COMPAT, 'UTF-8');
ob_end_clean();
$output .= '</pre>';
}
/* Conexión a la base de datos */ /* Conexión a la base de datos */
function conectar() function conectar()
{ {
include LOCALE.LOCALESET."lenguaje.php"; include_once LOCALE.LOCALESET."lenguaje.php";
if (!($puntero=mysql_connect("localhost","root","password"))) if (!($puntero=mysql_connect("localhost","root","password")))
{ {
echo $locale['bd']; echo $locale['bd'];
@ -24,8 +59,8 @@ function conectar()
/* Conexión a la base de datos de tablas */ /* Conexión a la base de datos de tablas */
function conectar_info() function conectar_info()
{ {
include LOCALE.LOCALESET."lenguaje.php"; include_once LOCALE.LOCALESET."lenguaje.php";
if (!($puntero=mysql_connect("localhost","root","0selfor0"))) if (!($puntero=mysql_connect("localhost","root","password")))
{ {
echo $locale['bd']; echo $locale['bd'];
return false; return false;

File diff suppressed because it is too large Load Diff

View File

@ -294,7 +294,7 @@ $locale['283'] = "Selecci&oacute;n solicitudes de oferta";
$locale['284'] = "Editar"; $locale['284'] = "Editar";
$locale['285'] = "Mostrar"; $locale['285'] = "Mostrar";
$locale['286'] = "Nota: los campos marcados con * son obligatorios."; $locale['286'] = "Nota: los campos marcados con * son obligatorios.";
$locale['287'] = "Candidatos <br> asignados"; $locale['287'] = "N&uacute;mero<br/>de ofertas";
$locale['288'] = "Actualizar parte"; $locale['288'] = "Actualizar parte";
$locale['289'] = "Solicitar vacaciones"; $locale['289'] = "Solicitar vacaciones";
$locale['290'] = "Se ha solicitado correctamente los d&iacute;as "; $locale['290'] = "Se ha solicitado correctamente los d&iacute;as ";
@ -1013,4 +1013,14 @@ $locale['4048'] = "Cualquier perfil t&eacute;cnico";
$locale['5001'] = "Provincia no deseada:"; $locale['5001'] = "Provincia no deseada:";
$locale['5002'] = "Se ha eliminado la provincia no deseada correctamente"; $locale['5002'] = "Se ha eliminado la provincia no deseada correctamente";
$locale['5003'] = "Estado"; $locale['5003'] = "Estado";
$locale['5100'] = "Lista de ofertas";
$locale['5101'] = "Nueva oferta";
$locale['5102'] = "Buscar oferta";
$locale['5103'] = "Ver oferta";
$locale['5104'] = "Afinidad";
$locale['5105'] = "A&ntilde;adir nueva oferta";
$locale['5106'] = "Referencia";
$locale['5107'] = "Candidato";
?> ?>

View File

@ -139,6 +139,15 @@ function eliminaCapa(idCapa) {
function mostrarCapa(idCapa){ function mostrarCapa(idCapa){
document.getElementById(idCapa).style.visibility="visible"; document.getElementById(idCapa).style.visibility="visible";
} }
function ocultarCapa(idCapa){ function ocultarCapa(idCapa){
document.getElementById(idCapa).style.visibility="hidden"; document.getElementById(idCapa).style.visibility="hidden";
} }
function cambiarCandidato(lugar) {
var mensaje="Esta oferta ya tiene asignada un candidato. \xbfEst\xe1 seguro que desea sustituirlo?";
if(confirm(mensaje)){
document.location=lugar;
}
}

41
lista_ofertas.php Normal file
View File

@ -0,0 +1,41 @@
<?php
include("seguridad.php");
include("functions.php");
if (!$usuario->tieneRol("4") && !$usuario->tieneRol("1") && !$usuario->tieneRol("3")) {
header("Location: aplicacion.php?e=permiso&rol=" . $usuario->getValor("rol"));
exit;
}
include_once("html/cabecera.php");
/* LISTA_PROYECTOS.PHP */
$consulta = "";
include_once("Objects/ListaOfertas.php");
include_once("Objects/HTML.php");
$html = new HTML($locale);
echo $html->menuOfertas($usuario, "");
echo "<h2>" . "Lista de ofertas" . "</h2>";
$tipoOfertas = (!empty($_GET["byEstado"])) ? $_GET['byEstado'] : "";
$order_by = (!empty($_GET['order'])) ? $_GET['order'] : "";
$modo = (!empty($_GET['modo'])) ? $_GET["modo"] : "";
// sacado de http://patrickallaert.blogspot.com/2007/09/building-dynamic-sql-queries-elegant.html
$cond = array();
if ($tipoOfertas != "") {
$cond[] = "estado = '$tipoOfertas'";
}
$orden = array();
if ($order_by != "") {
$orden[] = $order_by.' '.$modo;
}
$listaOfertas = new ListaOfertas($usuario, $cond, $orden);
include_once("ver_lista_ofertas.php");
include_once("html/pie.php");
?>

View File

@ -30,7 +30,7 @@ if (isset($_GET["order"]) && ($_GET["order"]!="")) {
$modo = (isset($_GET["modo"])) ? stripinput($_GET["modo"]) : ""; $modo = (isset($_GET["modo"])) ? stripinput($_GET["modo"]) : "";
$tipoPedidos = (isset($_GET["byEstado"]) && ($_GET['byEstado'] != "")) ? $_GET['byEstado'] : "10"; $tipoPedidos = (isset($_GET["byEstado"]) && ($_GET['byEstado'] != "")) ? $_GET['byEstado'] : "0";
$listaPedidos=new ListaPedido($usuario,$order_by,"",$tipoPedidos); $listaPedidos=new ListaPedido($usuario,$order_by,"",$tipoPedidos);

15
oferta.php Normal file
View File

@ -0,0 +1,15 @@
<?php
include_once("seguridad.php");
include("functions.php");
$idOferta = isset($_GET["idOferta"]) ? stripinput($_GET["idOferta"]) : "";
$tabla = isset($_POST["tabla"]) ? stripinput($_POST["tabla"]) : "";
$where = isset($_POST["where"]) ? stripinput($_POST["where"]) : "";
$condicion = isset($_POST["condicion"]) ? stripinput($_POST["condicion"]) : "";
include_once("ver_oferta.php");
include_once("html/pie.php");
?>

View File

@ -4,9 +4,9 @@ include("seguridad.php");
include("functions.php"); include("functions.php");
$idPedido = isset($_GET["idPedido"]) ? stripinput($_GET["idPedido"]) : ""; $idPedido = isset($_GET["idPedido"]) ? stripinput($_GET["idPedido"]) : "";
if(!isset($tabla)) $tabla = stripinput($_POST["tabla"]); $tabla = isset($_POST["tabla"]) ? stripinput($_POST["tabla"]) : "";
if(!isset($where)) $where = stripinput($_POST["where"]); $where = isset($_POST["where"]) ? stripinput($_POST["where"]) : "";
if(!isset($condicion)) $condicion = stripinput($_POST["condicion"]); $condicion = isset($_POST["condicion"]) ? stripinput($_POST["condicion"]) : "";
include_once("ver_pedido.php"); include_once("ver_pedido.php");

View File

@ -6,7 +6,6 @@ ini_set("session.use_trans_sid","0");
//iniciamos la sesión //iniciamos la sesión
session_name("loginUsuario"); session_name("loginUsuario");
include_once("Objects/Usuario.php"); include_once("Objects/Usuario.php");
include_once("Objects/ListaPedido.php");
include_once("Objects/Semaforo.php"); include_once("Objects/Semaforo.php");
session_start(); session_start();
//FICHERO DE IDIOMAS //FICHERO DE IDIOMAS

155
ver_lista_ofertas.php Normal file
View File

@ -0,0 +1,155 @@
<?php
include_once("seguridad.php");
/**
* Muestra toda la lista de ofertas de $listaOfertas
*/
include("functions.php");
$destinoURL = substr($_SERVER['REQUEST_URI'], strripos($_SERVER['REQUEST_URI'], "/") + 1);
if (stripos($destinoURL, "?") > 0) {
$destinoURL = substr($destinoURL, 0, stripos($destinoURL, "?"));
}
// Comprobamos mensajes que pueden llegar hasta aqui
if (isset($_GET['msg'])) {
switch ($_GET['msg']) {
case "1":$mensaje = "<div class=\"aviso ok\">" . $locale['1059'] . "</div>";
break;
case "2":$mensaje = "<div class=\"aviso error\">" . $locale['1060'] . "</div>";
break;
default:
break;
}
}
if (isset($mensaje)) echo $mensaje;
if (!isset($variablesExtra)) $variablesExtra = "";
?>
<div style="float:left; padding-top:10px; border-top:1px solid #CCC; border-left:1px solid #CCC; border-right:1px solid #CCC;background-color:#F0F0F0">
<ul id="tabnav">
<li class="<?php if ($tipoOfertas == "") echo "activo";
else echo "inactivo";
?>"><a href="<?php echo $destinoURL . "?byEstado=0" . $variablesExtra; ?>"><?php echo $locale['1067']; ?></a></li>
<li class="<?php if ($tipoOfertas == "110") echo "activo";
else echo "inactivo";
?>"><a href="<?php echo $destinoURL . "?byEstado=110" . $variablesExtra; ?>"><?php echo nombre_estado_oferta("110"); ?></a></li>
<li class="<?php if ($tipoOfertas == "120") echo "activo";
else echo "inactivo";
?>"><a href="<?php echo $destinoURL . "?byEstado=120" . $variablesExtra; ?>"><?php echo nombre_estado_oferta("120"); ?></a></li>
<li class="<?php if ($tipoOfertas == "130") echo "activo";
else echo "inactivo";
?>"><a href="<?php echo $destinoURL . "?byEstado=130" . $variablesExtra; ?>"><?php echo nombre_estado_oferta("130"); ?></a></li>
<li class="<?php if ($tipoOfertas == "140") echo "activo";
else echo "inactivo";
?>"><a href="<?php echo $destinoURL . "?byEstado=140" . $variablesExtra; ?>"><?php echo nombre_estado_oferta("140"); ?></a></li>
<li class="<?php if ($tipoOfertas == "150") echo "activo";
else echo "inactivo";
?>"><a href="<?php echo $destinoURL . "?byEstado=150" . $variablesExtra; ?>"><?php echo nombre_estado_oferta("150"); ?></a></li>
</ul>
</div>
<div style="height: 35px; border-bottom:1px solid #CCC"></div>
<div style="clear:both;"></div>
<?php
echo '<div id="ContTabul">';
// CABECERAS
echo "<table width=\"100%\"> ";
// Acciones
echo "<tr class=\"encabezado\">";
echo " <td align=\"center\" colspan=\"3\">" . $locale['2014'] . "</td>";
// denominacion
$orderView = "denominacion";
echo " <td align=\"center\">" . $locale['1042'].":" . "<br />" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=asc" . $variablesExtra . "\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=desc" . $variablesExtra . "\" ><img src=\"css/desc.png\" /></a></td>";
// Fecha
$orderView = "fecha";
echo " <td align=\"center\">" . $locale['1021'] . "<br />" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=asc" . $variablesExtra . "\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=desc" . $variablesExtra . "\" ><img src=\"css/desc.png\" /></a></td>" ;
// estado
$orderView = "estado";
echo " <td align=\"center\">" . $locale['1102'] . "<br />" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=asc" . $variablesExtra . "\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=desc" . $variablesExtra . "\" ><img src=\"css/desc.png\" /></a></td>";
// solicitud
$orderView = "solicitud";
echo " <td align=\"center\">" . $locale['278'].":" . "<br />" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=asc" . $variablesExtra . "\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=desc" . $variablesExtra . "\" ><img src=\"css/desc.png\" /></a></td>";
// Cliente
$orderView = "candidato";
echo " <td align=\"center\">" . $locale['704'].":" . "<br />" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=asc" . $variablesExtra . "\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=desc" . $variablesExtra . "\" ><img src=\"css/desc.png\" /></a></td>";
// Afinidad
/*$orderView = "afinidad";
echo " <td align=\"center\">" . $locale['5104'] . "<br />" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=asc" . $variablesExtra . "\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"" . $destinoURL . "?byEstado=" . $tipoOfertas . "&order=" . $orderView . "&modo=desc" . $variablesExtra . "\" ><img src=\"css/desc.png\" /></a></td>";
*/
echo "</tr>";
// Vamos mostrando ofertas
$listadeOfertas = $listaOfertas->getOfertas();
$pagLista = "1";
if (!empty($_GET['pagLista']) && ($_GET['pagLista'] > 0)) {
$pagLista = $_GET['pagLista'];
}
// Vemos si tiene ofertas
if (count($listadeOfertas) == 0) {
echo "<tr><td colspan=\"11\" align=\"center\">no hay ofertas</td></tr></table>";
} else {
$inicio = ($pagLista - 1) * constante("lista");
if (count($listadeOfertas) > ($inicio + constante("lista"))) {
$final = $inicio + constante("lista");
} else {
$final = count($listadeOfertas);
}
for ($i = $inicio;$i < $final;$i++) {
// foreach($listadeOfertas as $ofertaAct){
$ofertaAct = $listadeOfertas[$i];
echo "<tr>";
if (($ofertaAct->getValor("gerente") == $usuario->getValor("oid")) || $usuario->tieneRol("1")) {
// Es el gerente de ese pedido, puede editarlo y eliminarlo
echo '<td align="center"><a href="gestion_pedido.php?idPedido=' . $ofertaAct->getValor("oid") . '"><img src="css/edit.png" title="' . $locale['2017'] . '"/></a></td>';
echo "<td align=\"center\"><a href=\"#\" onclick=eliminarPedido('" . $ofertaAct->getValor("oid") . "') ><img src=\"css/eliminar.png\" title=\"" . $locale['2016'] . "\"/></a></td>";
} else {
// No es el gerente no puede ni editarlo ni eliminarlo
echo '<td></td><td></td>';
}
echo '<td align="center"><a href="oferta.php?idOferta=' . $ofertaAct->getValor("oid") . '"><img src="css/brick_go.png" title="' . $locale['2015'] . '" /></a></td>';
echo '<td align="center">' . $ofertaAct->getValor("referencia") . '</td>';
echo '<td align="center">' . $ofertaAct->getValor("fecha") . '</td>';
echo '<td align="center">' . $ofertaAct->getValor("nombre_estado") . '</td>';
echo '<td align="center"><a href="/pedido.php?idPedido=' . $ofertaAct->getValor("pedido") . '">' . $ofertaAct->getValor("nombre_solicitud") . '</a></td>';
echo '<td align="center"><a href="/detalle_candidato.php?oid=' . $ofertaAct->getValor("candidato") . '">' . $ofertaAct->getValor("nombre_candidato") . '</td>';
//echo '<td align="center">' . $ofertaAct->getValor("afinidad") . '</td>';
echo "</tr>";
}
// Comprobamos si tenemos que mostar una paginación
$numPaginas = ceil(count($listadeOfertas) / constante("lista"));
echo "<td colspan=\"11\"><div id=\"cronopaginacion\">";
if (isset($_GET["order"]) && ($_GET["order"] != "")) {
if ($variablesExtra != "") {
$variablesExtra = "&" . $variablesExtra;
}
$variables = "byEstado=" . $tipoOfertas . "order=" . $_GET["order"] . "&modo=" . $_GET["modo"] . $variablesExtra;
echo $html->paginacion($numPaginas, $pagLista, $destinoURL, $variables, "pagLista");
} else {
$variables = "byEstado=" . $tipoOfertas . $variablesExtra;
echo $html->paginacion($numPaginas, $pagLista, $destinoURL, $variables, "pagLista");
}
echo "</div></td></tr>";
echo " </table> ";
}
echo '</div>';
?>

View File

@ -33,9 +33,10 @@ if (!isset($variablesExtra)) $variablesExtra = "";
<div style="float:left; padding-top:10px; border-top:1px solid #CCC; border-left:1px solid #CCC; border-right:1px solid #CCC;background-color:#F0F0F0"> <div style="float:left; padding-top:10px; border-top:1px solid #CCC; border-left:1px solid #CCC; border-right:1px solid #CCC;background-color:#F0F0F0">
<ul id="tabnav"> <ul id="tabnav">
<li class="<?php if ($tipoPedidos=="0") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=0".$variablesExtra; ?>"><?php echo $locale['1067']; ?></a></li> <li class="<?php if ($tipoPedidos=="0") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=0".$variablesExtra; ?>"><?php echo $locale['1067']; ?></a></li>
<li class="<?php if ($tipoPedidos=="10") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=10".$variablesExtra; ?>"><?php echo nombre_estado_pedido("10"); ?></a></li> <li class="<?php if ($tipoPedidos=="110") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=110".$variablesExtra; ?>"><?php echo nombre_estado_pedido("110"); ?></a></li>
<li class="<?php if ($tipoPedidos=="20") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=20".$variablesExtra; ?>"><?php echo nombre_estado_pedido("20"); ?></a></li> <li class="<?php if ($tipoPedidos=="120") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=120".$variablesExtra; ?>"><?php echo nombre_estado_pedido("120"); ?></a></li>
<li class="<?php if ($tipoPedidos=="30") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=30".$variablesExtra; ?>"><?php echo nombre_estado_pedido("30"); ?></a></li> <li class="<?php if ($tipoPedidos=="130") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=130".$variablesExtra; ?>"><?php echo nombre_estado_pedido("130"); ?></a></li>
<li class="<?php if ($tipoPedidos=="140") echo "activo"; else echo "inactivo";?>"><a href="<?php echo $destinoURL."?byEstado=140".$variablesExtra; ?>"><?php echo nombre_estado_pedido("140"); ?></a></li>
</ul> </ul>
</div> </div>
<div style="float:left;padding-top:11px;"> <div style="float:left;padding-top:11px;">
@ -113,24 +114,22 @@ echo " <td align=\"center\">".$locale['1524']."<br />" .
" <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=asc".$variablesExtra."\" ><img src=\"css/asc.png\" /></a>" . " <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=asc".$variablesExtra."\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=desc".$variablesExtra."\" ><img src=\"css/desc.png\" /></a></td>"; " <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=desc".$variablesExtra."\" ><img src=\"css/desc.png\" /></a></td>";
// Número de personas // Número de ofertas
$orderView="empleados"; $orderView="empleados";
echo " <td align=\"center\">".$locale['1024']."<br />" . echo " <td align=\"center\">".$locale['287']."<br />" .
" <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=asc".$variablesExtra."\" ><img src=\"css/asc.png\" /></a>" . " <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=asc".$variablesExtra."\" ><img src=\"css/asc.png\" /></a>" .
" <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=desc".$variablesExtra."\" ><img src=\"css/desc.png\" /></a></td>"; " <a href=\"".$destinoURL."?byEstado=".$tipoPedidos."&order=".$orderView."&modo=desc".$variablesExtra."\" ><img src=\"css/desc.png\" /></a></td>";
// Candidatos asignados
echo " <td align=\"center\">".$locale['287']."</td>";
echo "</tr>"; echo "</tr>";
// Vamos mostrando petición por petición // Vamos mostrando petición por petición
$listadePedidos=$listaPedidos->getPedidos(); $listadePedidos=$listaPedidos->getPedidos();
if($_GET['pagLista']>0){
$pagLista=$_GET['pagLista']; $pagLista = "1";
}else{ if (!empty($_GET['pagLista']) && ($_GET['pagLista'] > 0)) {
$pagLista="1"; $pagLista = $_GET['pagLista'];
} }
// Vemos si tiene pedidos // Vemos si tiene pedidos
if(count($listadePedidos)==0){ if(count($listadePedidos)==0){
echo "<tr><td colspan=\"11\" align=\"center\">no tiene solicitudes de oferta</td></tr></table>"; echo "<tr><td colspan=\"11\" align=\"center\">no tiene solicitudes de oferta</td></tr></table>";
@ -172,7 +171,6 @@ if(count($listadePedidos)==0){
echo '</td>'; echo '</td>';
echo '<td align="center">'.$pedidoAct->getValor("empleados").'</td>'; echo '<td align="center">'.$pedidoAct->getValor("empleados").'</td>';
echo '<td align="center">'.$pedidoAct->dameNumCand("Aceptado").'</td>';
echo "</tr>"; echo "</tr>";
} }
// Comprobamos si tenemos que mostar una paginación // Comprobamos si tenemos que mostar una paginación

271
ver_oferta.php Normal file
View File

@ -0,0 +1,271 @@
<?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->colocarCandidato($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"); ?>

View File

@ -1,63 +1,179 @@
<?php <?php
include_once("Objects/Pedido.php"); include_once("Objects/Pedido.php");
include_once("Objects/ListaOfertas.php");
include_once("seguridad.php"); include_once("seguridad.php");
$usuario=$_SESSION['usuario']; $usuario = $_SESSION['usuario'];
//$pedido=new Pedido($idPedido,$usuario); //$pedido=new Pedido($idPedido,$usuario);
$pedido=new Pedido($idPedido,$usuario); $pedido = new Pedido($idPedido, $usuario);
if(($pedido->getValor("gerente")!=$usuario->getValor("oid")) if (($pedido->getValor("gerente") != $usuario->getValor("oid"))
&& !$usuario->tieneRol("4") && !$usuario->tieneRol("4")
&& !$usuario->tieneRol("1")){ && !$usuario->tieneRol("1")) {
header("Location: aplicacion.php?e=permiso"); header("Location: aplicacion.php?e=permiso");
exit; exit;
} }
include_once("html/cabecera.php"); include_once("html/cabecera.php");
include_once("Objects/Administracion.php"); include_once("Objects/Administracion.php");
$administracion=new Administracion($usuario,$locale); $administracion = new Administracion($usuario, $locale);
$constantes=$administracion->getItem("constantes"); $constantes = $administracion->getItem("constantes");
$mostrarTabla = $constantes['candPagina']; $mostrarTabla = $constantes['candPagina'];
$altoScroll=83/2 * $mostrarTabla; $altoScroll = 83 / 2 * $mostrarTabla;
?> ?>
<style type="text/css"> <style type="text/css">
.listaPropuestos{ .listaPropuestos{
border-collapse:separate; border-collapse:separate;
} }
.listaPropuestos tbody{ .listaPropuestos tbody{
overflow-y:auto; overflow-y:auto;
overflow-x:hidden; overflow-x:hidden;
} }
</style> </style>
<?php <?php
include_once("Objects/HTML.php"); include_once("Objects/HTML.php");
$html=new HTML($locale); $html = new HTML($locale);
// Constantes para la p<>gina // Constantes para la p<>gina
$pagAcept = isset($_GET["pagAcept"]) && ($_GET["pagAcept"]!="") ? $_GET["pagAcept"] : "1"; $pagAcept = isset($_GET["pagAcept"]) && ($_GET["pagAcept"] != "") ? $_GET["pagAcept"] : "1";
$pagProp = isset($_GET["pagProp"]) && ($_GET["pagProp"]!="") ? $_GET["pagProp"] : "1"; $pagProp = isset($_GET["pagProp"]) && ($_GET["pagProp"] != "") ? $_GET["pagProp"] : "1";
$pagRech = isset($_GET["pagRech"]) && ($_GET["pagRech"]!="") ? $_GET["pagRech"] : "1"; $pagRech = isset($_GET["pagRech"]) && ($_GET["pagRech"] != "") ? $_GET["pagRech"] : "1";
// Comprogamos si hay error de semaforo activo // Comprogamos si hay error de semaforo activo
if (isset($_GET["msgSem"]) && ($_GET["msgSem"]!="")) { if (isset($_GET["msgSem"]) && ($_GET["msgSem"] != "")) {
$mensajeSemaforo=$semaforo->getMensaje($_GET["msgSem"]); $mensajeSemaforo = $semaforo->getMensaje($_GET["msgSem"]);
echo "<div class=\"aviso semaforo\">".$mensajeSemaforo."</div>"; echo "<div class=\"aviso semaforo\">" . $mensajeSemaforo . "</div>";
} }
?>
/* PROYECTOS.PHP */
<?php
// Comprobamos si tenemos que aceptar o rechazar un candidato
$action = (isset($_GET['action']) && ($_GET['action'] != "")) ? $_GET['action'] : "";
//$action = (isset($_POST['action']) && ($_POST['action']!="")) ? $_POST['action'] : "";
if ($action != "") {
$error = false;
$mensaje = "";
switch ($action) {
case "aceptar": if ($_GET['idCand'] != "") {
try {
$estado = $pedido->aceptarCandidato($_GET['idCand']);
if ($estado) {
$tipo = "ok";
$mensaje = $locale['1055'];
} else {
$tipo = "error";
$mensaje = $locale['1053'];
}
} catch (Exception $e) {
$mensaje = $e->getMessage();
$tipo = "error";
}
} else {
$tipo = "error";
$mensaje = $locale['1053'];
}
break;
case "dell": if ($_GET['idCand'] != "") {
try {
$estado = $pedido->rechazarCandidato($_GET['idCand']);
if ($estado) {
$tipo = "ok";
$mensaje = $locale['1056'];
} else {
$tipo = "error";
$mensaje = $locale['1054'];
}
} catch (Exception $e) {
$mensaje = $e->getMessage();
$tipo = "error";
}
} else {
$tipo = "error";
$mensaje = $locale['1053'];
}
break;
case "cambEst": if ($_GET['idEst'] != "") {
try {
$camb = $pedido->transita($_GET['idEst'], "");
if ($camb) {
$tipo = "ok";
$mensaje = $locale['1072'];
} else {
$tipo = "error";
$mensaje = $locale['1073'];
}
} catch (Exception $e) {
$mensaje = $e->getMessage();
$tipo = "error";
}
}
break;
case "cambEstObs": if ($_POST['idEstado'] != "") {
try {
$camb = $pedido->transita($_POST['idEstado'], $_POST['txtObsCamb']);
if ($camb) {
$tipo = "ok";
$mensaje = $locale['1087'];
} else {
$tipo = "error";
$mensaje = $locale['1088'];
}
} catch (Exception $e) {
$mensaje = $e->getMessage();
$tipo = "error";
}
}
break;
case "addComent": if (($_POST['obs'] != "") && ($_POST['idCandidato'] != "")) {
// Agregamso comentario al candidato sobre el pedido
try {
$pedido->addComentarioPropuesta($_POST['idCandidato'], $_POST['obs']);
$mensaje = $locale['4047'];
$tipo = "ok";
} 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>";
}
}
?>
<?php
//menu_pedidos(""); //menu_pedidos("");
// MEN<45> // MEN<45>
if($pedido->getValor("estado")==40){ if ($pedido->getValor("estado") == 130) {
echo $html->menuPedidos($usuario,array("gestionar")); echo $html->menuPedidos($usuario, array("gestionar", "nueva_oferta"));
} elseif (!$usuario->tieneRol("3")) { } elseif (!$usuario->tieneRol("3")) {
echo $html->menuPedidos($usuario,array("gestionar")); echo $html->menuPedidos($usuario, array("gestionar"));
}else } else
echo $html->menuPedidos($usuario,""); echo $html->menuPedidos($usuario, "");
?>
<h2><?php echo $pedido->getValor("nombre"); ?></h2>
<?php
// Comprobamos mensajes que pueden llegar hasta aqui // Comprobamos mensajes que pueden llegar hasta aqui
if (isset($_GET["msg"])) { if (isset($_GET["msg"])) {
switch ($_GET['msg']) { switch ($_GET['msg']) {
case "1": $mensaje="<div class=\"aviso ok\">".$locale['1061']."</div>"; case "1": $mensaje = "<div class=\"aviso ok\">" . $locale['1061'] . "</div>";
break; break;
default: default:
break; break;
@ -65,116 +181,11 @@ if (isset($_GET["msg"])) {
} else { } else {
$mensaje = ""; $mensaje = "";
} }
echo $mensaje;
?> ?>
<link href="css/tablas.css" rel="stylesheet" type="text/css">
<h2><?php echo $pedido->getValor("nombre"); ?></h2> <table width="100%">
<?php echo $mensaje; <tr><td>
// Comprobamos si tenemos que aceptar o rechazar un candidato
$action = (isset($_GET['action']) && ($_GET['action']!="")) ? $_GET['action'] : "";
$action = (isset($_POST['action']) && ($_POST['action']!="")) ? $_POST['action'] : "";
if($action != "") {
$error=false;
$mensaje="";
switch ($action) {
case "aceptar": if($_GET['idCand']!=""){
try{
$estado=$pedido->aceptarCandidato($_GET['idCand']);
if($estado){
$tipo="ok";
$mensaje=$locale['1055'];
}else{
$tipo="error";
$mensaje=$locale['1053'];
}
} catch (Exception $e){
$mensaje=$e->getMessage();
$tipo="error";
}
} else {
$tipo="error";
$mensaje=$locale['1053'];
}
break;
case "dell": if($_GET['idCand']!=""){
try{
$estado=$pedido->rechazarCandidato($_GET['idCand']);
if($estado){
$tipo="ok";
$mensaje=$locale['1056'];
}else{
$tipo="error";
$mensaje=$locale['1054'];
}
} catch (Exception $e){
$mensaje=$e->getMessage();
$tipo="error";
}
} else {
$tipo="error";
$mensaje=$locale['1053'];
}
break;
case "cambEst": if($_GET['idEst']!=""){
try{
$camb=$pedido->transita($_GET['idEst'], "");
if($camb){
$tipo="ok";
$mensaje=$locale['1072'];
}else{
$tipo="error";
$mensaje=$locale['1073'];
}
} catch (Exception $e){
$mensaje=$e->getMessage();
$tipo="error";
}
}
break;
case "cambEstObs": if($_POST['idEstado']!=""){
try{
$camb=$pedido->transita($_POST['idEstado'], $_POST['txtObsCamb']);
if($camb){
$tipo="ok";
$mensaje=$locale['1087'];
}else{
$tipo="error";
$mensaje=$locale['1088'];
}
} catch (Exception $e){
$mensaje=$e->getMessage();
$tipo="error";
}
}
break;
case "addComent": if(($_POST['obs']!="") && ($_POST['idCandidato']!="")){
// Agregamso comentario al candidato sobre el pedido
try{
$pedido->addComentarioPropuesta($_POST['idCandidato'],$_POST['obs']);
$mensaje=$locale['4047'];
$tipo="ok";
} 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>";
}
}
?>
<table width="100%"><tr><td>
<table width="100%"> <table width="100%">
<tr> <tr>
<td class="nombre"><?php echo $locale['1010']; ?></td> <td class="nombre"><?php echo $locale['1010']; ?></td>
@ -185,10 +196,10 @@ if($mensaje!=""){
<td> <td>
<?php <?php
$perfiles=$pedido->getPerfiles(); $perfiles = $pedido->getPerfiles();
if(count($perfiles)>0){ if (count($perfiles) > 0) {
foreach($perfiles as $nombre => $codigo){ foreach ($perfiles as $nombre => $codigo) {
echo $nombre."<br />"; echo $nombre . "<br />";
} }
} else { } else {
?> ?>
@ -200,21 +211,21 @@ if($mensaje!=""){
<td class="nombre"><?php echo $locale['1013']; ?></td> <td class="nombre"><?php echo $locale['1013']; ?></td>
<td><?php echo $pedido->getValor("nombre_cliente");?></td> <td><?php echo $pedido->getValor("nombre_cliente"); ?></td>
</tr> </tr>
<tr> <tr>
<td class="nombre"><?php echo $locale['1026']; ?></td> <td class="nombre"><?php echo $locale['1026']; ?></td>
<td><?php echo $pedido->getValor("duracion");?></td> <td><?php echo $pedido->getValor("duracion"); ?></td>
<td class="nombre"><?php echo $locale['1014']; ?></td> <td class="nombre"><?php echo $locale['1014']; ?></td>
<td><?php echo $pedido->getValor("empleados");?></td> <td><?php echo $pedido->getValor("empleados"); ?></td>
<td class="nombre"><?php echo $locale['1027']; ?></td> <td class="nombre"><?php echo $locale['1027']; ?></td>
<td><?php echo $pedido->getValor("nombre_gerente");?></td> <td><?php echo $pedido->getValor("nombre_gerente"); ?></td>
<td class="nombre"><?php echo $locale['261']; ?></td> <td class="nombre"><?php echo $locale['261']; ?></td>
<td><?php echo $pedido->getValor("nombre_salario_min")." - ".$pedido->getValor("nombre_salario_max");?></td> <td><?php echo $pedido->getValor("nombre_salario_min") . " - " . $pedido->getValor("nombre_salario_max"); ?></td>
</tr> </tr>
<tr> <tr>
<td class="nombre"><?php echo $locale['1527']; ?></td> <td class="nombre"><?php echo $locale['1527']; ?></td>
<td><?php echo $pedido->getValor("nombre_estado");?> <td><?php echo $pedido->getValor("nombre_estado"); ?>
<div id="obsCambioEst" class="obsCambioEst"> <div id="obsCambioEst" class="obsCambioEst">
<form id="formCambEst" action="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=cambEstObs" method="post" > <form id="formCambEst" action="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=cambEstObs" method="post" >
<input type="hidden" name="action" value="cambEstObs" /> <input type="hidden" name="action" value="cambEstObs" />
@ -222,20 +233,20 @@ if($mensaje!=""){
</form> </form>
</div> </div>
<?php <?php
if($pedido->getValor("msgEstado")!=""){ if ($pedido->getValor("msgEstado") != "") {
echo " -> ".$pedido->getValor("msgEstado"); echo " -> " . $pedido->getValor("msgEstado");
} }
echo "<br />"; echo "<br />";
$estadosSiguientes=$pedido->getSiguientes(); $estadosSiguientes = $pedido->getSiguientes();
foreach($estadosSiguientes as $codEstado => $nombreEstado){ foreach ($estadosSiguientes as $codEstado => $nombreEstado) {
// En estados 50 se necesita mensaj obs // En estados 50 se necesita mensaj obs
if($codEstado=="50"){ if ($codEstado == "50") {
?> ?>
<input class="button" name="cambEstado" type="button" value="<?php echo $locale['2104'].$nombreEstado;?>" onClick="mostrarObs('<?php echo $pedido->getValor("oid"); ?>','<?php echo $codEstado;?>','txt')" style="margin-bottom:5px"> <input class="button" name="cambEstado" type="button" value="<?php echo $locale['2104'] . $nombreEstado; ?>" onClick="mostrarObs('<?php echo $pedido->getValor("oid"); ?>','<?php echo $codEstado; ?>','txt')" style="margin-bottom:5px">
<?php <?php
} else { } else {
?> ?>
<input class="button" name="cambEstado" type="button" value="<?php echo $locale['2104'].$nombreEstado;?>" onClick="javascript:document.location='pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=cambEst&idEst=<?php echo $codEstado;?>'" style="width:200px; margin-bottom:5px"><br /> <input class="button" name="cambEstado" type="button" value="<?php echo $locale['2104'] . $nombreEstado; ?>" onClick="javascript:document.location='pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=cambEst&idEst=<?php echo $codEstado; ?>'" style="width:200px; margin-bottom:5px"><br />
<?php <?php
} }
} }
@ -243,36 +254,38 @@ if($mensaje!=""){
</td> </td>
<td class="nombre"><?php echo $locale['123']; ?></td> <td class="nombre"><?php echo $locale['123']; ?></td>
<td><?php <td><?php
$idiomas=$pedido->getIdiomas(); $idiomas = $pedido->getIdiomas();
if(count($idiomas)>0){ if (count($idiomas) > 0) {
foreach($idiomas as $nombre => $codigo){ foreach ($idiomas as $nombre => $codigo) {
echo $nombre."<br />"; echo $nombre . "<br />";
} }
} else { } else {
?> ?>
<span class="errorcampo"><?php if($pedido->getValor("pesoIdioma") > 0) echo $locale['1097'];?></span><br /> <span class="errorcampo"><?php if ($pedido->getValor("pesoIdioma") > 0)
echo $locale['1097']; ?></span><br />
<?php <?php
} }
?></td> ?></td>
<td class="nombre"><?php echo $locale['122']; ?></td> <td class="nombre"><?php echo $locale['122']; ?></td>
<td><?php <td><?php
$tecnologias=$pedido->getTecnologias(); $tecnologias = $pedido->getTecnologias();
if(count($tecnologias)>0){ if (count($tecnologias) > 0) {
foreach($tecnologias as $nombre => $codigo){ foreach ($tecnologias as $nombre => $codigo) {
echo $nombre."<br />"; echo $nombre . "<br />";
} }
} else { } else {
?> ?>
<span class="errorcampo"><?php if($pedido->getValor("pesoTecno") > 0) echo $locale['1097'];?></span><br /> <span class="errorcampo"><?php if ($pedido->getValor("pesoTecno") > 0)
echo $locale['1097']; ?></span><br />
<?php <?php
} }
?></td> ?></td>
<td class="nombre"><?php echo $locale['209']; ?></td> <td class="nombre"><?php echo $locale['209']; ?></td>
<td><?php <td><?php
$tecnologias=$pedido->getProvincias(); $tecnologias = $pedido->getProvincias();
if(count($tecnologias)>0){ if (count($tecnologias) > 0) {
foreach($tecnologias as $nombre => $codigo){ foreach ($tecnologias as $nombre => $codigo) {
echo $nombre."<br />"; echo $nombre . "<br />";
} }
} else { } else {
?> ?>
@ -285,10 +298,9 @@ if($mensaje!=""){
<td class="nombre"><?php echo $locale['1082']; ?></td> <td class="nombre"><?php echo $locale['1082']; ?></td>
<td colspan="7"> <td colspan="7">
<?php <?php
echo $locale['1078']."( ".$pedido->getValor("pesoTecno")."% ) - "; echo $locale['1078'] . "( " . $pedido->getValor("pesoTecno") . "% ) - ";
echo $locale['1079']."( ".$pedido->getValor("pesoIdioma")."% ) - "; echo $locale['1079'] . "( " . $pedido->getValor("pesoIdioma") . "% ) - ";
echo $locale['1080']."( ".$pedido->getValor("pesoPerfil")."% )"; echo $locale['1080'] . "( " . $pedido->getValor("pesoPerfil") . "% )";
?></td> ?></td>
</tr> </tr>
<tr> <tr>
@ -296,436 +308,74 @@ if($mensaje!=""){
<td colspan="7"><?php echo nl2br($pedido->getValor("observaciones")); ?></td> <td colspan="7"><?php echo nl2br($pedido->getValor("observaciones")); ?></td>
</tr> </tr>
</table> </table>
</td></tr> </td></tr>
<tr><td> </table>
<!-- Tabla de candidatos aceptados -->
<h3><span class="nombre"><?php echo $locale['1046']; ?></span></h3> <br/>
<table width="100%" class="listaPropuestos">
<thead> <h3><span class="nombre"><?php echo $locale['5100']; ?></span></h3>
<table width="100%">
<thead>
<tr class="nombre"> <tr class="nombre">
<th><?php echo $locale['704']; ?></th>
<th><?php echo $locale['202']; ?></th>
<th><?php echo $locale['1052']; ?></th>
<th><?php echo $locale['2105']; ?></th>
<th><?php echo $locale['203']; ?></th>
<th><?php echo $locale['206']; ?></th>
<th><?php echo $locale['1015']; ?></th>
<th><?php echo $locale['2014']; ?></th> <th><?php echo $locale['2014']; ?></th>
<th><?php echo $locale['5106']; ?></th>
<th><?php echo $locale['1021']; ?></th>
<th><?php echo $locale['1102']; ?></th>
<th><?php echo $locale['5107']; ?></th>
</tr> </tr>
</thead> </thead>
<?php
$listaCandidatos = $pedido->getCandidatosAceptados();
if(gettype($listaCandidatos)=="NULL"){
?>
<tbody>
<tr>
<td colspan="8"><?php echo $locale['1049']; ?></td>
</tr>
<?php
}else{
echo "<tbody>";
/*if(count($listaCandidatos)<$mostrarTabla)
echo "<tbody>";
else
echo "<tbody style=\"height: ".$altoScroll."px;\">";
*/
$final=count($listaCandidatos);
for($i=0;$i<$final;$i++){
$candidato=$listaCandidatos[$i];
?>
<tr>
<td>
<a onclick="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" ondblclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="<?php echo (($candidato->getValor("obsGerente")!="") || ($candidato->getValor("obsRRHH")!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a>
<div id="obs-<?php echo $candidato->getValor("oid"); ?>" class="capaObs" onmouseover="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="css/dell.png" onclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" style="padding:2px 10px 2px 0px ">
<table width="550" bgcolor="#999999" style="border-collapse:separate ">
<tr>
<td width="50%"><b>Comentario de RRHH</b></td>
<td width="50%"><b>Comentario del Gerente</b></td>
</tr>
<tr>
<td width="50%"><textarea name="obs" readonly class="obsPropuesta" ><?php echo $candidato->getValor("obsRRHH"); ?></textarea></td>
<td width="50%">
<form action="pedido.php?idPedido=<?php echo $idPedido; ?>" method="post">
<input type="hidden" name="action" value="addComent">
<input type="hidden" name="idCandidato" value="<?php echo $candidato->getValor("oid"); ?>">
<textarea name="obs" class="obsPropuesta" ><?php echo $candidato->getValor("obsGerente"); ?></textarea>
<input class="button" style="border-color:#000000; " type="submit" value="comentar" >
</form>
</td>
</tr>
</table>
</div>
<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>&nbsp;
<?php
$perfiles=$candidato->getPerfiles();
$keylocalidades=array_values($perfiles);
// Mostramos la lista para borrar
foreach ($perfiles as $nombre =>$valor) {
echo "- ".$nombre."<br />";
}
?>
</td>
<td>&nbsp;<?php echo $candidato->getValor("estado_usuario"); ?></td>
<td>&nbsp;<?php echo $candidato->getValor("fecha"); ?></td>
<td>&nbsp;<?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>
<td>&nbsp;<?php echo $candidato->getValor("afinidad"); ?></td>
<td class="centrado"><a href="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=dell&idCand=<?php echo $candidato->getValor("oid"); ?>" ><img src="css/dell.png" title="<?php echo $locale['1048'];?>" /></a>
</td>
</tr>
<?php <?php
} // for $oidPedido = $pedido->getValor("oid");
} // if
?>
</tbody>
</table>
<div id="cronopaginacion"><?php echo $html->paginacion($numPaginas, $pagAcept,"pedido.php","idPedido=".$pedido->getValor("oid"),"pagAcept"); ?></div>
</td>
</tr>
<tr>
<td>
<!-- Lista de candidatos propuestos por RRHH -->
<h3><span class="nombre"><?php echo $locale['1071']; ?></span></h3>
<table width="100%" class="listaPropuestos">
<thead>
<tr class="nombre">
<th><?php echo $locale['704']; ?></th>
<th><?php echo $locale['202']; ?></th>
<th><?php echo $locale['1052']; ?></th>
<th><?php echo $locale['2106']; ?></th>
<th><?php echo $locale['203']; ?></th>
<th><?php echo $locale['206']; ?></th>
<th><?php echo $locale['1015']; ?></th>
<th><?php echo $locale['2014']; ?></th>
</tr>
</thead>
<?php
$listaCandidatos = $pedido->getCandidatosPropuestosRRHH();
if(gettype($listaCandidatos)=="NULL"){
?>
<tbody>
<tr>
<td colspan="8"><?php echo $locale['1050']; ?></td>
</tr>
<?php
}else{
echo "<tbody>";
/*if(count($listaCandidatos)<$mostrarTabla)
echo "<tbody>";
else
echo "<tbody style=\"height: ".$altoScroll."px;\">";
*/
$final=count($listaCandidatos);
for($i=0;$i<$final;$i++){
$candidato=$listaCandidatos[$i];
?>
<tr>
<?php
?> // sacado de http://patrickallaert.blogspot.com/2007/09/building-dynamic-sql-queries-elegant.html
<td>&nbsp; $cond = array();
<a onclick="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" ondblclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')"> $cond[] = "pedido = '$oidPedido'";
<img src="<?php echo (($candidato->getValor("obsGerente")!="") || ($candidato->getValor("obsRRHH")!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a>
<div id="obs-<?php echo $candidato->getValor("oid"); ?>" class="capaObs" onmouseover="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="css/dell.png" onclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" style="padding:2px 10px 2px 0px ">
<table width="550" bgcolor="#999999" style="border-collapse:separate ">
<tr>
<td width="50%"><b>Comentario de RRHH</b></td>
<td width="50%"><b>Comentario del Gerente</b></td>
</tr>
<tr>
<td width="50%"><textarea name="obs" readonly class="obsPropuesta" ><?php echo $candidato->getValor("obsRRHH"); ?></textarea></td>
<td width="50%">
<form action="pedido.php?idPedido=<?php echo $idPedido; ?>" method="post">
<input type="hidden" name="action" value="addComent">
<input type="hidden" name="idCandidato" value="<?php echo $candidato->getValor("oid"); ?>">
<textarea name="obs" class="obsPropuesta" ><?php echo $candidato->getValor("obsGerente"); ?></textarea>
<input class="button" style="border-color:#000000; " type="submit" value="comentar" >
</form>
</td>
</tr>
</table>
</div>
<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>&nbsp;
<?php
$perfiles=$candidato->getPerfiles();
$keylocalidades=array_values($perfiles);
// Mostramos la lista para borrar
foreach ($perfiles as $nombre =>$valor) {
echo "- ".$nombre."<br />";
}
?>
</td>
<td>&nbsp;<?php echo $candidato->getValor("estado_usuario"); ?></td>
<td>&nbsp;<?php echo $candidato->getValor("fecha"); ?></td>
<td>&nbsp;<?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>
<td>&nbsp;<?php echo $candidato->getValor("afinidad"); ?></td>
<td class="centrado">
<a href="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=aceptar&idCand=<?php echo $candidato->getValor("oid"); ?>" ><img src="css/accept.png" title="<?php echo $locale['1047']; ?>" /></a>
<a href="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=dell&idCand=<?php echo $candidato->getValor("oid"); ?>" ><img src="css/dell.png" title="<?php echo $locale['1048'];?>" /></a>
</td>
</tr>
<?php $orden = array();
} // for $orden[] = "referencia";
} // if
?>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<!-- Lista de candidatos propuestos por el sistema -->
<h3><span class="nombre"><?php echo $locale['1044']; ?></span></h3>
<table width="100%" class="listaPropuestos">
<thead>
<tr class="nombre">
<th><?php echo $locale['704']; ?></th>
<th><?php echo $locale['202']; ?></th>
<th><?php echo $locale['1052']; ?></th>
<th><?php echo $locale['2107']; ?></th>
<th><?php echo $locale['203']; ?></th>
<th><?php echo $locale['206']; ?></th>
<th><?php echo $locale['1015']; ?></th>
<th><?php echo $locale['2014']; ?></th>
</tr>
</thead>
<?php
$listaCandidatos = $pedido->getCandidatosPropuestos();
if(gettype($listaCandidatos)=="NULL"){
?>
<tbody>
<tr>
<td colspan="8"><?php echo $locale['1050']; ?></td>
</tr>
<?php
}else{
echo "<tbody>";
/*if(count($listaCandidatos)<$mostrarTabla)
echo "<tbody>";
else
echo "<tbody style=\"height: ".$altoScroll."px;\">";
*/
$final=count($listaCandidatos);
for($i=0;$i<$final;$i++){
$candidato=$listaCandidatos[$i];
?>
<tr>
<td>&nbsp;
<a onclick="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" ondblclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="<?php echo (($candidato->getValor("obsGerente")!="") || ($candidato->getValor("obsRRHH")!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a>
<div id="obs-<?php echo $candidato->getValor("oid"); ?>" class="capaObs" onmouseover="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="css/dell.png" onclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" style="padding:2px 10px 2px 0px ">
<table width="550" bgcolor="#999999" style="border-collapse:separate ">
<tr>
<td width="50%"><b>Comentario de RRHH</b></td>
<td width="50%"><b>Comentario del Gerente</b></td>
</tr>
<tr>
<td width="50%"><textarea name="obs" readonly class="obsPropuesta" ><?php echo $candidato->getValor("obsRRHH"); ?></textarea></td>
<td width="50%">
<form action="pedido.php?idPedido=<?php echo $idPedido; ?>" method="post">
<input type="hidden" name="action" value="addComent">
<input type="hidden" name="idCandidato" value="<?php echo $candidato->getValor("oid"); ?>">
<textarea name="obs" class="obsPropuesta" ><?php echo $candidato->getValor("obsGerente"); ?></textarea>
<input class="button" style="border-color:#000000; " type="submit" value="comentar" >
</form>
</td>
</tr>
</table>
</div>
<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>&nbsp;<?php echo $candidato->getValor("estado_usuario"); ?></td>
<td>&nbsp;<?php echo $candidato->getValor("fecha"); ?></td>
<td>&nbsp;<?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>
<td>&nbsp;<?php echo $candidato->getValor("afinidad"); ?></td>
<td class="centrado">
<a href="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=aceptar&idCand=<?php echo $candidato->getValor("oid"); ?>" ><img src="css/accept.png" title="<?php echo $locale['1047']; ?>" /></a>
<a href="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=dell&idCand=<?php echo $candidato->getValor("oid"); ?>" ><img src="css/dell.png" title="<?php echo $locale['1048'];?>" /></a>
</td>
</tr>
<?php $listaOfertas = new ListaOfertas($usuario, $cond, $orden);
} // for $ofertas = $listaOfertas->getOfertas();
} // if
?>
</tbody>
</table>
</td>
</tr>
<tr> // Vemos si tiene ofertas
<td> $totalOfertas = count($ofertas);
<!-- Lista de candidatos rechazados --> if ($totalOfertas == 0) {
echo "<tr><td colspan=\"11\" align=\"center\">Esta solicitud no tiene ofertas</td></tr>";
} else {
for ($i = 0; $i < $totalOfertas; $i++) {
$ofertaAct = $ofertas[$i];
<h3><span class="nombre"><?php echo $locale['1045']; ?></span></h3> echo "<tr>";
<table width="100%" class="listaPropuestos">
<thead>
<tr class="nombre">
<th><?php echo $locale['704']; ?></th>
<th><?php echo $locale['202']; ?></th>
<th><?php echo $locale['1052']; ?></th>
<th><?php echo $locale['2108']; ?></th>
<th><?php echo $locale['203']; ?></th>
<th><?php echo $locale['206']; ?></th>
<th><?php echo $locale['1015']; ?></th>
<th><?php echo $locale['2014']; ?></th>
</tr>
</thead>
<?php
$listaCandidatos = $pedido->getCandidatosRechazados();
if(gettype($listaCandidatos)=="NULL"){
?>
<tbody>
<tr>
<td colspan="8"><?php echo $locale['1051']; ?></td>
</tr>
<?php
}else{
echo "<tbody>";
/*if(count($listaCandidatos)<$mostrarTabla)
echo "<tbody>";
else
echo "<tbody style=\"height: ".$altoScroll."px;\">";
*/
$final=count($listaCandidatos);
for($i=0;$i<$final;$i++){
$candidato=$listaCandidatos[$i];
?>
<tr>
<td>&nbsp;
<a onclick="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" ondblclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="<?php echo (($candidato->getValor("obsGerente")!="") || ($candidato->getValor("obsRRHH")!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a>
<div id="obs-<?php echo $candidato->getValor("oid"); ?>" class="capaObs" onmouseover="mostrarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')">
<img src="css/dell.png" onclick="ocultarCapa('obs-<?php echo $candidato->getValor("oid"); ?>')" style="padding:2px 10px 2px 0px ">
<table width="550" bgcolor="#999999" style="border-collapse:separate ">
<tr>
<td width="50%"><b>Comentario de RRHH</b></td>
<td width="50%"><b>Comentario del Gerente</b></td>
</tr>
<tr>
<td width="50%"><textarea name="obs" readonly class="obsPropuesta" ><?php echo $candidato->getValor("obsRRHH"); ?></textarea></td>
<td width="50%">
<form action="pedido.php?idPedido=<?php echo $idPedido; ?>" method="post">
<input type="hidden" name="action" value="addComent">
<input type="hidden" name="idCandidato" value="<?php echo $candidato->getValor("oid"); ?>">
<textarea name="obs" class="obsPropuesta" ><?php echo $candidato->getValor("obsGerente"); ?></textarea>
<input class="button" style="border-color:#000000; " type="submit" value="comentar" >
</form>
</td>
</tr>
</table>
</div>
<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>&nbsp;
<?php
$perfiles=$candidato->getPerfiles();
$keylocalidades=array_values($perfiles);
// Mostramos la lista para borrar
foreach ($perfiles as $nombre =>$valor) {
echo "- ".$nombre."<br />";
}
?>
</td>
<td>&nbsp;<?php echo $candidato->getValor("estado_usuario"); ?></td>
<td>&nbsp;<?php echo $candidato->getValor("fecha"); ?></td>
<td>&nbsp;<?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>
<td>&nbsp;<?php echo $candidato->getValor("afinidad"); ?></td>
<td class="centrado">
<a href="pedido.php?idPedido=<?php echo $pedido->getValor("oid"); ?>&action=aceptar&idCand=<?php echo $candidato->getValor("oid"); ?>" ><img src="css/accept.png" title="<?php echo $locale['1047']; ?>" /></a>
</td>
</tr>
<?php /*if (($ofertaAct->getValor("gerente") == $usuario->getValor("oid")) || $usuario->tieneRol("1")) {
} // for // Es el gerente de ese pedido, puede editarlo y eliminarlo
} // if echo '<td align="center"><a href="gestion_pedido.php?idPedido=' . $ofertaAct->getValor("oid") . '"><img src="css/edit.png" title="' . $locale['2017'] . '"/></a></td>';
?> echo "<td align=\"center\"><a href=\"#\" onclick=eliminarPedido('" . $ofertaAct->getValor("oid") . "') ><img src=\"css/eliminar.png\" title=\"" . $locale['2016'] . "\"/></a></td>";
</tbody> } else {
</table> // No es el gerente no puede ni editarlo ni eliminarlo
echo '<td></td><td></td>';
}*/
</td> echo '<td align="center"><a href="oferta.php?idOferta=' . $ofertaAct->getValor("oid") . '"><img src="css/brick_go.png" title="' . $locale['2015'] . '" /></a></td>';
</tr> echo '<td align="center"><a href="oferta.php?idOferta=' . $ofertaAct->getValor("referencia") . '">'.$ofertaAct->getValor("referencia").'</a></td>';
<tr align="center"> echo '<td align="center">' . $ofertaAct->getValor("fecha") . '</td>';
echo '<td align="center">' . $ofertaAct->getValor("nombre_estado") . '</td>';
echo '<td align="center"><a href="/detalle_candidato.php?oid=' . $ofertaAct->getValor("candidato") . '">' . $ofertaAct->getValor("nombre_candidato") . '</td>';
echo "</tr>";
}
}
?>
</table>
<br/>
<table>
<tr align="center"> <!-- HISTORIAL -->
<td ><a name="historial"><?php echo $locale['127']; ?></a><br /> <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 $pedido->getHistorial(); ?></textarea> <textarea name="historial" readonly rows="8" cols="90" maxlength="300" style="overflow: auto;width:100%"><?php echo $pedido->getHistorial(); ?></textarea>
</td> </td>
</tr> </tr>
</table> </table>