diff --git a/assets/css/panel.css b/assets/css/panel.css index ff60260..0b58785 100644 --- a/assets/css/panel.css +++ b/assets/css/panel.css @@ -16,7 +16,9 @@ body, :root { --color-salmon: #ff4f4b; - --color-yellow: #faff82; + --color-yellow: #d6ff00; + --color-brown: #d6cfbe; + --color-grey: #c4c9cc; } .k-panel-menu { diff --git a/site/controllers/program.php b/site/controllers/program.php index e2a1c67..9286ece 100644 --- a/site/controllers/program.php +++ b/site/controllers/program.php @@ -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, ]; }; \ No newline at end of file