X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=97f87730f86112af1216beda2d184e1c08ef41b6;hb=eeb2ec0f85030e4890868d034ef6ff60ed94ea7d;hp=f58c7e125cd9b9fe2c29d043be2fd3f9c76c6aef;hpb=8ddd48c31ce151144118292e20fcdaa10ded9738;p=platal.git diff --git a/modules/search.php b/modules/search.php index f58c7e1..97f8773 100644 --- a/modules/search.php +++ b/modules/search.php @@ -1,6 +1,6 @@ log('search', 'quick=' . $quick); + } $list = 'profile|prf|fiche|fic|referent|ref|mentor'; if (S::has_perms()) { $list .= '|admin|adm|ax'; @@ -143,9 +146,9 @@ class SearchModule extends PLModule if (!S::logged() && $nb_tot > $globals->search->public_max) { new ThrowError('Votre recherche a généré trop de résultats pour un affichage public.'); } elseif ($nb_tot > $globals->search->private_max) { - new ThrowError('Recherche trop générale'); + new ThrowError('Recherche trop générale. Une recherche avancée permet de préciser la recherche.'); } elseif (empty($nb_tot)) { - new ThrowError('il n\'existe personne correspondant à ces critères dans la base !'); + new ThrowError('Il n\'existe personne correspondant à ces critères dans la base !'); } } else { $page->assign('formulaire',1); @@ -163,6 +166,7 @@ class SearchModule extends PLModule require_once 'geoloc.inc.php'; require_once dirname(__FILE__) . '/search/search.inc.php'; $page->assign('advanced',1); + $page->addJsLink('jquery.autocomplete.js'); if (!Env::has('rechercher') && $action != 'geoloc') { $this->form_prepare(); @@ -173,6 +177,8 @@ class SearchModule extends PLModule 'secteur' => array('field' => 'id', 'table' => 'emploi_secteur', 'text' => 'label', 'exact' => false), 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'), 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false), + 'networking_type' => array('field' => 'network_type', 'table' => 'profile_networking_enum', + 'text' => 'name', 'exact' => false), 'groupex' => array('field' => 'id', 'table' => 'groupex.asso', 'text' => "(a.cat = 'GroupesX' OR a.cat = 'Institutions') AND pub = 'public' AND nom", 'exact' => false), @@ -180,6 +186,9 @@ class SearchModule extends PLModule 'school' => array('field' => 'id', 'table' => 'applis_def', 'text' => 'text', 'exact' => false), 'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false) ); + if (!Env::has('page')) { + $_SESSION['log']->log('search', 'adv=' . var_export($_GET, true)); + } foreach ($textFields as $field=>&$query) { if (!Env::v($field) && Env::v($field . 'Txt')) { $res = XDB::query("SELECT {$query['field']} @@ -204,7 +213,7 @@ class SearchModule extends PLModule $nb_tot = $view->count(); if ($nb_tot > $globals->search->private_max) { $this->form_prepare(); - new ThrowError('Recherche trop générale'); + new ThrowError('Recherche trop générale.'); } } @@ -260,6 +269,13 @@ class SearchModule extends PLModule $beginwith = false; $realid = '`binets_def`.`id`'; break; + case 'networking_typeTxt': + $db = '`profile_networking_enum` INNER JOIN + `profile_networking` ON(`profile_networking`.`network_type` = `profile_networking_enum`.`network_type`)'; + $field = '`profile_networking_enum`.`name`'; + $unique = 'uid'; + $realid = '`profile_networking_enum`.`network_type`'; + break; case 'city': $db = '`geoloc_city` INNER JOIN `adresses` ON(`geoloc_city`.`id` = `adresses`.`cityid`)'; @@ -384,7 +400,7 @@ class SearchModule extends PLModule while ($result = $list->next()) { $nbResults++; if ($nbResults == 11) { - $res .= '...|1'."\n"; + $res .= $q."|-1\n"; } else { $res .= $result['field'].'|'; $res .= $result['nb']; @@ -412,6 +428,11 @@ class SearchModule extends PLModule case 'binet': $db = '`binets_def`'; break; + case 'networking_type': + $db = '`profile_networking_enum`'; + $field = '`name`'; + $id = '`network_type`'; + break; case 'country': $db = '`geoloc_pays`'; $field = '`pays`';