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