diff options
author | MaZderMind | 2018-05-12 01:57:14 +0200 |
---|---|---|
committer | MaZderMind | 2018-05-12 01:57:14 +0200 |
commit | 888bff1972e18a7f32d55fcc23cd4900d03c7d61 (patch) | |
tree | 5d4168fb824b5bac202c424682605deb1745b13b /view | |
parent | 2cf00ac475500f007bce90cf81d8d582208650c9 (diff) |
migrate logic to select current & upcoming talk into the Room class
Diffstat (limited to '')
-rw-r--r-- | view/overview.php | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/view/overview.php b/view/overview.php index adc8d5f..e5032c4 100644 --- a/view/overview.php +++ b/view/overview.php @@ -2,19 +2,14 @@ $schedule = $conference->getSchedule(); -$talksPerRoom = $schedule->getSchedule(); $now = time() + $schedule->getSimulationOffset(); - -$upcomingTalksPerRoom = array_map(function($talks) use($now) { - return [ - 'current' => array_filter_last($talks, function($talk) use ($now) { - return $talk['start'] < $now && $talk['end'] > $now; - }), - 'next' => array_filter_first($talks, function($talk) use ($now) { - return !isset($talk['special']) && $talk['start'] > $now; - }), +$upcomingTalksPerRoom = []; +foreach ($conference->getRooms() as $room) { + $upcomingTalksPerRoom[$room->getSlug()] = [ + 'current' => $room->getCurrentTalk($now), + 'next' => $room->getNextTalk($now), ]; -}, $talksPerRoom); +}; echo $tpl->render(array( 'page' => 'overview', |