Validate($_uid, false, 'medal', $_stamp); $this->mid = $_idmedal; $this->gid = $_subidmedal; } // }}} // {{{ function formu() function formu() { return 'include/form.valid.medals.tpl'; } // }}} // {{{ function _mail_subj function _mail_subj() { return "[Polytechnique.org/Décoration] Demande de décoration : ".$this->medal_name(); } // }}} // {{{ function _mail_body function _mail_body($isok) { if ($isok) { return " La décoration ".$this->medal_name()." vient d'être ajoutée à ta fiche."; } else { return " La demande que tu avais faite pour la décoration ".$this->medal_name()." a été refusée."; } } // }}} // {{{ function medal_name function medal_name() { //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 = {?}) WHERE m.id = {?}", $this->gid, $this->mid); return $r->fetchOneCell(); } // }}} // {{{ function submit() function submit() { $res = XDB::query("SELECT FIND_IN_SET(flags, 'validation') FROM profile_medals WHERE id = {?}", $this->mid); if ($res->fetchOneCell()) { parent::submit(); } else { $this->commit(); } } // }}} // {{{ function commit() function commit () { return XDB::execute('REPLACE INTO profile_medals_sub VALUES({?}, {?}, {?})', $this->uid, $this->mid, $this->gid); } // }}} } // }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>