aboutsummaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorMaZderMind2015-03-30 16:20:30 +0200
committerMaZderMind2015-03-30 16:20:30 +0200
commitf7d9d592745d1cb5cb2de76ed6ae99be974f1807 (patch)
tree0f9f77efe9efc70b3ac0404a46b249f809197922 /template
parentea4b6c7699a7fbb7be3d9e5ce86c84a36b63f569 (diff)
Implement MVT Pattern based on simple Config options
Diffstat (limited to '')
-rw-r--r--template/assemblies/chat.phtml13
-rw-r--r--template/assemblies/player/audio.phtml26
-rw-r--r--template/assemblies/player/music.phtml26
-rw-r--r--template/assemblies/player/slides.phtml20
-rw-r--r--template/assemblies/player/video.phtml42
-rw-r--r--template/assemblies/switcher/audio.phtml33
-rw-r--r--template/assemblies/switcher/music.phtml23
-rw-r--r--template/assemblies/switcher/slides.phtml52
-rw-r--r--template/assemblies/switcher/video.phtml36
-rw-r--r--template/page.phtml2
-rw-r--r--template/room.phtml36
11 files changed, 136 insertions, 173 deletions
diff --git a/template/assemblies/chat.phtml b/template/assemblies/chat.phtml
index 85245b2..8498c45 100644
--- a/template/assemblies/chat.phtml
+++ b/template/assemblies/chat.phtml
@@ -1,14 +1,15 @@
-<? if(room_has_irc($room)): ?>
+<? if($room->hasIrc()): ?>
<div>
- <a class="btn btn-primary irclink" href="<?=h(room_get_irc_url($room))?>" target="_blank">
- <span class="fa fa-comment"></span> <?=h(room_get_irc_display($room))?>
+ <a class="btn btn-primary irclink" href="<?=h($room->getIrcUrl())?>" target="_blank">
+ <span class="fa fa-comment"></span> <?=h($room->getIrcDisplay())?>
</a>
</div>
<? endif ?>
-<? if(room_has_twitter($room)): ?>
+
+<? if($room->hasTwitter($room)): ?>
<div>
- <a class="btn twitterlink" href="https://twitter.com/intent/tweet?text=<?=h(rawurlencode(room_get_twitter_hashtag($room)))?>" target="_blank">
- <span class="fa fa-twitter"></span> <?=h(room_get_twitter_display($room))?>
+ <a class="btn twitterlink" href="<?=h($room->getTwitterUrl())?>" target="_blank">
+ <span class="fa fa-twitter"></span> <?=h($room->getTwitterDisplay())?>
</a>
</div>
<? endif ?>
diff --git a/template/assemblies/player/audio.phtml b/template/assemblies/player/audio.phtml
index e007ab3..f8ed579 100644
--- a/template/assemblies/player/audio.phtml
+++ b/template/assemblies/player/audio.phtml
@@ -3,22 +3,12 @@
preload="auto"
style="width: 230px;"
>
- <? if(in_array("audio-mp3", $formats)): ?>
- <source
- src="<?=h(link_stream('audio', $room, 'mp3', @$translated))?>"
- type="audio/mp3"
- />
- <? endif ?>
- <? if(in_array("audio-opus", $formats)): ?>
- <source
- src="<?=h(link_stream('audio', $room, 'opus', @$translated))?>"
- type="audio/opus"
- />
- <? endif ?>
- <? if(in_array("audio-ogg", $formats)): ?>
- <source
- src="<?=h(link_stream('audio', $room, 'ogg', @$translated))?>"
- type="audio/ogg"
- />
- <? endif ?>
+ <source
+ src="<?=h($stream->getAudioUrl('mp3'))?>"
+ type="audio/mp3"
+ />
+ <source
+ src="<?=h($stream->getAudioUrl('opus'))?>"
+ type="audio/opus"
+ />
</audio>
diff --git a/template/assemblies/player/music.phtml b/template/assemblies/player/music.phtml
index 587d2d2..b1c804a 100644
--- a/template/assemblies/player/music.phtml
+++ b/template/assemblies/player/music.phtml
@@ -3,22 +3,12 @@
preload="auto"
style="width: 230px;"
>
- <? if(in_array("music-mp3", $formats)): ?>
- <source
- src="<?=h(link_stream('music', $room, 'mp3', @$translated))?>"
- type="audio/mp3"
- />
- <? endif ?>
- <? if(in_array("music-opus", $formats)): ?>
- <source
- src="<?=h(link_stream('music', $room, 'opus', @$translated))?>"
- type="audio/opus"
- />
- <? endif ?>
- <? if(in_array("music-ogg", $formats)): ?>
- <source
- src="<?=h(link_stream('music', $room, 'ogg', @$translated))?>"
- type="audio/ogg"
- />
- <? endif ?>
+ <source
+ src="<?=h($stream->getMusicUrl('mp3'))?>"
+ type="audio/mp3"
+ />
+ <source
+ src="<?=h($stream->getMusicUrl('opus'))?>"
+ type="audio/opus"
+ />
</audio>
diff --git a/template/assemblies/player/slides.phtml b/template/assemblies/player/slides.phtml
index c2720d6..7887aa0 100644
--- a/template/assemblies/player/slides.phtml
+++ b/template/assemblies/player/slides.phtml
@@ -1,28 +1,22 @@
-<div style="width: 100%; height: 100%; max-width: <?=h($width)?>px; margin: 0 auto;">
+<div style="max-width: <?=h($stream->getVideoWidth())?>px; max-height: <?=h($stream->getVideoHeight())?>px;" class="video-wrap">
<video
autoplay="autoplay"
preload="auto"
- width="<?=h($width)?>"
- height="<?=h($height)?>"
+ width="<?=h($stream->getVideoWidth())?>"
+ height="<?=h($stream->getVideoHeight())?>"
style="width: 100%; height: 100%;"
>
- <!--source
+ <source
data-plugin-type="native"
- src="<?=h(link_stream('webm', $room, 'webm_slides', $translated))?>"
+ src="<?=h($stream->getSlidesUrl('webm'))?>"
title="WebM (Icecast)"
type="video/webm"
- /-->
- <source
- data-plugin-type="flash"
- src="<?=h(link_stream('rtmp', $room, 'slides', $translated))?>"
- title="h.264 (RTMP)"
- type="video/rtmp"
/>
<source
data-plugin-type="native"
- src="<?=h(link_stream('hls', $room, 'slides', $translated))?>"
+ src="<?=h($stream->getSlidesUrl('hls'))?>"
title="h.264 (HLS)"
type="application/vnd.apple.mpegURL"
/>
</video>
-</div> \ No newline at end of file
+</div>
diff --git a/template/assemblies/player/video.phtml b/template/assemblies/player/video.phtml
index 0861cf8..3ffc333 100644
--- a/template/assemblies/player/video.phtml
+++ b/template/assemblies/player/video.phtml
@@ -1,34 +1,22 @@
-<div style="max-width: <?=h($width)?>px; max-height: <?=h($height)?>px;" class="video-wrap">
+<div style="max-width: <?=h($stream->getVideoWidth())?>px; max-height: <?=h($stream->getVideoHeight())?>px;" class="video-wrap">
<video
autoplay="autoplay"
preload="auto"
- width="<?=h($width)?>"
- height="<?=h($height)?>"
+ width="<?=h($stream->getVideoWidth())?>"
+ height="<?=h($stream->getVideoHeight())?>"
style="width: 100%; height: 100%;"
>
- <? if(in_array("webm-$selection", $formats)): ?>
- <source
- data-plugin-type="native"
- src="<?=h(link_stream('webm', $room, $selection, $translated))?>"
- title="WebM (Icecast)"
- type="video/webm"
- />
- <? endif ?>
- <? if(in_array("hls-$selection", $formats)): ?>
- <source
- data-plugin-type="native"
- src="<?=h(link_stream('hls', $room, $hlsformat, $translated))?>"
- title="h.264 (HLS)"
- type="application/vnd.apple.mpegURL"
- />
- <? endif ?>
- <? if(in_array("rtmp-$selection", $formats)): ?>
- <source
- data-plugin-type="flash"
- src="<?=h(link_stream('rtmp', $room, $selection, $translated))?>"
- title="h.264 (RTMP)"
- type="video/rtmp"
- />
- <? endif ?>
+ <source
+ data-plugin-type="native"
+ src="<?=h($stream->getVideoUrl('webm'))?>"
+ title="WebM (Icecast)"
+ type="video/webm"
+ />
+ <source
+ data-plugin-type="native"
+ src="<?=h($stream->getVideoUrl('hls'))?>"
+ title="h.264 (HLS)"
+ type="application/vnd.apple.mpegURL"
+ />
</video>
</div>
diff --git a/template/assemblies/switcher/audio.phtml b/template/assemblies/switcher/audio.phtml
index 53131d3..9f3ba76 100644
--- a/template/assemblies/switcher/audio.phtml
+++ b/template/assemblies/switcher/audio.phtml
@@ -1,5 +1,6 @@
<div class="container-fluid">
- <? if($has_translation): ?>
+ <? $selection = $room->createSelectionObject('audio') ?>
+ <? if($room->hasTranslation()): ?>
<h3>Audio</h3>
<div class="formats row">
@@ -7,11 +8,11 @@
<div class="btn-group" role="group">
<div class="btn btn-primary" disabled>Audio</div>
- <a href="<?=h(link_player($room, 'audio'))?>" class="btn btn-default">
+ <a href="<?=h($selection->getLink())?>" class="btn btn-default">
<span class="fa fa-flag-o"></span>
native
</a>
- <a href="<?=h(link_player($room, 'audio', true))?>" class="btn btn-default">
+ <a href="<?=h($selection->getTranslatedLink())?>" class="btn btn-default">
<span class="fa fa-flag"></span>
translated
</a>
@@ -23,35 +24,35 @@
<? endif ?>
- <h3>Directlinks</h3>
- <div class="formats row">
- <? foreach(array_intersect($formats, array('audio-mp3', 'audio-opus', 'audio-ogg')) as $format): ?>
- <div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
- <? $proto = substr($format, 6) ?>
- <div class="btn-group" role="group" title="<?=h(get("FORMAT.$format"))?>">
- <div class="btn btn-primary" disabled><?=h(strtoupper($proto))?></div>
+ <div class="directlinks">
- <? if($has_translation): ?>
+ <? foreach(Stream::getAudioProtos() as $proto => $display): ?>
+ <h3>Directlinks (<?=h($display)?>)</h3>
+ <div class="row">
+ <div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
+ <div class="btn-group" role="group">
+ <div class="btn btn-primary" disabled><?=h($selection->getDisplay())?></div>
+ <? if($room->hasTranslation()): ?>
- <a href="<?=h(link_stream('audio', $room, $proto))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject('audio', 'native')->getAudioUrl($proto))?>" class="btn btn-default">
<span class="fa fa-flag-o"></span>
native
</a>
- <a href="<?=h(link_stream('audio', $room, $proto, true))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject('audio', 'translated')->getAudioUrl($proto))?>" class="btn btn-default">
<span class="fa fa-flag"></span>
translated
</a>
<? else: ?>
- <a href="<?=h(link_stream('audio', $room, $proto))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject('audio')->getAudioUrl($proto))?>" class="btn btn-default">
<span class="fa fa-volume-up"></span>
- audio
+ video
</a>
<? endif ?>
-
+ </div>
</div>
</div>
<? endforeach ?>
diff --git a/template/assemblies/switcher/music.phtml b/template/assemblies/switcher/music.phtml
index df1fbf2..a6b3ffc 100644
--- a/template/assemblies/switcher/music.phtml
+++ b/template/assemblies/switcher/music.phtml
@@ -1,21 +1,20 @@
<div class="container-fluid">
<h3>Directlinks</h3>
- <div class="formats row">
+ <div class="directlinks">
+ <div class="row">
+ <? foreach(Stream::getMusicProtos() as $proto => $display): ?>
+ <div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
+ <div class="btn-group" role="group">
+ <div class="btn btn-primary" disabled><?=h($display)?></div>
- <? foreach(array_intersect($formats, array('music-mp3', 'music-opus', 'music-ogg')) as $format): ?>
- <div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
- <? $proto = substr($format, 6) ?>
- <div class="btn-group" role="group" title="<?=h(get("FORMAT.$format"))?>">
- <div class="btn btn-primary" disabled><?=h(strtoupper($proto))?></div>
-
- <a href="<?=h(link_stream('music', $room, $proto))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject('music')->getMusicUrl($proto))?>" class="btn btn-default">
<span class="fa fa-music"></span>
- music
+ live music
</a>
+ </div>
</div>
- </div>
- <? endforeach ?>
-
+ <? endforeach ?>
+ </div>
</div>
</div>
diff --git a/template/assemblies/switcher/slides.phtml b/template/assemblies/switcher/slides.phtml
index 7355da0..a5f5082 100644
--- a/template/assemblies/switcher/slides.phtml
+++ b/template/assemblies/switcher/slides.phtml
@@ -1,5 +1,6 @@
<div class="container-fluid">
- <? if($has_translation): ?>
+ <? $selection = $room->createSelectionObject('audio') ?>
+ <? if($room->hasTranslation()): ?>
<h3>Slides</h3>
<div class="formats row">
@@ -7,11 +8,11 @@
<div class="btn-group" role="group">
<div class="btn btn-primary" disabled>Slides</div>
- <a href="<?=h(link_player($room, 'slides'))?>" class="btn btn-default">
+ <a href="<?=h($selection->getLink())?>" class="btn btn-default">
<span class="fa fa-flag-o"></span>
native
</a>
- <a href="<?=h(link_player($room, 'slides', true))?>" class="btn btn-default">
+ <a href="<?=h($selection->getTranslatedLink())?>" class="btn btn-default">
<span class="fa fa-flag"></span>
translated
</a>
@@ -22,38 +23,39 @@
</div>
<? endif ?>
- <h3>Directlinks</h3>
- <div class="formats row">
- <? foreach(array_intersect($protos, array('rtmp', 'hls')) as $proto): ?>
- <div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
- <div class="btn-group" role="group" title="<?=h(get("FORMAT.slides"))?>">
- <div class="btn btn-primary" disabled><?=h(strtoupper($proto))?></div>
- <? if($has_translation): ?>
+ <div class="directlinks">
- <a href="<?=h(link_stream($proto, $room, 'slides'))?>" class="btn btn-default">
- <span class="fa fa-flag-o"></span>
- native
- </a>
- <a href="<?=h(link_stream($proto, $room, 'slides', true))?>" class="btn btn-default">
- <span class="fa fa-flag"></span>
- translated
- </a>
+ <? foreach(Stream::getSlidesProtos() as $proto => $display): ?>
+ <h3>Directlinks (<?=h($display)?>)</h3>
+ <div class="row">
+ <div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
+ <div class="btn-group" role="group" title="<?=h(get("FORMAT.slides"))?>">
+ <div class="btn btn-primary" disabled><?=h($selection->getDisplay())?></div>
+ <? if($room->hasTranslation()): ?>
- <? else: ?>
+ <a href="<?=h($room->createStreamObject('slides', 'native')->getSlidesUrl($proto))?>" class="btn btn-default">
+ <span class="fa fa-flag-o"></span>
+ native
+ </a>
+ <a href="<?=h($room->createStreamObject('slides', 'translated')->getSlidesUrl($proto))?>" class="btn btn-default">
+ <span class="fa fa-flag"></span>
+ translated
+ </a>
- <a href="<?=h(link_stream($proto, $room, 'slides'))?>" class="btn btn-default">
- <span class="fa fa-picture-o"></span>
- slides
- </a>
+ <? else: ?>
- <? endif ?>
+ <a href="<?=h($room->createStreamObject('slides')->getSlidesUrl($proto))?>" class="btn btn-default">
+ <span class="fa fa-picture-o"></span>
+ slides
+ </a>
+ <? endif ?>
+ </div>
</div>
</div>
<? endforeach ?>
</div>
-
</div> \ No newline at end of file
diff --git a/template/assemblies/switcher/video.phtml b/template/assemblies/switcher/video.phtml
index 5a35657..c0429d3 100644
--- a/template/assemblies/switcher/video.phtml
+++ b/template/assemblies/switcher/video.phtml
@@ -2,25 +2,26 @@
<h3>Video</h3>
<div class="formats row">
- <? foreach($videores as $iter): ?>
+ <? foreach($room->getVideoResolutions() as $res): ?>
+ <? $selection = $room->createSelectionObject($res) ?>
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
<div class="btn-group" role="group">
- <div class="btn btn-primary" disabled><?=h(strtoupper($iter))?></div>
+ <div class="btn btn-primary" disabled><?=h($selection->getDisplay())?></div>
- <? if($has_translation): ?>
+ <? if($room->hasTranslation()): ?>
- <a href="<?=h(link_player($room, $iter))?>" class="btn btn-default">
+ <a href="<?=h($selection->getLink())?>" class="btn btn-default">
<span class="fa fa-flag-o"></span>
native
</a>
- <a href="<?=h(link_player($room, $iter, true))?>" class="btn btn-default">
+ <a href="<?=h($selection->getTranslatedLink())?>" class="btn btn-default">
<span class="fa fa-flag"></span>
translated
</a>
<? else: ?>
- <a href="<?=h(link_player($room, $iter))?>" class="btn btn-default">
+ <a href="<?=h($selection->getLink())?>" class="btn btn-default">
<span class="fa fa-video-camera"></span>
video
</a>
@@ -37,30 +38,28 @@
</div>
<div class="directlinks">
-
- <? foreach($protos as $proto): ?>
- <h3>Directlinks (<?=h(strtoupper($proto))?>)</h3>
+ <? foreach(Stream::getVideoProtos() as $proto => $display): ?>
+ <h3>Directlinks (<?=h($display)?>)</h3>
<div class="row">
- <? foreach($formats as $format): ?>
- <? if(!startswith($proto, $format)) continue ?>
- <? $res = substr($format, -2) ?>
+ <? foreach($room->getVideoResolutions() as $res): ?>
+ <? $selection = $room->createSelectionObject($res) ?>
<div class="col-lg-3 col-md-4 col-lg-5 col-xs-12">
- <div class="btn-group" role="group" title="<?=h(get("FORMAT.$format"))?>">
- <div class="btn btn-primary" disabled><?=h(strtoupper($res))?></div>
- <? if($has_translation): ?>
+ <div class="btn-group" role="group">
+ <div class="btn btn-primary" disabled><?=h($selection->getDisplay())?></div>
+ <? if($room->hasTranslation()): ?>
- <a href="<?=h(link_stream($proto, $room, $res))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject($res, 'native')->getVideoUrl($proto))?>" class="btn btn-default">
<span class="fa fa-flag-o"></span>
native
</a>
- <a href="<?=h(link_stream($proto, $room, $res, true))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject($res, 'translated')->getVideoUrl($proto))?>" class="btn btn-default">
<span class="fa fa-flag"></span>
translated
</a>
<? else: ?>
- <a href="<?=h(link_stream($proto, $room, $res))?>" class="btn btn-default">
+ <a href="<?=h($room->createStreamObject($res)->getVideoUrl($proto))?>" class="btn btn-default">
<span class="fa fa-video-camera"></span>
video
</a>
@@ -71,6 +70,5 @@
<? endforeach ?>
</div>
<? endforeach ?>
-
</div>
</div>
diff --git a/template/page.phtml b/template/page.phtml
index 58f502c..cb79c16 100644
--- a/template/page.phtml
+++ b/template/page.phtml
@@ -27,7 +27,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="<?=h($baseurl)?>" />
- <link href="<?=h($baseurl.forceslash($GLOBALS['ROUTE']))?>" rel="canonical" />
+ <link href="<?=h($baseurl.forceslash($route))?>" rel="canonical" />
<link href="assets/img/apple-touch-icon/76x76.png" rel="apple-touch-icon" />
<link href="assets/img/apple-touch-icon/76x76.png" rel="apple-touch-icon" sizes="76x76" />
diff --git a/template/room.phtml b/template/room.phtml
index 416629b..25a7255 100644
--- a/template/room.phtml
+++ b/template/room.phtml
@@ -1,17 +1,17 @@
-<div class="container <?=h($tab)?> <?=h($selection)?> <?=h($language)?>">
+<div class="container <?=h($stream->getTab())?> <?=h($stream->getSelection())?> <?=h($stream->getLanguage())?>">
<div class="row headline">
<div class="col-xs-12">
- <h1 data-room="<?=h(get("ROOMS.$room.DISPLAY"))?>"><?=h($title)?></h1>
+ <h1 data-room="<?=h($room->getDisplay())?>"><?=h($stream->getDisplay())?></h1>
</div>
</div>
<ul class="nav nav-player nav-tabs nav-justified">
- <? foreach($tabs as $iter): ?>
+ <? foreach($room->getTabs() as $tab): ?>
<li
- <? if($tab == $iter):?>class="active"<? endif ?>
+ <? if($tab->getTab() == $stream->getTab()): ?>class="active"<? endif ?>
>
- <a href="<?=h(link_player($room, $iter))?>">
- <?=h(ucfirst($iter))?>
+ <a href="<?=h($tab->getLink())?>">
+ <?=h($tab->getDisplay())?>
</a>
</li>
<? endforeach ?>
@@ -19,7 +19,7 @@
<div class="player-wrap tab-content">
<div role="tabpanel" class="tab-pane active">
- <? include("$assemblies/player/$tab.phtml") ?>
+ <? require("$assemblies/player/".$stream->getPlayerType().".phtml") ?>
</div>
</div>
@@ -27,17 +27,17 @@
<li class="active">
<a href="#switcher" role="tab" data-toggle="tab">Formats</a>
</li>
- <? if(room_has_chat($room)): ?>
+ <? if($room->hasChat()): ?>
<li>
<a href="#chat" role="tab" data-toggle="tab">Chat</a>
</li>
<? endif ?>
- <? if(get("ROOMS.$room.SCHEDULE") && has("SCHEDULE")): ?>
+ <? if($room->hasSchedule()): ?>
<li>
- <a href="#program" role="tab" data-toggle="tab">Program</a>
+ <a href="#schedule" role="tab" data-toggle="tab">Schedule</a>
</li>
<? endif ?>
- <? if(get("ROOMS.$room.FEEDBACK") && has("FEEDBACK")): ?>
+ <? if($room->hasFeedback()): ?>
<li>
<a href="#feedback" role="tab" data-toggle="tab">Feedback</a>
</li>
@@ -46,21 +46,21 @@
<div class="functions-wrap tab-content">
<div role="tabpanel" class="tab-pane active" id="switcher">
- <? include("$assemblies/switcher/$tab.phtml") ?>
+ <? require("$assemblies/switcher/".$stream->getPlayerType().".phtml") ?>
</div>
- <? if(room_has_chat($room)): ?>
+ <? if($room->hasChat()): ?>
<div role="tabpanel" class="tab-pane" id="chat">
- <? include("$assemblies/chat.phtml") ?>
+ <? require("$assemblies/chat.phtml") ?>
</div>
<? endif ?>
- <? if(get("ROOMS.$room.SCHEDULE") && has("SCHEDULE")): ?>
+ <? if($room->hasSchedule()): ?>
<div role="tabpanel" class="tab-pane" id="program">
- <? include("$assemblies/program.phtml") ?>
+ <? require("$assemblies/program.phtml") ?>
</div>
<? endif ?>
- <? if(get("ROOMS.$room.FEEDBACK") && has("FEEDBACK")): ?>
+ <? if($room->hasFeedback()): ?>
<div role="tabpanel" class="tab-pane" id="feedback">
- <? include("$assemblies/feedback.phtml") ?>
+ <? require("$assemblies/feedback.phtml") ?>
</div>
<? endif ?>
</div>