Accelerates jobterms tree browsing and fixes some leaf problems
[platal.git] / include / validations / surveys.inc.php
index 7c26267..8eca5d6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -33,9 +33,9 @@ class SurveyReq extends Validate
     // }}}
     // {{{ constructor
 
-    public function __construct($_title, $_description, $_end, $_mode, $_promos, $_questions, $_uid)
+    public function __construct($_title, $_description, $_end, $_mode, $_promos, $_questions, User &$_user)
     {
-        parent::__construct($_uid, false, 'surveys');
+        parent::__construct($_user, false, 'surveys');
         $this->title       = $_title;
         $this->description = $_description;
         $this->end         = $_end;
@@ -54,7 +54,7 @@ class SurveyReq extends Validate
 
     // }}}
     // {{{ function _mail_subj
-    
+
     protected function _mail_subj()
     {
         return "[Polytechnique.org/SONDAGES] Proposition de sondage";
@@ -91,15 +91,10 @@ class SurveyReq extends Validate
 
     public function commit()
     {
-        $sql = 'INSERT INTO survey_surveys
-                        SET questions={?},
-                            title={?},
-                            description={?},
-                            author_id={?},
-                            end={?},
-                            mode={?},
-                            promos={?}';
-        return XDB::execute($sql, serialize($this->questions), $this->title, $this->description, $this->uid, $this->end, $this->mode, $this->promos);
+        $sql = 'INSERT INTO  surveys
+                        SET  questions = {?}, title = {?}, description = {?},
+                             uid = {?}, end = {?},mode = {?}, promos = {?}';
+        return XDB::execute($sql, serialize($this->questions), $this->title, $this->description, $this->user->id(), $this->end, $this->mode, $this->promos);
     }
 
     // }}}