X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fmedals.inc.php;h=16f5b99730958fe89434f7d6eaf2ebd14b1cad8f;hb=a19178e9a93c4eb3eb750845e85f87f2294ed1e4;hp=98d14d24e61a9a5c25cdbbd1da4d86b20da87966;hpb=dd9bac8f7903e9924525ad8db3e38650ff5ad1b6;p=platal.git diff --git a/include/validations/medals.inc.php b/include/validations/medals.inc.php index 98d14d2..16f5b99 100644 --- a/include/validations/medals.inc.php +++ b/include/validations/medals.inc.php @@ -1,6 +1,6 @@ mid = $_idmedal; + parent::__construct($_user, false, 'medal', $_stamp); + $this->mid = $_idmedal; $this->gid = $_subidmedal; + if (is_null($this->gid)) { + $this->gid = 0; + } } // }}} @@ -74,8 +77,8 @@ class MedalReq extends Validate //var_dump($this); $r = XDB::query(" SELECT IF (g.text IS NOT NULL, CONCAT(m.text,' - ', g.text), m.text) - FROM profile_medals AS m - LEFT JOIN profile_medals_grades AS g ON(g.mid = m.id AND g.gid = {?}) + FROM profile_medal_enum AS m + LEFT JOIN profile_medal_enum_grades AS g ON(g.mid = m.id AND g.gid = {?}) WHERE m.id = {?}", $this->gid, $this->mid); return $r->fetchOneCell(); } @@ -86,7 +89,7 @@ class MedalReq extends Validate public function submit() { $res = XDB::query("SELECT FIND_IN_SET('validation', flags) - FROM profile_medals + FROM profile_medal_enum WHERE id = {?}", $this->mid); if ($res->fetchOneCell()) { parent::submit(); @@ -100,11 +103,10 @@ class MedalReq extends Validate public function commit () { - require_once 'notifs.inc.php'; - register_watch_op($this->uid, WATCH_FICHE, 'medals'); - return XDB::execute('REPLACE INTO profile_medals_sub + return XDB::execute('REPLACE INTO profile_medals VALUES ({?}, {?}, {?})', - $this->uid, $this->mid, $this->gid); + $this->user->profile()->id(), $this->mid, + is_null($this->gid) ? 0 : $this->gid); } // }}}