diff options
Diffstat (limited to 'view')
-rw-r--r-- | view/overview.php | 19 | ||||
-rw-r--r-- | view/streams-json-v2.php | 18 |
2 files changed, 25 insertions, 12 deletions
diff --git a/view/overview.php b/view/overview.php index adc8d5f..fb9d15d 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; - }), +$now = $schedule->getScheduleDisplayTime(); +$upcomingTalksPerRoom = []; +foreach ($conference->getRooms() as $room) { + $upcomingTalksPerRoom[$room->getSlug()] = [ + 'current' => $room->getCurrentTalk($now), + 'next' => $room->getNextTalk($now), ]; -}, $talksPerRoom); +}; echo $tpl->render(array( 'page' => 'overview', diff --git a/view/streams-json-v2.php b/view/streams-json-v2.php index 114e73e..5302e16 100644 --- a/view/streams-json-v2.php +++ b/view/streams-json-v2.php @@ -2,11 +2,24 @@ header('Content-Type: application/json'); +$basetime = time(); $struct = []; foreach (Conferences::getActiveConferences() as $conference) { + $now = $conference->getSchedule()->getScheduleDisplayTime($basetime); $overview = $conference->getOverview(); + $isInDayChange = false; + + foreach($conference->getRooms() as $room) { + $currentTalk = $room->getCurrentTalk($now); + + if($currentTalk && isset($currentTalk['special']) && $currentTalk['special'] == 'daychange') { + $isInDayChange = true; + break; + } + } + $groupstruct = array(); foreach($overview->getGroups() as $group => $rooms) { @@ -91,6 +104,10 @@ foreach (Conferences::getActiveConferences() as $conference) 'link' => forceslash(baseurl()).$room->getLink(), 'display' => $room->getDisplay(), 'stream' => $room->getStream(), + 'talks' => [ + 'current' => $room->getCurrentTalk($now), + 'next' => $room->getNextTalk($now), + ], 'streams' => $streams, ); } @@ -109,6 +126,7 @@ foreach (Conferences::getActiveConferences() as $conference) 'schedule' => $conference->getSchedule()->getScheduleUrl(), 'startsAt' => $conference->startsAt() ? $conference->startsAt()->format(DateTime::ISO8601) : null, 'endsAt' => $conference->endsAt() ? $conference->endsAt()->format(DateTime::ISO8601) : null, + 'isCurrentlyStreaming' => !$isInDayChange, 'groups' => $groupstruct, ); } |