Date poll creation: Always propose 3 choices and 3 slots when choosing dates

This commit is contained in:
Olivier PEREZ 2015-05-31 15:57:44 +02:00
parent 94f80687f3
commit e8a1f37c98

View File

@ -221,17 +221,15 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) ||
} else { } else {
// Prefill form->choices // Prefill form->choices
if (count($_SESSION['form']->getChoices()) == 0) { foreach ($_SESSION['form']->getChoices() as $c) {
$c = new Choice(''); $count = 3 - count($c->getSlots());
for($i=0; $i< $count; $i++) {
$c->addSlot(''); $c->addSlot('');
$c->addSlot(''); }
$c->addSlot(''); }
$_SESSION['form']->addChoice($c);
$c = new Choice(''); $count = 3 - count($_SESSION['form']->getChoices());
$c->addSlot(''); for($i=0; $i< $count; $i++) {
$c->addSlot('');
$c->addSlot('');
$_SESSION['form']->addChoice($c);
$c = new Choice(''); $c = new Choice('');
$c->addSlot(''); $c->addSlot('');
$c->addSlot(''); $c->addSlot('');