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();
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;});";
138 $autoplay_on = $s->create();
139 $autoplay_off = $s->create();
140 $button = $factory->button()->toggle(
$lng->
txt(
"mcst_autoplay"), $autoplay_on, $autoplay_off, $autoplay);
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(
157 )->withOpenInNewViewport(
true)
165 $video_cnt = count($this->video_sequence->getVideos());
166 if ($video_cnt <= 1) {
169 $autoplay = (bool) ($this->
user->getPref(
"mcst_autoplay") ??
181 foreach ($this->video_sequence->getVideos() as $video) {
182 $actions[] = $this->
ui->factory()->button()->shy(
185 )->withOnLoadCode(
function (
string $id) use ($video) {
186 return "document.getElementById('$id').addEventListener('click', () => {il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"'); $('.ilToolbarStickyItem .dropdown.open').removeClass('open');});";
189 if (count($actions) > 0) {
190 return $this->
ui->factory()->dropdown()->standard($actions);
202 $tpl = new \ilTemplate(
"tpl.video_cast_side.html",
true,
true,
"components/ILIAS/MediaCast/Presentation");
204 $factory = $this->
ui->factory();
213 foreach ($this->video_sequence->getVideos() as $video) {
216 $video->getPreviewPic(),
217 "il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"');",
218 $video->getPlayingTime()
223 if (count($re) > 0) {
224 if ($re[0][
"read_count"] > 0) {
229 $b = $factory->button()->shy($video->getTitle(),
"")->withOnLoadCode(
function (
$id) use ($video) {
231 "$(\"#$id\").click(function() { il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"'); return false;});";
234 $this->
ctrl->setParameterByClass(
235 \ilObjMediaCastGUI::class,
240 "id" => $video->getId(),
241 "resource" => $video->getResource(),
242 "preview" => $preview->render(),
243 "preview_pic" => $video->getPreviewPic(),
244 "title" => $video->getTitle(),
246 "mime" => $video->getMime(),
247 "poster" => $video->getPreviewPic(),
248 "description" => nl2br($video->getDescription()),
249 "completed" => $completed,
250 "duration" => $video->getDuration(),
251 "renderUrl" => $this->
ctrl->getLinkTargetByClass(
252 \ilObjMediaCastGUI::class,
258 $panel = $factory->panel()->secondary()->listing(
263 $panel_html = str_replace(
264 '<div class="panel-body">',
265 '<div class="panel-body"><div id="mcst_playlist"></div>',
275 $factory->button()->standard(
$lng->
txt(
"mcst_prev_items"),
"")->withOnLoadCode(
278 "$(\"#$id\").click(function() { il.VideoPlaylist.previousItems('mcst_playlist'); return false;});";
286 $factory->button()->standard(
$lng->
txt(
"mcst_next_items"),
"")->withOnLoadCode(
289 "$(\"#$id\").click(function() { il.VideoPlaylist.nextItems('mcst_playlist'); return false;});";
295 $item_tpl = new \ilTemplate(
"tpl.playlist_item.html",
true,
true,
"components/ILIAS/MediaCast/Video");
296 $item_tpl->setVariable(
"TITLE",
" ");
297 $item_content = str_replace([
"\n",
"\r"],
"", $item_tpl->get());
299 $item = $factory->item()->standard(
"#video-title#")
301 $factory->image()->responsive(
"#img-src#",
"#img-alt#")
304 $item_content =
$renderer->render($item);
305 $item_content = str_replace([
"\n",
"\r"],
"", $item_content);
307 $init_videos = $this->media_cast->getNumberInitialVideos() > 0
308 ? $this->media_cast->getNumberInitialVideos()
310 $this->tpl->addOnLoadCode(
311 "il.VideoPlaylist.init('mcst_playlist', 'mcst_video', " . json_encode(
313 ) .
", '$item_content', " . ($autoplay ?
"true" :
"false") .
", " .
314 (
int) $init_videos .
", '" . $this->completed_callback .
"', '" . $this->autoplay_callback .
"', " . ((
int) $mcst_settings->getVideoCompletionThreshold()) .
");"
317 if (count($items) === 1) {
335 $tpl = new \ilTemplate(
"tpl.video_cast_layout.html",
true,
true,
"components/ILIAS/MediaCast/Presentation");
339 if ($side_column !=
"") {
346 $tpl->parseCurrentBlock();
352 if (is_object($this->tpl)) {
354 $this->tpl->setContent(
364 if ($this->mc_manager->commentsActive()) {
365 $target = $this->
ctrl->getLinkTargetByClass(
366 \ilObjMediaCastGUI::class,
369 return "<div data-mcst-comments='$target'></div>";
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.