31 protected \ilCtrlInterface
$ctrl;
37 protected \ilGlobalTemplateInterface
$tpl;
38 protected \ILIAS\DI\UIServices
$ui;
39 protected \ilLanguage
$lng;
53 $this->
ui = $DIC->ui();
55 $this->
lng = $DIC->language();
56 $this->media_cast = $obj;
59 $this->
user = $DIC->user();
60 $this->main_tpl = $DIC->ui()->mainTemplate();
61 $this->
toolbar = $DIC->toolbar();
62 $this->
ctrl = $DIC->ctrl();
63 $this->mc_manager = $DIC->mediaCast()->internal()->domain()->mediaCast(
83 if (count($this->video_sequence->getVideos()) == 0) {
88 $widget->setVideo($this->video_sequence->getFirst());
89 return $widget->render();
97 $video_cnt = count($this->video_sequence->getVideos());
103 $factory = $this->
ui->factory();
104 $renderer = $this->
ui->renderer();
106 if ($video_cnt > 1) {
107 $back = $factory->button()->standard(
108 "<span class=\"glyphicon glyphicon-chevron-left \" aria-hidden=\"true\"></span>",
111 ->withOnLoadCode(
function (
$id) {
113 "$(\"#$id\").click(function() { il.VideoWidget.previous(\"" . $this->video_wrapper_id .
"\"); return false;});";
115 $next = $factory->button()->standard(
116 "<span class=\"glyphicon glyphicon-chevron-right \" aria-hidden=\"true\"></span>",
119 ->withOnLoadCode(
function (
$id) {
121 "$(\"#$id\").click(function() { il.VideoWidget.next(\"" . $this->video_wrapper_id .
"\"); return false;});";
124 $toolbar->addStickyItem($back);
128 $toolbar->addStickyItem($dd);
131 $toolbar->addStickyItem($next);
136 $toolbar->addSeparator();
138 $autoplay_on = $s->create();
139 $autoplay_off = $s->create();
140 $button = $factory->button()->toggle($lng->txt(
"mcst_autoplay"), $autoplay_on, $autoplay_off, $autoplay);
141 $toolbar->addStickyItem($button);
142 $this->main_tpl->addOnLoadCode(
" 143 $(document).on('" . $autoplay_on .
"', function (event, signalData) { 144 il.VideoPlaylist.autoplay('mcst_playlist', true); 146 $(document).on('" . $autoplay_off .
"', function (event, signalData) { 147 il.VideoPlaylist.autoplay('mcst_playlist', false); 151 if ($video_cnt > 0 && $this->rss_link !==
"") {
152 $f = $this->
ui->factory();
154 $f->link()->standard(
155 $lng->txt(
"mcst_webfeed"),
157 )->withOpenInNewViewport(
true)
159 $toolbar->addComponent(
$f->dropdown()->standard($actions));
165 $video_cnt = count($this->video_sequence->getVideos());
166 if ($video_cnt <= 1) {
169 $autoplay = ($this->
user->existsPref(
"mcst_autoplay"))
170 ? (
bool) $this->
user->getPref(
"mcst_autoplay")
182 foreach ($this->video_sequence->getVideos() as $video) {
183 $actions[] = $this->
ui->factory()->button()->shy(
187 return "document.getElementById('$id').addEventListener('click', () => {il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"'); $('.ilToolbarStickyItem .dropdown.open').removeClass('open');});";
190 if (count($actions) > 0) {
191 return $this->
ui->factory()->dropdown()->standard($actions);
203 $tpl = new \ilTemplate(
"tpl.video_cast_side.html",
true,
true,
"Modules/MediaCast/Presentation");
205 $factory = $this->
ui->factory();
206 $renderer = $this->
ui->renderer();
214 foreach ($this->video_sequence->getVideos() as $video) {
217 $video->getPreviewPic(),
218 "il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"');",
219 $video->getPlayingTime()
224 if (count($re) > 0) {
225 if ($re[0][
"read_count"] > 0) {
230 $b = $factory->button()->shy($video->getTitle(),
"")->
withOnLoadCode(
function (
$id) use ($video) {
232 "$(\"#$id\").click(function() { il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"'); return false;});";
236 "id" => $video->getId(),
237 "resource" => $video->getResource(),
238 "preview" => $preview->render(),
239 "preview_pic" => $video->getPreviewPic(),
240 "title" => $video->getTitle(),
241 "linked_title" => $renderer->renderAsync(
$b),
242 "mime" => $video->getMime(),
243 "poster" => $video->getPreviewPic(),
244 "description" => nl2br($video->getDescription()),
245 "completed" => $completed,
246 "duration" => $video->getDuration()
250 $panel = $factory->panel()->secondary()->listing(
254 $panel_html = $renderer->render($panel);
255 $panel_html = str_replace(
256 '<div class="panel-body">',
257 '<div class="panel-body"><div id="mcst_playlist"></div>',
261 $tpl->setVariable(
"PANEL", $panel_html);
267 $factory->button()->standard($lng->txt(
"mcst_prev_items"),
"")->
withOnLoadCode(
270 "$(\"#$id\").click(function() { il.VideoPlaylist.previousItems('mcst_playlist'); return false;});";
278 $factory->button()->standard($lng->txt(
"mcst_next_items"),
"")->
withOnLoadCode(
281 "$(\"#$id\").click(function() { il.VideoPlaylist.nextItems('mcst_playlist'); return false;});";
287 $item_tpl = new \ilTemplate(
"tpl.playlist_item.html",
true,
true,
"Modules/MediaCast/Video");
288 $item_tpl->setVariable(
"TITLE",
" ");
289 $item_content = str_replace([
"\n",
"\r"],
"", $item_tpl->get());
291 $item = $factory->item()->standard(
"#video-title#")
293 $factory->image()->responsive(
"#img-src#",
"#img-alt#")
296 $item_content = $renderer->render($item);
297 $item_content = str_replace([
"\n",
"\r"],
"", $item_content);
299 $init_videos = $this->media_cast->getNumberInitialVideos() > 0
300 ? $this->media_cast->getNumberInitialVideos()
303 $this->tpl->addOnLoadCode(
304 "il.VideoPlaylist.init('mcst_playlist', 'mcst_video', " . json_encode(
306 ) .
", '$item_content', " . ($autoplay ?
"true" :
"false") .
", " .
307 (
int) $init_videos .
", '" . $this->completed_callback .
"', '" . $this->autoplay_callback .
"', " . ((
int) $mcst_settings->getVideoCompletionThreshold()) .
");" 310 if (count($items) === 1) {
328 $tpl = new \ilTemplate(
"tpl.video_cast_layout.html",
true,
true,
"Modules/MediaCast/Presentation");
332 if ($side_column !=
"") {
333 $tpl->setCurrentBlock(
"with_side_column");
334 $tpl->setVariable(
"SIDE", $side_column);
336 $tpl->setCurrentBlock(
"video_only");
339 $tpl->parseCurrentBlock();
345 if (is_object($this->tpl)) {
347 $this->tpl->setContent(
357 if ($this->mc_manager->commentsActive()) {
358 $target = $this->
ctrl->getLinkTargetByClass(
359 \ilObjMediaCastGUI::class,
362 return "<div data-mcst-comments='$target'></div>";
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withOnLoadCode(Closure $binder)
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins