ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjMediaCastGUI.php
Go to the documentation of this file.
1<?php
2
26
37{
38 protected \ILIAS\MediaObjects\Player\GUIService $mob_player_gui;
39 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager $media_type;
40 protected \ILIAS\MediaCast\InternalGUIService $gui;
41 protected $video_gui;
42 protected \ILIAS\MediaCast\MediaCastManager $mc_manager;
46 protected ilTabsGUI $tabs;
47 protected ilLogger $log;
48 protected ilHelpGUI $help;
49 private array $additionalPurposes = [];
50 protected FileSystem $filesystem;
51
55 public function __construct(
56 $a_data,
57 int $a_id,
58 bool $a_call_by_reference,
59 bool $a_prepare_output = true
60 ) {
61 global $DIC;
62
63 $this->ctrl = $DIC->ctrl();
64 $this->lng = $DIC->language();
65 $this->user = $DIC->user();
66 $this->tabs = $DIC->tabs();
67 $this->tpl = $DIC["tpl"];
68 $this->access = $DIC->access();
69 $this->toolbar = $DIC->toolbar();
70 $this->filesystem = $DIC->filesystem()->web();
71 $this->log = $DIC["ilLog"];
72 $this->help = $DIC["ilHelp"];
73 $this->locator = $DIC["ilLocator"];
74 $ilCtrl = $DIC->ctrl();
75 $lng = $DIC->language();
76 $this->mc_request = $DIC->mediaCast()
77 ->internal()
78 ->gui()
79 ->standardRequest();
80
81 $this->type = "mcst";
82 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
83 $lng->loadLanguageModule("mcst");
84 $lng->loadLanguageModule("news");
86
87 $ilCtrl->saveParameter($this, "item_id");
88
90
91 if ($this->object) {
92 $this->mc_manager = $DIC->mediaCast()->internal()
93 ->domain()->mediaCast($this->object);
94 }
95 $this->gui = $DIC->mediaCast()->internal()->gui();
96 $this->media_type = $DIC->mediaObjects()->internal()->domain()->mediaType();
97 $this->video_gui = $DIC->mediaObjects()->internal()->gui()->video();
98 $this->mob_player_gui = $DIC->mediaObjects()->internal()->gui()->player();
99 }
100
101 public function executeCommand(): void
102 {
103 $ilUser = $this->user;
104 $ilTabs = $this->tabs;
105
106 $next_class = $this->ctrl->getNextClass($this);
107 $cmd = $this->ctrl->getCmd();
108 $this->prepareOutput();
109
110 switch ($next_class) {
111 case "ilmediacreationgui":
112 $this->checkPermission('write');
113
114 $this->ctrl->setReturn($this, "listItems");
115 $ilTabs->activateTab("content");
116 $this->addContentSubTabs("manage");
117 $med_type = [];
118 switch ($this->object->getViewMode()) {
120 $med_type = [ilMediaCreationGUI::TYPE_VIDEO];
121 break;
123 $med_type = [ilMediaCreationGUI::TYPE_IMAGE];
124 break;
126 $med_type = [ilMediaCreationGUI::TYPE_AUDIO];
127 break;
128 }
129 $creation = new ilMediaCreationGUI($med_type, function ($mob_id) {
130 $this->afterUpload($mob_id);
131 }, function ($mob_id, $long_desc) {
132 $this->afterUrlSaving($mob_id, $long_desc);
133 }, function ($mob_ids) {
134 $this->afterPoolInsert($mob_ids);
135 }, function ($mob_id) {
136 $this->finishSingleUpload($mob_id);
137 }, function ($mob_id) {
138 $this->onMobUpdate($mob_id);
139 });
140 $this->ctrl->forwardCommand($creation);
141 break;
142
143 case "ilinfoscreengui":
144 if (!$this->checkPermissionBool("read")) {
145 $this->checkPermission("visible");
146 }
147 $this->infoScreen(); // forwards command
148 break;
149
150 case "ilexportgui":
151 // $this->prepareOutput();
152 $ilTabs->activateTab("export");
153 $exp_gui = new ilExportGUI($this);
154 $exp_gui->addFormat("xml");
155 $ret = $this->ctrl->forwardCommand($exp_gui);
156 // $this->tpl->show();
157 break;
158
159 case 'ilpermissiongui':
160 $ilTabs->activateTab("id_permissions");
161 $perm_gui = new ilPermissionGUI($this);
162 $ret = $this->ctrl->forwardCommand($perm_gui);
163 break;
164
165 case 'ilobjectcopygui':
166 $cp = new ilObjectCopyGUI($this);
167 $cp->setType('mcst');
168 $this->ctrl->forwardCommand($cp);
169 break;
170
171 case "ilcommonactiondispatchergui":
173 $this->ctrl->forwardCommand($gui);
174 break;
175
176 case "illearningprogressgui":
177 $ilTabs->activateTab('learning_progress');
178 $new_gui = new ilLearningProgressGUI(
180 $this->object->getRefId(),
181 $this->mc_request->getUserId() ?: $ilUser->getId()
182 );
183 $this->ctrl->forwardCommand($new_gui);
184 $this->tabs_gui->setTabActive('learning_progress');
185 break;
186
187 case "mcstimagegallerygui":
188 $view = new \McstImageGalleryGUI($this->object, $this->tpl, $this->getFeedLink());
189 $this->ctrl->forwardCommand($view);
190 break;
191
192 case "mcstpodcastgui":
193 $view = new \McstPodcastGUI($this->object, $this->tpl, $this->getFeedLink());
194 $this->ctrl->forwardCommand($view);
195 break;
196
197 case strtolower(ilCommentGUI::class):
198 $this->ctrl->forwardCommand($this->getCommentGUI());
199 break;
200
201 case strtolower(ilObjectMetaDataGUI::class):
202 $this->checkPermission("write");
203 $ilTabs->activateTab("meta_data");
204 $gui = new ilObjectMetaDataGUI($this->object);
205 $this->ctrl->forwardCommand($gui);
206 break;
207
208 case strtolower(SettingsGUI::class):
209 $this->checkPermission("write");
210 $ilTabs->activateTab("id_settings");
211 $gui = $this->gui->settings()->settingsGUI(
212 $this->object->getId(),
213 $this->object->getRefId()
214 );
215 $this->ctrl->forwardCommand($gui);
216 break;
217
218 default:
219 if (!$cmd) {
220 $cmd = "infoScreen";
221 }
222 $cmd .= "Object";
223 if ($cmd != "infoScreenObject") {
224 $this->checkPermission("read");
225 } else {
226 $this->checkPermission("visible");
227 }
228 $this->$cmd();
229
230 break;
231 }
232 $this->addHeaderAction();
233 }
234
235 public function editObject(): void
236 {
237 if (!$this->checkPermissionBool("write")) {
238 $this->error->raiseError($this->lng->txt("msg_no_perm_write"), $this->error->MESSAGE);
239 }
240
241 $this->ctrl->redirectByClass(SettingsGUI::class, "");
242 }
243
244
245 protected function afterSave(ilObject $new_object): void
246 {
247 // always send a message
248 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
249 ilUtil::redirect("ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=" . $new_object->getRefId() . "&cmd=editSettings");
250 }
251
252 public function listItemsObject(bool $a_presentation_mode = false): void
253 {
256 $ilAccess = $this->access;
257 $ilToolbar = $this->toolbar;
258
259 $this->checkPermission("write");
260
261 if ($a_presentation_mode) {
262 $this->tpl->setOnScreenMessage('info', $this->lng->txt("mcst_view_abandoned"));
263 return;
264 }
265
266 if ($a_presentation_mode) {
267 $this->addContentSubTabs("content");
268 } else {
269 $this->addContentSubTabs("manage");
270 }
271
272 $med_items = $this->object->getSortedItemsArray();
273
274 if ($a_presentation_mode) {
275 $table_gui = new ilMediaCastTableGUI($this, "showContent", false, true);
276 } else {
277 $table_gui = new ilMediaCastTableGUI($this, "listItems");
278 }
279
280 $table_gui->setData($med_items);
281
282 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id) && !$a_presentation_mode) {
283 if (in_array($this->object->getViewMode(), [
287 ], true)) {
288 $ilToolbar->addButton($lng->txt("add"), $this->ctrl->getLinkTargetByClass("ilMediaCreationGUI", ""));
289 } else {
290 $ilToolbar->addButton($lng->txt("add"), $this->ctrl->getLinkTarget($this, "addCastItem"));
291 }
292
293 $table_gui->addMultiCommand("confirmDeletionItems", $lng->txt("delete"));
294 $table_gui->setSelectAllCheckbox("item_id");
295 }
296
297 $new_table = $this->getManageTableGUI();
298
299 $script = <<<EOT
300<script>
301 window.addEventListener('load', (event) => {
302 $(document).on('hidden.bs.modal', (e) => {
303 $('.modal-body').html('');
304 });
305 $(document).on('shown.bs.modal', (e) => {
306 window.dispatchEvent(new Event('resize'));
307 });
308 });
309</script>
310EOT;
311 $tpl->setContent($this->gui->ui()->renderer()->render($new_table->get()) . $script);
312 }
313
314 public function tableCommandObject(): void
315 {
316 $new_table = $this->getManageTableGUI();
317 $new_table->handleCommand();
318 }
319
321 {
322 return $this->gui->getMediaCastManageTableGUI($this, "tableCommand");
323 }
324
325 public function getFeedLink(): string
326 {
327 $public_feed = ilBlockSetting::_lookup(
328 "news",
329 "public_feed",
330 0,
331 $this->object->getId()
332 );
333 $url = "";
334 // rss icon/link
335 if ($public_feed) {
336 $news_set = new ilSetting("news");
337 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
338 if ($enable_internal_rss) {
339 $url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $this->requested_ref_id;
340 }
341 }
342 return $url;
343 }
344
348 public function addCastItemObject(): void
349 {
351
352 $this->checkPermission("write");
353
354 $this->initAddCastItemForm();
355 $tpl->setContent($this->form_gui->getHTML());
356 }
357
358 public function editCastItemObject(): void
359 {
360 $item_id = $this->mc_request->getItemId();
361 $this->ctrl->setParameterByClass(self::class, "item_id", $item_id);
362
364 $ilToolbar = $this->toolbar;
365 $ilCtrl = $this->ctrl;
366
367 $this->checkPermission("write");
368
369 $this->mcst_item = new ilNewsItem(
370 $this->mc_request->getItemId()
371 );
372
373 // conversion toolbar
374 $this->video_gui->addPreviewExtractionToToolbar(
375 $this->mcst_item->getMobId(),
376 self::class
377 );
378
379 $this->initAddCastItemForm("edit");
380 $this->getCastItemValues($item_id);
381 $tpl->setContent($this->form_gui->getHTML());
382 }
383
384 public function finishSingleUpload(int $mob_id): void
385 {
386 foreach ($this->object->getSortedItemsArray() as $item) {
387 if ($mob_id == $item["mob_id"]) {
388 $this->ctrl->setParameter($this, "item_id", $item["id"]);
389 $this->ctrl->redirect($this, "editCastItem");
390 }
391 }
392 $this->ctrl->redirect($this, "listItems");
393 }
394
395 protected function onMobUpdate(int $mob_id): void
396 {
397 foreach ($this->object->getSortedItemsArray() as $item) {
398 if ($mob_id == $item["mob_id"]) {
399 $mob = new ilObjMediaObject($item["mob_id"]);
400 $mc_item = new ilNewsItem($item["id"]);
401 $mc_item->setTitle($mob->getTitle());
402 $mc_item->setContent($mob->getLongDescription());
403 $mc_item->update();
404 }
405 }
406 }
407
408 public function initAddCastItemForm(string $a_mode = "create"): void
409 {
411 $ilCtrl = $this->ctrl;
412 $ilTabs = $this->tabs;
413
414 $this->checkPermission("write");
415 $ilTabs->activateTab("edit_content");
416
417 $lng->loadLanguageModule("mcst");
418
419 $news_set = new ilSetting("news");
420 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
421
422 $this->form_gui = new ilPropertyFormGUI();
423 $this->form_gui->setMultipart(true);
424
425 // Property Title
426 $text_input = new ilTextInputGUI($lng->txt("title"), "title");
427 $text_input->setMaxLength(200);
428 $this->form_gui->addItem($text_input);
429
430 // Property Content
431 $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
432 $text_area->setRequired(false);
433 $this->form_gui->addItem($text_area);
434
435 // Property Visibility
436 if ($enable_internal_rss) {
437 $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
438 $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
439 $radio_group->addOption($radio_option);
440 $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
441 $radio_group->addOption($radio_option);
442 $radio_group->setInfo($lng->txt("mcst_visibility_info"));
443 $radio_group->setRequired(true);
444 $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
445 $this->form_gui->addItem($radio_group);
446 }
447
448 // Duration
449 if ($this->getObject()->getViewMode() !== ilObjMediaCast::VIEW_IMG_GALLERY) {
450 $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
451 $dur->setInfo($lng->txt("mcst_duration_info"));
452 $dur->setShowDays(false);
453 $dur->setShowHours(true);
454 $dur->setShowSeconds(true);
455 $this->form_gui->addItem($dur);
456 }
457
458 foreach (ilObjMediaCast::$purposes as $purpose) {
459 if ($purpose == "VideoAlternative" &&
460 $a_mode == "create") {
461 continue;
462 }
463
464 $section = new ilFormSectionHeaderGUI();
465 $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title"));
466 $this->form_gui->addItem($section);
467 if ($a_mode != "create") {
468 $value = new ilHiddenInputGUI("value_" . $purpose);
469 $label = new ilNonEditableValueGUI($lng->txt("value"));
470 $label->setPostVar("label_value_" . $purpose);
471 $label->setInfo($lng->txt("mcst_current_value_info"));
472 $this->form_gui->addItem($label);
473 $this->form_gui->addItem($value);
474 }
475 $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose);
476 $file->setSuffixes($this->mc_manager->getSuffixesForViewMode(
477 $this->object->getViewMode()
478 ));
479 $this->form_gui->addItem($file);
480 $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose);
481 $text_input->setPattern("/https?\:\/\/.+/i");
482 $text_input->setInfo($lng->txt("mcst_reference_info"));
483 $this->form_gui->addItem($text_input);
484 if ($purpose != "Standard") {
485 $clearCheckBox = new ilCheckboxInputGUI();
486 $clearCheckBox->setPostVar("delete_" . $purpose);
487 $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
488 $this->form_gui->addItem($clearCheckBox);
489 } else {
490 //
491 $ne = new ilNonEditableValueGUI($lng->txt("mcst_mimetype"), "mimetype_" . $purpose);
492 $this->form_gui->addItem($ne);
493
494 // preview picure
495 $mob_id = 0;
496 if ($a_mode !== "create") {
497 $mcst_item = new ilNewsItem($this->mc_request->getItemId());
498 $mob_id = $mcst_item->getMobId();
499 }
500 $this->video_gui->addPreviewInput($this->form_gui, $mob_id);
501 }
502 }
503
504 // save/cancel button
505 if ($a_mode == "create") {
506 $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
507 $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
508 } else {
509 $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
510 $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
511 }
512 $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
513 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
514 }
515
519 public function getCastItemValues(int $item_id): void
520 {
522
523 // get mob
524 $this->mcst_item = new ilNewsItem(
525 $item_id
526 );
527 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
528
529 $values = array();
530 $mediaItems = $this->getMediaItems(
531 $this->mc_request->getItemId()
532 );
533 if (count($mediaItems) > 0) {
534 foreach ($mediaItems as $med) {
535 if (!isset($values["title"])) {
536 // first item, so set title, description, ...
537 $values["title"] = $this->mcst_item->getTitle();
538 $values["description"] = $this->mcst_item->getContent();
539 $values["visibility"] = $this->mcst_item->getVisibility();
540 $length = explode(":", $this->mcst_item->getPlaytime());
541 $values["duration"] = array("hh" => $length[0], "mm" => $length[1], "ss" => $length[2]);
542 }
543
544 $values["value_" . $med->getPurpose()] = (strlen($med->getLocation()) > 100) ? "..." . substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
545 $values["label_value_" . $med->getPurpose()] = (strlen($med->getLocation()) > 100) ? "..." . substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
546 $values["mimetype_" . $med->getPurpose()] = $med->getFormat();
547 }
548 }
549 foreach (ilObjMediaCast::$purposes as $purpose) {
550 if (!isset($values["value_" . $purpose])) {
551 $values["label_value_" . $purpose] = $lng->txt("none");
552 $values["value_" . $purpose] = $lng->txt("none");
553 }
554 }
555 $this->form_gui->setValuesByArray($values);
556 }
557
558 public function saveCastItemObject(): void
559 {
560 return;
562 $ilCtrl = $this->ctrl;
563 $ilUser = $this->user;
565 $ilTabs = $this->tabs;
566
567 $this->checkPermission("write");
568 $ilTabs->activateTab("edit_content");
569
570 $this->initAddCastItemForm();
571
572 if (!$this->form_gui->checkInput() ||
573 ($this->form_gui->getInput("url_Standard") == "" && !$_FILES['file_Standard']['tmp_name'])) {
574 $this->tpl->setOnScreenMessage('failure', $lng->txt("mcst_input_either_file_or_url"));
575 $this->populateFormFromPost();
576 } else {
577 // create dummy object in db (we need an id)
578 $mob = new ilObjMediaObject();
579 $mob->create();
580
581 //handle standard purpose
582 $file = $this->createMediaItemForPurpose($mob, "Standard");
583
584 // set title and description
585 // set title to basename of file if left empty
586 $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
587 $description = $this->form_gui->getInput("description");
588 $mob->setTitle($title);
589 $mob->setDescription($description);
590
591 // save preview pic
592 $this->video_gui->savePreviewInput($this->form_gui, $mob->getId());
593
594 // determine duration for standard purpose
595 $duration = $this->getDuration($file);
596
597 // handle other purposes
598 foreach ($this->additionalPurposes as $purpose) {
599 // check if some purpose has been uploaded
600 $file_gui = $this->form_gui->getInput("file_" . $purpose);
601 $url_gui = $this->form_gui->getInput("url_" . $purpose);
602 if ($url_gui || $file_gui["size"] > 0) {
603 $this->createMediaItemForPurpose($mob, $purpose);
604 }
605 }
606
607 $mob->update();
608
609 if ($prevpic["size"] == 0) {
610 // re-read media object
611 $mob = new ilObjMediaObject($mob->getId());
612 $mob->generatePreviewPic(320, 240);
613 }
614
615 //
616 // @todo: save usage
617 //
618
619 $news_set = new ilSetting("news");
620 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
621
622 // create new media cast item
623 $mc_item = new ilNewsItem();
624 $mc_item->setMobId($mob->getId());
625 $mc_item->setContentType(NEWS_AUDIO);
626 $mc_item->setContextObjId($this->object->getId());
627 $mc_item->setContextObjType($this->object->getType());
628 $mc_item->setUserId($ilUser->getId());
629 $mc_item->setPlaytime($duration);
630 $mc_item->setTitle($title);
631 $mc_item->setContent($description);
632 $mc_item->setLimitation(false);
633 if ($enable_internal_rss) {
634 $mc_item->setVisibility($this->form_gui->getInput("visibility"));
635 } else {
636 $mc_item->setVisibility("users");
637 }
638 $mc_item->create();
639
640 $ilCtrl->redirect($this, "listItems");
641 }
642 }
643
644 private function getDuration(ilMediaItem $media_item): string
645 {
646 $duration = isset($this->form_gui)
647 ? $this->form_gui->getInput("duration")
648 : array("hh" => 0, "mm" => 0, "ss" => 0);
649
650 $duration_str = str_pad($duration["hh"], 2, "0", STR_PAD_LEFT) . ":" .
651 str_pad($duration["mm"], 2, "0", STR_PAD_LEFT) . ":" .
652 str_pad($duration["ss"], 2, "0", STR_PAD_LEFT);
653
654 if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0) {
655 $media_item->determineDuration();
656 $d = $media_item->getDuration();
657 if ($d > 0) {
658 $duration_str = $this->object->getPlaytimeForSeconds($d);
659 }
660 }
661
662 return $duration_str;
663 }
664
669 ilObjMediaObject $mob,
670 string $purpose
671 ): string {
672 $mediaItem = new ilMediaItem();
673 $mob->addMediaItem($mediaItem);
674 $mediaItem->setPurpose($purpose);
675 return $this->updateMediaItem($mob, $mediaItem);
676 }
677
685 private function updateMediaItem(
686 ilObjMediaObject $mob,
687 ilMediaItem $mediaItem
688 ): string {
689 $locationType = "";
690 $location = "";
691 $file = "";
692 $purpose = $mediaItem->getPurpose();
693 $locationType = $mediaItem->getLocationType();
694 $url_gui = $this->form_gui->getInput("url_" . $purpose);
695 $file_gui = $this->form_gui->getInput("file_" . $purpose);
696 if ($url_gui) {
697 // http
698 $file = $this->form_gui->getInput("url_" . $purpose);
699 $title = basename($file);
700 $location = $this->form_gui->getInput("url_" . $purpose);
701 $locationType = "Reference";
702 } elseif ($file_gui["size"] > 0) {
703 // lokal
704 // determine and create mob directory, move uploaded file to directory
705 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
706 if (!is_dir($mob_dir)) {
707 $mob->createDirectory();
708 } else {
709 $dir = LegacyPathHelper::createRelativePath($mob_dir);
710 $old_files = $this->filesystem->finder()->in([$dir])->exclude([$dir . '/mob_vpreview.png'])->files();
711 foreach ($old_files as $file) {
712 $this->filesystem->delete($file->getPath());
713 }
714 }
715
716 $file_name = ilFileUtils::getASCIIFilename($_FILES['file_' . $purpose]['name']);
717 $file_name = str_replace(" ", "_", $file_name);
718
719 $file = $mob_dir . "/" . $file_name;
720 $title = $file_name;
721 $locationType = "LocalFile";
722 $location = $title;
723 ilFileUtils::moveUploadedFile($_FILES['file_' . $purpose]['tmp_name'], $file_name, $file);
725 }
726
727 // check if not automatic mimetype detection
728 $format = ilObjMediaObject::getMimeType($mediaItem->getLocation(), ($locationType === "Reference"));
729 $mediaItem->setFormat($format);
730
731 if ($file != "") {
732 // get mime type, if not already set!
733 if ($format === "") {
734 $format = ilObjMediaObject::getMimeType($file, ($locationType === "Reference"));
735 }
736
737 // set real meta and object data
738 $mediaItem->setFormat($format);
739 $mediaItem->setLocation($location);
740 $mediaItem->setLocationType($locationType);
741 $mediaItem->setHAlign("Left");
742 $mediaItem->setHeight(self::isAudio($format) ? 0 : 180);
743 $mob->generatePreviewPic(320, 240);
744 }
745
746 if (($purpose === "Standard") && isset($title)) {
747 $mob->setTitle($title);
748 }
749
750 return $file;
751 }
752
756 public function updateCastItemObject(): void
757 {
758 $ilCtrl = $this->ctrl;
759 $ilUser = $this->user;
760 $ilLog = $this->log;
761 $title = "";
762 $description = "";
763 $file = null;
764
765 $this->checkPermission("write");
766
767 $this->initAddCastItemForm("edit");
768
769 if ($this->form_gui->checkInput()) {
770 // create new media cast item
771 $mc_item = new ilNewsItem(
772 $this->mc_request->getItemId()
773 );
774 $mob_id = $mc_item->getMobId();
775
776 // create dummy object in db (we need an id)
777 $mob = new ilObjMediaObject($mob_id);
778
779
780 foreach (ilObjMediaCast::$purposes as $purpose) {
781 if ($this->form_gui->getInput("delete_" . $purpose)) {
782 $mob->removeMediaItem($purpose);
783 $ilLog->write("Mcst: deleting purpose $purpose");
784 continue;
785 }
786 $media_item = $mob->getMediaItem($purpose);
787 $url_gui = $this->form_gui->getInput("url_" . $purpose);
788 $file_gui = $this->form_gui->getInput("file_" . $purpose);
789
790 if ($media_item == null) {
791 if ($purpose != "Standard" &&
792 ($url_gui || $file_gui["size"] > 0)) {
793 // check if we added an additional purpose when updating
794 // either by url or by file
795 $file = $this->createMediaItemForPurpose($mob, $purpose);
796 }
797 } else {
798 $file = $this->updateMediaItem($mob, $media_item);
799 }
800
801 if ($purpose == "Standard") {
802 if ($this->getObject()->getViewMode() !== ilObjMediaCast::VIEW_IMG_GALLERY) {
803 $duration = $this->getDuration($media_item);
804 }
805 $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
806 $description = $this->form_gui->getInput("description");
807
808 $mob->setTitle($title);
809 $mob->setDescription($description);
810
811 $this->video_gui->savePreviewInput($this->form_gui, $mob->getId());
812 }
813 }
814
815 // set real meta and object data
816 $mob->update();
817
818 //
819 // @todo: save usage
820 //
821
822 $news_set = new ilSetting("news");
823 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
824
825 $mc_item->setUserId($ilUser->getId());
826 if (isset($duration)) {
827 $mc_item->setPlaytime($duration);
828 $dur_arr = explode(":", $duration);
829 $seconds = ((int) $dur_arr[0] * 60 * 60) + ((int) $dur_arr[1] * 60) + ((int) $dur_arr[2]);
830 $st_med = $mob->getMediaItem("Standard");
831 $st_med->setDuration($seconds);
832 $st_med->update();
833 }
834 $mc_item->setTitle($title);
835 $mc_item->setContent($description);
836 if ($enable_internal_rss) {
837 $mc_item->setVisibility($this->form_gui->getInput("visibility"));
838 }
839 $mc_item->update();
840
841 $ilCtrl->redirect($this, "listItems");
842 } else {
843 $this->populateFormFromPost();
844 }
845 }
846
847 public function showCastItemObject(): void
848 {
849 $f = $this->gui->ui()->factory();
850 $item_id = $this->mc_request->getItemId();
851 $news = new ilNewsItem($item_id);
852 $mob = new ilObjMediaObject($news->getMobId());
853 $med = $mob->getMediaItem("Standard");
854 $comp = null;
855 if ($med) {
856 $file = $mob->getStandardSrc();
857 if ($this->media_type->isAudio($med->getFormat())) {
858 $comp = $f->player()->audio($file, "");
859 } elseif ($this->media_type->isVideo($med->getFormat())) {
860 $comp = $f->player()->video($file);
861 } elseif ($this->media_type->isImage($med->getFormat())) {
862 $comp = $f->image()->responsive($file, $mob->getTitle());
863 }
864
865 }
866 if (is_null($comp)) {
867 $comp = $f->messageBox()->info($this->lng->txt("mcst_item_not_found"));
868 }
869 $this->gui->modal(
870 $this->lng->txt("mcst_preview"),
871 $this->lng->txt("close")
872 )->content([$comp])->send();
873 }
874
875 public function confirmItemDeletionObject(): void
876 {
877 $items = [];
878 $f = $this->gui->ui()->factory();
879 $r = $this->gui->ui()->renderer();
880 $ids = $this->mc_request->getItemIds();
881 if (current($ids) === 'ALL_OBJECTS') {
882 $arr = $this->object->getSortedItemsArray();
883 $ids = array_keys($arr);
884 }
885
886 foreach ($ids as $id) {
887 $item = new ilNewsItem($id);
888 $items[] = $f->modal()->interruptiveItem()->keyValue($id, "", $item->getTitle());
889 }
890 $this->gui->send($r->renderAsync([
891 $f->modal()->interruptive(
892 $this->lng->txt("mcst_confirm_deletion"),
893 $this->lng->txt("info_delete_sure"),
894 $this->ctrl->getFormAction($this, "deleteItems")
895 )->withAffectedItems($items)
896 ]));
897 }
898
899 public function confirmDeletionItemsObject(): void
900 {
901 $ilCtrl = $this->ctrl;
903 $tpl = $this->tpl;
904 $ilTabs = $this->tabs;
905
906 $this->checkPermission("write");
907 $ilTabs->activateTab("edit_content");
908
909 $ids = $this->mc_request->getItemIds();
910 if (count($ids) == 0) {
911 $this->listItemsObject();
912 return;
913 }
914
915 $c_gui = new ilConfirmationGUI();
916
917 // set confirm/cancel commands
918 $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteItems"));
919 $c_gui->setHeaderText($lng->txt("info_delete_sure"));
920 $c_gui->setCancel($lng->txt("cancel"), "listItems");
921 $c_gui->setConfirm($lng->txt("confirm"), "deleteItems");
922
923 // add items to delete
924 foreach ($ids as $item_id) {
925 $item = new ilNewsItem($item_id);
926 $c_gui->addItem(
927 "item_id[]",
928 $item_id,
929 $item->getTitle(),
930 ilUtil::getImagePath("standard/icon_mcst.svg")
931 );
932 }
933
934 $tpl->setContent($c_gui->getHTML());
935 }
936
937 public function deleteItemsObject(): void
938 {
939 $ilCtrl = $this->ctrl;
940
941 $this->checkPermission("write");
942
943 // delete all selected news items
944 $ids = $this->mc_request->getItemIds();
945 foreach ($ids as $item_id) {
946 $mc_item = new ilNewsItem($item_id);
947 $mc_item->delete();
948 }
949 $this->object->saveOrder(array_map(function ($i) {
950 return $i["id"];
951 }, $this->object->readItems()));
952 $ilCtrl->redirect($this, "listItems");
953 }
954
958 public function downloadItemObject(): void
959 {
960 $ilCtrl = $this->ctrl;
961 $ilUser = $this->user;
962
963 $this->checkPermission("read");
964 $news_item = new ilNewsItem($this->mc_request->getItemId());
965 $this->object->handleLPUpdate($ilUser->getId(), $news_item->getMobId());
966 if (!$news_item->deliverMobFile(
967 "Standard",
968 $this->mc_request->getPresentation()
969 )) {
970 $ilCtrl->redirect($this, "showContent");
971 }
972 exit;
973 }
974
975 public function determinePlaytimeObject(): void
976 {
977 $ilCtrl = $this->ctrl;
979
980 $mc_item = new ilNewsItem($this->mc_request->getItemId());
981 $mob = $mc_item->getMobId();
982 $mob = new ilObjMediaObject($mob);
983 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
984 $m_item = $mob->getMediaItem("Standard");
985
986 $success = false;
987
988 $m_item->determineDuration();
989 $dur = $m_item->getDuration();
990 if ($dur > 0) {
991 $mc_item->setPlaytime($this->object->getPlaytimeForSeconds($dur));
992 $mc_item->update();
993 $success = true;
994 $this->tpl->setOnScreenMessage('success', $lng->txt("mcst_set_playtime"), true);
995 }
996
997 if (!$success) {
998 $this->tpl->setOnScreenMessage('failure', $lng->txt("mcst_unable_to_determin_playtime"), true);
999 }
1000
1001 $ilCtrl->redirect($this, "listItems");
1002 }
1003
1007 public function infoScreenObject(): void
1008 {
1009 if (!$this->checkPermissionBool("read")) {
1010 $this->checkPermission("visible");
1011 }
1012 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, "showSummary");
1013 }
1014
1015 public function infoScreen(): void
1016 {
1017 $ilTabs = $this->tabs;
1018
1019 $ilTabs->activateTab("id_info");
1020
1021 if (!$this->checkPermissionBool("read")) {
1022 $this->checkPermission("visible");
1023 }
1024
1025 $info = new ilInfoScreenGUI($this);
1026
1027 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1028 $info->enablePrivateNotes();
1029
1030 // general information
1031 $this->lng->loadLanguageModule("meta");
1032 $this->lng->loadLanguageModule("mcst");
1033 $med_items = $this->object->getItemsArray();
1034 $info->addSection($this->lng->txt("meta_general"));
1035 $info->addProperty(
1036 $this->lng->txt("mcst_nr_items"),
1037 count($med_items)
1038 );
1039
1040 if (count($med_items) > 0) {
1041 $cur = current($med_items);
1042 $last = ilDatePresentation::formatDate(new ilDateTime($cur["creation_date"], IL_CAL_DATETIME));
1043 } else {
1044 $last = "-";
1045 }
1046
1047 $info->addProperty($this->lng->txt("mcst_last_submission"), $last);
1048
1049 // forward the command
1050 $this->ctrl->forwardCommand($info);
1051 }
1052
1053 protected function setTabs(): void
1054 {
1055 $ilAccess = $this->access;
1056 $ilTabs = $this->tabs;
1057 $lng = $this->lng;
1058 $ilHelp = $this->help;
1059
1060 $ilHelp->setScreenIdComponent("mcst");
1061
1062 // list items
1063 if ($ilAccess->checkAccess('read', "", $this->object->getRefId())) {
1064 $ilTabs->addTab(
1065 "content",
1066 $lng->txt("content"),
1067 $this->ctrl->getLinkTarget($this, "showContent")
1068 );
1069 }
1070
1071 // info screen
1072 if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()) ||
1073 $ilAccess->checkAccess('read', "", $this->object->getRefId())) {
1074 $ilTabs->addTab(
1075 "id_info",
1076 $lng->txt("info_short"),
1077 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
1078 );
1079 }
1080
1081 // settings
1082 if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
1083 $ilTabs->addTab(
1084 "id_settings",
1085 $lng->txt("settings"),
1086 $this->ctrl->getLinkTargetByClass(SettingsGUI::class, "")
1087 );
1088 }
1089
1090 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1091 $ilTabs->addTab(
1092 'learning_progress',
1093 $lng->txt('learning_progress'),
1094 $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
1095 );
1096 }
1097
1098 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1099 $mdgui = new ilObjectMetaDataGUI($this->object);
1100 $mdtab = $mdgui->getTab();
1101 if ($mdtab) {
1102 $this->tabs_gui->addTab(
1103 "meta_data",
1104 $this->lng->txt("meta_data"),
1105 $mdtab
1106 );
1107 }
1108 }
1109
1110 // export
1111 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1112 $ilTabs->addTab(
1113 "export",
1114 $lng->txt("export"),
1115 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1116 );
1117 }
1118
1119 // edit permissions
1120 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
1121 $ilTabs->addTab(
1122 "id_permissions",
1123 $lng->txt("perm_settings"),
1124 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
1125 );
1126 }
1127 }
1128
1129 public function addContentSubTabs(
1130 string $a_active = "content"
1131 ): void {
1132 $ilTabs = $this->tabs;
1133 $ilAccess = $this->access;
1134 $lng = $this->lng;
1135
1136 $ilTabs->addSubTab(
1137 "content",
1138 $lng->txt("view"),
1139 $this->ctrl->getLinkTarget($this, "showContent")
1140 );
1141
1142 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
1143 $ilTabs->addSubTab(
1144 "manage",
1145 $lng->txt("mcst_manage"),
1146 $this->ctrl->getLinkTarget($this, "listItems")
1147 );
1148
1149 if ($this->object->getOrder() == ilObjMediaCast::ORDER_MANUAL) {
1150 $ilTabs->addSubTab(
1151 "sorting",
1152 $lng->txt("mcst_ordering"),
1153 $this->ctrl->getLinkTarget($this, "editOrder")
1154 );
1155 }
1156 }
1157
1158 $ilTabs->activateSubTab($a_active);
1159 $ilTabs->activateTab("content");
1160 }
1161
1162 public function editSettingsObject(): void
1163 {
1164 $this->editObject();
1165 }
1166
1167 protected function addLocatorItems(): void
1168 {
1169 $ilLocator = $this->locator;
1170
1171 if (is_object($this->object)) {
1172 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "showContent"), "", $this->requested_ref_id);
1173 }
1174 }
1175
1176 public static function _goto(string $a_target): void
1177 {
1178 global $DIC;
1179 $main_tpl = $DIC->ui()->mainTemplate();
1180
1181 $ilAccess = $DIC->access();
1182 $lng = $DIC->language();
1183 $ctrl = $DIC->ctrl();
1184
1185 if ($ilAccess->checkAccess("read", "", $a_target)) {
1186 $ctrl->setParameterByClass("ilobjmediacastgui", "ref_id", $a_target);
1187 //exit;
1188 $ctrl->redirectByClass(["ilmediacasthandlergui", "ilobjmediacastgui"], "showContent");
1189 } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1190 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
1191 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1192 $main_tpl->setOnScreenMessage('failure', sprintf(
1193 $lng->txt("msg_no_perm_read_item"),
1195 ));
1197 }
1198
1199 throw new ilPermissionException($lng->txt("msg_no_perm_read"));
1200 }
1201
1202 protected static function isAudio(string $extension): bool
1203 {
1204 return strpos($extension, "audio") !== false;
1205 }
1206
1210 protected function getMediaItem(int $id): ilMediaItem
1211 {
1212 $this->mcst_item = new ilNewsItem($id);
1213 // create dummy object in db (we need an id)
1214 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1215 return $mob->getMediaItem("Standard");
1216 }
1217
1218 protected function getMediaItems(int $id): array
1219 {
1220 $this->mcst_item = new ilNewsItem($id);
1221 // create dummy object in db (we need an id)
1222 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1223 return $mob->getMediaItems();
1224 }
1225
1226 private function populateFormFromPost(): void
1227 {
1228 $tpl = $this->tpl;
1229 $this->form_gui->setValuesByPost();
1230
1231 //issue: we have to display the current settings
1232 // problem: POST does not contain values of disabled text fields
1233 // solution: use hidden field and label to display-> here we need to synchronize the labels
1234 // with the values from the hidden fields.
1235 foreach (ilObjMediaCast::$purposes as $purpose) {
1236 if ($this->form_gui->getInput("value_" . $purpose)) {
1237 $input = $this->form_gui->getItemByPostVar("label_value_" . $purpose);
1238 $input->setValue($this->form_gui->getInput("value_" . $purpose));
1239 }
1240 }
1241
1242 $this->form_gui->setValuesByPost();
1243 $tpl->setContent($this->form_gui->getHTML());
1244 }
1245
1246 protected function editOrderObject(): void
1247 {
1248 $ilTabs = $this->tabs;
1249 $lng = $this->lng;
1250 $tpl = $this->tpl;
1251
1252 $this->checkPermission("write");
1253 $ilTabs->activateTab("edit_content");
1254
1255 $this->addContentSubTabs("sorting");
1256
1257 // sort by order setting
1258 switch ($this->object->getOrder()) {
1262 $this->listItemsObject();
1263 return;
1264
1266 // sub-tabs
1267 break;
1268 }
1269
1270 $table_gui = new ilMediaCastTableGUI($this, "editOrder", true);
1271
1272 $table_gui->setTitle($lng->txt("mcst_media_cast"));
1273 $table_gui->setData($this->object->getSortedItemsArray());
1274
1275 $table_gui->addCommandButton("saveOrder", $lng->txt("mcst_save_order"));
1276
1277 $tpl->setContent($table_gui->getHTML());
1278 }
1279
1280 public function saveOrderObject(): void
1281 {
1282 $lng = $this->lng;
1283
1284 $ids = $this->mc_request->getItemIds();
1285 asort($ids);
1286
1287 $items = array();
1288 foreach (array_keys($ids) as $id) {
1289 $items[] = $id;
1290 }
1291 $this->object->saveOrder($items);
1292
1293 $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
1294 $this->ctrl->redirect($this, "editOrder");
1295 }
1296
1300
1301 public function showContentObject(): void
1302 {
1303 $tpl = $this->tpl;
1304 $ilUser = $this->user;
1305 $ilTabs = $this->tabs;
1306
1307 // need read events for parent for LP statistics
1309 "mcst",
1310 $this->object->getRefId(),
1311 $this->object->getId(),
1312 $ilUser->getId()
1313 );
1314
1315 // trigger LP update
1316 ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
1317
1318 if ($this->object->getViewMode() == ilObjMediaCast::VIEW_GALLERY) {
1319 $this->showGallery();
1320 } elseif ($this->object->getViewMode() == ilObjMediaCast::VIEW_IMG_GALLERY) {
1321 $view = new \McstImageGalleryGUI($this->object, $this->tpl, $this->getFeedLink());
1322 $view->setCompletedCallback($this->ctrl->getLinkTarget(
1323 $this,
1324 "handlePlayerCompletedEvent",
1325 "",
1326 true,
1327 false
1328 ));
1329 $this->tabs->activateTab("content");
1330 $this->addContentSubTabs("content");
1331 $tpl->setContent($this->ctrl->getHTML($view));
1332 } elseif ($this->object->getViewMode() == ilObjMediaCast::VIEW_PODCAST) {
1333 $view = new \McstPodcastGUI($this->object, $this->tpl, $this->getFeedLink());
1334 $this->tabs->activateTab("content");
1335 $this->addContentSubTabs("content");
1336 $tpl->setContent($this->ctrl->getHTML($view));
1337 } elseif ($this->object->getViewMode() == ilObjMediaCast::VIEW_VCAST) {
1338 $ilTabs->activateTab("content");
1339 $this->addContentSubTabs("content");
1340 $view = new \ILIAS\MediaCast\Presentation\VideoViewGUI($this->object, $tpl, $this->getFeedLink());
1341 $view->setCompletedCallback($this->ctrl->getLinkTarget(
1342 $this,
1343 "handlePlayerCompletedEvent",
1344 "",
1345 true,
1346 false
1347 ));
1348 $view->setAutoplayCallback($this->ctrl->getLinkTarget(
1349 $this,
1350 "handleAutoplayTrigger",
1351 "",
1352 true,
1353 false
1354 ));
1355 $view->show();
1356 } else {
1357 $this->listItemsObject(true);
1358 }
1359
1360 $tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
1361 }
1362
1363 public function showGallery(): void
1364 {
1365 $tpl = $this->tpl;
1366 $ilTabs = $this->tabs;
1367 $ilCtrl = $this->ctrl;
1368
1369 $this->tpl->setOnScreenMessage('info', $this->lng->txt("mcst_view_abandoned"));
1370 }
1371
1372 public function extractPreviewImageObject(): void
1373 {
1374 $ilCtrl = $this->ctrl;
1375 $this->checkPermission("write");
1376 $this->mcst_item = new ilNewsItem($this->mc_request->getItemId());
1377 $this->video_gui->handleExtractionRequest(
1378 $this->mcst_item->getMobId()
1379 );
1380 $ilCtrl->redirect($this, "editCastItem");
1381 }
1382
1383 public function handlePlayerEventObject(): void
1384 {
1385 if ($this->mc_request->getEvent() === "play") {
1386 $player = explode("_", $this->mc_request->getPlayer());
1387 $news_id = (int) $player[1];
1388 $item = new ilNewsItem($news_id);
1389 $item->increasePlayCounter();
1390
1391 $mob_id = $item->getMobId();
1392 if ($mob_id) {
1393 $ilUser = $this->user;
1394 $this->object->handleLPUpdate($ilUser->getId(), $mob_id);
1395 }
1396 }
1397 exit;
1398 }
1399
1400 protected function handlePlayerCompletedEventObject(): void
1401 {
1402 $mob_id = $this->mc_request->getMobId();
1403 if ($mob_id > 0) {
1404 $ilUser = $this->user;
1405 $this->object->handleLPUpdate($ilUser->getId(), $mob_id);
1406 }
1407 exit;
1408 }
1409
1410 protected function afterUpload($mob_ids): void
1411 {
1412 $this->addMobsToCast($mob_ids, "", false);
1413 }
1414
1415 protected function afterUrlSaving(int $mob_id, string $long_desc): void
1416 {
1417 $this->addMobsToCast([$mob_id], $long_desc);
1418 }
1419
1420 protected function addMobsToCast(
1421 array $mob_ids,
1422 string $long_desc = "",
1423 bool $redirect = true,
1424 bool $extract = false
1425 ): void {
1426 $ctrl = $this->ctrl;
1427 $user = $this->user;
1428
1429 $item_ids = [];
1430 foreach ($mob_ids as $mob_id) {
1431 $item_ids[] = $this->object->addMobToCast($mob_id, $user->getId(), $long_desc, $extract);
1432 }
1433
1434 if ($redirect) {
1435 if (count($item_ids) === 1) {
1436 $ctrl->setParameter($this, "item_id", $item_ids[0]);
1437 $ctrl->redirect($this, "editCastItem");
1438 }
1439 $ctrl->redirect($this, "listItems");
1440 }
1441 }
1442
1443 protected function afterPoolInsert(array $mob_ids): void
1444 {
1445 $this->addMobsToCast($mob_ids, "", true, true);
1446 }
1447
1448 protected function handleAutoplayTriggerObject(): void
1449 {
1450 $this->user->writePref(
1451 "mcst_autoplay",
1452 $this->mc_request->getAutoplay()
1453 );
1454 exit;
1455 }
1456
1457 protected function getCommentGUI(): ilCommentGUI
1458 {
1459 return $this->gui->comments()->commentGUI(
1460 $this->object->getRefId(),
1461 $this->mc_request->getItemId()
1462 );
1463 }
1464
1465 protected function showCommentsObject(): void
1466 {
1467 echo $this->getCommentGUI()->getListHTML() . "<script>ilNotes.init(null);</script>";
1468 exit;
1469 }
1470
1471 protected function renderVideoObject(): void
1472 {
1473 $mob_id = $this->mc_request->getMobId();
1474 $html = $this->mob_player_gui->wrapper()->renderComponent(new ilObjMediaObject($mob_id));
1475 $this->gui->httpUtil()->sendString($html);
1476 }
1477}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$duration
$location
Definition: buildRTE.php:22
Mime type determination.
Definition: MimeType.php:30
Indicates that a file is missing or not found.
Indicates general problems with the input or output operations.
Definition: IOException.php:28
The legacy path helper provides convenient functions for the integration of the filesystem service wi...
const IL_CAL_DATETIME
error(string $a_errmsg)
const NEWS_AUDIO
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
This class represents a duration (typical hh:mm:ss) property in a property form.
Export User Interface Class.
This class represents a file property in a property form.
static getASCIIFilename(string $a_filename)
static renameExecutables(string $a_dir)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
This class represents a section header in a property form.
Help GUI class.
This class represents a hidden form property in a property form.
Class ilInfoScreenGUI.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
loadLanguageModule(string $a_module)
Load language module.
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...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
Component logger with individual log levels by component id.
TableGUI class for table NewsForContext.
Class ilMediaItem Media Item, component of a media object (file or reference)
setLocationType(string $a_type)
setLocation(string $a_location)
setHeight(string $a_height)
setFormat(string $a_format)
setHAlign(string $a_halign)
set horizontal align
A news item can be created by different sources.
This class represents a non editable value in a property form.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
updateMediaItem(ilObjMediaObject $mob, ilMediaItem $mediaItem)
Update media item from form.
getDuration(ilMediaItem $media_item)
afterUrlSaving(int $mob_id, string $long_desc)
downloadItemObject()
Download news media item.
static isAudio(string $extension)
__construct( $a_data, int $a_id, bool $a_call_by_reference, bool $a_prepare_output=true)
ilPropertyFormGUI $form_gui
ILIAS MediaObjects Player GUIService $mob_player_gui
addContentSubTabs(string $a_active="content")
ILIAS MediaCast MediaCastManager $mc_manager
ILIAS MediaObjects MediaType MediaTypeManager $media_type
updateCastItemObject()
Update cast item.
afterSave(ilObject $new_object)
Post (successful) object creation hook.
createMediaItemForPurpose(ilObjMediaObject $mob, string $purpose)
Handle media item for given purpose.
getCastItemValues(int $item_id)
Get cast item values into form.
infoScreenObject()
This one is called from the info button in the repository.
static _goto(string $a_target)
addMobsToCast(array $mob_ids, string $long_desc="", bool $redirect=true, bool $extract=false)
addCastItemObject()
Add media cast item.
listItemsObject(bool $a_presentation_mode=false)
ILIAS MediaCast InternalGUIService $gui
initAddCastItemForm(string $a_mode="create")
StandardGUIRequest $mc_request
getMediaItem(int $id)
Get MediaItem for id and updates local variable mcst_item.
static array $purposes
getMediaItem(string $a_purpose)
get item for media purpose
static getMimeType(string $a_file, bool $a_external=false)
get mime type for file
createDirectory()
Create file directory of media object.
addMediaItem(ilMediaItem $a_item)
removeMediaItem(string $a_purpose)
static _getDirectory(int $a_mob_id)
Get absolute directory.
update(bool $a_upload=false)
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
ilAccessHandler $access
ilGlobalTemplateInterface $tpl
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilSetting $settings
addHeaderAction()
Add header action menu.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
ilToolbarGUI $toolbar
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
Class ilObjectMetaDataGUI.
Class ilObject Basic functions for all objects.
setTitle(string $title)
static _lookupObjId(int $ref_id)
setDescription(string $description)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a regular expression input property in a property form.
ILIAS Setting Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
const CLIENT_ID
Definition: constants.php:41
const ROOT_FOLDER_ID
Definition: constants.php:32
exit
$info
Definition: entry_point.php:21
The filesystem interface provides the public interface for the Filesystem service API consumer.
Definition: Filesystem.php:37
setContent(string $a_html)
Sets content for standard template.
$log
Definition: ltiresult.php:34
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68