X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=4386c99f2d7eb4d5a70c0914692697fda072e589;hb=28c20b86be8b40cecba0d83080879f81c49e07ad;hp=7b4b3022340ec75d2678d3f67271257d02970975;hpb=0073747ac81cc9cff9e43847eb008f0e815255f0;p=platal.git diff --git a/modules/search.php b/modules/search.php index 7b4b302..4386c99 100644 --- a/modules/search.php +++ b/modules/search.php @@ -48,10 +48,20 @@ class SearchModule extends PLModule global $globals; if (Env::has('quick') || $action == 'geoloc') { - $quick = trim(Env::t('quick')); + $quick = Env::t('quick'); if (S::logged() && !Env::has('page')) { S::logger()->log('search', 'quick=' . $quick); } + + if ($quick == '') { + $page->trigWarning('Aucun critère de recherche n\'est spécifié.'); + $page->changeTpl('search/index.tpl'); + $page->setTitle('Annuaire'); + $page->assign('formulaire', 1); + $page->addJsLink('ajax.js'); + return; + } + $list = 'profile|prf|fiche|fic|referent|ref|mentor'; if (S::admin()) { $list .= '|admin|adm|ax'; @@ -243,6 +253,10 @@ class SearchModule extends PLModule function handler_list(&$page, $type = null, $idVal = null) { + $page->assign('name', $type); + $page->assign('with_text_value', true); + $page->assign('onchange', "document.forms.recherche.{$type}Txt.value = this.options[this.selectedIndex].text"); + // Give the list of all values possible of type and builds a select input for it $ids = null; @@ -270,9 +284,9 @@ class SearchModule extends PLModule case 'nationalite': $ids = DirEnum::getOptionsIter(DirEnum::NATIONALITIES); break; - case 'region': - if ($isset($_REQUEST['country'])) { - $ids = DirEnum::getOptionsIter(DirEnum::ADMINAREAS, $_REQUEST['country']); + case 'region': + if (Env::has('country')) { + $ids = DirEnum::getOptionsIter(DirEnum::ADMINAREAS, Env::v('country')); } else { $ids = DirEnum::getOptionsIter(DirEnum::ADMINAREAS); } @@ -296,10 +310,7 @@ class SearchModule extends PLModule } pl_content_headers("text/xml"); $page->changeTpl('include/field.select.tpl', NO_SKIN); - $page->assign('name', $type); $page->assign('list', $ids); - $page->assign('with_text_value', true); - $page->assign('onchange', "document.forms.recherche.{$type}Txt.value = this.options[this.selectedIndex].text"); } }