26 protected \ILIAS\MediaCast\InternalDomainService
$domain;
31 protected \ILIAS\DI\UIServices
$ui;
32 protected \ilLanguage
$lng;
45 $this->
ui = $DIC->ui();
47 $this->
lng = $DIC->language();
48 $this->media_cast = $obj;
50 $this->
user = $DIC->user();
51 $this->
ctrl = $DIC->ctrl();
52 $this->
access = $DIC->access();
53 $this->
toolbar = $DIC->toolbar();
54 $this->domain = $DIC->mediaCast()->internal()->domain();
62 $cmd = $ctrl->getCmd();
64 switch ($next_class) {
66 if (in_array($cmd, array(
"downloadAll"))) {
74 $f = $this->
ui->factory();
75 $renderer = $this->
ui->renderer();
82 if ($this->media_cast->getDownloadable()) {
83 $toolbar->addFormButton($lng->txt(
"mcst_download_all"),
"downloadAll");
86 if ($this->rss_link !==
"") {
87 $b =
$f->link()->standard(
88 $lng->txt(
"mcst_webfeed"),
90 )->withOpenInNewViewport(
true);
91 $toolbar->addComponent(
$b);
100 $lp_collection_mode = $this->domain->learningProgress($this->media_cast)->isCollectionMode();
103 foreach ($this->media_cast->getSortedItemsArray() as $item) {
104 $mob = new \ilObjMediaObject($item[
"mob_id"]);
105 $med = $mob->getMediaItem(
"Standard");
107 if (!in_array($med->getFormat(), [
"image/png",
"image/jpeg",
"image/gif"])) {
111 if (strcasecmp(
"Reference", $med->getLocationType()) == 0) {
112 $resource = $med->getLocation();
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 foreach ($this->media_cast->getSortedItemsArray() as $item) {
136 $mob = new \ilObjMediaObject($item[
"mob_id"]);
137 $med = $mob->getMediaItem(
"Standard");
139 if (!in_array($med->getFormat(), [
"image/png",
"image/jpeg",
"image/gif"])) {
143 if (strcasecmp(
"Reference", $med->getLocationType()) == 0) {
144 $resource = $med->getLocation();
149 $preview_resource = $resource;
150 if ($mob->getVideoPreviewPic() !=
"") {
155 $preview_image =
$f->image()->responsive(
160 $image =
$f->image()->responsive(
165 if (!$lp_collection_mode) {
166 $modal = $main_modal;
168 $modal = $mob_modals[$mob->getId()];
171 $card_image = $preview_image->withAction($modal->getShowSignal());
174 if (!$lp_collection_mode) {
175 $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($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 $title = $mob->getTitle();
202 $card =
$f->card()->standard(
207 )->withTitleAction($modal->getShowSignal());
213 $deck =
$f->deck($cards);
215 if (count($pages) === 0 && count($mob_modals) === 0) {
218 if (!$lp_collection_mode) {
219 $modals = [$main_modal];
221 $modals = $mob_modals;
223 return "<div id='il-mcst-img-gallery'>" . $renderer->render(array_merge([$deck], $modals)) .
"</div>";
228 if (!$this->media_cast->getDownloadable() ||
229 !$this->
access->checkAccess(
'read',
'', $this->media_cast->getRefId())) {
230 $this->tpl->setOnScreenMessage(
231 $this->tpl::MESSAGE_TYPE_FAILURE,
232 $this->
lng->txt(
'permission_denied'),
235 $this->
ctrl->redirectByClass(ilObjMediaCastGUI::class);
239 $download_task = new \ILIAS\MediaCast\BackgroundTasks\DownloadAllBackgroundTask(
240 (
int) $user->getId(),
241 (
int) $this->media_cast->getRefId(),
242 (
int) $this->media_cast->getId()
245 if ($download_task->run()) {
246 $this->tpl->setOnScreenMessage(
248 $this->
lng->txt(
'mcst_download_started_bg'),
253 $this->
ctrl->redirectByClass(
"ilobjmediacastgui",
"showContent");
__construct(\ilObjMediaCast $obj, $tpl=null, string $rss_link="")
string $completed_callback
ilGlobalTemplateInterface $tpl
ilObjMediaCast $media_cast
getNextClass($a_gui_class=null)
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)