X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fmentor.inc.php;h=54858b99416a6412660b6a6bc3c9331684279e47;hb=a93519575833e6886e055abb8b43b3ada6f163bc;hp=64b1de74e81707602a02c47b5f3276125c08204d;hpb=6dae45b393a59fd04713b9c651ff0970aeec84d7;p=platal.git diff --git a/modules/profile/mentor.inc.php b/modules/profile/mentor.inc.php index 64b1de7..54858b9 100644 --- a/modules/profile/mentor.inc.php +++ b/modules/profile/mentor.inc.php @@ -1,6 +1,6 @@ next()) { @@ -42,8 +42,7 @@ class ProfileSecteurs implements ProfileSetting } else if (!is_array($value)) { $value = array(); } else if (count($value) > 10) { - global $page; - $page->trig("Le nombre de secteurs d'expertise est limité à 10"); + Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10."); $success = false; } ksort($value); @@ -56,7 +55,7 @@ class ProfileSecteurs implements ProfileSetting public function save(ProfilePage &$page, $field, $value) { - XDB::execute("DELETE FROM mentor_secteurs + XDB::execute("DELETE FROM profile_mentor_sector WHERE uid = {?}", S::i('uid')); if (!count($value)) { @@ -64,7 +63,7 @@ class ProfileSecteurs implements ProfileSetting } foreach ($value as $id=>&$sect) { foreach ($sect as $sid=>&$name) { - XDB::execute("INSERT INTO mentor_secteurs (uid, secteur, ss_secteur) + XDB::execute("INSERT INTO profile_mentor_sector (uid, sectorid, subsectorid) VALUES ({?}, {?}, {?})", S::i('uid'), $id, $sid); } @@ -79,9 +78,9 @@ class ProfileCountry implements ProfileSetting $success = true; if (is_null($value)) { $value = array(); - $res = XDB::iterRow("SELECT m.pid, p.pays - FROM mentor_pays AS m - INNER JOIN geoloc_pays AS p ON(m.pid = p.a2) + $res = XDB::iterRow("SELECT m.country, gc.countryFR + FROM profile_mentor_country AS m + INNER JOIN geoloc_countries AS gc ON (m.country = gc.iso_3166_1_a2) WHERE m.uid = {?}", S::i('uid')); while (list($id, $name) = $res->next()) { @@ -90,8 +89,7 @@ class ProfileCountry implements ProfileSetting } else if (!is_array($value)) { $value = array(); } else if (count($value) > 10) { - global $page; - $page->trig("Le nombre de secteurs d'expertise est limité à 10"); + Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10"); $success = false; } ksort($value); @@ -100,11 +98,11 @@ class ProfileCountry implements ProfileSetting public function save(ProfilePage &$page, $field, $value) { - XDB::execute("DELETE FROM mentor_pays + XDB::execute("DELETE FROM profile_mentor_country WHERE uid = {?}", S::i('uid')); foreach ($value as $id=>&$name) { - XDB::execute("INSERT INTO mentor_pays (uid, pid) + XDB::execute("INSERT INTO profile_mentor_country (uid, country) VALUES ({?}, {?})", S::i('uid'), $id); } @@ -151,10 +149,14 @@ class ProfileMentor extends ProfilePage } } - public function _prepare(PlatalPage &$page, $id) + public function _prepare(PlPage &$page, $id) { - $page->assign('secteurs_sel', XDB::iterator("SELECT id, label - FROM emploi_secteur")); + $page->assign('secteurs_sel', XDB::iterator("SELECT id, name AS label + FROM profile_job_sector_enum")); + + $page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, countryFR + FROM geoloc_countries + ORDER BY countryFR")); } }