{
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') {
+ $quick = trim(Env::v('quick'));
+ $list = 'profile|prf|fiche|fic|referent|ref|mentor';
+ if (S::has_perms()) {
+ $list .= '|admin|adm|ax';
+ }
+ if (preg_match('/^(' . $list . '):([-a-z]+(\.[-a-z]+(\.\d{2,4})?)?)$/', $quick, $matches)) {
+ $forlife = $matches[2];
+ switch($matches[1]) {
+ case 'admin': case 'adm':
+ $base = 'admin/user/';
+ break;
+ case 'ax':
+ $base = 'profile/ax/';
+ break;
+ case 'profile': case 'prf': case 'fiche': case 'fic':
+ $base = 'profile/';
+ break;
+ case 'referent': case 'ref': case 'mentor':
+ $base = 'referent/';
+ break;
+ }
+ pl_redirect($base . $forlife);
+ } elseif (strpos($quick, 'doc:') === 0) {
+ $url = 'Docs/Recherche?';
+ $url .= 'action=search&q=' . urlencode(substr($quick, 4));
+ $url .= '&group=' . urlencode('-Equipe,-Main,-PmWiki,-Site');
+ pl_redirect($url);
+ }
+
$page->assign('formulaire', 0);
require_once 'userset.inc.php';
$view->addMod('minifiche', 'Minifiches', true, array('with_score' => true));
if (S::logged() && !Env::i('nonins')) {
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true, 'with_score' => true));
- $view->addMod('geoloc', 'Planisphère');
+ $view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'search/adv'));
}
$view->apply('search', $page, $action, $subaction);
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');
}
require_once dirname(__FILE__) . '/search/search.inc.php';
- $page->changeTpl('search/index.tpl');
+ $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)
$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->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'search/adv'));
$view->apply('search/adv', $page, $action, $subaction);
-
+
if ($subaction) {
return;
}
$_REQUEST['q']);
if (!$q) exit();
- // try to look in cached results
+ // try to look in cached results
$cache = XDB::query('SELECT `result`
FROM `search_autocomplete`
WHERE `name` = {?} AND
echo $res;
die();
}
-
+
// default search
+ $q = preg_quote($q);
$unique = '`user_id`';
$db = '`auth_user_md5`';
$realid = false;
$beginwith = true;
$field2 = false;
$qsearch = $q;
-
+
switch ($type) {
case 'binetTxt':
$db = '`binets_def` INNER JOIN
$field = '`entreprise`';
$unique='`uid`';
break;
- case '`firstname`':
+ case 'firstname':
$field = '`prenom`';
$q = '(^|[ \\-])'.$q;
$beginwith = false;
$beginwith = false;
break;
case 'sectionTxt':
- $db = '`sections` INNER JOIN
+ $db = '`sections` INNER JOIN
`auth_user_md5` ON(`auth_user_md5`.`section` = `sections`.`id`)';
$field = '`sections`.`text`';
$realid = '`sections`.`id`';
echo $res;
exit();
}
-
+
function handler_list(&$page, $type = null, $idVal = null)
{
// Give the list of all values possible of type and builds a select input for it
$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;
case 'region':
$db = '`geoloc_region`';
$field = '`name`';
- $id = '`region`';
+ $id = '`region`';
if (isset($_REQUEST['country'])) {
$where .= ' WHERE `a2` = "'.$_REQUEST['country'].'"';
}
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));
}
}