date.chapril.org-framadate/app/classes/Framadate/Form.php

135 lines
3.0 KiB
PHP
Raw Permalink Normal View History

<?php
2014-12-17 13:48:03 +01:00
/**
* This software is governed by the CeCILL-B license. If a copy of this license
* is not distributed with this file, you can obtain one at
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt
*
* Authors of STUdS (initial project): Guilhem BORGHESI (borghesi@unistra.fr) and Raphaël DROZ
* Authors of Framadate/OpenSondage: Framasoft (https://github.com/framasoft)
2014-12-17 13:48:03 +01:00
*
* =============================
*
* Ce logiciel est régi par la licence CeCILL-B. Si une copie de cette licence
* ne se trouve pas avec ce fichier vous pouvez l'obtenir sur
* http://www.cecill.info/licences/Licence_CeCILL-B_V1-fr.txt
*
* Auteurs de STUdS (projet initial) : Guilhem BORGHESI (borghesi@unistra.fr) et Raphaël DROZ
* Auteurs de Framadate/OpenSondage : Framasoft (https://github.com/framasoft)
*/
namespace Framadate;
use DateTime;
class Form
{
2014-12-25 00:55:52 +01:00
public $title;
public $id;
2014-12-25 00:55:52 +01:00
public $description;
public $admin_name;
public $admin_mail;
public $format;
/**
* @var DateTime
*/
2014-12-25 00:55:52 +01:00
public $end_date;
/**
* @var DateTime
*/
public $creation_date;
public $choix_sondage;
public $ValueMax;
public $errors = [];
/**
* Tells if users can modify their choices.
* @var \Framadate\Editable
*/
public $editable;
/**
* If true, notify poll administrator when new vote is made.
*/
public $receiveNewVotes;
/**
* If true, notify poll administrator when new comment is posted.
*/
public $receiveNewComments;
/**
* If true, only the poll maker can see the poll's results
* @var boolean
*/
public $use_ValueMax;
/**
* if true, there will be a limit of voters per option
* @var boolean
*/
public $hidden;
2016-08-04 21:44:31 +02:00
/**
* If true, the author want to customize the URL
* @var boolean
*/
public $use_customized_url;
/**
* If true, a password will be needed to access the poll
* @var boolean
*/
public $use_password;
/**
2015-04-09 18:18:05 +02:00
* The password needed to access the poll, hashed. Only used if $use_password is set to true
* @var string
*/
2015-04-09 18:18:05 +02:00
public $password_hash;
/**
* If true, the polls results will be also visible for those without password
* @var boolean
*/
public $results_publicly_visible;
Collecting Polled Users Emails Modification de la BDD : ajout de la colonne mail dans la table vote Modification de la BDD : ajout de la colonne mail dans la table vote (bis) MAJ de VoteRepository : méthode insert et update MAJ de PollService : méthodes updateVote, addVote et splitVotes Modification studs.php, adminstuds.php et vote_table_date.tpl : OK pour l'ajout d'un vote avec nom + mail Modification de vote_table_classic.tpl : OK pour l'ajout d'un vote avec nom + mail Ajout d'un bouton enveloppe pour chaque colonne avec méthode de traitement pour test Le numéro de la colonne est enfin récupéré correctement Implémentation récupération des adresses mails des sondés intéressants dans adminstuds.php et appel d'un fichier display_mails.tpl qui affichent ces adresses mails. Extension du traitement pour les sondages classic Ajout récupération des adresses des non aussi, et ajouts de tests pour l'affichage Changement des input type=text en type=email Corrections automatiques pour passage pipelines Corrections suite aux remarques sur la merge request Corrections 2 suite aux remarques sur la merge request Corrections 3 suite aux remarques sur la merge request Modif BDD : ajout colonne collect_mail dans poll Modif classes Form, PollRepository Passage de la collecte des mails des sondés en fonctionalité optionnelle Si la collecte de mail est activée, la saisie du mail est obligatoire Ajout avertissements collect_mail + editableByAll dans création de sondage et tableaux de vote Update create poll string and put a danger background on warning Signed-off-by: Thomas Citharel <tcit@tcit.fr> Translation strings updated and better position for the email public warning message Also, a CSS tweak and cleanup Signed-off-by: Thomas Citharel <tcit@tcit.fr> CS Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-03-18 10:40:38 +01:00
/**
* Tells if voters email addresses are collected or not.
* @var \Framadate\CollectMail
Collecting Polled Users Emails Modification de la BDD : ajout de la colonne mail dans la table vote Modification de la BDD : ajout de la colonne mail dans la table vote (bis) MAJ de VoteRepository : méthode insert et update MAJ de PollService : méthodes updateVote, addVote et splitVotes Modification studs.php, adminstuds.php et vote_table_date.tpl : OK pour l'ajout d'un vote avec nom + mail Modification de vote_table_classic.tpl : OK pour l'ajout d'un vote avec nom + mail Ajout d'un bouton enveloppe pour chaque colonne avec méthode de traitement pour test Le numéro de la colonne est enfin récupéré correctement Implémentation récupération des adresses mails des sondés intéressants dans adminstuds.php et appel d'un fichier display_mails.tpl qui affichent ces adresses mails. Extension du traitement pour les sondages classic Ajout récupération des adresses des non aussi, et ajouts de tests pour l'affichage Changement des input type=text en type=email Corrections automatiques pour passage pipelines Corrections suite aux remarques sur la merge request Corrections 2 suite aux remarques sur la merge request Corrections 3 suite aux remarques sur la merge request Modif BDD : ajout colonne collect_mail dans poll Modif classes Form, PollRepository Passage de la collecte des mails des sondés en fonctionalité optionnelle Si la collecte de mail est activée, la saisie du mail est obligatoire Ajout avertissements collect_mail + editableByAll dans création de sondage et tableaux de vote Update create poll string and put a danger background on warning Signed-off-by: Thomas Citharel <tcit@tcit.fr> Translation strings updated and better position for the email public warning message Also, a CSS tweak and cleanup Signed-off-by: Thomas Citharel <tcit@tcit.fr> CS Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-03-18 10:40:38 +01:00
*/
public $collect_users_mail;
/**
* List of available choices
*/
private $choices;
public function __construct()
{
2015-04-06 14:06:47 +02:00
$this->editable = Editable::EDITABLE_BY_ALL;
$this->collect_users_mail = CollectMail::NO_COLLECT;
$this->clearChoices();
}
public function clearChoices() {
$this->choices = [];
}
public function addChoice(Choice $choice)
{
$this->choices[] = $choice;
}
public function getChoices()
{
return $this->choices;
}
public function sortChoices()
{
usort($this->choices, ['Framadate\Choice', 'compare']);
}
2016-08-04 21:44:31 +02:00
}