Backport
[platal.git] / include / validations.inc.php
index b3dddb1..6af52e8 100644 (file)
@@ -21,6 +21,8 @@
 
 define('SIZE_MAX', 32768);
 
+__autoload('XDB');
+
 /**
  * Iterator class, that lists objects through the database
  */
@@ -30,7 +32,7 @@ class ValidateIterator extends XOrgDBIterator
 
     function ValidateIterator ()
     {
-        parent::XOrgDBIterator('SELECT data,stamp FROM requests ORDER BY stamp', MYSQL_NUM);
+        parent::__construct('SELECT data,stamp FROM requests ORDER BY stamp', MYSQL_NUM);
     }
 
     // }}}
@@ -67,6 +69,7 @@ class Validate
     var $unique;
     // enable the refuse button
     var $refuse = true;
+    
     var $type;
     var $comments = Array();
     // the validations rules : comments for admins
@@ -156,6 +159,16 @@ class Validate
             return true;
         }
 
+        // mise à jour des informations
+        if (Env::has('edit')) {
+            if ($this->handle_editor()) {
+                $this->update();
+                $this->trig('requête mise à jour');
+                return true;
+            }
+            return false;
+        }
+
         // ajout d'un commentaire
         if (Env::has('hold') && Env::has('comm')) {
             $formid = Env::i('formid');
@@ -300,6 +313,13 @@ class Validate
     { return null; }
 
     // }}}
+    // {{{ function editor()
+
+    /** nom du formulaire d'édition */
+    function editor()
+    { return null; }
+
+    // }}}
     // {{{ function answers()
 
     /** automatic answers table for this type of validation */
@@ -313,6 +333,14 @@ class Validate
     }
 
     // }}}
+    // {{{ function id()
+
+    function id()
+    {
+        return $this->uid . '_' . $this->type . '_' . $this->stamp;
+    }
+
+    // }}}
 }
 
 foreach (glob(dirname(__FILE__).'/validations/*.inc.php') as $file) {