X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations.inc.php;h=12ec2819f13880c78425e403a24563f410fb9616;hb=b8971a3ed64f3ba69becf1cd8f3b32ee2292026d;hp=10bfc8293c6df9124296d1721ab0f7069bf7e178;hpb=61e0e8619a9e391d9536d1af3c8cd441491bbc99;p=platal.git diff --git a/include/validations.inc.php b/include/validations.inc.php index 10bfc82..12ec281 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -21,7 +21,8 @@ define('SIZE_MAX', 32768); -require_once dirname(__FILE__) . '/../classes/xdb.php'; +global $globals; +require_once $globals->spoolroot . '/core/classes/xdb.php'; /** * Iterator class, that lists objects through the database @@ -116,7 +117,7 @@ abstract class Validate $this->uid, $this->type, $this, $this->stamp); global $globals; - update_NbValid(); + $globals->updateNbValid(); return true; } @@ -146,7 +147,7 @@ abstract class Validate $success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?} AND stamp={?}', $this->uid, $this->type, $this->stamp); } - update_NbValid(); + $globals->updateNbValid(); return $success; } @@ -159,7 +160,7 @@ abstract class Validate { if (Env::has('delete')) { $this->clean(); - $this->trig('requete supprimée'); + $this->trigSuccess('Requête supprimée'); return true; } @@ -167,7 +168,7 @@ abstract class Validate if (Env::has('edit')) { if ($this->handle_editor()) { $this->update(); - $this->trig('requête mise à jour'); + $this->trigSuccess('Requête mise à jour'); return true; } return false; @@ -202,7 +203,7 @@ abstract class Validate $mailer->send(); $this->update(); - $this->trig('commentaire ajouté'); + $this->trigSuccess('Commentaire ajouté'); return true; } @@ -210,10 +211,10 @@ abstract class Validate if ($this->commit()) { $this->sendmail(true); $this->clean(); - $this->trig('mail envoyé'); + $this->trigSuccess('Mail de validation envoyé'); return true; } else { - $this->trig('erreur lors de la validation'); + $this->trigError('Erreur lors de la validation'); return false; } } @@ -222,10 +223,10 @@ abstract class Validate if (Env::v('comm')) { $this->sendmail(false); $this->clean(); - $this->trig('mail envoyé'); + $this->trigSuccess('Mail de refus envoyé'); return true; } else { - $this->trig('pas de motivation pour le refus !!!'); + $this->trigError('pas de motivation pour le refus !!!'); } } @@ -256,10 +257,19 @@ abstract class Validate // }}} // {{{ function trig() - protected function trig($msg) + protected function trigError($msg) { - global $page; - $page->trig($msg); + Platal::page()->trigError($msg); + } + + protected function trigWarning($msg) + { + Platal::page()->trigWarning($msg); + } + + protected function trigSuccess($msg) + { + Platal::page()->trigSuccess($msg); } // }}}