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();
81 $renderer = $this->
ui->renderer();
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"),
96 )->withOpenInNewViewport(
true);
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 if (strcasecmp(
"Reference", $med->getLocationType()) == 0) {
117 $resource = $med->getLocation();
123 $image =
$f->image()->responsive(
128 $pages[] =
$f->modal()->lightboxImagePage($image, $mob->getTitle());
129 if ($lp_collection_mode) {
130 $mob_modals[$mob->getId()] =
$f->modal()->lightbox($pages);
135 if (!$lp_collection_mode) {
136 $main_modal =
$f->modal()->lightbox($pages);
140 foreach ($this->media_cast->getSortedItemsArray() as $item) {
141 $mob = new \ilObjMediaObject($item[
"mob_id"]);
142 $med = $mob->getMediaItem(
"Standard");
144 if (!in_array($med->getFormat(), iterator_to_array($this->media_types->getAllowedImageMimeTypes()),
true)) {
148 if (strcasecmp(
"Reference", $med->getLocationType()) == 0) {
149 $resource = $med->getLocation();
154 $preview_resource = $resource;
155 if ($mob->getVideoPreviewPic() !=
"") {
160 $preview_image =
$f->image()->responsive(
165 $image =
$f->image()->responsive(
170 if (!$lp_collection_mode) {
171 $modal = $main_modal;
173 $modal = $mob_modals[$mob->getId()];
176 $card_image = $preview_image->withAction($modal->getShowSignal());
179 if (!$lp_collection_mode) {
180 $slide_to =
"document.querySelector('.modal-body .carousel [data-slide-to=\"" . $cnt .
"\"]').click();";
182 $completed_cb = $this->completed_callback .
'&mob_id=' . $mob->getId();
183 $completed_cb =
"$.ajax({type:'GET', url: '$completed_cb'});";
186 $card_image = $card_image->withAdditionalOnLoadCode(
function (
$id) use ($slide_to, $completed_cb) {
187 return "$('#$id').click(function(e) { $slide_to $completed_cb });";
189 if (!$lp_collection_mode) {
193 $sections = ($mob->getDescription())
194 ? [
$f->legacy($mob->getDescription())]
197 if ($this->media_cast->getDownloadable()) {
198 $ctrl->setParameterByClass(
"ilobjmediacastgui",
"item_id", $item[
"id"]);
199 $ctrl->setParameterByClass(
"ilobjmediacastgui",
"purpose",
"Standard");
200 $download = $ctrl->getLinkTargetByClass(
"ilobjmediacastgui",
"downloadItem");
201 $sections[] =
$f->button()->standard($lng->txt(
"download"), $download);
205 if ($this->mc_manager->commentsActive()) {
206 $comments_gui = $this->gui->comments()->commentGUI(
207 $this->media_cast->getRefId(),
210 $sections[] =
$f->legacy($comments_gui->getGlyph());
214 $title = $mob->getTitle();
216 $card =
$f->card()->standard(
221 )->withTitleAction($modal->getShowSignal());
227 $deck =
$f->deck($cards);
229 if (count($pages) === 0 && count($mob_modals) === 0) {
232 if (!$lp_collection_mode) {
233 $modals = [$main_modal];
235 $modals = $mob_modals;
237 return "<div id='il-mcst-img-gallery'>" . $renderer->render(array_merge([$deck], $modals)) .
"</div>";
242 if (!$this->media_cast->getDownloadable() ||
243 !$this->
access->checkAccess(
'read',
'', $this->media_cast->getRefId())) {
244 $this->tpl->setOnScreenMessage(
245 $this->tpl::MESSAGE_TYPE_FAILURE,
246 $this->
lng->txt(
'permission_denied'),
249 $this->
ctrl->redirectByClass(ilObjMediaCastGUI::class);
253 $download_task = new \ILIAS\MediaCast\BackgroundTasks\DownloadAllBackgroundTask(
254 (
int) $user->getId(),
255 (
int) $this->media_cast->getRefId(),
256 (
int) $this->media_cast->getId()
259 if ($download_task->run()) {
260 $this->tpl->setOnScreenMessage(
262 $this->
lng->txt(
'mcst_download_started_bg'),
267 $this->
ctrl->redirectByClass(
"ilobjmediacastgui",
"showContent");
__construct(\ilObjMediaCast $obj, $tpl=null, string $rss_link="")
string $completed_callback
ilGlobalTemplateInterface $tpl
ilObjMediaCast $media_cast
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...
ILIAS MediaCast InternalDomainService $domain
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static signFile(string $path_to_file)
setCompletedCallback(string $completed_callback)
ILIAS MediaCast InternalGUIService $gui