some changes in survey module
authorx2004laborde <x2004laborde@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 12 Apr 2007 08:57:56 +0000 (08:57 +0000)
committerx2004laborde <x2004laborde@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 12 Apr 2007 08:57:56 +0000 (08:57 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1689 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/survey/survey.inc.php
templates/survey/edit_personal.tpl [deleted file]
templates/survey/index.tpl
templates/survey/show_personal.tpl [deleted file]

index f1f8fe5..27b11db 100644 (file)
@@ -41,8 +41,7 @@ class Survey
                                   'textarea' => 'texte long',
                                   'num'      => 'num&#233;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 (file)
index 1b84f38..0000000
+++ /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}
-    <tr>
-      <td class="titre">Demande</td>
-      <td>
-        <input type="checkbox" name="survey_question[promo]" value="1" id="survey_question[promo]"{if $survey_current.promo} checked="checked"{/if}/><label for="survey_question[promo]">Demander la promotion</label><br/>
-        <input type="checkbox" name="survey_question[name]" value="1" id="survey_question[name]"{if $survey_current.name} checked="checked"{/if}/><label for="survey_question[name]">Demander le nom et le pr&#233;nom</label>
-    <tr>
-      <td colspan='2'>
-        Cette question d&#233;truit totalement ou en partie l'anonymat du sondage : un message sera affich&#233; pour pr&#233;venir les utilisateurs,
-        ils pourront accepter ou non de transmettre ces informations.
-      </td>
-    </tr>
-
-{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
index f74f8ae..9c65e5b 100644 (file)
@@ -29,6 +29,7 @@
     </th>
   </tr>
   {iterate item=s from=$survey_current}
+    {if $smarty.session.auth || $s.mode == Survey::MODE_ALL}
   <tr class="{cycle values="impair,pair"}">
     <td class="half">
       &bull;
@@ -37,7 +38,8 @@
       </a>
     </td>
   </tr>
-  {assign var="has_cs" value="true"}
+      {assign var="has_cs" value="true"}
+    {/if}
   {/iterate}
   {if !$has_cs}
   <tr>
@@ -55,6 +57,7 @@
     </th>
   </tr>
   {iterate item=s from=$survey_old}
+    {if $smarty.session.auth || $s.mode == Survey::MODE_ALL}
   <tr class="{cycle values="impair,pair"}">
     <td class="half">
       &bull;
@@ -63,7 +66,8 @@
       </a>
     </td>
   </tr>
-  {assign var="has_os" value="true"}
+      {assign var="has_os" value="true"}
+    {/if}
   {/iterate}
   {if !$has_os}
   <tr>
diff --git a/templates/survey/show_personal.tpl b/templates/survey/show_personal.tpl
deleted file mode 100644 (file)
index eb0aab2..0000000
+++ /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}
-  <input type="checkbox" name="survey{$survey.id}[{$squestion.id}][promo]" value="1" id="survey{$survey.id}_{$squestion.id}_promo" {if !$survey_votemode}disabled="disabled"{/if}/>
-  <label for="survey{$survey.id}_{$squestion.id}_promo">Je veux indiquer ma promotion</label><br/>
-{/if}
-{if $squestion.name}
-  <input type="checkbox" name="survey{$survey.id}[{$squestion.id}][name]" value="1" id="survey{$survey.id}_{$squestion.id}_name" {if !$survey_votemode}disabled="disabled"{/if}/>
-  <label for="survey{$survey.id}_{$squestion.id}_name">Je veux indiquer mon nom et mon pr&#233;nom</label><br/>
-{/if}
-  <strong>Attention, cocher cette(ces) case(s) d&#233;truit totalement ou en partie l'anonymat de ta r&#233;ponse.</strong>
-
-{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}