aboutsummaryrefslogtreecommitdiff
path: root/view/room.php
diff options
context:
space:
mode:
authorMaZderMind2015-03-30 16:20:30 +0200
committerMaZderMind2015-03-30 16:20:30 +0200
commitf7d9d592745d1cb5cb2de76ed6ae99be974f1807 (patch)
tree0f9f77efe9efc70b3ac0404a46b249f809197922 /view/room.php
parentea4b6c7699a7fbb7be3d9e5ce86c84a36b63f569 (diff)
Implement MVT Pattern based on simple Config options
Diffstat (limited to 'view/room.php')
-rw-r--r--view/room.php118
1 files changed, 6 insertions, 112 deletions
diff --git a/view/room.php b/view/room.php
index 4484a14..505be95 100644
--- a/view/room.php
+++ b/view/room.php
@@ -1,121 +1,15 @@
<?php
-$room = $_GET['room'];
-$language = $_GET['language'];
-$selection = $_GET['selection'];
-
-if(!has("ROOMS.$room"))
- return include('pages/404.php');
-
-$formats = get("ROOMS.$room.FORMATS");
-$has_translation = get("ROOMS.$room.TRANSLATION");
-
-$protos = array();
-$selections = array();
-$tabs = array();
-$videores = array();
-
-if(room_has_hd($room))
- $selections[] = $videores[] = 'hd';
-
-if(room_has_sd($room))
- $selections[] = $videores[] = 'sd';
-
-if(room_has_video($room))
- $tabs[] = 'video';
-
-
-if(room_has_audio($room))
- $selections[] = $tabs[] = 'audio';
-
-if(room_has_music($room))
- $selections[] = $tabs[] = 'music';
-
-if(room_has_slides($room))
- $selections[] = $tabs[] = 'slides';
-
-
-if(room_has_rtmp($room))
- $protos[] = 'rtmp';
-
-if(room_has_webm($room))
- $protos[] = 'webm';
-
-if(room_has_hls($room))
- $protos[] = 'hls';
-
-
-
-// default page
-if(!$selection)
- $selection = $selections[0];
-
-if(!in_array($selection, $selections))
- return include('pages/404.php');
-
-
-
-switch($selection) {
- case 'audio':
- $tab = 'audio';
- $title = 'Audio';
- break;
-
- case 'music':
- $tab = 'music';
- $title = 'Music';
- break;
-
- case 'slides':
- $tab = 'slides';
- $title = 'Slides';
- $width = 1024;
- $height = 576;
- break;
-
- case 'hd':
- $tab = 'video';
- $title = 'FullHD Video';
- $width = 1920;
- $height = 1080;
- break;
-
- case 'sd':
- $tab = 'video';
- $title = 'SD Video';
- $width = 1024;
- $height = 576;
- break;
-}
-
-if($language == 'translated')
-{
- if(!$has_translation)
- return include('pages/404.php');
-
- $title = 'Translated '.$title;
-}
+$room = new Room($_GET['room']);
+$stream = $room->selectStream(
+ $_GET['selection'], $_GET['language']);
echo $tpl->render(array(
'page' => 'room',
- 'title' => get("ROOMS.$room.DISPLAY").' – '.$title,
+ 'title' => $stream->getDisplay(),
'room' => $room,
+ 'stream' => $stream,
- 'program' => program(),
-
- 'tab' => $tab,
- 'tabs' => $tabs,
-
- 'width' => @$width,
- 'height' => @$height,
- 'language' => $language,
- 'translated' => ($language == 'translated'),
- 'selection' => $selection,
- 'hlsformat' => ($selection == 'hd' ? 'auto' : $selection),
-
- 'has_translation' => $has_translation,
- 'formats' => $formats,
- 'protos' => $protos,
- 'videores' => $videores,
+ 'schedule' => new Schedule(),
));