X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=d76117585d77769893cde651b3f96a50be7b840a;hb=d24c8a1195dce2641e62477fc4618786d931ebce;hp=eb7c9f1fcf43047c53ed3a2c8ab2f7982141ff6c;hpb=8d8f76072d8a363c3b24cfd0f2728bdc5754ec7f;p=platal.git diff --git a/modules/search.php b/modules/search.php index eb7c9f1..d761175 100644 --- a/modules/search.php +++ b/modules/search.php @@ -26,9 +26,18 @@ class SearchModule extends PLModule return array( 'search' => $this->make_hook('quick', AUTH_PUBLIC), 'search/adv' => $this->make_hook('advanced', AUTH_COOKIE), + 'search/ajax/region' => $this->make_hook('region', AUTH_COOKIE, '', NO_AUTH), + 'search/ajax/grade' => $this->make_hook('grade', AUTH_COOKIE, '', NO_AUTH), + 'advanced_search.php' => $this->make_hook('redir_advanced', AUTH_PUBLIC), ); } + function handler_redir_advanced(&$page, $mode = null) + { + pl_redirect('search/adv'); + exit; + } + function on_subscribe($forlife, $uid, $promo, $pass) { require_once 'user.func.inc.php'; @@ -96,21 +105,30 @@ class SearchModule extends PLModule XDB::iterator('SELECT id,text FROM applis_def ORDER BY text')); $page->assign('choix_secteurs', XDB::iterator('SELECT id,label FROM emploi_secteur ORDER BY label')); + $this->get_diplomas(); + } - if (Env::has('school')) { - $sql = 'SELECT type FROM applis_def WHERE id='.Env::i('school'); + function get_diplomas($school = null) + { + if (is_null($school) && Env::has('school')) { + $school = Env::i('school'); + } + + if (!is_null($school)) { + $sql = 'SELECT type FROM applis_def WHERE id=' . $school; } else { $sql = 'DESCRIBE applis_def type'; } $res = XDB::query($sql); $row = $res->fetchOneRow(); - if (Env::has('school')) { + if (!is_null($school)) { $types = $row[0]; } else { $types = explode('(',$row[1]); $types = str_replace("'","",substr($types[1],0,-1)); } + global $page; $page->assign('choix_diplomas', explode(',',$types)); } @@ -145,6 +163,7 @@ class SearchModule extends PLModule AND w.uid='.S::v('uid').') '.$globals->search->result_where_statement." $where + GROUP BY u.user_id ORDER BY ".($order?($order.', '):'') .implode(',',array_filter(array($fields->get_order_statement(), 'promo DESC, NomSortKey, prenom'))).' @@ -159,7 +178,7 @@ class SearchModule extends PLModule { global $globals; - require_once 'search.inc.php'; + require_once dirname(__FILE__).'/search/search.inc.php'; $page->changeTpl('search/index.tpl'); @@ -196,7 +215,7 @@ class SearchModule extends PLModule { global $globals; - require_once 'search.inc.php' ; + require_once dirname(__FILE__).'/search/search.inc.php'; require_once 'applis.func.inc.php'; require_once 'geoloc.inc.php'; @@ -227,8 +246,26 @@ class SearchModule extends PLModule } + $page->addJsLink('ajax.js'); $page->register_modifier('display_lines', 'display_lines'); } + + function handler_region(&$page, $country = null) + { + header('Content-Type: text/html; charset="iso-8859-15"'); + require_once("geoloc.inc.php"); + $page->ChangeTpl('search/adv.region.form.tpl', NO_SKIN); + $page->assign('region', ""); + $page->assign('country', $country); + } + + function handler_grade(&$page, $school = null) + { + header('Content-Type: text/html; charset="iso-8859-15"'); + $page->ChangeTpl('search/adv.grade.form.tpl', NO_SKIN); + $page->assign('grade', ''); + $this->get_diplomas($school); + } } ?>