2014-12-03 21:08:08 +01:00
|
|
|
<?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
|
2016-08-04 22:26:37 +02:00
|
|
|
* 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)
|
|
|
|
*/
|
2014-12-03 21:08:08 +01:00
|
|
|
namespace Framadate;
|
|
|
|
|
|
|
|
class Form
|
|
|
|
{
|
2014-12-25 00:55:52 +01:00
|
|
|
public $title;
|
2015-12-05 16:03:01 +01:00
|
|
|
public $id;
|
2014-12-25 00:55:52 +01:00
|
|
|
public $description;
|
|
|
|
public $admin_name;
|
|
|
|
public $admin_mail;
|
|
|
|
public $format;
|
|
|
|
public $end_date;
|
2014-12-03 21:08:08 +01:00
|
|
|
public $choix_sondage;
|
2018-02-20 13:06:58 +01:00
|
|
|
public $ValueMax;
|
2014-12-03 21:08:08 +01:00
|
|
|
|
|
|
|
/**
|
2014-12-05 01:08:38 +01:00
|
|
|
* Tells if users can modify their choices.
|
2015-04-05 15:41:19 +02:00
|
|
|
* @var \Framadate\Editable
|
2014-12-03 21:08:08 +01:00
|
|
|
*/
|
2014-12-05 01:08:38 +01:00
|
|
|
public $editable;
|
2014-12-12 13:43:43 +01:00
|
|
|
|
2014-12-05 01:08:38 +01:00
|
|
|
/**
|
|
|
|
* If true, notify poll administrator when new vote is made.
|
|
|
|
*/
|
|
|
|
public $receiveNewVotes;
|
2014-12-03 21:08:08 +01:00
|
|
|
|
2015-01-17 01:22:03 +01:00
|
|
|
/**
|
|
|
|
* If true, notify poll administrator when new comment is posted.
|
|
|
|
*/
|
|
|
|
public $receiveNewComments;
|
|
|
|
|
2015-04-05 18:36:43 +02:00
|
|
|
/**
|
|
|
|
* If true, only the poll maker can see the poll's results
|
|
|
|
* @var boolean
|
|
|
|
*/
|
2018-02-20 13:06:58 +01:00
|
|
|
public $use_ValueMax;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* if true, there will be a limit of voters per option
|
|
|
|
* @var boolean
|
|
|
|
*/
|
2015-04-05 18:36:43 +02:00
|
|
|
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;
|
|
|
|
|
2015-04-09 17:53:00 +02:00
|
|
|
/**
|
|
|
|
* 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
|
2015-04-09 17:53:00 +02:00
|
|
|
* @var string
|
|
|
|
*/
|
2015-04-09 18:18:05 +02:00
|
|
|
public $password_hash;
|
2015-04-09 17:53:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, the polls results will be also visible for those without password
|
|
|
|
* @var boolean
|
|
|
|
*/
|
|
|
|
public $results_publicly_visible;
|
|
|
|
|
2018-03-18 10:40:38 +01:00
|
|
|
/**
|
2018-05-08 15:03:22 +02:00
|
|
|
* Tells if voters email addresses are collected or not.
|
|
|
|
* @var \Framadate\Collect_mail
|
2018-03-18 10:40:38 +01:00
|
|
|
*/
|
|
|
|
public $collect_users_mail;
|
|
|
|
|
2014-12-03 21:08:08 +01:00
|
|
|
/**
|
|
|
|
* List of available choices
|
|
|
|
*/
|
|
|
|
private $choices;
|
|
|
|
|
|
|
|
public function __construct(){
|
2015-04-06 14:06:47 +02:00
|
|
|
$this->editable = Editable::EDITABLE_BY_ALL;
|
2018-05-08 15:03:22 +02:00
|
|
|
$this->collect_users_mail = Collect_mail::NO_COLLECT;
|
2014-12-03 21:08:08 +01:00
|
|
|
$this->clearChoices();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function clearChoices() {
|
2018-02-19 00:18:43 +01:00
|
|
|
$this->choices = [];
|
2014-12-03 21:08:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function addChoice(Choice $choice)
|
|
|
|
{
|
|
|
|
$this->choices[] = $choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getChoices()
|
|
|
|
{
|
|
|
|
return $this->choices;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sortChoices()
|
|
|
|
{
|
2018-02-19 00:18:43 +01:00
|
|
|
usort($this->choices, ['Framadate\Choice', 'compare']);
|
2014-12-03 21:08:08 +01:00
|
|
|
}
|
2016-08-04 21:44:31 +02:00
|
|
|
}
|