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
|
|
|
|
* Authors of Framadate/OpenSondate: Framasoft (https://github.com/framasoft)
|
|
|
|
*
|
|
|
|
* =============================
|
|
|
|
*
|
|
|
|
* 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;
|
|
|
|
|
2015-04-05 15:41:19 +02:00
|
|
|
use Framadate\Editable;
|
|
|
|
|
2014-12-03 21:08:08 +01:00
|
|
|
class Form
|
|
|
|
{
|
|
|
|
|
2014-12-25 00:55:52 +01:00
|
|
|
public $title;
|
|
|
|
public $description;
|
|
|
|
public $admin_name;
|
|
|
|
public $admin_mail;
|
|
|
|
public $format;
|
|
|
|
public $end_date;
|
2014-12-03 21:08:08 +01:00
|
|
|
public $choix_sondage;
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
|
*/
|
|
|
|
public $hidden;
|
|
|
|
|
2014-12-03 21:08:08 +01:00
|
|
|
/**
|
|
|
|
* List of available choices
|
|
|
|
*/
|
|
|
|
private $choices;
|
|
|
|
|
|
|
|
public function __construct(){
|
2015-04-05 15:41:19 +02:00
|
|
|
$this->editable = Editable::NOT_EDITABLE;
|
2014-12-03 21:08:08 +01:00
|
|
|
$this->clearChoices();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function clearChoices() {
|
|
|
|
$this->choices = array();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addChoice(Choice $choice)
|
|
|
|
{
|
|
|
|
$this->choices[] = $choice;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getChoices()
|
|
|
|
{
|
|
|
|
return $this->choices;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sortChoices()
|
|
|
|
{
|
|
|
|
usort($this->choices, array('Framadate\Choice', 'compare'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function lastChoice()
|
|
|
|
{
|
|
|
|
return end($this->choices);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|