Fix session bootstrap
[platal.git] / include / validations / evts.inc.php
index 6714ab7..9cca8b5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -25,20 +25,20 @@ class EvtReq extends Validate
 {
     // {{{ properties
 
-    var $evtid;
-    var $titre;
-    var $texte;
-    var $pmin;
-    var $pmax;
-    var $peremption;    
-    var $comment;
+    public $evtid;
+    public $titre;
+    public $texte;
+    public $pmin;
+    public $pmax;
+    public $peremption;    
+    public $comment;
     
     // }}}
     // {{{ constructor
 
-    function EvtReq($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, $_uid) {
-        global $globals;
-        $this->Validate($_uid, false, 'evts');
+    public function __construct($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, $_uid)
+    {
+        parent::__construct($_uid, false, 'evts');
         $this->titre      = $_titre;
         $this->texte      = $_texte;
         $this->pmin       = $_pmin;
@@ -50,36 +50,58 @@ class EvtReq extends Validate
     // }}}
     // {{{ function formu()
 
-    function formu()
-    { return 'include/form.valid.evts.tpl'; }
+    public function formu()
+    {
+        return 'include/form.valid.evts.tpl';
+    }
+
+    // }}}
+    // {{{ functon editor()
+
+    public function editor()
+    {
+        return 'include/form.valid.edit-evts.tpl';
+    }
+
+    // }}}
+    // {{{ function handle_editor()
+
+    protected function handle_editor()
+    {
+        $this->titre      = Env::v('titre');
+        $this->texte      = Env::v('texte');
+        $this->pmin       = Env::i('promo_min');
+        $this->pmax       = Env::i('promo_max');
+        $this->peremption = Env::v('peremption');
+        return true;
+    }
 
     // }}}
     // {{{ function _mail_subj
     
-    function _mail_subj()
+    protected function _mail_subj()
     {
-        return "[Polytechnique.org/EVENEMENTS] Proposition d'événement";
+        return "[Polytechnique.org/EVENEMENTS] Proposition d'événement";
     }
 
     // }}}
     // {{{ function _mail_body
 
-    function _mail_body($isok)
+    protected function _mail_body($isok)
     {
         if ($isok) {
-            return "  L'annonce que tu avais proposée ({$this->titre}) vient d'être validée.";
+            return "  L'annonce que tu avais proposée ({$this->titre}) vient d'être validée.";
         } else {
-            return "  L'annonce que tu avais proposée ({$this->titre}) a été refusée.";
+            return "  L'annonce que tu avais proposée ({$this->titre}) a été refusée.";
         }
     }
 
     // }}}
     // {{{ function commit()
 
-    function commit()
+    public function commit()
     {
-        global $globals;
-        return $globals->xdb->execute(
+        return XDB::execute(
                 "INSERT INTO  evenements
                          SET  user_id = {?}, creation_date=NOW(), titre={?}, texte={?},
                               peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide')",
@@ -92,5 +114,5 @@ class EvtReq 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:
 ?>