<?php
/***************************************************************************
- * Copyright (C) 2003-2010 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
);
}
- function handler_redir_advanced(&$page, $mode = null)
+ function handler_redir_advanced($page, $mode = null)
{
pl_redirect('search/adv');
exit;
* $model: The way of presenting the results: minifiche, trombi, geoloc.
* $byletter: Show only names beginning with this letter
*/
- function handler_quick(&$page, $model = null, $byletter = null)
+ function handler_quick($page, $model = null, $byletter = null)
{
global $globals;
$page->changeTpl('search/index.tpl');
$page->setTitle('Annuaire');
$page->assign('formulaire', 1);
- $page->addJsLink('ajax.js');
return;
}
if ($user) {
pl_redirect($base . $user->login());
}
- $_REQUEST['quick'] = $login;
- $_GET['quick'] = $login;
+ Get::set('quick', $login);
} elseif (strpos($quick, 'doc:') === 0) {
$url = 'Docs/Recherche?';
$url .= 'action=search&q=' . urlencode(substr($quick, 4));
$page->assign('formulaire', 0);
require_once 'userset.inc.php';
- $view = new SearchSet(true);
+ $view = new QuickSearchSet();
$view->addMod('minifiche', 'Mini-fiches', true, array('with_score' => true, 'starts_with' => $byletter));
if (S::logged() && !Env::i('nonins')) {
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true, 'with_score' => true));
}
} else {
$page->assign('formulaire',1);
- $page->addJsLink('ajax.js');
}
$page->changeTpl('search/index.tpl');
/** $model is the way of presenting the results: minifiche, trombi, geoloc.
*/
- function handler_advanced(&$page, $model = null, $byletter = null)
+ function handler_advanced($page, $model = null, $byletter = null)
{
global $globals;
$page->assign('advanced',1);
- $page->addJsLink('jquery.autocomplete.js');
$networks = DirEnum::getOptions(DirEnum::NETWORKS);
$networks[-1] = 'Tous types';
}
require_once 'userset.inc.php';
- $view = new SearchSet(false);
+ // Enable X.org fields for X.org admins, and AX fields for AX secretaries.
+ $view = new AdvancedSearchSet(S::admin(),
+ S::user()->checkPerms(User::PERM_EDIT_DIRECTORY));
+
if (!$view->isValid()) {
$this->form_prepare();
$page->trigError('Recherche invalide.');
}
$page->changeTpl('search/index.tpl', $model == 'mini' ? SIMPLE : SKINNED);
- $page->addJsLink('ajax.js');
$page->assign('public_directory',0);
}
- function handler_autocomplete(&$page, $type = null)
+ function handler_autocomplete($page, $type = null)
{
// Autocompletion : according to type required, return
// a list of results matching with the number of matches.
exit();
}
- function handler_list(&$page, $type = null, $idVal = null)
+ function handler_list($page, $type = null, $idVal = null)
{
$page->assign('name', $type);
$page->assign('with_text_value', true);
case 'nationalite':
$ids = DirEnum::getOptionsIter(DirEnum::NATIONALITIES);
break;
- case 'region':
+ case 'administrativearea':
if (Env::has('country')) {
$ids = DirEnum::getOptionsIter(DirEnum::ADMINAREAS, Env::v('country'));
} else {
$ids = DirEnum::getOptionsIter(DirEnum::ADMINAREAS);
}
+ $page->assign('onchange', 'changeAdministrativeArea(this.value)');
+ break;
+ case 'subadministrativearea':
+ if (Env::has('administrativearea')) {
+ $ids = DirEnum::getOptionsIter(DirEnum::SUBADMINAREAS, Env::v('administrativearea'));
+ } else {
+ $ids = DirEnum::getOptionsIter(DirEnum::SUBADMINAREAS);
+ }
break;
case 'school':
$ids = DirEnum::getOptionsIter(DirEnum::EDUSCHOOLS);
break;
case 'jobterm':
if (Env::has('jtid')) {
- JobTerms::ajaxGetBranch(&$page, JobTerms::ONLY_JOBS);
+ JobTerms::ajaxGetBranch($page, JobTerms::ONLY_JOBS);
return;
} else {
pl_content_headers('text/xml');
$page->assign('list', $ids);
}
- function handler_referent(&$page, $action = null, $subaction = null)
+ function handler_referent($page, $action = null, $subaction = null)
{
global $globals;
$res = XDB::query("SELECT count(distinct pid) FROM profile_mentor_term");
$page->assign('mentors_number', $res->fetchOneCell());
- $page->addJsLink('jquery.autocomplete.js');
-
// Search for mentors matching filters
require_once 'ufbuilder.inc.php';
$ufb = new UFB_MentorSearch();
* know about. Only referents linked to term (jtid) are displayed.
* @param $jtid id of job term to restrict referents
*/
- function handler_referent_countries(&$page, $jtid = null)
+ function handler_referent_countries($page, $jtid = null)
{
pl_content_headers("text/xml");
$page->changeTpl('include/field.select.tpl', NO_SKIN);
$page->assign('name', 'country');
- $it = XDB::iterator("SELECT gc.iso_3166_1_a2 AS id, gc.countryFR AS field
+ $it = XDB::iterator("SELECT gc.iso_3166_1_a2 AS id, gc.country AS field
FROM geoloc_countries AS gc
INNER JOIN profile_mentor_country AS mp ON (mp.country = gc.iso_3166_1_a2)
INNER JOIN profile_mentor_term AS mt ON (mt.pid = mp.pid)
INNER JOIN profile_job_term_relation AS jtr ON (jtr.jtid_2 = mt.jtid)
WHERE jtr.jtid_1 = {?}
- GROUP BY iso_3166_1_a2
- ORDER BY countryFR", $jtid);
+ GROUP BY gc.iso_3166_1_a2
+ ORDER BY gc.country", $jtid);
$page->assign('list', $it);
}
}