2014-12-03 21:08:08 +01:00
|
|
|
<?php
|
|
|
|
namespace Framadate;
|
|
|
|
|
|
|
|
class Form
|
|
|
|
{
|
|
|
|
|
|
|
|
public $titre;
|
|
|
|
public $commentaires;
|
|
|
|
public $nom;
|
|
|
|
public $adresse;
|
|
|
|
public $formatsondage;
|
|
|
|
public $champdatefin;
|
|
|
|
public $choix_sondage;
|
|
|
|
|
|
|
|
/**
|
2014-12-05 01:08:38 +01:00
|
|
|
* Tells if users can modify their choices.
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* List of available choices
|
|
|
|
*/
|
|
|
|
private $choices;
|
|
|
|
|
|
|
|
public function __construct(){
|
2014-12-12 13:43:43 +01:00
|
|
|
$this->editable = true;
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|