diff options
author | VOC | 2015-11-13 19:48:45 +0100 |
---|---|---|
committer | VOC | 2015-11-13 19:48:45 +0100 |
commit | 92f4fa13749566f6c4378f2c9e80774e8320b825 (patch) | |
tree | f17c6da85da6edba9c7be10138687518ee534d50 /view/streams-json-v1.php | |
parent | 32fd126b3fa937389efd1457e9d05daff9f3b347 (diff) | |
parent | 29af764323dc474c14e05985eeabd3a06ef19c86 (diff) |
Merge branch 'mandators'
Diffstat (limited to '')
-rw-r--r-- | view/streams-json-v1.php | 164 |
1 files changed, 89 insertions, 75 deletions
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); |