change panel colors

This commit is contained in:
isUnknown 2024-09-03 11:12:23 +02:00
parent 57751f78fc
commit bb1ff96462
2 changed files with 25 additions and 13 deletions

View file

@ -25,6 +25,24 @@ function sortByMonth($sessions) {
return $orderedSessions;
}
function createArraySession($event, $session) {
$isMapadoEvent = $event->isMapadoEvent() == 'true';
$arraySession = $session->toArray();
$arraySession['title'] = $event->title()->value();
$arraySession['authors'] = $event->authors();
$arraySession['place'] = $event->place();
$arraySession['public'] = $event->public();
$arraySession['event-url'] = $event->url();
$arraySession['duration'] = $isMapadoEvent ? $event->remoteDuration() : $event->duration();
$arraySession['ticketingUrl'] = $isMapadoEvent ? $session->ticketingUrl() : false;
$arraySession['bookableStock'] = $isMapadoEvent ? $session->bookableStock()->value() : 'free';
$arraySession['color'] = $event->color();
return $arraySession;
}
return function($page) {
$currentSeason = $page->children()->first();
$today = date('Ymd');
@ -33,6 +51,7 @@ return function($page) {
$nextEvents = new Pages();
$currentSeasonSessions = [];
$previousSeasons = $page->children()->without($currentSeason);
foreach ($currentSeason->children() as $event) {
$sessions = $event->isMapadoEvent() == 'true' ? $event->remoteSessions() : $event->sessions();
@ -40,18 +59,8 @@ return function($page) {
$isStillShowing = false;
foreach ($sessions->toStructure() as $session) {
$arraySession = $session->toArray();
$arraySession['title'] = $event->title()->value();
$arraySession['authors'] = $event->authors();
$arraySession['place'] = $event->place();
$arraySession['public'] = $event->public();
$arraySession['event-url'] = $event->url();
$arraySession['duration'] = $event->isMapadoEvent() == 'true' ? $event->remoteDuration() : $event->duration();
$arraySession['ticketingUrl'] = $event->isMapadoEvent() == 'true' ? $session->ticketingUrl() : false;
$arraySession['bookableStock'] = $event->isMapadoEvent() == 'true' ? $session->bookableStock()->value() : 'free';
$arraySession['color'] = $event->color();
$arraySession = createArraySession($event, $session);
$currentSeasonSessions[] = $arraySession;
$sessionDate = str_replace('-', '', $session->date()->toDate('YMMdd'));
if ($sessionDate >= $today) {
@ -69,6 +78,7 @@ return function($page) {
return [
'previousEvents' => $previousEvents,
'nextEvents' => $nextEvents,
'currentSeasonSessions' => sortByMonth($currentSeasonSessions)
'currentSeasonSessions' => sortByMonth($currentSeasonSessions),
'previousSeasons' => $previousSeasons,
];
};