X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fmedals.inc.php;h=e419e4605016551f7f397528e75288b4035ba519;hb=787bb3d745141f2f85bd947ad7dd775d2c63f908;hp=54266f11999d2fd24bf1f73fe7261f29453bae0d;hpb=5ddeb07cc787dd1dc3630a31f1528f5cc7c4d9b9;p=platal.git diff --git a/include/validations/medals.inc.php b/include/validations/medals.inc.php index 54266f1..e419e46 100644 --- a/include/validations/medals.inc.php +++ b/include/validations/medals.inc.php @@ -25,15 +25,15 @@ class MedalReq extends Validate { // {{{ properties - var $mid; - var $gid; + public $mid; + public $gid; // }}} // {{{ constructor - function MedalReq ($_uid, $_idmedal, $_subidmedal, $_stamp=0) + public function __construct($_uid, $_idmedal, $_subidmedal, $_stamp=0) { - $this->Validate($_uid, false, 'medal', $_stamp); + parent::__construct($_uid, false, 'medal', $_stamp); $this->mid = $_idmedal; $this->gid = $_subidmedal; } @@ -41,51 +41,51 @@ class MedalReq extends Validate // }}} // {{{ function formu() - function formu() - { - return 'include/form.valid.medals.tpl'; - } + public function formu() + { + return 'include/form.valid.medals.tpl'; + } // }}} // {{{ function _mail_subj - function _mail_subj() + protected function _mail_subj() { - return "[Polytechnique.org/Décoration] Demande de décoration : ".$this->medal_name(); + return "[Polytechnique.org/Décoration] Demande de décoration : ".$this->medal_name(); } // }}} // {{{ function _mail_body - function _mail_body($isok) + protected function _mail_body($isok) { if ($isok) { - return " La décoration ".$this->medal_name()." vient d'être ajoutée à ta fiche."; + 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."; + return " La demande que tu avais faite pour la décoration ".$this->medal_name()." a été refusée."; } } // }}} // {{{ function medal_name - function medal_name() + public 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(); + //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() + public function submit() { - $res = XDB::query("SELECT FIND_IN_SET(flags, 'validation') + $res = XDB::query("SELECT FIND_IN_SET('validation', flags) FROM profile_medals WHERE id = {?}", $this->mid); if ($res->fetchOneCell()) { @@ -94,13 +94,13 @@ class MedalReq extends Validate $this->commit(); } } - + // }}} // {{{ function commit() - function commit () + public function commit () { - return XDB::execute('REPLACE INTO profile_medals_sub VALUES({?}, {?}, {?})', $this->uid, $this->mid, $this->gid); + return XDB::execute('REPLACE INTO profile_medals_sub VALUES({?}, {?}, {?})', $this->uid, $this->mid, $this->gid); } // }}} @@ -108,5 +108,5 @@ class MedalReq extends Validate // }}} -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>