program - ordere events

This commit is contained in:
isUnknown 2024-09-13 16:44:50 +02:00
parent 61bc24c984
commit b33cb5510d
3 changed files with 28 additions and 14 deletions

View file

@ -45,13 +45,10 @@ function createArraySession($event, $session) {
}
return function($page) {
return function($kirby, $page) {
$currentSeason = $page->children()->first();
$today = date('Ymd');
$previousEvents = new Pages();
$nextEvents = new Pages();
$currentSeasonSessions = [];
foreach ($currentSeason->children() as $event) {
@ -68,17 +65,11 @@ return function($page) {
$isStillShowing = true;
}
}
if ($isStillShowing) {
$nextEvents->add($event);
} else {
$previousEvents->add($event);
}
}
return [
'previousEvents' => $previousEvents,
'nextEvents' => $nextEvents,
'pastEvents' => filterPastEvents($kirby->collection('ordered-season')),
'futureEvents' => filterFutureEvents($kirby->collection('ordered-season')),
'currentSeasonSessions' => sortByMonth($currentSeasonSessions)
];
};