From f6c0270d40f6730fe1e1820f2866b08792df1db6 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 10 Dec 2016 18:22:34 +0100 Subject: rewrite data-model so that every configuration option is accessed through the conference --- view/feedback-read.php | 5 +---- view/feedback.php | 4 ++-- view/overview.php | 2 +- view/relive.php | 2 +- view/room.php | 4 ++-- view/schedule-json.php | 2 +- view/schedule.php | 2 +- 7 files changed, 9 insertions(+), 12 deletions(-) (limited to 'view') diff --git a/view/feedback-read.php b/view/feedback-read.php index 4f04a02..3c29dbd 100644 --- a/view/feedback-read.php +++ b/view/feedback-read.php @@ -1,9 +1,6 @@ isEnabled()) - throw new NotFoundException('Feedback is disabled'); - +$feedback = $conference->getFeedback(); if(!$feedback->isLoggedIn()) { $feedback->requestLogin(); diff --git a/view/feedback.php b/view/feedback.php index c4ba146..cff9c8e 100644 --- a/view/feedback.php +++ b/view/feedback.php @@ -1,11 +1,11 @@ isEnabled()) +if(!$conference->hasFeedback()) throw new NotFoundException('Feedback is disabled'); $info = $_POST; +$feedback = $conference->getFeedback(); if($feedback->validate($info)) { $feedback->store($info); diff --git a/view/overview.php b/view/overview.php index 3b52e8f..93cf007 100644 --- a/view/overview.php +++ b/view/overview.php @@ -4,5 +4,5 @@ echo $tpl->render(array( 'page' => 'overview', 'title' => 'Live-Streams', - 'overview' => new Overview(), + 'overview' => $conference->getOverview(), )); diff --git a/view/relive.php b/view/relive.php index e59f80c..cc8d682 100644 --- a/view/relive.php +++ b/view/relive.php @@ -1,6 +1,6 @@ getRelive(); if(!$relive->isEnabled()) throw new NotFoundException('Internal Relive is disabled'); diff --git a/view/room.php b/view/room.php index 505be95..d586248 100644 --- a/view/room.php +++ b/view/room.php @@ -1,6 +1,6 @@ getRoom($_GET['room']); $stream = $room->selectStream( $_GET['selection'], $_GET['language']); @@ -11,5 +11,5 @@ echo $tpl->render(array( 'room' => $room, 'stream' => $stream, - 'schedule' => new Schedule(), + 'schedule' => $conference->getSchedule(), )); diff --git a/view/schedule-json.php b/view/schedule-json.php index 9aea603..19346fd 100644 --- a/view/schedule-json.php +++ b/view/schedule-json.php @@ -1,6 +1,6 @@ getSchedule(); if(!$schedule->isEnabled()) throw new NotFoundException('Schedule is disabled'); diff --git a/view/schedule.php b/view/schedule.php index 4b2746d..3a3d6db 100644 --- a/view/schedule.php +++ b/view/schedule.php @@ -5,5 +5,5 @@ echo $tpl->render(array( 'title' => 'Schedule-Übersicht', 'refresh' => 15*60, - 'schedule' => new Schedule(), + 'schedule' => $conference->getSchedule(), )); -- cgit v1.2.3 From 35e7a2b2adad42b077de60d1566c22da62edeb77 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 18 Dec 2016 13:31:34 +0100 Subject: move upcoming & current logic from javascript/ajax into php --- view/overview.php | 18 ++++++++++++++++++ view/schedule-json.php | 13 ------------- 2 files changed, 18 insertions(+), 13 deletions(-) delete mode 100644 view/schedule-json.php (limited to 'view') diff --git a/view/overview.php b/view/overview.php index 93cf007..adc8d5f 100644 --- a/view/overview.php +++ b/view/overview.php @@ -1,8 +1,26 @@ 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; + }), + ]; +}, $talksPerRoom); + echo $tpl->render(array( 'page' => 'overview', 'title' => 'Live-Streams', 'overview' => $conference->getOverview(), + + 'upcomingTalksPerRoom' => $upcomingTalksPerRoom, )); diff --git a/view/schedule-json.php b/view/schedule-json.php deleted file mode 100644 index 19346fd..0000000 --- a/view/schedule-json.php +++ /dev/null @@ -1,13 +0,0 @@ -getSchedule(); -if(!$schedule->isEnabled()) - throw new NotFoundException('Schedule is disabled'); - -header('Content-Type: application/json'); - -if($conference->isClosed()) - echo '{}'; - -else - echo json_encode($schedule->getSchedule(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); -- cgit v1.2.3