- return XDB::execute('REPLACE INTO profile_medals_sub VALUES({?}, {?}, {?})', $this->uid, $this->mid, $this->gid);
+ return XDB::execute('INSERT INTO profile_medals (pid, mid, gid)
+ VALUES ({?}, {?}, {?})
+ ON DUPLICATE KEY UPDATE gid = VALUES(gid)',
+ $this->profile->id(), $this->mid,
+ is_null($this->gid) ? 0 : $this->gid);
+ }
+
+ // }}}
+ // {{{ function get_request($medal)
+
+ static public function get_request($pid, $type)
+ {
+ $reqs = parent::get_typed_requests($pid, 'medal');
+ foreach ($reqs as &$req) {
+ if ($req->mid == $type) {
+ return $req;
+ }
+ }
+ return null;