X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=e7a2a9d7750d5439611c240f32377763239c99c9;hb=0d2ceeffea379e48bb64373855d35ea9f42b96d8;hp=ea8491ad0831190a651408a52f7e084b4c5db77b;hpb=ff3eb9b7ade4406804e721579111384a768e7791;p=platal.git diff --git a/modules/search.php b/modules/search.php index ea8491a..e7a2a9d 100644 --- a/modules/search.php +++ b/modules/search.php @@ -80,6 +80,13 @@ class SearchModule extends PLModule { global $globals; + $res = XDB::query("SELECT MIN(`diminutif`), MAX(`diminutif`) + FROM `groupex`.`asso` + WHERE `cat` = 'Promotions'"); + list($min, $max) = $res->fetchOneRow(); + $page->assign('promo_min', $min); + $page->assign('promo_max', $max); + if (Env::has('quick') || $action == 'geoloc') { $page->assign('formulaire', 0); @@ -104,12 +111,6 @@ class SearchModule extends PLModule new ThrowError('il n\'existe personne correspondant à ces critères dans la base !'); } } else { - $res = XDB::query("SELECT MIN(`diminutif`), MAX(`diminutif`) - FROM `groupex`.`asso` - WHERE `cat` = 'Promotions'"); - list($min, $max) = $res->fetchOneRow(); - $page->assign('promo_min', $min); - $page->assign('promo_max', $max); $page->assign('formulaire',1); $page->addJsLink('ajax.js'); } @@ -117,7 +118,6 @@ class SearchModule extends PLModule require_once dirname(__FILE__) . '/search/search.inc.php'; $page->changeTpl('search/index.tpl'); $page->assign('xorg_title','Polytechnique.org - Annuaire'); - $page->assign('baseurl', $globals->baseurl); } function handler_advanced(&$page, $action = null, $subaction = null) @@ -134,8 +134,8 @@ class SearchModule extends PLModule $view = new SearchSet(false, $action == 'geoloc' && substr($subaction, -3) == 'swf'); $view->addMod('minifiche', 'Minifiches', true); $view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true)); - $view->addMod('geoloc', 'Planishpère'); - $view->apply('search', $page, $action, $subaction); + $view->addMod('geoloc', 'Planisphère'); + $view->apply('search/adv', $page, $action, $subaction); if ($subaction) { return; @@ -183,6 +183,7 @@ class SearchModule extends PLModule } // default search + $q = preg_quote($q); $unique = '`user_id`'; $db = '`auth_user_md5`'; $realid = false; @@ -218,7 +219,7 @@ class SearchModule extends PLModule $field = '`entreprise`'; $unique='`uid`'; break; - case '`firstname`': + case 'firstname': $field = '`prenom`'; $q = '(^|[ \\-])'.$q; $beginwith = false; @@ -363,7 +364,8 @@ class SearchModule extends PLModule $db = '`groupesx_def`'; break; case 'nationalite': - $db = '`geoloc_pays`'; + $db = '`geoloc_pays` INNER JOIN + `auth_user_md5` ON (`geoloc_pays`.`a2` = `auth_user_md5`.`nationalite`)'; $field = 'IF(`nat`=\'\', `pays`, `nat`)'; $id = '`a2`'; break; @@ -395,11 +397,12 @@ class SearchModule extends PLModule exit(); } header('Content-Type: text/xml; charset="UTF-8"'); - $page->changeTpl('include/select.field.tpl', NO_SKIN); + $page->changeTpl('include/field.select.tpl', NO_SKIN); $page->assign('name', $type); $page->assign('list', XDB::iterator('SELECT '.$field.' AS field, '.$id.' AS id FROM '.$db.$where.' + GROUP BY '.$field.' ORDER BY '.$field)); } }