X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fdecos.inc.php;h=31d68cdee64106488319168d7b784a6d06be5dfd;hb=00112b2e8cd1e6e37d06135e6279380f7e2aaa73;hp=9aaea5ee579b313f1a02e625f7add007f7203589;hpb=ddb649901f5a88d695a7050f2a59da140842ec89;p=platal.git diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php index 9aaea5e..31d68cd 100644 --- a/modules/profile/decos.inc.php +++ b/modules/profile/decos.inc.php @@ -1,6 +1,6 @@ next()) { - $value[$id] = array('grade' => $grade, + $value[$id] = array('grade' => $grade, 'valid' => '1'); } @@ -76,8 +76,9 @@ class ProfileDeco implements ProfileSetting // Add new ones foreach ($value as $id=>&$val) { if (!isset($orig[$id]) || $orig[$id]['grade'] != $val['grade']) { - $req = new MedalReq(S::i('uid'), $id, $val['grade']); + $req = new MedalReq(S::user(), $id, $val['grade']); $req->submit(); + sleep(1); } } } @@ -92,21 +93,20 @@ class ProfileDecos extends ProfilePage parent::__construct($wiz); $this->settings['medals'] = new ProfileDeco(); $this->settings['medals_pub'] = new ProfilePub(); + $this->watched['medals'] = true; } - protected function fetchData() + protected function _fetchData() { $res = XDB::query("SELECT profile_medals_pub FROM auth_user_quick WHERE user_id = {?}", S::i('uid')); $this->values['medals_pub'] = $res->fetchOneCell(); - parent::fetchData(); } - protected function saveData() + protected function _saveData() { - parent::saveData(); if ($this->changed['medals_pub']) { XDB::execute("UPDATE auth_user_quick SET profile_medals_pub = {?} @@ -115,18 +115,8 @@ class ProfileDecos extends ProfilePage } } - public function prepare(PlatalPage &$page, $id) + public function _prepare(PlPage &$page, $id) { - parent::prepare($page, $id); - $res = XDB::iterator("SELECT * - FROM profile_medals_grades - ORDER BY mid, pos"); - $grades = array(); - while ($tmp = $res->next()) { - $grades[$tmp['mid']][] = $tmp; - } - $page->assign('grades', $grades); - $res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate FROM profile_medals ORDER BY type, text"); @@ -135,7 +125,6 @@ class ProfileDecos extends ProfilePage $mlist[$tmp['type']][] = $tmp; } $page->assign('medal_list', $mlist); - $trad = Array('ordre' => 'Ordres', 'croix' => 'Croix', 'militaire' => 'Médailles militaires',