From: Raphaël Barrois Date: Sat, 6 Feb 2010 09:39:13 +0000 (+0100) Subject: Switch to the new PlSet system X-Git-Tag: xorg/1.0.0~332^2~243 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=307c371050d2789b35c58806a83e630d32d728bb;p=platal.git Switch to the new PlSet system Signed-off-by: Raphaël Barrois --- diff --git a/modules/profile.php b/modules/profile.php index 2e75801..58bce5f 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -659,13 +659,11 @@ class ProfileModule extends PLModule $page->setTitle('Conseil Pro'); + require_once "directory.enums.inc.php"; + // Retrieval of sector names - $res = XDB::iterRow("SELECT id, name AS label - FROM profile_job_sector_enum"); + $sectors = DirEnum::getOptionsArray(DirEnum::SECTORS); $sectors[''] = ''; - while (list($tmp_id, $tmp_label) = $res->next()) { - $sectors[$tmp_id] = $tmp_label; - } $page->assign_by_ref('sectors', $sectors); // nb de mentors @@ -673,38 +671,19 @@ class ProfileModule extends PLModule $page->assign('mentors_number', $res->fetchOneCell()); // On vient d'un formulaire - $where = array(); - $pays_sel = XDB::escape(Env::v('pays_sel')); - $sectorSelection = XDB::escape(Env::v('sector')); - $subSectorSelection = XDB::escape(Env::v('subSector')); - $expertise_champ = XDB::escape(Env::v('expertise')); - - if ($pays_sel != "''") { - $where[] = "mp.country = $pays_sel"; - } - if ($sectorSelection != "''") { - $where[] = "ms.sectorid = " . $sectorSelection; - if ($subSectorSelection != "''") { - $where[] = "ms.subsectorid = " . $subSectorSelection; - } - } - if ($expertise_champ != "''") { - $where[] = "MATCH(m.expertise) AGAINST($expertise_champ)"; - } - - if ($where) { - $where = join(' AND ', $where); - - $set = new UserSet("INNER JOIN profile_mentor AS m ON (m.uid = u.user_id) - LEFT JOIN profile_mentor_country AS mp ON (mp.uid = m.uid) - LEFT JOIN profile_mentor_sector AS ms ON (ms.uid = m.uid)", - $where); - $set->addMod('mentor', 'Référents'); + require_once 'ufbuilder.inc.php'; + $ufb = new UFB_MentorSearch(); + if (!$ufb->isEmpty()) { + require_once 'userset.inc.php'; + $ufc = $ufb->getUFC(); + $set = new ProfileSet($ufc); + $set->addMod('referent', 'Référents'); $set->apply('referent/search', $page, $action, $subaction); if ($set->count() > 100) { $page->assign('recherche_trop_large', true); } } + $page->changeTpl('profile/referent.tpl'); }