Skip to content
Snippets Groups Projects
Commit 4d14dd1b authored by Antonin's avatar Antonin
Browse files

Dealing in PHP with the suppressed dates

parent d762c38e
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,17 @@ switch ($step) {
// Clear previous choices
$_SESSION['form']->clearChoices();
// Reorder moments to deal with suppressed dates
$moments = array();
$i = 0;
while(count($moments) < count($_POST['days'])) {
if (!empty($_POST['horaires' . $i])) {
$moments[] = $_POST['horaires' . $i];
}
$i++;
}
for ($i = 0; $i < count($_POST['days']); $i++) {
$day = $_POST['days'][$i];
......@@ -130,7 +141,7 @@ switch ($step) {
$choice = new Choice($time);
$_SESSION['form']->addChoice($choice);
$schedules = $inputService->filterArray($_POST['horaires' . $i], FILTER_DEFAULT);
$schedules = $inputService->filterArray($moments[$i], FILTER_DEFAULT);
for ($j = 0; $j < count($schedules); $j++) {
if (!empty($schedules[$j])) {
$choice->addSlot(strip_tags($schedules[$j]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment