'textarea' => 'texte long',
'num' => 'numérique',
'radio' => 'radio',
- 'checkbox' => 'checkbox',
- 'personal' => 'informations personnelles');
+ 'checkbox' => 'checkbox');
public static function getTypes()
{
} 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'] : '#';
// }}}
// }}}
-// {{{ 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:
?>
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* 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énom</label>
- <tr>
- <td colspan='2'>
- 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.
- </td>
- </tr>
-
-{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
</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">
•
</a>
</td>
</tr>
- {assign var="has_cs" value="true"}
+ {assign var="has_cs" value="true"}
+ {/if}
{/iterate}
{if !$has_cs}
<tr>
</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">
•
</a>
</td>
</tr>
- {assign var="has_os" value="true"}
+ {assign var="has_os" value="true"}
+ {/if}
{/iterate}
{if !$has_os}
<tr>
+++ /dev/null
-{**************************************************************************}
-{* *}
-{* 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énom</label><br/>
-{/if}
- <strong>Attention, cocher cette(ces) case(s) détruit totalement ou en partie l'anonymat de ta réponse.</strong>
-
-{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}