mirror of
https://framagit.org/framasoft/framadate/framadate
synced 2026-07-22 09:36:36 +00:00
Dealing in PHP with the suppressed dates
This commit is contained in:
parent
d762c38e81
commit
4d14dd1b70
1 changed files with 12 additions and 1 deletions
|
|
@ -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]));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue