From 0fb8904157ea87997fa662ad2c975d773dd75455 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 4 Apr 2015 20:11:25 +0200 Subject: [PATCH] Implement Close-Down Page with Upcoming Event --- assets/css/_bootstrap-selection.less | 2 +- config.php | 7 ++++++ index.php | 33 ++++++++++++++++++---------- model/Conference.php | 4 ++++ model/Upcoming.php | 19 ++++++++++++++++ template/closed.phtml | 25 +++++++++++++++++++++ view/closed.php | 10 +++++++++ 7 files changed, 87 insertions(+), 13 deletions(-) create mode 100644 model/Upcoming.php create mode 100644 template/closed.phtml create mode 100644 view/closed.php diff --git a/assets/css/_bootstrap-selection.less b/assets/css/_bootstrap-selection.less index dcddb2e0..8d532ca3 100644 --- a/assets/css/_bootstrap-selection.less +++ b/assets/css/_bootstrap-selection.less @@ -33,7 +33,7 @@ @import "bootstrap-3.3.2/alerts.less"; //@import "bootstrap-3.3.2/progress-bars.less"; //@import "bootstrap-3.3.2/media.less"; -//@import "bootstrap-3.3.2/list-group.less"; +@import "bootstrap-3.3.2/list-group.less"; @import "bootstrap-3.3.2/panels.less"; //@import "bootstrap-3.3.2/responsive-embed.less"; @import "bootstrap-3.3.2/wells.less"; diff --git a/config.php b/config.php index 02f8aa59..fe906055 100644 --- a/config.php +++ b/config.php @@ -10,6 +10,13 @@ if($_SERVER['HTTP_HOST'] != 'localhost') $GLOBALS['CONFIG']['CONFERENCE'] = array( + /** + * Am Ende der Konferenz wird durch das Umlegen dieses Schalters auf True eine Danke-Und-Kommen-Sie- + * Gut-Nach-Hause-Seite sowie einem Ausblick auf die kommenden Events angezeigt. Während einer + * Konferenz kann dieser Schalter auskommentiert oder auf false gesetzt werden. + */ + 'CLOSED' => false, + /** * Titel der Konferenz (kann Leer- und Sonderzeichen enthalten) * Dieser im Seiten-Header, im -Tag, in der About-Seite und ggf. ab weiteren Stellen als diff --git a/index.php b/index.php index c1a44388..76558812 100644 --- a/index.php +++ b/index.php @@ -16,10 +16,12 @@ require_once('model/RoomTab.php'); require_once('model/RoomSelection.php'); require_once('model/Stream.php'); require_once('model/Relive.php'); +require_once('model/Upcoming.php'); $route = @$_GET['route']; $route = rtrim($route, '/'); +$conference = new Conference(); $tpl = new PhpTemplate('template/page.phtml'); $tpl->set(array( @@ -27,7 +29,7 @@ $tpl->set(array( 'route' => $route, 'assemblies' => './template/assemblies/', - 'conference' => new Conference(), + 'conference' => $conference, 'feedback' => new Feedback(), 'schedule' => new Schedule(), )); @@ -35,36 +37,43 @@ $tpl->set(array( ob_start(); try { - if($route == '') + + + if($route == 'feedback/read') + { + require('view/feedback-read.php'); + } + + else if($conference->isClosed()) + { + require('view/closed.php'); + } + + else if($route == '') { require('view/overview.php'); } - else if(preg_match('@^about$@', $route, $m)) + else if($route == 'about') { require('view/about.php'); } - else if(preg_match('@^schedule.json$@', $route, $m)) + else if($route == 'schedule.json') { require('view/schedule-json.php'); } - else if(preg_match('@^multiview$@', $route, $m)) + else if($route == 'multiview') { require('view/multiview.php'); } - else if(preg_match('@^feedback$@', $route, $m)) + else if($route == 'feedback') { require('view/feedback.php'); } - else if(preg_match('@^feedback/read$@', $route, $m)) - { - require('view/feedback-read.php'); - } - else if(preg_match('@^relive/([0-9]+)$@', $route, $m)) { $_GET = array( @@ -73,7 +82,7 @@ try { require('view/relive-player.php'); } - else if(preg_match('@^relive$@', $route, $m)) + else if($route == 'relive') { require('view/relive.php'); } diff --git a/model/Conference.php b/model/Conference.php index e9e33a61..a4c14aa6 100644 --- a/model/Conference.php +++ b/model/Conference.php @@ -6,6 +6,10 @@ class Conference extends ModelBase return $this->get('CONFERENCE.TITLE', 'C3Voc Streaming'); } + public function isClosed() { + return $this->get('CONFERENCE.CLOSED'); + } + public function hasAuthor() { return $this->has('CONFERENCE.AUTHOR'); } diff --git a/model/Upcoming.php b/model/Upcoming.php new file mode 100644 index 00000000..6f548144 --- /dev/null +++ b/model/Upcoming.php @@ -0,0 +1,19 @@ +<?php + +class Upcoming +{ + public function getNextEvent() + { + try { + $events = file_get_contents('https://c3voc.de/eventkalender/events.json?filter=upcoming'); + $events = json_decode($events, true); + $names = array_keys($events['voc_events']); + + return $events['voc_events'][$names[0]]; + } + catch(ErrorException $e) + { + return null; + } + } +} diff --git a/template/closed.phtml b/template/closed.phtml new file mode 100644 index 00000000..f6734fa7 --- /dev/null +++ b/template/closed.phtml @@ -0,0 +1,25 @@ +<div class="container about"> + <h1><?=h($conference->getTitle())?> is over!</h1> + + <? if($upcoming): ?> + <h2>See you soon at <?=h($upcoming['name'])?></h2> + <? endif ?> + + <p> + Lecture recording and streaming at <strong><?=h($conference->getTitle())?></strong> was organized and performed by the <a href="http://c3voc.de">Chaos Computer Club Video Operation Center</a>. The next Event we'll attend will be at + </p> + + <br><br><br> + + <div class="col-xs-10 col-xs-offset-1 col-md-6 col-md-offset-3"> + + <div class="panel panel-default"> + <div class="panel-heading"><?=h($upcoming['name'])?></div> + <div class="panel-body"> + <?=h($upcoming['location'])?><br /> + <?=h($upcoming['start_date'])?> – <?=h($upcoming['end_date'])?> + </div> + </div> + + </div> +</div> diff --git a/view/closed.php b/view/closed.php new file mode 100644 index 00000000..e1b126cd --- /dev/null +++ b/view/closed.php @@ -0,0 +1,10 @@ +<?php + +$upcoming = new Upcoming(); + +echo $tpl->render(array( + 'page' => 'closed', + 'title' => 'See you soon … somewhere else!', + + 'upcoming' => $upcoming->getNextEvent(), +));