X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fdecos.inc.php;h=10305bf154921011b513a4af2f514fdb5b6c51b7;hb=a6483c122527912e19f708b0c54086d620251c26;hp=4a6bd69ac2db494dd13b13d5016dc58ba0734ad5;hpb=d1f1137df1a8b0861084bb8016673d3073d114dc;p=platal.git diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php index 4a6bd69..10305bf 100644 --- a/modules/profile/decos.inc.php +++ b/modules/profile/decos.inc.php @@ -1,6 +1,6 @@ pid()); $value = array(); while (list($id, $grade) = $res->next()) { $value[$id] = array('grade' => $grade, @@ -61,9 +61,9 @@ class ProfileDeco implements ProfileSetting foreach ($orig as $id=>&$val) { if (!isset($value[$id]) || $val['grade'] != $value[$id]['grade']) { if ($val['valid']) { - XDB::execute("DELETE FROM profile_medals_sub - WHERE uid = {?} AND mid = {?}", - S::i('uid'), $id); + XDB::execute("DELETE FROM profile_medals + WHERE pid = {?} AND mid = {?}", + $page->pid(), $id); } else { $req = MedalReq::get_request(S::i('uid'), $id); if ($req) { @@ -84,41 +84,41 @@ class ProfileDeco implements ProfileSetting } } -class ProfileDecos extends ProfilePage +class ProfileSettingDecos extends ProfilePage { protected $pg_template = 'profile/deco.tpl'; public function __construct(PlWizard &$wiz) { parent::__construct($wiz); - $this->settings['medals'] = new ProfileDeco(); - $this->settings['medals_pub'] = new ProfilePub(); + $this->settings['medals'] = new ProfileSettingDeco(); + $this->settings['medals_pub'] = new ProfileSettingPub(); $this->watched['medals'] = true; } protected function _fetchData() { - $res = XDB::query("SELECT profile_medals_pub - FROM auth_user_quick - WHERE user_id = {?}", - S::i('uid')); + $res = XDB::query("SELECT medals_pub + FROM profiles + WHERE pid = {?}", + $this->pid()); $this->values['medals_pub'] = $res->fetchOneCell(); } protected function _saveData() { if ($this->changed['medals_pub']) { - XDB::execute("UPDATE auth_user_quick - SET profile_medals_pub = {?} - WHERE user_id = {?}", - $this->values['medals_pub'], S::i('uid')); + XDB::execute("UPDATE profiles + SET medals_pub = {?} + WHERE pid = {?}", + $this->values['medals_pub'], $this->pid()); } } public function _prepare(PlPage &$page, $id) { $res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate - FROM profile_medals + FROM profile_medal_enum ORDER BY type, text"); $mlist = array(); while ($tmp = $res->next()) {