fix next / previous events
This commit is contained in:
parent
e5e8cad6ca
commit
94cf47ee43
3 changed files with 14 additions and 9 deletions
|
|
@ -19,8 +19,9 @@ function getMonthNumber($month) {
|
|||
return $array[$month];
|
||||
}
|
||||
|
||||
function filterFutureEvents($events) {
|
||||
$futureEvents = new Pages();
|
||||
function splitNextAndPreviousEvents($events) {
|
||||
$next = new Pages();
|
||||
$previous = new Pages();
|
||||
|
||||
foreach ($events as $event) {
|
||||
$sessions = $event->isMapadoEvent() == 'true' ? $event->remoteSessions()->toStructure() : $event->sessions()->toStructure();
|
||||
|
|
@ -41,11 +42,16 @@ function filterFutureEvents($events) {
|
|||
|
||||
|
||||
if (!empty($futureDates)) {
|
||||
$futureEvents->add($event);
|
||||
$next->add($event);
|
||||
} else {
|
||||
$previous->add($event);
|
||||
}
|
||||
}
|
||||
|
||||
return $futureEvents;
|
||||
return [
|
||||
'next' => $next,
|
||||
'previous' => $previous,
|
||||
];
|
||||
}
|
||||
|
||||
function filterPastEvents($events) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue