X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fmentor.inc.php;h=2e9b8c230c191e1e03f92e09e0dcce825079d53e;hb=9891bd15f772caef0c199a98f036e976bf4ab94a;hp=bf577d92a6f16e52f2faf9f5c2076062f84db332;hpb=b8971a3ed64f3ba69becf1cd8f3b32ee2292026d;p=platal.git diff --git a/modules/profile/mentor.inc.php b/modules/profile/mentor.inc.php index bf577d9..2e9b8c2 100644 --- a/modules/profile/mentor.inc.php +++ b/modules/profile/mentor.inc.php @@ -1,6 +1,6 @@ next()) { @@ -42,7 +42,7 @@ class ProfileSecteurs implements ProfileSetting } else if (!is_array($value)) { $value = array(); } else if (count($value) > 10) { - Platal::page()->trigError("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); @@ -55,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)) { @@ -63,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); } @@ -78,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, p.pays + FROM profile_mentor_country AS m + INNER JOIN geoloc_pays AS p ON (m.country = p.a2) WHERE m.uid = {?}", S::i('uid')); while (list($id, $name) = $res->next()) { @@ -98,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,8 +151,8 @@ class ProfileMentor extends ProfilePage 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")); } }