From a0b2129479ba10561811847c0651df8b55c8a6ba Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 15:15:53 +0100 Subject: Support an All-Conference-Closed Screen and mutliple Schedules & Relive-URLs --- view/allclosed.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 view/allclosed.php (limited to 'view') diff --git a/view/allclosed.php b/view/allclosed.php new file mode 100644 index 0000000..869cbc1 --- /dev/null +++ b/view/allclosed.php @@ -0,0 +1,12 @@ +getNextEvents(); + +echo $tpl->render(array( + 'page' => 'allclosed', + 'title' => 'See you soon … somewhere else!', + + 'next' => @$events[0], + 'events' => $events, +)); -- cgit v1.3.1 From 0d91cc5f111fac882f1bb375c2bf426195c9cae2 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 16:31:29 +0100 Subject: finish overview-page --- assets/css/_allconferences.less | 25 +++++++++++++++++++++++++ assets/css/_structure.less | 1 + configs/conferences/31c3/main.less | 21 +++++++++++++++++++++ index.php | 31 +++++++++++++++---------------- model/Conferences.php | 32 ++++++++++++++++++++++++-------- template/about.phtml | 2 +- template/allconferences.phtml | 33 +++++++++++++++++++++++++++++++++ view/allconferences.php | 8 ++++++++ 8 files changed, 128 insertions(+), 25 deletions(-) create mode 100644 assets/css/_allconferences.less create mode 100644 configs/conferences/31c3/main.less create mode 100644 template/allconferences.phtml create mode 100644 view/allconferences.php (limited to 'view') diff --git a/assets/css/_allconferences.less b/assets/css/_allconferences.less new file mode 100644 index 0000000..d8a14aa --- /dev/null +++ b/assets/css/_allconferences.less @@ -0,0 +1,25 @@ +body.allconferences { + text-align: center; + + .conference { + a { + font-size: @jumbo-font-size; + line-height: @jumbo-line-height; + + @media (max-width: @screen-xs-min) { + font-size: @jumbo-font-size-xs; + } + + display: block; + text-align: center; + + &:hover { + text-decoration: none; + } + } + + p { + margin-top: @line-height-computed; + } + } +} diff --git a/assets/css/_structure.less b/assets/css/_structure.less index 2082e38..d6e4257 100644 --- a/assets/css/_structure.less +++ b/assets/css/_structure.less @@ -88,3 +88,4 @@ body { @import "_closed.less"; @import "_embed.less"; @import "_feedback.less"; +@import "_allconferences.less"; diff --git a/configs/conferences/31c3/main.less b/configs/conferences/31c3/main.less new file mode 100644 index 0000000..a60d3b4 --- /dev/null +++ b/configs/conferences/31c3/main.less @@ -0,0 +1,21 @@ +@import "../../../assets/css/_structure.less"; + +// conference specific styles here + +// often configured values (and their defaults): +// +// @brand-primary: #337ab7; +// @text-color: @gray-dark; +// +// @link-color: @brand-primary; +// @link-hover-color: darken(@link-color, 15%); +// +// @navbar-default-color: #777777; +// @navbar-default-bg: #f8f8f8; +// +// @navbar-default-link-color: #777; +// @navbar-default-link-hover-color: #333; + +body { + background-color: red; +} diff --git a/index.php b/index.php index cdd58a7..a26f391 100644 --- a/index.php +++ b/index.php @@ -34,22 +34,23 @@ if($route == 'gen/main.css') exit; } +// generic template +$tpl = new PhpTemplate('template/page.phtml'); +$tpl->set(array( + 'baseurl' => forceslash(baseurl()), + 'route' => $route, + 'canonicalurl' => forceslash(baseurl()).forceslash($route), + 'assemblies' => './template/assemblies/', + 'assets' => 'assets/', + + 'conference' => new GenericConference(), +)); + @list($mandator, $route) = explode('/', $route, 2); if(!$mandator) { // root requested - $tpl = new PhpTemplate('template/page.phtml'); - $tpl->set(array( - 'baseurl' => forceslash(baseurl()), - 'route' => $route, - 'canonicalurl' => forceslash(baseurl()).forceslash($route), - 'assemblies' => './template/assemblies/', - 'assets' => 'assets/', - - 'conference' => new GenericConference(), - )); - if(Conferences::getActiveConferencesCount() == 0) { // no clients @@ -72,10 +73,7 @@ if(!$mandator) // multiple clients // show overview - // TODO Template - $clients = Conferences::getActiveConferences(); - var_dump('multiple clients'); - var_dump($clients); + require('view/allconferences.php'); exit; } } @@ -83,7 +81,8 @@ else if(!Conferences::exists($mandator)) { // old url OR wrong client OR // -> error - die('unknown conference '.$mandator); + require('view/404.php'); + exit; } Conferences::load($mandator); diff --git a/model/Conferences.php b/model/Conferences.php index 9f87388..10a3172 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -5,9 +5,16 @@ class Conferences extends ModelBase const MANDATOR_DIR = 'configs/conferences/'; public static function getConferences() { - return array_values(array_filter(scandir(forceslash(Conferences::MANDATOR_DIR)), function($el) { - return $el[0] != '.'; - })); + $conferences = []; + foreach(scandir(forceslash(Conferences::MANDATOR_DIR)) as $el) + { + if($el[0] == '.') + continue; + + $conferences[$el] = Conferences::getConferenceInformation($el); + } + + return $conferences; } public static function getConferencesCount() { return count(Conferences::getConferences()); @@ -15,7 +22,10 @@ class Conferences extends ModelBase public static function getActiveConferences() { return array_values(array_filter( - Conferences::getConferences(), ['Conferences', 'isActive'] + Conferences::getConferences(), + function($info) { + return $info['active']; + } )); } @@ -24,22 +34,28 @@ class Conferences extends ModelBase } public static function exists($mandator) { - return in_array($mandator, Conferences::getConferences()); + return array_key_exists($mandator, Conferences::getConferences()); } - public static function isActive($mandator) { + public static function getConferenceInformation($mandator) { if(isset($GLOBALS['CONFIG'])) $saved_config = $GLOBALS['CONFIG']; Conferences::load($mandator); $conf = new Conference(); - $active = !$conf->isClosed(); + $info = [ + 'slug' => $mandator, + 'link' => forceslash($mandator), + 'active' => !$conf->isClosed(), + 'title' => $conf->getTitle(), + 'description' => $conf->getDescription(), + ]; unset($GLOBALS['CONFIG']); if(isset($saved_config)) $GLOBALS['CONFIG'] = $saved_config; - return $active; + return $info; } public static function hasCustomStyles($mandator) { diff --git a/template/about.phtml b/template/about.phtml index 68aa2fb..eee4896 100644 --- a/template/about.phtml +++ b/template/about.phtml @@ -6,7 +6,7 @@

If you like what we're doing, you can flattr us:

- Flattr this + Flattr this

diff --git a/template/allconferences.phtml b/template/allconferences.phtml new file mode 100644 index 0000000..2d47b82 --- /dev/null +++ b/template/allconferences.phtml @@ -0,0 +1,33 @@ +
+

+

We are currently active on multiple Conferences. Please choose which one you want access.

+ +

+ +
+ + $info): ?> + + +
+
+
+ +

+
+
+
+ +
+
diff --git a/view/allconferences.php b/view/allconferences.php new file mode 100644 index 0000000..8cce073 --- /dev/null +++ b/view/allconferences.php @@ -0,0 +1,8 @@ +render(array( + 'page' => 'allconferences', + 'title' => 'Multiple Conferences', + + 'conferences' => Conferences::getActiveConferences(), +)); -- cgit v1.3.1 From 61c9cf52b0c015951351b47148cdecb47c680bfa Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 20:36:34 +0100 Subject: global streams api --- index.php | 15 +++-- model/Conferences.php | 2 + view/streams-json-v1.php | 164 +++++++++++++++++++++++++---------------------- 3 files changed, 100 insertions(+), 81 deletions(-) (limited to 'view') diff --git a/index.php b/index.php index b7fe5da..c3199ee 100644 --- a/index.php +++ b/index.php @@ -29,13 +29,21 @@ try { $route = @$_GET['route']; $route = rtrim($route, '/'); - // GLOBAL CSS (for conferences overview) + // GLOBAL ROUTES if($route == 'gen/main.css') { + // global css (for conferences overview) handle_lesscss_request('assets/css/main.less', '../assets/css/'); exit; } + else if($route == 'streams/v1.json') + { + require('view/streams-json-v1.php'); + exit; + } + + // generic template $tpl = new PhpTemplate('template/page.phtml'); $tpl->set(array( @@ -136,11 +144,6 @@ try { require('view/schedule-json.php'); } - else if($route == 'streams/v1.json') - { - require('view/streams-json-v1.php'); - } - else if($route == 'gen/main.css') { if(Conferences::hasCustomStyles($mandator)) diff --git a/model/Conferences.php b/model/Conferences.php index 885c2c8..9396a48 100644 --- a/model/Conferences.php +++ b/model/Conferences.php @@ -49,6 +49,8 @@ class Conferences extends ModelBase 'active' => !$conf->isClosed(), 'title' => $conf->getTitle(), 'description' => $conf->getDescription(), + + 'CONFIG' => $GLOBALS['CONFIG'], ]; unset($GLOBALS['CONFIG']); diff --git a/view/streams-json-v1.php b/view/streams-json-v1.php index c705bd7..af0909b 100644 --- a/view/streams-json-v1.php +++ b/view/streams-json-v1.php @@ -2,97 +2,111 @@ header('Content-Type: application/json'); -if($conference->isClosed()) -{ - echo '[]'; - return; -} - -$overview = new Overview(); +$conferences = Conferences::getActiveConferences(); $struct = array(); -foreach($overview->getGroups() as $group => $rooms) +if(isset($GLOBALS['CONFIG'])) + $saved_config = $GLOBALS['CONFIG']; + +foreach ($conferences as $conference) { - $roomstruct = array(); - foreach($rooms as $room) + /* + ok. das ist so hacky. EIGENTLICH müsste man aus ModelBase + das $GLOBALS tilgen und von der api ne v2 releasen, welche + conferences als eigenes Objekt betrachtet + */ + $GLOBALS['CONFIG'] = $conference['CONFIG']; + $GLOBALS['MANDATOR'] = $conference['slug']; + + $overview = new Overview(); + + foreach($overview->getGroups() as $group => $rooms) { - $streams = array(); - foreach($room->getStreams() as $stream) + $roomstruct = array(); + foreach($rooms as $room) { - $key = $stream->getSelection().'-'.$stream->getLanguage(); - - $urls = array(); - switch($stream->getPlayerType()) + $streams = array(); + foreach($room->getStreams() as $stream) { - case 'video': - foreach ($stream->getVideoProtos() as $proto => $display) - { - $urls[$proto] = array( - 'display' => $display, - 'tech' => $stream->getVideoTech($proto), - 'url' => $stream->getVideoUrl($proto), - ); - } - break; + $key = $stream->getSelection().'-'.$stream->getLanguage(); + + $urls = array(); + switch($stream->getPlayerType()) + { + case 'video': + foreach ($stream->getVideoProtos() as $proto => $display) + { + $urls[$proto] = array( + 'display' => $display, + 'tech' => $stream->getVideoTech($proto), + 'url' => $stream->getVideoUrl($proto), + ); + } + break; + + case 'slides': + foreach ($stream->getSlidesProtos() as $proto => $display) + { + $urls[$proto] = array( + 'display' => $display, + 'tech' => $stream->getSlidesTech($proto), + 'url' => $stream->getSlidesUrl($proto), + ); + } + break; - case 'slides': - foreach ($stream->getSlidesProtos() as $proto => $display) - { - $urls[$proto] = array( - 'display' => $display, - 'tech' => $stream->getSlidesTech($proto), - 'url' => $stream->getSlidesUrl($proto), - ); - } - break; + case 'audio': + foreach ($stream->getAudioProtos() as $proto => $display) + { + $urls[$proto] = array( + 'display' => $display, + 'tech' => $stream->getAudioTech($proto), + 'url' => $stream->getAudioUrl($proto), + ); + } + break; - case 'audio': - foreach ($stream->getAudioProtos() as $proto => $display) - { - $urls[$proto] = array( - 'display' => $display, - 'tech' => $stream->getAudioTech($proto), - 'url' => $stream->getAudioUrl($proto), - ); - } - break; + case 'music': + foreach ($stream->getMusicProtos() as $proto => $display) + { + $urls[$proto] = array( + 'display' => $display, + 'tech' => $stream->getMusicTech($proto), + 'url' => $stream->getMusicUrl($proto), + ); + } + break; + } - case 'music': - foreach ($stream->getMusicProtos() as $proto => $display) - { - $urls[$proto] = array( - 'display' => $display, - 'tech' => $stream->getMusicTech($proto), - 'url' => $stream->getMusicUrl($proto), - ); - } - break; + $streams[] = array( + 'slug' => $key, + 'display' => $stream->getDisplay(), + 'type' => $stream->getPlayerType(), + 'isTranslated' => $stream->isTranslated(), + 'videoSize' => $stream->getVideoSize(), + 'urls' => $urls, + ); } - $streams[] = array( - 'slug' => $key, - 'display' => $stream->getDisplay(), - 'type' => $stream->getPlayerType(), - 'isTranslated' => $stream->isTranslated(), - 'videoSize' => $stream->getVideoSize(), - 'urls' => $urls, + $roomstruct[] = array( + 'slug' => $room->getSlug(), + 'schedulename' => $room->getScheduleName(), + 'thumb' => forceslash(baseurl()).$room->getThumb(), + 'link' => forceslash(baseurl()).$room->getLink(), + 'display' => $room->getDisplay(), + 'streams' => $streams, ); } - $roomstruct[] = array( - 'slug' => $room->getSlug(), - 'schedulename' => $room->getScheduleName(), - 'thumb' => forceslash(baseurl()).$room->getThumb(), - 'link' => forceslash(baseurl()).$room->getLink(), - 'display' => $room->getDisplay(), - 'streams' => $streams, + $struct[] = array( + 'conference' => $conference['title'], + 'group' => $group, + 'rooms' => $roomstruct, ); } - - $struct[] = array( - 'group' => $group, - 'rooms' => $roomstruct, - ); } +if(isset($saved_config)) + $GLOBALS['CONFIG'] = $saved_config; + echo json_encode($struct, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); -- cgit v1.3.1