From: x2004laborde Date: Thu, 12 Apr 2007 08:57:56 +0000 (+0000) Subject: some changes in survey module X-Git-Tag: xorg/0.9.14~101 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0b78af4727f2a6495583641cdecd319a8cb7ed92;p=platal.git some changes in survey module git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1689 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/modules/survey/survey.inc.php b/modules/survey/survey.inc.php index f1f8fe5..27b11db 100644 --- a/modules/survey/survey.inc.php +++ b/modules/survey/survey.inc.php @@ -41,8 +41,7 @@ class Survey 'textarea' => 'texte long', 'num' => 'numérique', 'radio' => 'radio', - 'checkbox' => 'checkbox', - 'personal' => 'informations personnelles'); + 'checkbox' => 'checkbox'); public static function getTypes() { @@ -82,8 +81,8 @@ class Survey } else { $this->end = (preg_match('#^\d{4}-\d{2}-\d{2}$#', $args['end']))? $args['end'] : '#'; } - $this->mode = $args['mode']; - if ($args['mode'] == 0) { + $this->mode = (isset($args['mode']))? $args['mode'] : self::MODE_ALL; + if ($this->mode == self::MODE_ALL) { $args['promos'] = ''; } $this->promos = ($args['promos'] == '' || preg_match('#^(\d{4}-?|(\d{4})?-\d{4})(,(\d{4}-?|(\d{4})?-\d{4}))*$#', $args['promos']))? $args['promos'] : '#'; @@ -684,45 +683,5 @@ class SurveyCheckbox extends SurveyList // }}} // }}} -// {{{ class SurveyPersonal extends SurveyQuestion : allows easy and verified access to user's personal data (promotion, name...) -// actually this type of question should be suppressed (non anonymous surveys are possible with survey modes) -// and anyway it is not finished (checkAnswer implementation) : currently it does not store anything when a user votes -class SurveyPersonal extends SurveyQuestion -{ - private $perm; - - public function update($args) - { - $args['question'] = "Informations personnelles"; - parent::update($args); - $this->perm['promo'] = isset($args['promo'])? 1 : 0; - $this->perm['name'] = isset($args['name'])? 1 : 0; - } - - public function checkAnswer($ans) - { - if (intval($ans) == 1) { - // requete mysql qvb - return null; - } else { - return null; - } - } - - protected function getQuestionType() - { - return "personal"; - } - - public function toArray() - { - $a = parent::toArray(); - $a['promo'] = $this->perm['promo']; - $a['name'] = $this->perm['name']; - return $a; - } -} -// }}} - // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> diff --git a/templates/survey/edit_personal.tpl b/templates/survey/edit_personal.tpl deleted file mode 100644 index 1b84f38..0000000 --- a/templates/survey/edit_personal.tpl +++ /dev/null @@ -1,36 +0,0 @@ -{**************************************************************************} -{* *} -{* Copyright (C) 2003-2007 Polytechnique.org *} -{* http://opensource.polytechnique.org/ *} -{* *} -{* This program is free software; you can redistribute it and/or modify *} -{* it under the terms of the GNU General Public License as published by *} -{* the Free Software Foundation; either version 2 of the License, or *} -{* (at your option) any later version. *} -{* *} -{* This program is distributed in the hope that it will be useful, *} -{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} -{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} -{* GNU General Public License for more details. *} -{* *} -{* You should have received a copy of the GNU General Public License *} -{* along with this program; if not, write to the Free Software *} -{* Foundation, Inc., *} -{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} -{* *} -{**************************************************************************} - - {include file='survey/edit_question.tpl' disable_question=true} - - Demande - -
- - - - Cette question détruit totalement ou en partie l'anonymat du sondage : un message sera affiché pour prévenir les utilisateurs, - ils pourront accepter ou non de transmettre ces informations. - - - -{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *} diff --git a/templates/survey/index.tpl b/templates/survey/index.tpl index f74f8ae..9c65e5b 100644 --- a/templates/survey/index.tpl +++ b/templates/survey/index.tpl @@ -29,6 +29,7 @@ {iterate item=s from=$survey_current} + {if $smarty.session.auth || $s.mode == Survey::MODE_ALL} • @@ -37,7 +38,8 @@ - {assign var="has_cs" value="true"} + {assign var="has_cs" value="true"} + {/if} {/iterate} {if !$has_cs} @@ -55,6 +57,7 @@ {iterate item=s from=$survey_old} + {if $smarty.session.auth || $s.mode == Survey::MODE_ALL} • @@ -63,7 +66,8 @@ - {assign var="has_os" value="true"} + {assign var="has_os" value="true"} + {/if} {/iterate} {if !$has_os} diff --git a/templates/survey/show_personal.tpl b/templates/survey/show_personal.tpl deleted file mode 100644 index eb0aab2..0000000 --- a/templates/survey/show_personal.tpl +++ /dev/null @@ -1,34 +0,0 @@ -{**************************************************************************} -{* *} -{* Copyright (C) 2003-2007 Polytechnique.org *} -{* http://opensource.polytechnique.org/ *} -{* *} -{* This program is free software; you can redistribute it and/or modify *} -{* it under the terms of the GNU General Public License as published by *} -{* the Free Software Foundation; either version 2 of the License, or *} -{* (at your option) any later version. *} -{* *} -{* This program is distributed in the hope that it will be useful, *} -{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} -{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} -{* GNU General Public License for more details. *} -{* *} -{* You should have received a copy of the GNU General Public License *} -{* along with this program; if not, write to the Free Software *} -{* Foundation, Inc., *} -{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} -{* *} -{**************************************************************************} - - -{if $squestion.promo} - -
-{/if} -{if $squestion.name} - -
-{/if} - Attention, cocher cette(ces) case(s) détruit totalement ou en partie l'anonymat de ta réponse. - -{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}