program - ordere events
This commit is contained in:
parent
61bc24c984
commit
b33cb5510d
3 changed files with 28 additions and 14 deletions
|
|
@ -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)
|
||||
];
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue