26 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager
$media_types;
27 protected \ILIAS\MediaCast\InternalGUIService
$gui;
29 protected \ILIAS\MediaCast\InternalDomainService
$domain;
34 protected \ILIAS\DI\UIServices
$ui;
35 protected \ilLanguage
$lng;
48 $this->
ui = $DIC->ui();
50 $this->
lng = $DIC->language();
51 $this->media_cast = $obj;
53 $this->
user = $DIC->user();
54 $this->
ctrl = $DIC->ctrl();
55 $this->
access = $DIC->access();
56 $this->
toolbar = $DIC->toolbar();
57 $this->media_types = $DIC->mediaObjects()->internal()->domain()->mediaType();
58 $this->mc_manager = $DIC->mediaCast()->internal()->domain()->mediaCast($this->media_cast);
59 $this->gui = $DIC->mediaCast()->internal()->gui();
60 $this->domain = $DIC->mediaCast()->internal()->domain();
68 $cmd = $ctrl->getCmd();
70 switch ($next_class) {
72 if (in_array($cmd, array(
"downloadAll"))) {
80 $f = $this->
ui->factory();
88 if ($this->media_cast->getDownloadable()) {
89 $toolbar->addFormButton($lng->txt(
"mcst_download_all"),
"downloadAll");
92 if ($this->rss_link !==
"") {
93 $b =
$f->link()->standard(
94 $lng->txt(
"mcst_webfeed"),
97 $toolbar->addComponent(
$b);
106 $lp_collection_mode = $this->domain->learningProgress($this->media_cast)->isCollectionMode();
109 foreach ($this->media_cast->getSortedItemsArray() as $item) {
110 $mob = new \ilObjMediaObject($item[
"mob_id"]);
111 $med = $mob->getMediaItem(
"Standard");
112 if (!in_array($med->getFormat(), iterator_to_array($this->media_types->getAllowedImageMimeTypes()),
true)) {
116 $resource = $mob->getStandardSrc();
118 $image =
$f->image()->responsive(
123 $pages[] =
$f->modal()->lightboxImagePage($image, $mob->getTitle());
124 if ($lp_collection_mode) {
125 $mob_modals[$mob->getId()] =
$f->modal()->lightbox($pages);
130 if (!$lp_collection_mode) {
131 $main_modal =
$f->modal()->lightbox($pages);
135 $items = $this->media_cast->getSortedItemsArray();
136 $total = count($items);
137 foreach ($items as $item) {
138 $mob = new \ilObjMediaObject($item[
"mob_id"]);
139 $med = $mob->getMediaItem(
"Standard");
141 if (!in_array($med->getFormat(), iterator_to_array($this->media_types->getAllowedImageMimeTypes()),
true)) {
145 $resource = $mob->getStandardSrc();
147 $preview_resource = $resource;
148 if ($mob->getVideoPreviewPic() !=
"") {
153 $preview_image =
$f->image()->responsive(
158 $image =
$f->image()->responsive(
163 if (!$lp_collection_mode) {
164 $modal = $main_modal;
166 $modal = $mob_modals[$mob->getId()];
169 $card_image = $preview_image->withAction($modal->getShowSignal());
172 if (!$lp_collection_mode) {
174 $slide_to =
"document.querySelector('.modal-body .carousel [data-slide-to=\"" . $cnt .
"\"]').click();";
177 $completed_cb = $this->completed_callback .
'&mob_id=' . $mob->getId();
178 $completed_cb =
"$.ajax({type:'GET', url: '$completed_cb'});";
181 $card_image = $card_image->withAdditionalOnLoadCode(
function (
$id) use ($slide_to, $completed_cb) {
182 return "$('#$id').click(function(e) { $slide_to $completed_cb });";
184 if (!$lp_collection_mode) {
188 $sections = ($mob->getDescription())
189 ? [
$f->legacy()->content($mob->getDescription())]
192 if ($this->media_cast->getDownloadable()) {
193 $ctrl->setParameterByClass(
"ilobjmediacastgui",
"item_id", $item[
"id"]);
194 $ctrl->setParameterByClass(
"ilobjmediacastgui",
"purpose",
"Standard");
195 $download = $ctrl->getLinkTargetByClass(
"ilobjmediacastgui",
"downloadItem");
196 $sections[] =
$f->button()->standard($lng->txt(
"download"), $download);
200 if ($this->mc_manager->commentsActive()) {
201 $comments_gui = $this->gui->comments()->commentGUI(
202 $this->media_cast->getRefId(),
205 $sections[] =
$f->legacy()->content($comments_gui->getGlyph());
209 $title = $mob->getTitle();
211 $card =
$f->card()->standard(
216 )->withTitleAction($modal->getShowSignal());
223 $deck =
$f->deck($cards);
225 if (count($pages) === 0 && count($mob_modals) === 0) {
228 if (!$lp_collection_mode) {
229 $modals = [$main_modal];
231 $modals = $mob_modals;
233 return "<div id='il-mcst-img-gallery'>" .
$renderer->render(array_merge([$deck], $modals)) .
"</div>";
238 if (!$this->media_cast->getDownloadable() ||
239 !$this->
access->checkAccess(
'read',
'', $this->media_cast->getRefId())) {
240 $this->tpl->setOnScreenMessage(
241 $this->tpl::MESSAGE_TYPE_FAILURE,
242 $this->
lng->txt(
'permission_denied'),
245 $this->
ctrl->redirectByClass(ilObjMediaCastGUI::class);
249 $download_task = new \ILIAS\MediaCast\BackgroundTasks\DownloadAllBackgroundTask(
250 (
int) $user->getId(),
251 (
int) $this->media_cast->getRefId(),
252 (
int) $this->media_cast->getId()
255 if ($download_task->run()) {
256 $this->tpl->setOnScreenMessage(
258 $this->
lng->txt(
'mcst_download_started_bg'),
263 $this->
ctrl->redirectByClass(
"ilobjmediacastgui",
"showContent");
__construct(\ilObjMediaCast $obj, $tpl=null, string $rss_link="")
string $completed_callback
ilGlobalTemplateInterface $tpl
ilObjMediaCast $media_cast
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ILIAS MediaCast MediaCastManager $mc_manager
getNextClass($a_gui_class=null)
ILIAS MediaObjects MediaType MediaTypeManager $media_types
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ILIAS MediaCast InternalDomainService $domain
setCompletedCallback(string $completed_callback)
ILIAS MediaCast InternalGUIService $gui