X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fmentor.inc.php;h=035bb4768a074cae1e12e3328d5dadee62bcae62;hb=858a5b42c45ea07566d384408d21d22dc663edcf;hp=e85318c64e233a0456e7ded547dc67f5099775b5;hpb=8a43972f58f0a77015ae9e509f1c073d188874d2;p=platal.git diff --git a/modules/profile/mentor.inc.php b/modules/profile/mentor.inc.php index e85318c..035bb47 100644 --- a/modules/profile/mentor.inc.php +++ b/modules/profile/mentor.inc.php @@ -1,6 +1,6 @@ pid()); while (list($s, $ss, $ssname) = $res->next()) { if (!isset($value[$s])) { $value[$s] = array($ss => $ssname); @@ -56,22 +56,22 @@ class ProfileSectors implements ProfileSetting { XDB::execute("DELETE FROM profile_mentor_sector - WHERE uid = {?}", - S::i('uid')); + WHERE pid = {?}", + $page->pid()); if (!count($value)) { return; } foreach ($value as $id => $sect) { foreach ($sect as $sid => $name) { - XDB::execute("INSERT INTO profile_mentor_sector (uid, sectorid, subsectorid) + XDB::execute("INSERT INTO profile_mentor_sector (pid, sectorid, subsectorid) VALUES ({?}, {?}, {?})", - S::i('uid'), $id, $sid); + $page->pid(), $id, $sid); } } } } -class ProfileCountry implements ProfileSetting +class ProfileSettingCountry implements ProfileSetting { public function value(ProfilePage &$page, $field, $value, &$success) { @@ -81,8 +81,8 @@ class ProfileCountry implements ProfileSetting $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')); + WHERE m.pid = {?}", + $page->pid()); while (list($id, $name) = $res->next()) { $value[$id] = $name; } @@ -99,18 +99,18 @@ class ProfileCountry implements ProfileSetting public function save(ProfilePage &$page, $field, $value) { XDB::execute("DELETE FROM profile_mentor_country - WHERE uid = {?}", - S::i('uid')); + WHERE pid = {?}", + $page->pid()); foreach ($value as $id=>&$name) { - XDB::execute("INSERT INTO profile_mentor_country (uid, country) + XDB::execute("INSERT INTO profile_mentor_country (pid, country) VALUES ({?}, {?})", - S::i('uid'), $id); + $page->pid(), $id); } } } -class ProfileMentor extends ProfilePage +class ProfileSettingMentor extends ProfilePage { protected $pg_template = 'profile/mentor.tpl'; @@ -118,16 +118,16 @@ class ProfileMentor extends ProfilePage { parent::__construct($wiz); $this->settings['expertise'] = null; - $this->settings['sectors'] = new ProfileSectors(); - $this->settings['countries'] = new ProfileCountry(); + $this->settings['sectors'] = new ProfileSettingSectors(); + $this->settings['countries'] = new ProfileSettingCountry(); } protected function _fetchData() { $res = XDB::query("SELECT expertise FROM profile_mentor - WHERE uid = {?}", - S::i('uid')); + WHERE pid = {?}", + $this->pid()); $this->values['expertise'] = $res->fetchOneCell(); } @@ -137,13 +137,13 @@ class ProfileMentor extends ProfilePage $expertise = trim($this->values['expertise']); if (empty($expertise)) { XDB::execute("DELETE FROM profile_mentor - WHERE uid = {?}", - S::i('uid')); + WHERE pid = {?}", + $this->pid()); $this->values['expertise'] = null; } else { - XDB::execute("REPLACE INTO profile_mentor (uid, expertise) + XDB::execute("REPLACE INTO profile_mentor (pid, expertise) VALUES ({?}, {?})", - S::i('uid'), $expertise); + $this->pid(), $expertise); $this->values['expertise'] = $expertise; } }