git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk@152 e2b1556b-49f8-d141-9351-52d6861a72d9
322 lines
11 KiB
PHP
322 lines
11 KiB
PHP
<?php
|
|
include("seguridad.php");
|
|
include("functions.php");
|
|
|
|
// Sólo los administradores y rrhh pueden buscar
|
|
if(!$usuario->tieneRol("1")
|
|
&& !$usuario->tieneRol("4")){
|
|
header("Location: aplicacion.php?e=permiso");
|
|
exit;
|
|
}
|
|
|
|
include_once("html/cabecera.php");
|
|
include_once("Objects/HTML.php");
|
|
$html=new HTML($locale);
|
|
echo $html->menuCandidatos();
|
|
|
|
include_once("Objects/ListaCandidatos.php");
|
|
$listaCandidatos=new ListaCandidatos($usuario,"","","10");
|
|
//CAMPOS EN LOS QUE BUSCAR LA PALABRA
|
|
$resultado=$listaCandidatos->getCamposBusqueda();
|
|
$camposPermitidos = array("nombre", "apellidos", "observaciones");
|
|
|
|
////////////////////////////
|
|
// Proceso del Formulario
|
|
///////////////////////////
|
|
$errores=array();
|
|
$error = "";
|
|
$order_by="";
|
|
if(!empty($_GET["order"])){
|
|
$order_by = " ORDER by ".$_GET["order"]." ".$_GET["modo"];
|
|
} else {
|
|
$order_by = " ORDER BY fecha_modificacion DESC";
|
|
}
|
|
$modo = (!empty($_GET["modo"])) ? stripinput($_GET["modo"]) : "";
|
|
|
|
|
|
if (isset($_GET['byEstado'])) {
|
|
if ((isset($_SESSION['palabra'])) && ($_SESSION['palabra'] != ""))
|
|
$_POST['palabra'] = $_SESSION['palabra'];
|
|
|
|
if ((isset($_SESSION['campos'])) && ($_SESSION['campos'] != ""))
|
|
$_POST['campo'] = $_SESSION['campos'];
|
|
|
|
if ((isset($_SESSION['salario_busqueda_min'])) && ($_SESSION['salario_busqueda_min'] != ""))
|
|
$_POST['salario_busqueda_min'] = $_SESSION['salario_busqueda_min'];
|
|
|
|
if ((isset($_SESSION['salario_busqueda_max'])) && ($_SESSION['salario_busqueda_max'] != ""))
|
|
$_POST['salario_busqueda_max'] = $_SESSION['salario_busqueda_max'];
|
|
|
|
if ((isset($_SESSION['idiomas'])) && ($_SESSION['idiomas'] != ""))
|
|
$_POST['idiomas'] = $_SESSION['idiomas'];
|
|
|
|
if ((isset($_SESSION['perfiles_tecnicos'])) && ($_SESSION['perfiles_tecnicos'] != ""))
|
|
$_POST['id_perfil_tecnico'] = $_SESSION['perfiles_tecnicos'];
|
|
|
|
if ((isset($_SESSION['perfiles_funcionales'])) && ($_SESSION['perfiles_funcionales'] != ""))
|
|
$_POST['id_perfil_funcional'] = $_SESSION['perfiles_funcionales'];
|
|
|
|
if ((isset($_SESSION['tecnologias'])) && ($_SESSION['tecnologias'] != ""))
|
|
$_POST['tecnologias'] = $_SESSION['tecnologias'];
|
|
}
|
|
|
|
if ((isset($_POST['buscar'])) || (isset($_GET['byEstado']))) {
|
|
$palabra=$_POST['palabra'];
|
|
$campos=$_POST['campo'];
|
|
$tipoPedidos=$_GET['byEstado'];
|
|
$whereCampos="";
|
|
$tablas = "usuarios";
|
|
|
|
foreach($campos as $campo)
|
|
if ($campo != "") {
|
|
if ($whereCampos != "") {
|
|
$whereCampos = $whereCampos . " or ";
|
|
}
|
|
if ($campo == "cv") {
|
|
$ids = solr_buscar_palabra($palabra);
|
|
$whereCampos .= "usuarios.oid in (".implode(",", $ids).")";
|
|
}
|
|
else {
|
|
$whereCampos = $whereCampos . "usuarios.". $campo ." like '%". $palabra ."%'";
|
|
}
|
|
}
|
|
if (($palabra != "") && (count($campos) == 0)) {
|
|
$errores[]="1";
|
|
$error .= $locale['01903']."<br />";
|
|
}
|
|
|
|
$whereSalario="";
|
|
$salario_busqueda_min=$_POST['salario_busqueda_min'];
|
|
$salario_busqueda_max=$_POST['salario_busqueda_max'];
|
|
//VALIDAMOS QUE LOS VALORES SELECCIONADOS SE CORRESPONDAN A NUMÉRICOS Y QUE EL MIN SEA MENOR QUE EL MAX
|
|
$resul;
|
|
$valor_minimo="";
|
|
$valor_maximo="";
|
|
$bdconsulta=new BD();
|
|
|
|
$sql = "SELECT nombre from salario where (id = ". $salario_busqueda_min .")";
|
|
$resul = $bdconsulta->execQuery($sql);
|
|
while($fila = mysql_fetch_array($resul)) {
|
|
$valor_minimo = str_replace(".", "", $fila["nombre"]);
|
|
}
|
|
|
|
$sql = "SELECT nombre from salario where (id = ". $salario_busqueda_max .")";
|
|
$resul = $bdconsulta->execQuery($sql);
|
|
while($fila = mysql_fetch_array($resul)) {
|
|
$valor_maximo = str_replace(".", "", $fila["nombre"]);
|
|
}
|
|
|
|
if (($valor_minimo!="")) {
|
|
if (is_numeric($valor_minimo)) {
|
|
$tablas .= ", salario salario1";
|
|
$whereSalario = "((replace(replace(salario1.nombre, ',', '' ) , '.', '' ) >= ". $valor_minimo . ") and (salario1.id = usuarios.salario_min))";
|
|
}
|
|
else {
|
|
$errores[]="2";
|
|
$error .= $locale['01904']."<br />";
|
|
}
|
|
}
|
|
|
|
if (($valor_maximo!="")) {
|
|
if (is_numeric($valor_maximo) && ($valor_minimo <= $valor_maximo)) {
|
|
$tablas .= ", salario salario2";
|
|
if ($whereSalario != "") {
|
|
$whereSalario = $whereSalario . " and ";
|
|
}
|
|
$whereSalario .= "((replace(replace(salario1.nombre, ',', '' ) , '.', '' ) <= ". $valor_maximo . ") and (salario2.id = usuarios.salario_max))";
|
|
}
|
|
else {
|
|
$errores[]="2";
|
|
$error .= $locale['01904']."<br />";
|
|
}
|
|
}
|
|
|
|
$SemaforoPerfilTec = false;
|
|
$perfiles_tec = $_POST["id_perfil_tecnico"];
|
|
$wherePerfilesTec="";
|
|
foreach($perfiles_tec as $perfil)
|
|
if ($perfil != "") {
|
|
if(!$SemaforoPerfilTec)
|
|
$tablas .= ", capacidades capacidades1";
|
|
$SemaforoPerfilTec = true;
|
|
|
|
if ($wherePerfilesTec != "") {
|
|
$wherePerfilesTec = $wherePerfilesTec . " or ";
|
|
}
|
|
$wherePerfilesTec = $wherePerfilesTec . "(capacidades1.id_perfil_tecnico = ". $perfil ." and capacidades1.id_usuario = usuarios.oid)";
|
|
}
|
|
|
|
$SemaforoPerfilFun = false;
|
|
$perfiles_fun = $_POST["id_perfil_funcional"];
|
|
$wherePerfilesFun="";
|
|
foreach($perfiles_fun as $perfil)
|
|
if ($perfil != "") {
|
|
if(!$SemaforoPerfilFun)
|
|
$tablas .= ", capacidades capacidades2";
|
|
$SemaforoPerfilFun = true;
|
|
|
|
if ($wherePerfilesFun != "") {
|
|
$wherePerfilesFun = $wherePerfilesFun . " or ";
|
|
}
|
|
$wherePerfilesFun = $wherePerfilesFun . "(capacidades2.id_perfil_funcional = ". $perfil ." and capacidades2.id_usuario = usuarios.oid)";
|
|
}
|
|
|
|
$SemaforoTecnologias = false;
|
|
$tecnologias = $_POST["tecnologias"];
|
|
$whereTecnologias="";
|
|
foreach($tecnologias as $tecnologia)
|
|
if ($tecnologia != "") {
|
|
if(!$SemaforoTecnologias)
|
|
$tablas .= ", capacidades capacidades3, capacidades_perfil_tecnologias";
|
|
$SemaforoTecnologias = true;
|
|
|
|
if ($whereTecnologias != "") {
|
|
$whereTecnologias = $whereTecnologias . " or ";
|
|
}
|
|
$whereTecnologias = $whereTecnologias . "(capacidades_perfil_tecnologias.id_tecnologia = ". $tecnologia ." and capacidades_perfil_tecnologias.id_capacidad = capacidades3.id and capacidades3.id_usuario = usuarios.oid)";
|
|
}
|
|
|
|
$SemaforoIdiomas = false;
|
|
$idiomas = $_POST["idiomas"];
|
|
$whereIdiomas="";
|
|
foreach($idiomas as $idioma)
|
|
if ($idioma != "") {
|
|
if(!$SemaforoIdiomas)
|
|
$tablas .= ", idioma_usuario";
|
|
$SemaforoIdiomas = true;
|
|
|
|
if ($whereIdiomas != "") {
|
|
$whereIdiomas = $whereIdiomas . " or ";
|
|
}
|
|
$whereIdiomas = $whereIdiomas . "(idioma_usuario.idioma = ". $idioma ." and idioma_usuario.oid_i = usuarios.oid)";
|
|
}
|
|
|
|
//Vamos a meter los parametros de busqueda en session para que en la paginación no se pierdan
|
|
$_SESSION['palabra']=$palabra;
|
|
$_SESSION['campos']=$campos;
|
|
$_SESSION['idiomas']=$idiomas;
|
|
$_SESSION['perfiles_tecnicos']=$perfiles_tec;
|
|
$_SESSION['perfiles_funcionales']=$perfiles_fun;
|
|
$_SESSION['tecnologias']=$tecnologias;
|
|
$_SESSION['salario_busqueda_min']=$salario_busqueda_min;
|
|
$_SESSION['salario_busqueda_max']=$salario_busqueda_max;
|
|
|
|
if ($error == "") {
|
|
$query = "SELECT distinct usuarios.* from ". $tablas ." where (usuarios.tipo = 'candidato')";
|
|
if (($tipoPedidos != "") && ($tipoPedidos != 0))
|
|
$query = $query . " and (estado = ". $tipoPedidos .")";
|
|
if ($whereCampos != "")
|
|
$query = $query . " and (". $whereCampos .")";
|
|
if ($whereSalario != "")
|
|
$query = $query . " and (". $whereSalario .")";
|
|
if ($whereIdiomas != "")
|
|
$query = $query . " and (". $whereIdiomas .")";
|
|
if ($wherePerfilesTec != "")
|
|
$query = $query . " and (". $wherePerfilesTec .")";
|
|
if ($wherePerfilesFun != "")
|
|
$query = $query . " and (". $wherePerfilesFun .")";
|
|
if ($whereTecnologias != "")
|
|
$query = $query . " and (". $whereTecnologias .")";
|
|
|
|
//Metemos la ordenacion deseada
|
|
$query = $query. $order_by;
|
|
//echo $query;
|
|
$listaCandidatos=new ListaCandidatos($usuario,"",$query,"");
|
|
}
|
|
}
|
|
?>
|
|
|
|
<form name="buscador" method="post" action="buscar_candidato.php"><br>
|
|
<h2><?php echo $locale['820']; ?></h2>
|
|
|
|
<?php
|
|
if($error!=""){
|
|
// Mostramos el mensaje
|
|
echo "<div class=\"aviso error\">".$error."</div>";
|
|
}
|
|
?>
|
|
|
|
<div class="encabezado"><?php echo $locale['Candidato007']; ?></div>
|
|
<table align="center" width="100%" border="0">
|
|
<tr>
|
|
<td width="12%">
|
|
|
|
<?php echo $locale['01901'] .'<br><input type="text" name="palabra" value="'. $_POST['palabra'] .'"><br/>
|
|
<p>* Para la búsqueda en los ficheros de currículums, se devolverán como máximo los 100 primeros resultados.</p>
|
|
</td>';
|
|
|
|
echo '<td width="6%"';
|
|
if (in_array("1",$errores)) echo " class=\"errorcampo\"";
|
|
echo '>'. $locale['01902'];
|
|
?>
|
|
<br><select multiple name="campo[]" id="campo" size="10">
|
|
<?php
|
|
while($row = mysql_fetch_row($resultado)) {
|
|
if (in_array($row[0], $camposPermitidos)){
|
|
|
|
if (in_array($row[0], $_POST['campo']))
|
|
echo '<option selected ';
|
|
else
|
|
echo '<option ';
|
|
|
|
echo 'value="'. $row[0] .'">'. $row[0] .'</option>';
|
|
}
|
|
}
|
|
?>
|
|
<option <?php echo (in_array('cv', $_POST['campo'])) ? "selected" : ""; ?> value="cv"><?php echo $locale['5108']; ?></option>
|
|
</select>
|
|
|
|
|
|
</td>
|
|
<td width="11%">
|
|
<?php
|
|
echo $locale['123'].'<br>';
|
|
echo $html->listaSelect("idiomas","oid","id","idiomas",array("",$locale['ns']),$_POST['idiomas'],true,true,"15");
|
|
?>
|
|
<td width="71%"
|
|
<?php
|
|
if (in_array("2",$errores)) echo " class=\"errorcampo\"";
|
|
echo '>';
|
|
|
|
echo $locale['130busqueda01'];
|
|
$opcionvacia = '<option value="">'.$locale['ns'].'</option>';
|
|
echo rellena_desplegable_select_oidCol("salario","id","nombre","salario_busqueda_min",$opcionvacia,$_POST['salario_busqueda_min']);
|
|
echo $locale['130busqueda02'];
|
|
echo rellena_desplegable_select_oidCol("salario","id","nombre","salario_busqueda_max",$opcionvacia,$_POST['salario_busqueda_max']);
|
|
?>
|
|
<br/><p>* No se tendrá en cuenta candidatos cuyo salario mínimo no sea numérico</p>
|
|
</td>
|
|
</tr></table>
|
|
<input type="submit" value="Buscar" name="buscar">
|
|
<br>
|
|
<div class="encabezado"><?php echo $locale['Capacidades004']; ?></div>
|
|
<table align="center" width="100%" border="0">
|
|
<tr>
|
|
<td width="18%">
|
|
<?php
|
|
echo $locale['202']. "<br>";
|
|
echo $html->listaSelect("perfil","oid","id","id_perfil_tecnico",array("",$locale['ns']),$_POST['id_perfil_tecnico'],true,true,"15");
|
|
?>
|
|
</td>
|
|
<td width="12%">
|
|
<?php
|
|
echo $locale['203'].'<br>';
|
|
echo $html->listaSelect("tecnologia","oid","id","tecnologias",array("",$locale['ns']),$_POST['tecnologias'],true,true,"15");
|
|
?>
|
|
</td>
|
|
<td width="70%">
|
|
<?php
|
|
echo $locale['202_2'].'<br>';
|
|
echo $html->listaSelect("perfil_funcional","oid","id","id_perfil_funcional",array("",$locale['ns']),$_POST['id_perfil_funcional'],true,true,"15");
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<input type="submit" value="Buscar" name="buscar">
|
|
</form>
|
|
|
|
<?php
|
|
include_once("ver_lista_candidatos.php");
|
|
include_once("html/pie.php");
|
|
?>
|