ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\MediaCast\Presentation\VideoViewGUI Class Reference
+ Collaboration diagram for ILIAS\MediaCast\Presentation\VideoViewGUI:

Public Member Functions

 __construct (\ilObjMediaCast $obj, ?\ilGlobalTemplateInterface $tpl=null, string $rss_link="")
 
 setCompletedCallback (string $completed_callback)
 
 renderMainColumn ()
 
 renderToolbar ()
 
 renderSideColumn ()
 
 render ()
 
 show ()
 
 renderCommentsContainer ()
 

Protected Member Functions

 getDropdown ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
ILIAS MediaCast MediaCastManager $mc_manager
 
string $rss_link
 
ilToolbarGUI $toolbar
 
ilGlobalTemplateInterface $main_tpl
 
ilObjMediaCast $media_cast
 
ilGlobalTemplateInterface $tpl
 
ILIAS DI UIServices $ui
 
ilLanguage $lng
 
ilObjUser $user
 
string $completed_callback = ""
 
VideoSequence $video_sequence
 
string $video_wrapper_id = "mcst_video"
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.VideoViewGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MediaCast\Presentation\VideoViewGUI::__construct ( \ilObjMediaCast  $obj,
?\ilGlobalTemplateInterface  $tpl = null,
string  $rss_link = "" 
)

Definition at line 45 of file class.VideoViewGUI.php.

49 {
50 global $DIC;
51
52 $this->ui = $DIC->ui();
53 $this->rss_link = $rss_link;
54 $this->lng = $DIC->language();
55 $this->media_cast = $obj;
56 $this->tpl = $tpl;
57 $this->video_sequence = new VideoSequence($this->media_cast);
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(
63 $this->media_cast
64 );
65 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\MediaCast\Presentation\VideoViewGUI\$rss_link, ILIAS\MediaCast\Presentation\VideoViewGUI\$tpl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDropdown()

ILIAS\MediaCast\Presentation\VideoViewGUI::getDropdown ( )
protected

Definition at line 138 of file class.VideoViewGUI.php.

139 {
140
141 $actions = [];
142 foreach ($this->video_sequence->getVideos() as $video) {
143 $actions[] = $this->ui->factory()->button()->shy(
144 $video->getTitle(),
145 "#"
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');});";
148 });
149 }
150 if (count($actions) > 0) {
151 return $this->ui->factory()->dropdown()->standard($actions);
152 }
153 return null;
154 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This describes a Standard Dropdown.
Definition: Standard.php:27

References $id, and ILIAS\Repository\ui().

Referenced by ILIAS\MediaCast\Presentation\VideoViewGUI\renderToolbar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ILIAS\MediaCast\Presentation\VideoViewGUI::render ( )
Exceptions

ilTemplateException

Definition at line 297 of file class.VideoViewGUI.php.

297 : string
298 {
299 // this is current only to include the resize mechanism when
300 // the main menu is changed, so that the player is resized, too
301 //\ilMediaPlayerGUI::initJavascript();
302 $tpl = new \ilTemplate("tpl.video_cast_layout.html", true, true, "components/ILIAS/MediaCast/Presentation");
303 $side_column = $this->renderSideColumn();
304
305
306 if ($side_column != "") {
307 $tpl->setCurrentBlock("with_side_column");
308 $tpl->setVariable("SIDE", $side_column);
309 } else {
310 $tpl->setCurrentBlock("video_only");
311 }
312 $tpl->setVariable("MAIN", $this->renderMainColumn());
314 return $tpl->get();
315 }
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
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.

References ILIAS\MediaCast\Presentation\VideoViewGUI\$tpl, ILIAS\UICore\GlobalTemplate\get(), ILIAS\MediaCast\Presentation\VideoViewGUI\renderMainColumn(), ILIAS\MediaCast\Presentation\VideoViewGUI\renderSideColumn(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), and ILIAS\UICore\GlobalTemplate\setVariable().

+ Here is the call graph for this function:

◆ renderCommentsContainer()

ILIAS\MediaCast\Presentation\VideoViewGUI::renderCommentsContainer ( )

Definition at line 329 of file class.VideoViewGUI.php.

330 {
331 if ($this->mc_manager->commentsActive()) {
332 $target = $this->ctrl->getLinkTargetByClass(
333 \ilObjMediaCastGUI::class,
334 "showComments"
335 );
336 return "<div data-mcst-comments='$target'></div>";
337 }
338 }

References ILIAS\Repository\ctrl().

Referenced by ILIAS\MediaCast\Presentation\VideoViewGUI\show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderMainColumn()

ILIAS\MediaCast\Presentation\VideoViewGUI::renderMainColumn ( )
Exceptions

ilTemplateException

Definition at line 75 of file class.VideoViewGUI.php.

75 : string
76 {
77 if (count($this->video_sequence->getVideos()) == 0) {
78 return "";
79 }
80
81 $widget = new VideoWidgetGUI($this->tpl, "mcst_video");
82 $widget->setVideo($this->video_sequence->getFirst());
83 return $widget->render();
84 }

Referenced by ILIAS\MediaCast\Presentation\VideoViewGUI\render(), and ILIAS\MediaCast\Presentation\VideoViewGUI\show().

+ Here is the caller graph for this function:

◆ renderSideColumn()

ILIAS\MediaCast\Presentation\VideoViewGUI::renderSideColumn ( )

Definition at line 156 of file class.VideoViewGUI.php.

156 : string
157 {
158 $mcst_settings = \ilMediaCastSettings::_getInstance();
159
161 $tpl = new \ilTemplate("tpl.video_cast_side.html", true, true, "components/ILIAS/MediaCast/Presentation");
162
163 $factory = $this->ui->factory();
164 $renderer = $this->ui->renderer();
165
166 // items
167 $items = [];
168 $has_items = false;
169
170 $panel_items = [];
171
172 foreach ($this->video_sequence->getVideos() as $video) {
173 $has_items = true;
174 $preview = new VideoPreviewGUI(
175 $video->getPreviewPic(),
176 "il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() . "');",
177 $video->getPlayingTime()
178 );
179 $completed = false;
180
181 $re = \ilChangeEvent::_lookupReadEvents($video->getId(), $this->user->getId());
182 if (count($re) > 0) {
183 if ($re[0]["read_count"] > 0) {
184 $completed = true;
185 }
186 }
187
188 $b = $factory->button()->shy($video->getTitle(), "")->withOnLoadCode(function ($id) use ($video) {
189 return
190 "$(\"#$id\").click(function() { il.VideoPlaylist.toggleItem('mcst_playlist', '" . $video->getId() . "'); return false;});";
191 });
192
193 $this->ctrl->setParameterByClass(
194 \ilObjMediaCastGUI::class,
195 "mob_id",
196 $video->getId()
197 );
198 $download_url = "";
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");
203 }
204
205 $items[] = [
206 "id" => $video->getId(),
207 "resource" => $video->getResource(),
208 "preview" => $preview->render(),
209 "preview_pic" => $video->getPreviewPic(),
210 "title" => $video->getTitle(),
211 "linked_title" => $renderer->renderAsync($b),
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,
219 "renderVideo"
220 ),
221 "download_url" => $download_url
222 ];
223 }
224
225 $panel = $factory->panel()->secondary()->listing(
226 "Videos",
227 []
228 );
229 $panel_html = $renderer->render($panel);
230 $panel_html = str_replace(
231 '<div class="panel-body">',
232 '<div class="panel-body"><div id="mcst_playlist"></div>',
233 $panel_html,
234 );
235
236 $tpl->setVariable("PANEL", $panel_html);
237 // previous items / next items links
238 if ($has_items) {
240 "PREV",
241 $renderer->render(
242 $factory->button()->standard($lng->txt("mcst_prev_items"), "")->withOnLoadCode(
243 function ($id) {
244 return
245 "$(\"#$id\").click(function() { il.VideoPlaylist.previousItems('mcst_playlist'); return false;});";
246 }
247 )
248 )
249 );
251 "NEXT",
252 $renderer->render(
253 $factory->button()->standard($lng->txt("mcst_next_items"), "")->withOnLoadCode(
254 function ($id) {
255 return
256 "$(\"#$id\").click(function() { il.VideoPlaylist.nextItems('mcst_playlist'); return false;});";
257 }
258 )
259 )
260 );
261
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());
265
266 $item = $factory->item()->standard("#video-title#")
267 ->withLeadImage(
268 $factory->image()->responsive("#img-src#", "#img-alt#")
269 );
270
271 $item_content = $renderer->render($item);
272 $item_content = str_replace(["\n", "\r"], "", $item_content);
273
274 $init_videos = $this->media_cast->getNumberInitialVideos() > 0
275 ? $this->media_cast->getNumberInitialVideos()
276 : 1;
277 $this->tpl->addOnLoadCode(
278 "il.VideoPlaylist.init('mcst_playlist', 'mcst_video', " . json_encode(
279 $items
280 ) . ", '$item_content', false, " .
281 (int) $init_videos . ", '" . $this->completed_callback . "', '', " . ((int) $mcst_settings->getVideoCompletionThreshold()) . ");"
282 );
283
284 if (count($items) === 1) {
285 return " ";
286 }
287
288 return $tpl->get();
289 }
290
291 return "";
292 }
$renderer
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...

References Vendor\Package\$b, $id, ILIAS\MediaCast\Presentation\VideoViewGUI\$lng, $renderer, ILIAS\MediaCast\Presentation\VideoViewGUI\$tpl, ilMediaCastSettings\_getInstance(), ilChangeEvent\_lookupReadEvents(), ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), ILIAS\UICore\GlobalTemplate\setVariable(), ilLanguage\txt(), and ILIAS\Repository\ui().

Referenced by ILIAS\MediaCast\Presentation\VideoViewGUI\render(), and ILIAS\MediaCast\Presentation\VideoViewGUI\show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderToolbar()

ILIAS\MediaCast\Presentation\VideoViewGUI::renderToolbar ( )

Definition at line 86 of file class.VideoViewGUI.php.

86 : void
87 {
90
91 $video_cnt = count($this->video_sequence->getVideos());
92
93 $mcst_settings = \ilMediaCastSettings::_getInstance();
94
95 $factory = $this->ui->factory();
96 $renderer = $this->ui->renderer();
97
98 if ($video_cnt > 1) {
99 $back = $factory->button()->standard(
100 "<span class=\"glyphicon glyphicon-chevron-left \" aria-hidden=\"true\"></span>",
101 ""
102 )
103 ->withOnLoadCode(function ($id) {
104 return
105 "$(\"#$id\").click(function() { il.VideoWidget.previous(\"" . $this->video_wrapper_id . "\"); return false;});";
106 });
107 $next = $factory->button()->standard(
108 "<span class=\"glyphicon glyphicon-chevron-right \" aria-hidden=\"true\"></span>",
109 ""
110 )
111 ->withOnLoadCode(function ($id) {
112 return
113 "$(\"#$id\").click(function() { il.VideoWidget.next(\"" . $this->video_wrapper_id . "\"); return false;});";
114 });
115
116 $toolbar->addStickyItem($back);
117
118 $dd = $this->getDropdown();
119 if (!is_null($dd)) {
121 }
122
123 $toolbar->addStickyItem($next);
124 }
125
126 if ($video_cnt > 0 && $this->rss_link !== "") {
127 $f = $this->ui->factory();
128 $actions = [
129 $f->link()->standard(
130 $lng->txt("mcst_webfeed"),
131 $this->rss_link
132 )->withOpenInNewViewport(true)
133 ];
134 $toolbar->addComponent($f->dropdown()->standard($actions));
135 }
136 }
addComponent(\ILIAS\UI\Component\Component $a_comp)
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.

References Vendor\Package\$f, $id, ILIAS\MediaCast\Presentation\VideoViewGUI\$lng, $renderer, ILIAS\MediaCast\Presentation\VideoViewGUI\$toolbar, ilMediaCastSettings\_getInstance(), ilToolbarGUI\addComponent(), ilToolbarGUI\addStickyItem(), ILIAS\MediaCast\Presentation\VideoViewGUI\getDropdown(), ilLanguage\txt(), and ILIAS\Repository\ui().

Referenced by ILIAS\MediaCast\Presentation\VideoViewGUI\show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCompletedCallback()

ILIAS\MediaCast\Presentation\VideoViewGUI::setCompletedCallback ( string  $completed_callback)

Definition at line 67 of file class.VideoViewGUI.php.

67 : void
68 {
69 $this->completed_callback = $completed_callback;
70 }

References ILIAS\MediaCast\Presentation\VideoViewGUI\$completed_callback.

◆ show()

ILIAS\MediaCast\Presentation\VideoViewGUI::show ( )

Definition at line 317 of file class.VideoViewGUI.php.

317 : void
318 {
319 if (is_object($this->tpl)) {
320 $this->renderToolbar();
321 $this->tpl->setContent(
322 $this->renderMainColumn() .
324 );
325 $this->tpl->setRightContent($this->renderSideColumn());
326 }
327 }

References ILIAS\MediaCast\Presentation\VideoViewGUI\renderCommentsContainer(), ILIAS\MediaCast\Presentation\VideoViewGUI\renderMainColumn(), ILIAS\MediaCast\Presentation\VideoViewGUI\renderSideColumn(), and ILIAS\MediaCast\Presentation\VideoViewGUI\renderToolbar().

+ Here is the call graph for this function:

Field Documentation

◆ $completed_callback

string ILIAS\MediaCast\Presentation\VideoViewGUI::$completed_callback = ""
protected

◆ $ctrl

ilCtrlInterface ILIAS\MediaCast\Presentation\VideoViewGUI::$ctrl
protected

Definition at line 31 of file class.VideoViewGUI.php.

◆ $lng

ilLanguage ILIAS\MediaCast\Presentation\VideoViewGUI::$lng
protected

◆ $main_tpl

ilGlobalTemplateInterface ILIAS\MediaCast\Presentation\VideoViewGUI::$main_tpl
protected

Definition at line 35 of file class.VideoViewGUI.php.

◆ $mc_manager

ILIAS MediaCast MediaCastManager ILIAS\MediaCast\Presentation\VideoViewGUI::$mc_manager
protected

Definition at line 32 of file class.VideoViewGUI.php.

◆ $media_cast

ilObjMediaCast ILIAS\MediaCast\Presentation\VideoViewGUI::$media_cast
protected

Definition at line 36 of file class.VideoViewGUI.php.

◆ $rss_link

string ILIAS\MediaCast\Presentation\VideoViewGUI::$rss_link
protected

◆ $toolbar

ilToolbarGUI ILIAS\MediaCast\Presentation\VideoViewGUI::$toolbar
protected

◆ $tpl

◆ $ui

ILIAS DI UIServices ILIAS\MediaCast\Presentation\VideoViewGUI::$ui
protected

Definition at line 38 of file class.VideoViewGUI.php.

◆ $user

ilObjUser ILIAS\MediaCast\Presentation\VideoViewGUI::$user
protected

Definition at line 40 of file class.VideoViewGUI.php.

◆ $video_sequence

VideoSequence ILIAS\MediaCast\Presentation\VideoViewGUI::$video_sequence
protected

Definition at line 42 of file class.VideoViewGUI.php.

◆ $video_wrapper_id

string ILIAS\MediaCast\Presentation\VideoViewGUI::$video_wrapper_id = "mcst_video"
protected

Definition at line 43 of file class.VideoViewGUI.php.


The documentation for this class was generated from the following file: