31 protected \ilCtrlInterface
$ctrl;
37 protected \ilGlobalTemplateInterface
$tpl;
38 protected \ILIAS\DI\UIServices
$ui;
39 protected \ilLanguage
$lng;
52 $this->
ui = $DIC->ui();
54 $this->
lng = $DIC->language();
55 $this->media_cast = $obj;
58 $this->
user = $DIC->user();
59 $this->main_tpl =
$DIC->ui()->mainTemplate();
60 $this->
toolbar = $DIC->toolbar();
61 $this->
ctrl = $DIC->ctrl();
62 $this->mc_manager =
$DIC->mediaCast()->internal()->domain()->mediaCast(
77 if (count($this->video_sequence->getVideos()) == 0) {
82 $widget->setVideo($this->video_sequence->getFirst());
83 return $widget->render();
91 $video_cnt = count($this->video_sequence->getVideos());
95 $factory = $this->
ui->factory();
99 $back = $factory->button()->standard(
100 "<span class=\"glyphicon glyphicon-chevron-left \" aria-hidden=\"true\"></span>",
103 ->withOnLoadCode(
function (
$id) {
105 "$(\"#$id\").click(function() { il.VideoWidget.previous(\"" . $this->video_wrapper_id .
"\"); return false;});";
107 $next = $factory->button()->standard(
108 "<span class=\"glyphicon glyphicon-chevron-right \" aria-hidden=\"true\"></span>",
111 ->withOnLoadCode(
function (
$id) {
113 "$(\"#$id\").click(function() { il.VideoWidget.next(\"" . $this->video_wrapper_id .
"\"); return false;});";
126 if ($video_cnt > 0 && $this->rss_link !==
"") {
127 $f = $this->
ui->factory();
129 $f->link()->standard(
132 )->withOpenInNewViewport(
true)
142 foreach ($this->video_sequence->getVideos() as $video) {
143 $actions[] = $this->
ui->factory()->button()->shy(
146 )->withOnLoadCode(
function (
string $id) use ($video) {
147 return "document.getElementById('$id').addEventListener('click', () => {il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"'); $('.ilToolbarStickyItem .dropdown.open').removeClass('open');});";
150 if (count($actions) > 0) {
151 return $this->
ui->factory()->dropdown()->standard($actions);
161 $tpl = new \ilTemplate(
"tpl.video_cast_side.html",
true,
true,
"components/ILIAS/MediaCast/Presentation");
163 $factory = $this->
ui->factory();
172 foreach ($this->video_sequence->getVideos() as $video) {
175 $video->getPreviewPic(),
176 "il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"');",
177 $video->getPlayingTime()
182 if (count($re) > 0) {
183 if ($re[0][
"read_count"] > 0) {
188 $b = $factory->button()->shy($video->getTitle(),
"")->withOnLoadCode(
function (
$id) use ($video) {
190 "$(\"#$id\").click(function() { il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() .
"'); return false;});";
193 $this->
ctrl->setParameterByClass(
194 \ilObjMediaCastGUI::class,
199 if ($video->isLocal() && $this->media_cast->getDownloadable()) {
200 $this->
ctrl->setParameterByClass(
"ilobjmediacastgui",
"purpose",
"Standard");
201 $this->
ctrl->setParameterByClass(
"ilobjmediacastgui",
"item_id", $video->getNewsId());
202 $download_url = $this->
ctrl->getLinkTargetByClass(
"ilobjmediacastgui",
"downloadItem");
206 "id" => $video->getId(),
207 "resource" => $video->getResource(),
208 "preview" => $preview->render(),
209 "preview_pic" => $video->getPreviewPic(),
210 "title" => $video->getTitle(),
212 "mime" => $video->getMime(),
213 "poster" => $video->getPreviewPic(),
214 "description" => nl2br($video->getDescription()),
215 "completed" => $completed,
216 "duration" => $video->getDuration(),
217 "renderUrl" => $this->
ctrl->getLinkTargetByClass(
218 \ilObjMediaCastGUI::class,
221 "download_url" => $download_url
225 $panel = $factory->panel()->secondary()->listing(
230 $panel_html = str_replace(
231 '<div class="panel-body">',
232 '<div class="panel-body"><div id="mcst_playlist"></div>',
242 $factory->button()->standard(
$lng->
txt(
"mcst_prev_items"),
"")->withOnLoadCode(
245 "$(\"#$id\").click(function() { il.VideoPlaylist.previousItems('mcst_playlist'); return false;});";
253 $factory->button()->standard(
$lng->
txt(
"mcst_next_items"),
"")->withOnLoadCode(
256 "$(\"#$id\").click(function() { il.VideoPlaylist.nextItems('mcst_playlist'); return false;});";
262 $item_tpl = new \ilTemplate(
"tpl.playlist_item.html",
true,
true,
"components/ILIAS/MediaCast/Video");
263 $item_tpl->setVariable(
"TITLE",
" ");
264 $item_content = str_replace([
"\n",
"\r"],
"", $item_tpl->get());
266 $item = $factory->item()->standard(
"#video-title#")
268 $factory->image()->responsive(
"#img-src#",
"#img-alt#")
271 $item_content =
$renderer->render($item);
272 $item_content = str_replace([
"\n",
"\r"],
"", $item_content);
274 $init_videos = $this->media_cast->getNumberInitialVideos() > 0
275 ? $this->media_cast->getNumberInitialVideos()
277 $this->tpl->addOnLoadCode(
278 "il.VideoPlaylist.init('mcst_playlist', 'mcst_video', " . json_encode(
280 ) .
", '$item_content', false, " .
281 (
int) $init_videos .
", '" . $this->completed_callback .
"', '', " . ((
int) $mcst_settings->getVideoCompletionThreshold()) .
");"
284 if (count($items) === 1) {
302 $tpl = new \ilTemplate(
"tpl.video_cast_layout.html",
true,
true,
"components/ILIAS/MediaCast/Presentation");
306 if ($side_column !=
"") {
313 $tpl->parseCurrentBlock();
319 if (is_object($this->tpl)) {
321 $this->tpl->setContent(
331 if ($this->mc_manager->commentsActive()) {
332 $target = $this->
ctrl->getLinkTargetByClass(
333 \ilObjMediaCastGUI::class,
336 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.