X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fmedals.inc.php;h=a2a5dc14cf9479f14baf74bb5f6ffca5813fe428;hb=34062b64fa9f161dc071527b2e864496555d598d;hp=e419e4605016551f7f397528e75288b4035ba519;hpb=eaf30d86cc99df2414cf4f171a9b0f11b0561e3b;p=platal.git diff --git a/include/validations/medals.inc.php b/include/validations/medals.inc.php index e419e46..a2a5dc1 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; } @@ -100,7 +100,25 @@ class MedalReq extends Validate public function commit () { - return XDB::execute('REPLACE INTO profile_medals_sub VALUES({?}, {?}, {?})', $this->uid, $this->mid, $this->gid); + require_once 'notifs.inc.php'; + register_watch_op($this->user->id(), WATCH_FICHE, '', 'medals'); + return XDB::execute('REPLACE INTO profile_medals_sub + VALUES ({?}, {?}, {?})', + $this->user->id(), $this->mid, $this->gid); + } + + // }}} + // {{{ function get_request($medal) + + static public function get_request($uid, $type) + { + $reqs = Validate::get_typed_requests($uid, 'medal'); + foreach ($reqs as &$req) { + if ($req->mid == $type) { + return $req; + } + } + return null; } // }}}