From: x2003bruneau Date: Sat, 14 Apr 2007 09:48:58 +0000 (+0000) Subject: Close #656: PlSet and Ajax for mentor search X-Git-Tag: xorg/0.9.14~94 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ff3eb9b7ade4406804e721579111384a768e7791;p=platal.git Close #656: PlSet and Ajax for mentor search Coding rules for search autocompletion ChangeLog | 3 classes/plset.php | 3 include/userset.inc.php | 25 ++ modules/profile.php | 159 +++++---------- modules/search.php | 415 +++++++++++++++++++---------------------- templates/profile/referent.tpl | 143 +++++--------- 6 files changed, 338 insertions(+), 410 deletions(-) git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1696 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/ChangeLog b/ChangeLog index eb687ab..1e37ccc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,9 @@ New: - Add soundex search for quick search -FRU - Add autocompletion for advanced search -Car + * Survey: + - New module -PIK + * Xnetgrp: - Direct access to the group forum (if exists) -FRU diff --git a/classes/plset.php b/classes/plset.php index aa5bfa6..83322a6 100644 --- a/classes/plset.php +++ b/classes/plset.php @@ -138,7 +138,8 @@ class PlSet { $view = strtolower($view); if (!$view || !class_exists($view . 'View') || !isset($this->mods[$view])) { - $view = $this->default ? $this->default : $this->mods[0]; + reset($this->mods); + $view = $this->default ? $this->default : key($this->mods); } $this->mod = $view; $class = $view . 'View'; diff --git a/include/userset.inc.php b/include/userset.inc.php index f96ccfb..48d5878 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -204,6 +204,31 @@ class MinificheView extends MultipageView } } +class MentorView extends MultipageView +{ + public function __construct(PlSet &$set, $data, array $params) + { + $this->entriesPerPage = 10; + $this->addSortKey('rand', array('RAND(' . S::i('uid') . ')'), 'aléatoirement'); + $this->addSortKey('name', array('nom', 'prenom'), 'nom'); + $this->addSortKey('promo', array('-promo', 'nom', 'prenom'), 'promotion'); + $this->addSortKey('date', array('-watch_last', '-promo', 'nom', 'prenom'), 'dernière modification'); + parent::__construct($set, $data, $params); + } + + public function fields() + { + return "m.uid, u.prenom, u.nom, u.promo, + a.alias AS bestalias, m.expertise, mp.pid, + ms.secteur, ms.ss_secteur"; + } + + public function templateName() + { + return 'include/plview.referent.tpl'; + } +} + class TrombiView extends MultipageView { public function __construct(PlSet &$set, $data, array $params) diff --git a/modules/profile.php b/modules/profile.php index 07dd95e..f766844 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -36,6 +36,8 @@ class ProfileModule extends PLModule 'referent' => $this->make_hook('referent', AUTH_COOKIE), 'referent/search' => $this->make_hook('ref_search', AUTH_COOKIE), + 'referent/ssect' => $this->make_hook('ref_sect', AUTH_COOKIE, 'user', NO_AUTH), + 'referent/country' => $this->make_hook('ref_country', AUTH_COOKIE, 'user', NO_AUTH), 'groupes-x' => $this->make_hook('xnet', AUTH_COOKIE), @@ -57,30 +59,6 @@ class ProfileModule extends PLModule return $this->handler_profile($page, Env::v('user')); } - - function _trombi_getlist($offset, $limit) - { - $where = ( $this->promo > 0 ? "WHERE promo='{$this->promo}'" : "" ); - - $res = XDB::query( - "SELECT COUNT(*) - FROM auth_user_md5 AS u - RIGHT JOIN photo AS p ON u.user_id=p.uid - $where"); - $pnb = $res->fetchOneCell(); - - $res = XDB::query( - "SELECT promo, user_id, a.alias AS forlife, - IF (nom_usage='', nom, nom_usage) AS nom, prenom - FROM photo AS p - INNER JOIN auth_user_md5 AS u ON u.user_id=p.uid - INNER JOIN aliases AS a ON ( u.user_id=a.id AND a.type='a_vie' ) - $where - ORDER BY promo, nom, prenom LIMIT {?}, {?}", $offset*$limit, $limit); - - return array($pnb, $res->fetchAllAssoc()); - } - function handler_photo(&$page, $x = null, $req = null) { if (is_null($x)) { @@ -513,22 +491,10 @@ class ProfileModule extends PLModule $page->addJsLink('close_on_esc.js'); } - function handler_ref_search(&$page) + function handler_ref_search(&$page, $action = null, $subaction = null) { - $page->changeTpl('profile/referent.tpl'); - $page->assign('xorg_title', 'Polytechnique.org - Conseil Pro'); - $secteur_sel = Post::v('secteur'); - $ss_secteur_sel = Post::v('ss_secteur'); - $pays_sel = Post::v('pays', '00'); - $expertise_champ = Post::v('expertise'); - - $page->assign('pays_sel', $pays_sel); - $page->assign('expertise_champ', $expertise_champ); - $page->assign('secteur_sel', $secteur_sel); - $page->assign('ss_secteur_sel', $ss_secteur_sel); - //recuperation des noms de secteurs $res = XDB::iterRow("SELECT id, label FROM emploi_secteur"); $secteurs[''] = ''; @@ -537,92 +503,73 @@ class ProfileModule extends PLModule } $page->assign_by_ref('secteurs', $secteurs); - //on recupere les sous-secteurs si necessaire - $ss_secteurs[''] = ''; - if (!empty($secteur_sel)) { - $res = XDB::iterRow("SELECT id, label FROM emploi_ss_secteur - WHERE secteur = {?}", $secteur_sel); - while (list($tmp_id, $tmp_label) = $res->next()) { - $ss_secteurs[$tmp_id] = $tmp_label; - } - } - $page->assign_by_ref('ss_secteurs', $ss_secteurs); - - //recuperation des noms de pays - $res = XDB::iterRow("SELECT a2, pays FROM geoloc_pays - WHERE pays <> '' ORDER BY pays"); - $pays['00'] = ''; - while (list($tmp_id, $tmp_label) = $res->next()) { - $pays[$tmp_id] = $tmp_label; - } - $page->assign_by_ref('pays', $pays); - // nb de mentors $res = XDB::query("SELECT count(*) FROM mentor"); $page->assign('mentors_number', $res->fetchOneCell()); - if (!Env::has('Chercher')) { - return; - } - // On vient d'un formulaire - $where = array(); - - if ($pays_sel != '00') { - $where[] = "mp.pid = '".addslashes($pays_sel)."'"; - } - if ($secteur_sel) { - $where[] = "ms.secteur = '".addslashes($secteur_sel)."'"; - if ($ss_secteur_sel) { - $where[] = "ms.ss_secteur = '".addslashes($ss_secteur_sel)."'"; + $where = array(); + $pays_sel = XDB::escape(Env::v('pays_sel')); + $secteur_sel = XDB::escape(Env::v('secteur')); + $ss_secteur_sel = XDB::escape(Env::v('ss_secteur')); + $expertise_champ = XDB::escape(Env::v('expertise')); + + if ($pays_sel != "''") { + $where[] = "mp.pid = $pays_sel"; + } + if ($secteur_sel != "''") { + $where[] = "ms.secteur = $secteur_sel"; + if ($ss_secteur_sel != "''") { + $where[] = "ms.ss_secteur = $ss_secteur_sel"; } } - if ($expertise_champ) { - $where[] = "MATCH(m.expertise) AGAINST('".addslashes($expertise_champ)."')"; + if ($expertise_champ != "''") { + $where[] = "MATCH(m.expertise) AGAINST($expertise_champ)"; } if ($where) { $where = join(' AND ', $where); - $sql = "SELECT m.uid, a.prenom, a.nom, a.promo, - l.alias AS bestalias, m.expertise, mp.pid, - ms.secteur, ms.ss_secteur - FROM mentor AS m - LEFT JOIN auth_user_md5 AS a ON(m.uid = a.user_id) - INNER JOIN aliases AS l ON (a.user_id=l.id AND - FIND_IN_SET('bestalias', l.flags)) - LEFT JOIN mentor_pays AS mp ON(m.uid = mp.uid) - LEFT JOIN mentor_secteurs AS ms ON(m.uid = ms.uid) - WHERE $where - GROUP BY uid - ORDER BY RAND({?})"; - $res = XDB::iterator($sql, S::v('uid')); - - if ($res->total() == 0) { - $page->assign('recherche_trop_large', true); - return; + $set = new UserSet("INNER JOIN mentor AS m ON (m.uid = u.user_id) + LEFT JOIN mentor_pays AS mp ON (mp.uid = m.uid) + LEFT JOIN mentor_secteurs AS ms ON (ms.uid = m.uid)", + $where); + $set->addMod('mentor', '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'); + } - $nb_max_res_total = 100; - $nb_max_res_ppage = 10; - - $curpage = Env::i('curpage', 1); - $personnes = array(); - $i = 0; - - while (($pers = $res->next()) && count($personnes) < $nb_max_res_total) { - $the_page = intval($i / $nb_max_res_ppage) + 1; - if ($the_page == $curpage) { - $personnes[] = $pers; - } - $i ++; - } + function handler_ref_sect(&$page, $sect) + { + header('Content-Type: text/html; charset=utf-8'); + $page->changeTpl('include/select.field.tpl', NO_SKIN); + $page->assign('onchange', 'setSSecteurs()'); + $page->assign('id', 'ssect_field'); + $page->assign('name', 'ss_secteur'); + $it = XDB::iterator("SELECT id,label AS field + FROM emploi_ss_secteur + WHERE secteur = {?}", $sect); + $page->assign('list', $it); + } - $page->assign('personnes', $personnes); - $page->assign('curpage', $curpage); - $page->assign('nb_pages_total', - intval($res->total() / $nb_max_res_ppage) + 1); - } + function handler_ref_country(&$page, $sect, $ssect = '') + { + header('Content-Type: text/html; charset=utf-8'); + $page->changeTpl('include/select.field.tpl', NO_SKIN); + $page->assign('name', 'pays_sel'); + $where = ($ssect ? ' AND ms.ss_secteur = {?}' : ''); + $it = XDB::iterator("SELECT a2 AS id, pays AS field + FROM geoloc_pays AS g + INNER JOIN mentor_pays AS mp ON (mp.pid = g.a2) + INNER JOIN mentor_secteurs AS ms ON (ms.uid = mp.uid) + WHERE ms.secteur = {?} $where + GROUP BY a2 + ORDER BY pays", $sect, $ssect); + $page->assign('list', $it); } function handler_p_usage(&$page) diff --git a/modules/search.php b/modules/search.php index e54df37..ea8491a 100644 --- a/modules/search.php +++ b/modules/search.php @@ -161,30 +161,25 @@ class SearchModule extends PLModule // result2|nb2 // ... header('Content-Type: text/plain; charset="UTF-8"'); - $q = preg_replace( - array( - '/\*+$/', // always look for $q* - '/([\^\$\[\]])/', // escape special regexp char - '/\*/'), // replace joker by regexp joker - array( - '', - '\\\\\1', - '.*'), - $_REQUEST['q']); + $q = preg_replace(array('/\*+$/', // always look for $q* + '/([\^\$\[\]])/', // escape special regexp char + '/\*/'), // replace joker by regexp joker + array('', + '\\\\\1', + '.*'), + $_REQUEST['q']); if (!$q) exit(); - // try to look in cached results - $cache = XDB::query(' - SELECT `result` - FROM `search_autocomplete` - WHERE - `name` = {?} AND - `query` = {?} AND - `generated` > NOW() - INTERVAL 1 DAY', - $type, $q); + // try to look in cached results + $cache = XDB::query('SELECT `result` + FROM `search_autocomplete` + WHERE `name` = {?} AND + `query` = {?} AND + `generated` > NOW() - INTERVAL 1 DAY', + $type, $q); if ($res = $cache->fetchOneCell()) { - echo $res; - die(); + echo $res; + die(); } // default search @@ -196,131 +191,126 @@ class SearchModule extends PLModule $qsearch = $q; switch ($type) { - case 'binetTxt': - $db = '`binets_def` INNER JOIN - `binets_ins` ON(`binets_def`.`id` = `binets_ins`.`binet_id`)'; - $field='`binets_def`.`text`'; - if (strlen($q) > 2) - $beginwith = false; - $realid = '`binets_def`.`id`'; - break; - case 'city': - $db = '`geoloc_city` INNER JOIN - `adresses` ON(`geoloc_city`.`id` = `adresses`.`cityid`)'; - $unique='`uid`'; - $field='`geoloc_city`.`name`'; - break; - case 'countryTxt': - $db = '`geoloc_pays` INNER JOIN - `adresses` ON(`geoloc_pays`.`a2` = `adresses`.`country`)'; - $unique='`uid`'; - $field = '`geoloc_pays`.`pays`'; - $field2 = '`geoloc_pays`.`country`'; - $realid='`geoloc_pays`.`a2`'; - break; - case 'entreprise': - $db = '`entreprises`'; - $field = '`entreprise`'; - $unique='`uid`'; - break; - case '`firstname`': - $field = '`prenom`'; - $q = '(^|[ \\-])'.$q; - $beginwith = false; - break; - case 'fonctionTxt': - $db = '`fonctions_def` INNER JOIN - `entreprises` ON(`entreprises`.`fonction` = `fonctions_def`.`id`)'; - $field = '`fonction_fr`'; - $unique = '`uid`'; - $realid = '`fonctions_def`.`id`'; - $qsearch = '(^|[ /\\-])'.$q; - $beginwith = false; - break; - case 'groupexTxt': - $db = '`groupesx_def` INNER JOIN - `groupesx_ins` ON(`groupesx_def`.`id` = `groupesx_ins`.`gid`)'; - $field='`groupesx_def`.`text`'; - if (strlen($q) > 2) - $beginwith = false; - $realid = '`groupesx_def`.`id`'; - $unique = '`guid`'; - break; - case 'name': - $field = '`nom`'; - $field2 = '`nom_usage`'; - $qsearch = '(^|[ \\-])'.$q; - $beginwith = false; - break; - case 'nationaliteTxt': - $db = '`geoloc_pays` INNER JOIN - `auth_user_md5` ON(`geoloc_pays`.`a2` = `auth_user_md5`.`nationalite`)'; - $field = 'IF(`geoloc_pays`.`nat`=\'\', - `geoloc_pays`.`pays`, - `geoloc_pays`.`nat`)'; - $realid = '`geoloc_pays`.`a2`'; - break; - case 'nickname': - $field = '`profile_nick`'; - $db = '`auth_user_quick`'; - $qsearch = '(^|[ \\-])'.$q; - $beginwith = false; - break; - case 'poste': - $db = '`entreprises`'; - $field = '`poste`'; - $unique='`uid`'; - break; - case 'schoolTxt': - $db = '`applis_def` INNER JOIN - `applis_ins` ON(`applis_def`.`id` = `applis_ins`.`aid`)'; - $field='`applis_def`.`text`'; - $unique = '`uid`'; - $realid = '`applis_def`.`id`'; - if (strlen($q) > 2) - $beginwith = false; - break; - case 'secteurTxt': - $db = '`emploi_secteur` INNER JOIN - `entreprises` ON(`entreprises`.`secteur` = `emploi_secteur`.`id`)'; - $field = '`emploi_secteur`.`label`'; - $realid = '`emploi_secteur`.`id`'; - $unique = '`uid`'; - $beginwith = false; - break; - case 'sectionTxt': - $db = '`sections` INNER JOIN - `auth_user_md5` ON(`auth_user_md5`.`section` = `sections`.`id`)'; - $field = '`sections`.`text`'; - $realid = '`sections`.`id`'; - $beginwith = false; - break; - default: exit(); + case 'binetTxt': + $db = '`binets_def` INNER JOIN + `binets_ins` ON(`binets_def`.`id` = `binets_ins`.`binet_id`)'; + $field='`binets_def`.`text`'; + if (strlen($q) > 2) + $beginwith = false; + $realid = '`binets_def`.`id`'; + break; + case 'city': + $db = '`geoloc_city` INNER JOIN + `adresses` ON(`geoloc_city`.`id` = `adresses`.`cityid`)'; + $unique='`uid`'; + $field='`geoloc_city`.`name`'; + break; + case 'countryTxt': + $db = '`geoloc_pays` INNER JOIN + `adresses` ON(`geoloc_pays`.`a2` = `adresses`.`country`)'; + $unique='`uid`'; + $field = '`geoloc_pays`.`pays`'; + $field2 = '`geoloc_pays`.`country`'; + $realid='`geoloc_pays`.`a2`'; + break; + case 'entreprise': + $db = '`entreprises`'; + $field = '`entreprise`'; + $unique='`uid`'; + break; + case '`firstname`': + $field = '`prenom`'; + $q = '(^|[ \\-])'.$q; + $beginwith = false; + break; + case 'fonctionTxt': + $db = '`fonctions_def` INNER JOIN + `entreprises` ON(`entreprises`.`fonction` = `fonctions_def`.`id`)'; + $field = '`fonction_fr`'; + $unique = '`uid`'; + $realid = '`fonctions_def`.`id`'; + $qsearch = '(^|[ /\\-])'.$q; + $beginwith = false; + break; + case 'groupexTxt': + $db = '`groupesx_def` INNER JOIN + `groupesx_ins` ON(`groupesx_def`.`id` = `groupesx_ins`.`gid`)'; + $field='`groupesx_def`.`text`'; + if (strlen($q) > 2) + $beginwith = false; + $realid = '`groupesx_def`.`id`'; + $unique = '`guid`'; + break; + case 'name': + $field = '`nom`'; + $field2 = '`nom_usage`'; + $qsearch = '(^|[ \\-])'.$q; + $beginwith = false; + break; + case 'nationaliteTxt': + $db = '`geoloc_pays` INNER JOIN + `auth_user_md5` ON(`geoloc_pays`.`a2` = `auth_user_md5`.`nationalite`)'; + $field = 'IF(`geoloc_pays`.`nat`=\'\', + `geoloc_pays`.`pays`, + `geoloc_pays`.`nat`)'; + $realid = '`geoloc_pays`.`a2`'; + break; + case 'nickname': + $field = '`profile_nick`'; + $db = '`auth_user_quick`'; + $qsearch = '(^|[ \\-])'.$q; + $beginwith = false; + break; + case 'poste': + $db = '`entreprises`'; + $field = '`poste`'; + $unique='`uid`'; + break; + case 'schoolTxt': + $db = '`applis_def` INNER JOIN + `applis_ins` ON(`applis_def`.`id` = `applis_ins`.`aid`)'; + $field='`applis_def`.`text`'; + $unique = '`uid`'; + $realid = '`applis_def`.`id`'; + if (strlen($q) > 2) + $beginwith = false; + break; + case 'secteurTxt': + $db = '`emploi_secteur` INNER JOIN + `entreprises` ON(`entreprises`.`secteur` = `emploi_secteur`.`id`)'; + $field = '`emploi_secteur`.`label`'; + $realid = '`emploi_secteur`.`id`'; + $unique = '`uid`'; + $beginwith = false; + break; + case 'sectionTxt': + $db = '`sections` INNER JOIN + `auth_user_md5` ON(`auth_user_md5`.`section` = `sections`.`id`)'; + $field = '`sections`.`text`'; + $realid = '`sections`.`id`'; + $beginwith = false; + break; + default: exit(); } - $field_select = $field; - if ($field2) { - $field_select = 'IF('.$field.' REGEXP {?}, '.$field.', '.$field2.')'; - } - - if ($beginwith) { - $qsearch = '^'.$qsearch; - } - $list = XDB::iterator(' - SELECT - '.$field_select.' AS field, - COUNT(DISTINCT '.$unique.') AS nb - '.($realid?(', '.$realid.' AS id'):'').' - FROM '.$db.' - WHERE '.$field.' REGEXP {?}'. - ($field2?(' OR '.$field2.' REGEXP {?}'):'').' - GROUP BY '.$field_select.' - ORDER BY nb DESC - LIMIT 11', - $qsearch, - $qsearch, - $qsearch, - $qsearch); + $field_select = $field; + if ($field2) { + $field_select = 'IF('.$field.' REGEXP {?}, '.$field.', '.$field2.')'; + } + + if ($beginwith) { + $qsearch = '^'.$qsearch; + } + $list = XDB::iterator('SELECT '.$field_select.' AS field, + COUNT(DISTINCT '.$unique.') AS nb + '.($realid?(', '.$realid.' AS id'):'').' + FROM '.$db.' + WHERE '.$field.' REGEXP {?}'. + ($field2?(' OR '.$field2.' REGEXP {?}'):'').' + GROUP BY '.$field_select.' + ORDER BY nb DESC + LIMIT 11', + $qsearch, $qsearch, $qsearch, $qsearch); $nbResults = 0; $res = ""; while ($result = $list->next()) { @@ -329,91 +319,88 @@ class SearchModule extends PLModule $res .= '...|1'."\n"; } else { $res .= $result['field'].'|'; - $res .= $result['nb']; - if (isset($result['id'])) { - $res .= '|'.$result['id']; - } - $res .= "\n"; + $res .= $result['nb']; + if (isset($result['id'])) { + $res .= '|'.$result['id']; + } + $res .= "\n"; } } - XDB::query(' - REPLACE INTO `search_autocomplete` - VALUES ({?}, {?}, {?}, NOW())', - $type, $q, $res); + XDB::query('REPLACE INTO `search_autocomplete` + VALUES ({?}, {?}, {?}, NOW())', + $type, $q, $res); 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 - $field = '`text`'; - $id = '`id`'; - $where = ''; - - switch ($type) { - case 'binet': - $db = '`binets_def`'; - break; - case 'country': - $db = '`geoloc_pays`'; - $field = '`pays`'; - $id = '`a2`'; - $page->assign('onchange', 'changeCountry(this.value)'); - break; - case 'fonction': - $db = '`fonctions_def`'; - $field = '`fonction_fr`'; - break; - case 'diploma': + // Give the list of all values possible of type and builds a select input for it + $field = '`text`'; + $id = '`id`'; + $where = ''; + + switch ($type) { + case 'binet': + $db = '`binets_def`'; + break; + case 'country': + $db = '`geoloc_pays`'; + $field = '`pays`'; + $id = '`a2`'; + $page->assign('onchange', 'changeCountry(this.value)'); + break; + case 'fonction': + $db = '`fonctions_def`'; + $field = '`fonction_fr`'; + break; + case 'diploma': header('Content-Type: text/xml; charset="UTF-8"'); - $this->get_diplomas(); - $page->changeTpl('search/adv.grade.form.tpl', NO_SKIN); - return; - case 'groupex': - $db = '`groupesx_def`'; - break; - case 'nationalite': - $db = '`geoloc_pays`'; - $field = 'IF(`nat`=\'\', `pays`, `nat`)'; - $id = '`a2`'; - break; - case 'region': - $db = '`geoloc_region`'; - $field = '`name`'; + $this->get_diplomas(); + $page->changeTpl('search/adv.grade.form.tpl', NO_SKIN); + return; + case 'groupex': + $db = '`groupesx_def`'; + break; + case 'nationalite': + $db = '`geoloc_pays`'; + $field = 'IF(`nat`=\'\', `pays`, `nat`)'; + $id = '`a2`'; + break; + case 'region': + $db = '`geoloc_region`'; + $field = '`name`'; $id = '`region`'; if (isset($_REQUEST['country'])) { $where .= ' WHERE `a2` = "'.$_REQUEST['country'].'"'; } - break; - case 'school': - $db = '`applis_def`'; - $page->assign('onchange', 'changeSchool(this.value)'); - break; - case 'section': - $db = '`sections`'; - break; - case 'secteur': - $db = '`emploi_secteur`'; - $field = '`label`'; - break; - default: exit(); - } - if (isset($idVal)) { - header('Content-Type: text/plain; charset="UTF-8"'); - $result = XDB::query('SELECT '.$field.' AS field FROM '.$db.' WHERE '.$id.' = {?} LIMIT 1',$idVal); - echo $result->fetchOneCell(); - exit(); - } + break; + case 'school': + $db = '`applis_def`'; + $page->assign('onchange', 'changeSchool(this.value)'); + break; + case 'section': + $db = '`sections`'; + break; + case 'secteur': + $db = '`emploi_secteur`'; + $field = '`label`'; + break; + default: exit(); + } + if (isset($idVal)) { + header('Content-Type: text/plain; charset="UTF-8"'); + $result = XDB::query('SELECT '.$field.' AS field FROM '.$db.' WHERE '.$id.' = {?} LIMIT 1',$idVal); + echo $result->fetchOneCell(); + exit(); + } header('Content-Type: text/xml; charset="UTF-8"'); - $page->changeTpl('search/adv.list.form.tpl', NO_SKIN); + $page->changeTpl('include/select.field.tpl', NO_SKIN); $page->assign('name', $type); - $page->assign('list', XDB::iterator(' - SELECT - '.$field.' AS field, - '.$id.' AS id - FROM '.$db.$where.' - ORDER BY '.$field)); + $page->assign('list', XDB::iterator('SELECT '.$field.' AS field, + '.$id.' AS id + FROM '.$db.$where.' + ORDER BY '.$field)); } } diff --git a/templates/include/plview.referent.tpl b/templates/include/plview.referent.tpl new file mode 100644 index 0000000..60190e3 --- /dev/null +++ b/templates/include/plview.referent.tpl @@ -0,0 +1,51 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2007 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +
+{iterate from=$set item=p} +
+
+ {$p.nom} {$p.prenom} +
+
+ X{$p.promo} +
+ +
+ + + + + +
Expertise :{$p.expertise|nl2br}
+
+
+{/iterate} +
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/search/adv.list.form.tpl b/templates/include/select.field.tpl similarity index 98% rename from templates/search/adv.list.form.tpl rename to templates/include/select.field.tpl index 504d29b..51a99be 100644 --- a/templates/search/adv.list.form.tpl +++ b/templates/include/select.field.tpl @@ -20,7 +20,7 @@ {* *} {**************************************************************************} - {iterate from=$list item='option'} diff --git a/templates/profile/referent.tpl b/templates/profile/referent.tpl index d7f6dbb..a7397ab 100644 --- a/templates/profile/referent.tpl +++ b/templates/profile/referent.tpl @@ -21,78 +21,23 @@ {**************************************************************************} -{literal} - -{/literal} - -

- Rechercher un camarade pouvant m'aider à orienter mon parcours professionnel -

-{if $recherche_trop_large} -

-Les critères de recherche que tu as rentrés n'ont pas produit de résultats, -sans doute car ta requête était trop générale. Nous t'invitons à -procéder à une nouvelle recherche, en essayant -d'être plus précis. -

-{elseif $personnes} -
-{foreach from=$personnes item=p} -
-
- {$p.nom} {$p.prenom} -
-
- X{$p.promo} -
- -
- - - - - -
Expertise :{$p.expertise|nl2br}
-
-
-{/foreach} -
-
-

- - - - - - +{if $plset_count} +{include file="core/plset.tpl"} +{else} +

+ Rechercher un camarade pouvant m'aider à orienter mon parcours professionnel +

- Pages :  - {section name="page_number" start=1 loop=$nb_pages_total+1} - {if $smarty.section.page_number.index == $curpage} - {$curpage} {else} - {$smarty.section.page_number.index} - {/if} - {/section} -

-
+{if $recherche_trop_large} +

+Les critères de recherche que tu as rentrés n'ont pas produit de résultats, +sans doute car ta requête était trop générale. +

{else} - +

Si tu utilises ce service pour la première fois, lis attentivement le texte qui suit. - +

En renseignant sa fiche dans l'annuaire, chacun d'entre nous a la possibilité de renseigner, dans la section "Mentoring", @@ -133,49 +78,71 @@ une recherche par mots-clefs.
Nous t'incitons à prendre plutôt 2 ou 3 contacts qu'un seul, cela te permettant certainement d'avoir une vision des choses plus complète.

+{/if} +{/if}

Actuellement, {$mentors_number} mentors et référents se sont déclarés sur {#globals.core.sitename#}.

-
+{javascript name=ajax} + + + - - + - - + - - - - - + @@ -189,6 +156,4 @@ Actuellement, {$mentors_number} mentors et référents se sont déclarés sur {# -{/if} - {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
Secteur de compétence
du référent
- +
-   +