2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 // {{{ class SurveyReq
24 class SurveyReq
extends Validate
36 public function __construct($_title, $_description, $_end, $_mode, $_promos, $_questions, User
&$_user)
38 parent
::__construct($_user, false
, 'surveys');
39 $this->title
= $_title;
40 $this->description
= $_description;
43 $this->promos
= $_promos;
44 $this->questions
= $_questions;
48 // {{{ function formu()
50 public function formu()
52 return 'include/form.valid.surveys.tpl';
56 // {{{ function _mail_subj
58 protected function _mail_subj()
60 return "[Polytechnique.org/SONDAGES] Proposition de sondage";
64 // {{{ function _mail_body
66 protected function _mail_body($isok)
69 return " Le sondage que tu avais proposé vient d'être validé.";
71 return " Le sondage que tu avais proposé a été refusé.";
76 // {{{ function updateReq()
78 public function updateReq($_title, $_description, $_end, $_mode, $_promos, $_questions)
80 $this->title
= $_title;
81 $this->description
= $_description;
84 $this->promos
= $_promos;
85 $this->questions
= $_questions;
86 return $this->update();
90 // {{{ function commit()
92 public function commit()
94 $sql = 'INSERT INTO survey_surveys
102 return XDB
::execute($sql, serialize($this->questions
), $this->title
, $this->description
, $this->user
->id(), $this->end
, $this->mode
, $this->promos
);
110 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: