Se adaptan las búsquedas de candidatos para buscar por palabra en los campos seleccionados, y por capacidades profesionales (primera subida funcionando)

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk@104 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
roberto 2011-08-03 15:03:57 +00:00
parent c3127aa26b
commit eb83c96383
5 changed files with 147 additions and 20 deletions

View File

@ -46,6 +46,16 @@ class ListaCandidatos extends ListaPersonas {
return $bd->keyValueQuery($consulta, "cod", "nombre");
}
/**
* Devuelve una lista de los campos por los que buscar del candidato.
*/
function getCamposBusqueda() {
$consulta = "SHOW FIELDS FROM usuarios";
$bd = new BD();
$resultado = $bd->execQuery($consulta);
return $resultado;
}
/**
* Inserta un nuevo candidato en la lista de candidatos.
* @param campos - datos del candidato.

View File

@ -105,6 +105,7 @@ include_once("Empleado.php");
}
$bd=new BD();
$resultado = $bd->execQuery($consulta);
//Procesamos los candidatos.
if(mysql_num_rows($resultado) == 0){
$this->personas = array();

View File

@ -10,29 +10,144 @@ if(!$usuario->tieneRol("1")
}
include_once("html/cabecera.php");
/* BUSCAR.PHP */
include_once("Objects/HTML.php");
$html=new HTML($locale);
echo $html->menuCandidatos();
$tipobusqueda="candidato";
include_once("Objects/ListaCandidatos.php");
$listaCandidatos=new ListaCandidatos($usuario,"","","10");
$resultado=$listaCandidatos->getCamposBusqueda();
?>
<h2><?php echo $locale['820']; ?></h2>
<div id="ContTabul">
<form action="busqueda_candidato_multiple.php" method="POST" name="form_busqueda_multiple">
<?php include_once("formulario_buscar_persona.php"); ?>
<table align="center" width="100%" cellspacing="2" cellpadding="2" border="0">
<tr>
<td class="sinborde" align="center">
<input type="submit" name="enviar" value="Buscar" class="button" onclick="return comprobar_busqueda_multiple(this)">
<input type="reset" name="borrar" value="Borrar" class="button" >
</td>
</tr>
</form>
</table>
</div>
<form name="buscador" method="post" action="buscar_candidato.php"><br>
<h2><?php echo $locale['820']; ?></h2>
<div class="encabezado"><?php echo $locale['Candidato007']; ?></div>
<table align="center" width="100%" border="0">
<tr>
<td width="10%">
Palabra: <br><input type="text" name="palabra">
</td>
<td width="90%">
>Buscar en: <br><select multiple name="campo[]" id="campo" size="10">
<?php
while($row = mysql_fetch_row($resultado)) {
?>
<option value="<?php echo $row[0]; ?>"><?php echo $row[0]; ?></option>
<?php
}
?>
</select>
</td>
</tr></table>
<div class="encabezado"><?php echo $locale['Capacidades004']; ?></div>
<table align="center" width="100%" border="0">
<tr>
<td width="20%">
<?php
echo $locale['121']. "<br>";
echo $html->listaSelect("perfil","oid","id","id_perfil_tecnico",array("",$locale['ns']),$_POST['id_perfil_tecnico'],true,true,"15");
?>
</td>
<td width="20%">
<?php
echo $locale['122'].'<br>';
echo $html->listaSelect("tecnologia","oid","id","tecnologias",array("",$locale['ns']),$_POST['tecnologias'],true,true,"15");
?>
</td>
<td width="60%">
<?php
echo $locale['Capacidades002_0'].'<br>';
echo $html->listaSelect("perfil_funcional","oid","id","id_perfil_funcional",array("",$locale['ns']),$_POST['id_perfil_funcional'],true,true,"15");
?>
</td>
</tr>
</table>
<br>
<input type="submit" value="Buscar" name="buscar">
</form>
<?php
////////////////////////////
// Proceso del Formulario
///////////////////////////
if(isset($_POST['buscar'])) {
$palabra=$_POST['palabra'];
$campos=$_POST['campo'];
$whereCampos="";
$tablas = "usuarios";
foreach($campos as $campo)
if ($campo != "") {
if ($whereCampos != "") {
$whereCampos = $whereCampos . " or ";
}
$whereCampos = $whereCampos . "usuarios.". $campo ." like '%". $palabra ."%'";
}
$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)";
}
$query = "SELECT distinct usuarios.* from ". $tablas ." where (usuarios.tipo = 'candidato')";
if ($whereCampos != "")
$query = $query . " and (". $whereCampos .")";
if ($wherePerfilesTec != "")
$query = $query . " and (". $wherePerfilesTec .")";
if ($wherePerfilesFun != "")
$query = $query . " and (". $wherePerfilesFun .")";
if ($whereTecnologias != "")
$query = $query . " and (". $whereTecnologias .")";
//echo $query;
$listaCandidatos=new ListaCandidatos($usuario,"",$query,"");
include_once("ver_lista_candidatos.php");
include_once("html/pie.php");
?>
}
?>

View File

@ -149,6 +149,7 @@ $locale['Candidato003'] = "Disponibilidad viajar:";
$locale['Candidato004'] = "Disponibilidad proyectos internacionales:";
$locale['Candidato005'] = "Carnet de conducir:";
$locale['Candidato006'] = "Foto";
$locale['Candidato007'] = "DATOS";
$locale['Capacidades001'] = "CAPACIDADES PROFESIONALES";
$locale['Capacidades002_0'] = "Perfil funcional*:";
$locale['Capacidades002_1'] = "Perfil funcional*:";

View File

@ -121,7 +121,7 @@ echo '<div id="ContTabul">';
// Vemos si hay candidatos
$listaPesonas=$listaCandidatos->getPersonas();
if(count($listaPesonas)==0) {
if(count($listaPesonas)==0) {
?>
<tr><td colspan="12" align="center"><?php echo $locale['1579']; ?></td></tr></table>
<?php