33 protected \ILIAS\MediaObjects\Video\GUIService
$video_gui;
51 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager
$media_type;
62 bool $a_call_by_reference =
false,
63 bool $a_prepare_output =
false
67 $this->
access = $DIC->access();
68 $this->
error = $DIC[
"ilErr"];
69 $this->
help = $DIC[
"ilHelp"];
70 $this->
tabs = $DIC->tabs();
71 $this->
toolbar = $DIC->toolbar();
72 $this->
user = $DIC->user();
74 $ilCtrl =
$DIC->ctrl();
75 $domain =
$DIC->mediaObjects()
78 $this->media_type = $domain->mediaType();
80 $this->
ctrl = $ilCtrl;
83 $this->back_title =
"";
86 $this->sub_title_request =
$DIC->mediaObjects()
93 $this->file_service_settings =
$DIC->fileServiceSettings();
94 $this->video_gui =
$DIC->mediaObjects()->internal()->gui()->video();
95 $this->md =
$DIC->mediaObjects()->internal()->domain()->metadata();
96 $this->media_manager = $domain->mediaObject();
106 string $a_adv_subtype =
"-"
108 $this->adv_ref_id = $a_adv_ref_id;
109 $this->adv_type = $a_adv_type;
110 $this->adv_subtype = $a_adv_subtype;
119 if ($this->adv_type ==
null) {
124 return [$this->adv_ref_id, $this->adv_type, $this->adv_subtype];
135 return $this->header;
139 bool $a_enabledmapareas
141 $this->enabledmapareas = $a_enabledmapareas;
146 return $this->enabledmapareas;
154 $this->width_preset = $a_val;
159 return $this->width_preset;
167 $this->height_preset = $a_val;
172 return $this->height_preset;
177 return $this->form_gui;
182 if ($this->
id != 0) {
192 $this->
ctrl->returnToParent($this);
198 public function executeCommand(): void
202 $next_class = $this->
ctrl->getNextClass($this);
203 $cmd = $this->
ctrl->getCmd();
206 switch ($next_class) {
207 case 'ilobjectmetadatagui':
210 $md_gui->addMDObserver($this->
object,
'MDUpdateListener',
'General');
213 if ($this->adv_type !=
"") {
214 $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
217 $this->
ctrl->forwardCommand($md_gui);
220 case "ilimagemapeditorgui":
222 $mob = $this->object;
224 $ret = $this->
ctrl->forwardCommand($image_map_edit);
225 $tpl->setContent($ret);
226 $this->checkFixSize();
229 case strtolower(ilContainerResourceGUI::class):
230 $res = $this->media_manager->getContainerResource($this->
object->
getId());
235 $this->
lng->txt(
'files'),
248 $this->
ctrl->forwardCommand($container_gui);
253 $ret = $this->$cmd();
260 $this->back_title = $a_title;
266 $ilHelp = $this->help;
268 $ilHelp->setScreenId(
"create");
270 $tpl->setContent($this->form_gui->getHTML());
273 public function initForm(
string $a_mode =
"create"): void
276 $ilCtrl = $this->ctrl;
281 if ($a_mode ==
"edit") {
282 $std_item = $this->
object->getMediaItem(
"Standard");
290 $title->setMaxLength(120);
291 $this->form_gui->addItem($title);
295 $up->setSuffixes(iterator_to_array($this->media_type->getAllowedSuffixes()));
298 if ($a_mode ==
"create" || $std_item->getLocationType() !=
"LocalFile") {
299 $up->setRequired(
true);
301 $op1->addSubItem($up);
302 $radio_prop->addOption($op1);
305 $ref->setInfo(
$lng->txt(
"cont_ref_helptext"));
306 $ref->setRequired(
true);
307 $op2->addSubItem($ref);
308 $radio_prop->addOption($op2);
309 $radio_prop->setValue(
"File");
310 $this->form_gui->addItem($radio_prop);
313 if ($a_mode ==
"edit") {
315 $format->setValue($std_item->getFormat());
316 $this->form_gui->addItem($format);
321 if ($a_mode ==
"edit") {
322 if ($orig_size = $std_item->getOriginalSize()) {
323 $add_str =
" (" . ($orig_size[
"width"] ??
"") .
" x " . ($orig_size[
"height"] ??
"") .
")";
325 $op1 =
new ilRadioOption(
$lng->txt(
"cont_resource_size") . $add_str,
"original");
326 $op1->setInfo(
$lng->txt(
"cont_resource_size_info"));
330 $op1->setInfo(
$lng->txt(
"cont_resource_size_info"));
333 $radio_size->addOption($op1);
337 " / " .
$lng->txt(
"cont_height"),
"standard_width_height");
338 if ($a_mode ==
"edit" && is_int(strpos($std_item->getFormat(),
"image"))
339 && $std_item->getLocationType() ==
"LocalFile") {
340 $width_height->setSupportConstraintsProps(
true);
341 $width_height->setConstrainProportions(
true);
343 $op2->addSubItem($width_height);
346 if ($a_mode ==
"edit") {
347 $std_item = $this->
object->getMediaItem(
"Standard");
348 if (is_int(strpos($std_item->getFormat(),
"image"))
349 && $std_item->getLocationType() ==
"LocalFile") {
351 $op2->addSubItem($resize);
355 $radio_size->setValue(
"original");
356 if ($a_mode ==
"create" && ($this->getHeightPreset() > 0 || $this->getWidthPreset() > 0)) {
357 $radio_size->setValue(
"selected");
358 $width_height->setWidth($this->getWidthPreset());
359 $width_height->setHeight($this->getHeightPreset());
361 $radio_size->addOption($op2);
362 $this->form_gui->addItem($radio_size);
366 $caption->setCols(30);
367 $caption->setRows(2);
368 $this->form_gui->addItem($caption);
376 if ($a_mode ==
"edit" && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
380 $ta->setInfo(
$lng->txt(
"text_repr_info"));
381 $this->form_gui->addItem($ta);
385 $this->video_gui->addPreviewInput($this->form_gui, $this->
object->getId());
389 if ($a_mode ==
"edit" &&
390 $this->media_type->usesParameterProperty($std_item->getFormat())) {
391 if ($this->media_type->usesAutoStartParameterOnly(
392 $std_item->getLocation(),
393 $std_item->getFormat()
401 $this->form_gui->addItem($par);
405 if ($a_mode ==
"edit") {
406 $full_item = $this->
object->getMediaItem(
"Fullscreen");
411 $fs_sec->setTitle(
$lng->txt(
"cont_fullscreen"));
412 $this->form_gui->addItem($fs_sec);
416 $radio_prop2->addOption($op1);
417 $op4 =
new ilRadioOption(
$lng->txt(
"cont_use_same_resource_as_above"),
"Standard");
418 $radio_prop2->addOption($op4);
421 $up->setSuffixes(iterator_to_array($this->media_type->getAllowedSuffixes()));
424 if ($a_mode ==
"create" || !$full_item || $full_item->getLocationType() !=
"LocalFile") {
425 $up->setRequired(
true);
427 $op2->addSubItem($up);
428 $radio_prop2->addOption($op2);
431 $ref->setInfo(
$lng->txt(
"cont_ref_helptext"));
432 $ref->setRequired(
true);
433 $op3->addSubItem($ref);
434 $radio_prop2->addOption($op3);
435 $radio_prop2->setValue(
"None");
436 $this->form_gui->addItem($radio_prop2);
439 if ($a_mode ==
"edit") {
440 if ($this->
object->hasFullscreenItem()) {
442 $format->setValue($full_item->getFormat());
443 $this->form_gui->addItem($format);
448 $full_support_constraint_props =
false;
450 if ($a_mode ==
"edit") {
452 if ($this->
object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
453 $add_str =
" (" . ($orig_size[
"width"] ??
"") .
" x " . ($orig_size[
"height"] ??
"") .
")";
455 if (is_int(strpos($full_item->getFormat(),
"image"))
456 && $full_item->getLocationType() ==
"LocalFile") {
457 $full_support_constraint_props =
true;
460 $op1 =
new ilRadioOption(
$lng->txt(
"cont_resource_size") . $add_str,
"original");
461 $op1->setInfo(
$lng->txt(
"cont_resource_size_info"));
465 $op1->setInfo(
$lng->txt(
"cont_resource_size_info"));
468 $radio_size->addOption($op1);
472 " / " .
$lng->txt(
"cont_height"),
"full_width_height");
473 if ($full_support_constraint_props) {
474 $width_height->setSupportConstraintsProps(
true);
475 $width_height->setConstrainProportions(
true);
477 $op2->addSubItem($width_height);
480 if ($a_mode ==
"edit") {
481 $full_item = $this->
object->getMediaItem(
"Fullscreen");
482 if ($this->
object->hasFullscreenItem() &&
483 is_int(strpos($full_item->getFormat(),
"image")) &&
484 $full_item->getLocationType() ==
"LocalFile") {
486 $lng->txt(
"cont_resize_img"),
489 $op2->addSubItem($resize);
493 $radio_size->setValue(
"original");
494 $radio_size->addOption($op2);
495 $this->form_gui->addItem($radio_size);
499 $caption->setCols(30);
500 $caption->setRows(2);
501 $this->form_gui->addItem($caption);
509 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
513 $ta->setInfo(
$lng->txt(
"text_repr_info"));
514 $this->form_gui->addItem($ta);
519 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() &&
520 $this->media_type->usesParameterProperty($full_item->getFormat())) {
521 if ($this->media_type->usesAutoStartParameterOnly(
522 $full_item->getLocation(),
523 $full_item->getFormat()
531 $this->form_gui->addItem($par);
536 if ($a_mode ==
"edit") {
537 $this->form_gui->setTitle(
$lng->txt(
"cont_edit_mob"));
538 $this->form_gui->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
540 $this->form_gui->setTitle(
$lng->txt(
"cont_insert_mob"));
541 $this->form_gui->addCommandButton(
"save",
$lng->txt(
"save"));
542 $this->form_gui->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
544 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
552 $std_item = $this->
object->getMediaItem(
"Standard");
553 if ($std_item->getWidth() ==
"" || $std_item->getHeight() ==
"") {
554 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"mob_no_fixed_size_map_editing"));
566 $values[
"standard_title"] = $this->
object->getTitle();
568 $std_item = $this->
object->getMediaItem(
"Standard");
569 if ($std_item->getLocationType() ==
"LocalFile") {
570 $values[
"standard_type"] =
"File";
571 $values[
"standard_file"] = $std_item->getLocation();
573 $values[
"standard_type"] =
"Reference";
574 $values[
"standard_reference"] = $std_item->getLocation();
576 $values[
"standard_format"] = $std_item->getFormat();
577 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
578 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
579 $values[
"standard_width_height"][
"constr_prop"] =
true;
581 $values[
"standard_size"] =
"selected";
583 $orig_size = $std_item->getOriginalSize();
584 if ($std_item->getWidth() ==
"" && $std_item->getHeight() ==
"") {
585 $values[
"standard_size"] =
"original";
586 $values[
"standard_width_height"][
"width"] = $orig_size[
"width"] ??
"";
587 $values[
"standard_width_height"][
"height"] = $orig_size[
"height"] ??
"";
590 $values[
"standard_caption"] = $std_item->getCaption();
591 $values[
"text_representation"] = $std_item->getTextRepresentation();
592 if ($this->media_type->usesAutoStartParameterOnly(
593 $std_item->getLocation(),
594 $std_item->getFormat()
601 $values[
"standard_parameters"] = $std_item->getParameterString();
604 $values[
"full_type"] =
"None";
605 $values[
"full_size"] =
"original";
606 if ($this->
object->hasFullscreenItem()) {
607 $full_item = $this->
object->getMediaItem(
"Fullscreen");
608 if ($full_item->getLocationType() ==
"LocalFile") {
609 $values[
"full_type"] =
"File";
610 $values[
"full_file"] = $full_item->getLocation();
612 $values[
"full_type"] =
"Reference";
613 $values[
"full_reference"] = $full_item->getLocation();
615 $values[
"full_format"] = $full_item->getFormat();
616 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
617 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
618 $values[
"full_width_height"][
"constr_prop"] =
true;
620 $values[
"full_size"] =
"selected";
622 $orig_size = $full_item->getOriginalSize();
623 if ($full_item->getWidth() ==
"" &&
624 $full_item->getHeight() ==
"") {
625 $values[
"full_size"] =
"original";
626 $values[
"full_width_height"][
"width"] = $orig_size[
"width"] ??
"";
627 $values[
"full_width_height"][
"height"] = $orig_size[
"height"] ??
"";
629 $values[
"full_caption"] = $full_item->getCaption();
630 if ($this->media_type->usesAutoStartParameterOnly(
631 $full_item->getLocation(),
632 $full_item->getFormat()
639 $values[
"full_parameters"] = $full_item->getParameterString();
641 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
644 $this->form_gui->setValuesByArray($values);
655 if ($this->form_gui->checkInput()) {
657 $this->setObjectPerCreationForm($this->
object);
658 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"saved_media_object"),
true);
660 $this->form_gui->setValuesByPost();
661 $tpl->setContent($this->form_gui->getHTML());
667 if (!$this->form_gui->checkInput()) {
668 $this->form_gui->setValuesByPost();
681 $form = $this->form_gui;
689 if (trim($form->getInput(
"standard_title")) !=
"") {
690 $title = trim($form->getInput(
"standard_title"));
692 if ($form->getInput(
"standard_type") ==
"File") {
693 $title = $_FILES[
'standard_file'][
'name'];
695 $title = $form->getInput(
"standard_reference");
709 if ($form->getInput(
"standard_type") ==
"File") {
710 $width = $height = 0;
711 $constr_prop =
false;
712 if ($form->getInput(
"standard_size") !=
"original") {
713 $wh_input = $form->getInput(
"standard_width_height");
714 $width = (
int) $wh_input[
"width"];
715 $height = (
int) $wh_input[
"height"];
716 $constr_prop = ($wh_input[
"constr_prop"] ??
false);
720 $_FILES[
"standard_file"][
"tmp_name"],
721 $_FILES[
"standard_file"][
"name"],
729 $media_item->setPurpose(
"Standard");
732 $media_item->setFormat($format);
734 $media_item->setLocationType(
"Reference");
738 }
catch (Exception
$e) {
761 if ($form->getInput(
"standard_caption") !=
"") {
762 $media_item->setCaption($form->getInput(
"standard_caption"));
766 $media_item->setHAlign(
"Left");
769 if ($form->getInput(
"full_type") !=
"None") {
772 $media_item2->setPurpose(
"Fullscreen");
775 if ($form->getInput(
"full_type") ==
"File") {
777 if ($_FILES[
'full_file'][
'name'] !=
"") {
779 $file = $mob_dir .
"/" . $full_file_name;
781 $_FILES[
'full_file'][
'tmp_name'],
788 } elseif ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"File") {
793 if ($form->getInput(
"full_type") ==
"File" ||
794 ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"File")) {
795 if (($form->getInput(
"full_size") !=
"original" &&
796 is_int(strpos($format,
"image")))
798 $full_wh_input = $form->getInput(
"full_width_height");
799 $location = $this->media_manager->resizeImage(
803 (
int) $full_wh_input[
"width"],
804 (
int) $full_wh_input[
"height"],
805 (
bool) ($full_wh_input[
"constr_prop"] ??
false)
809 $media_item2->setFormat($format);
811 $media_item2->setLocationType(
"LocalFile");
815 if ($form->getInput(
"full_type") ==
"Reference") {
817 if ($form->getInput(
"full_reference") !=
"") {
823 if ($form->getInput(
"full_type") ==
"Reference" ||
824 ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"Reference")) {
825 $media_item2->setFormat($format);
827 $media_item2->setLocationType(
"Reference");
848 if ($form->getInput(
"full_caption") !=
"") {
849 $media_item2->setCaption($form->getInput(
"full_caption"));
865 $this->
ctrl->returnToParent($this);
872 $this->setPropertiesSubTabs(
"general");
873 $this->video_gui->addPreviewExtractionToToolbar(
877 $this->initForm(
"edit");
879 $tpl->setContent($this->form_gui->getHTML());
884 $ilCtrl = $this->ctrl;
885 $this->video_gui->handleExtractionRequest(
888 $ilCtrl->redirect($this,
"edit");
897 $std_item = $this->
object->getMediaItem(
"Standard");
898 if ($std_item->getLocationType() ==
"LocalFile" &&
899 is_int(strpos($std_item->getFormat(),
"image"))
901 $location = $this->media_manager->resizeImage(
903 $std_item->getLocation(),
904 $std_item->getFormat(),
905 $std_item->getWidth(),
906 $std_item->getHeight()
913 if ($this->
object->hasFullscreenItem()) {
914 $full_item = $this->
object->getMediaItem(
"Fullscreen");
915 if ($full_item->getLocationType() ==
"LocalFile" &&
916 is_int(strpos($full_item->getFormat(),
"image"))
918 $location = $this->media_manager->resizeImage(
920 $full_item->getLocation(),
921 $full_item->getFormat(),
922 $full_item->getWidth(),
923 $full_item->getHeight()
926 $full_item->update();
930 $this->
ctrl->redirect($this,
"edit");
939 $std_item = $this->
object->getMediaItem(
"Standard");
942 if ($std_item->getLocationType() ==
"LocalFile") {
943 $file = $mob_dir .
"/" . $std_item->getLocation();
947 $std_item->setWidth($size[0]);
948 $std_item->setHeight($size[1]);
949 $this->
object->update();
951 $this->
ctrl->redirect($this,
"edit");
960 $full_item = $this->
object->getMediaItem(
"Fullscreen");
963 if ($full_item->getLocationType() ==
"LocalFile") {
964 $file = $mob_dir .
"/" . $full_item->getLocation();
966 $full_item->setWidth($size[0]);
967 $full_item->setHeight($size[1]);
968 $this->
object->update();
970 $this->
ctrl->redirect($this,
"edit");
980 $this->initForm(
"edit");
981 $form = $this->form_gui;
983 if ($form->checkInput()) {
984 $title = trim($form->getInput(
"standard_title"));
985 $this->
object->setTitle($title);
987 $std_item = $this->
object->getMediaItem(
"Standard");
989 $format = $std_item->getFormat();
990 if ($form->getInput(
"standard_type") ==
"Reference") {
992 $std_item->setFormat($format);
994 $std_item->setLocationType(
"Reference");
997 if ($form->getInput(
"standard_type") ==
"File") {
999 if ($_FILES[
'standard_file'][
'name'] !=
"") {
1001 $file_name = $_FILES[
'standard_file'][
'name'];
1002 $this->media_manager->addFileFromLegacyUpload(
1004 $_FILES[
'standard_file'][
'tmp_name']
1012 } elseif ($form->getInput(
"standard_resize")) {
1019 if ($form->getInput(
"standard_size") !=
"original" &&
1020 is_int(strpos($format,
"image"))) {
1021 $wh_input = $form->getInput(
"standard_width_height");
1022 $location = $this->media_manager->resizeImage(
1026 (
int) $wh_input[
"width"],
1027 (
int) $wh_input[
"height"],
1028 (
bool) ($wh_input[
"constr_prop"] ??
false)
1031 $std_item->setFormat($format);
1035 $std_item->setLocationType(
"LocalFile");
1037 $this->
object->setDescription($format);
1039 $wh_input = $form->getInput(
"standard_width_height");
1042 $form->getInput(
"standard_type"),
1044 $std_item->getLocation(),
1045 (
bool) ($wh_input[
"constr_prop"] ??
false),
1046 ($form->getInput(
"standard_size") ==
"original"),
1047 ($wh_input[
"width"] ==
"") ?
null : (
int) $wh_input[
"width"],
1048 ($wh_input[
"height"] ==
"") ?
null : (
int) $wh_input[
"height"]
1050 if ($wh[
"info"] !=
"") {
1051 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
1053 $std_item->setWidth($wh[
"width"]);
1054 $std_item->setHeight($wh[
"height"]);
1057 $std_item->setCaption($form->getInput(
"standard_caption"));
1060 $std_item->setTextRepresentation($form->getInput(
"text_representation"));
1062 $this->video_gui->savePreviewInput($form, $this->
object->getId());
1065 if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1066 if (!$this->media_type->usesAutoStartParameterOnly(
1067 $std_item->getLocation(),
1068 $std_item->getFormat()
1070 $std_item->setParameters($form->getInput(
"standard_parameters"));
1075 if ($form->getInput(
"full_type") ==
"None") {
1076 if ($this->
object->hasFullscreenItem()) {
1077 $this->
object->removeMediaItem(
"Fullscreen");
1080 if ($this->
object->hasFullscreenItem()) {
1081 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1084 $this->
object->addMediaItem($full_item);
1085 $full_item->setPurpose(
"Fullscreen");
1088 $format = $full_item->getFormat();
1089 if ($form->getInput(
"full_type") ==
"Reference") {
1091 $full_item->setFormat($format);
1092 $full_item->setLocationType(
"Reference");
1094 $type =
"Reference";
1098 if ($form->getInput(
"full_type") ==
"File") {
1100 if ($_FILES[
'full_file'][
'name'] !=
"") {
1101 $full_file_name = $_FILES[
'full_file'][
'name'];
1102 $this->media_manager->addFileFromLegacyUpload(
1104 $_FILES[
'full_file'][
'tmp_name']
1111 } elseif ($form->getInput(
"full_resize")) {
1117 if ($form->getInput(
"full_size") !=
"original" &&
1118 is_int(strpos($format,
"image"))) {
1119 $wh_input = $form->getInput(
"full_width_height");
1120 $location = $this->media_manager->resizeImage(
1124 (
int) $wh_input[
"width"],
1125 (
int) $wh_input[
"height"],
1126 (
bool) ($wh_input[
"constr_prop"] ??
false)
1129 $full_item->setFormat($format);
1133 $full_item->setLocationType(
"LocalFile");
1136 if ($form->getInput(
"full_type") ==
"Standard") {
1137 $format = $std_item->getFormat();
1139 $full_item->setLocationType($std_item->getLocationType());
1140 $full_item->setFormat($format);
1142 $type = $std_item->getLocationType();
1143 if ($type ==
"LocalFile") {
1147 if ($form->getInput(
"full_size") !=
"original" &&
1148 is_int(strpos($format,
"image")) &&
1149 $full_item->getLocationType() ==
"LocalFile") {
1150 $wh_input = $form->getInput(
"full_width_height");
1151 $location = $this->media_manager->resizeImage(
1155 (
int) $wh_input[
"width"],
1156 (
int) $wh_input[
"height"],
1157 (
bool) ($wh_input[
"constr_prop"] ??
false)
1163 $wh_input = $form->getInput(
"full_width_height");
1168 $full_item->getLocation(),
1169 (
bool) ($wh_input[
"constr_prop"] ??
false),
1170 ($form->getInput(
"full_size") ==
"original"),
1171 ($wh_input[
"width"] ==
"") ?
null : (
int) $wh_input[
"width"],
1172 ($wh_input[
"height"] ==
"") ?
null : (
int) $wh_input[
"height"]
1174 if ($wh[
"info"] !=
"") {
1175 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
1178 $full_item->setWidth($wh[
"width"]);
1179 $full_item->setHeight($wh[
"height"]);
1182 $full_item->setCaption($form->getInput(
"full_caption"));
1185 $full_item->setTextRepresentation($form->getInput(
"full_text_representation"));
1189 if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1190 if (!$this->media_type->usesAutoStartParameterOnly(
1191 $std_item->getLocation(),
1192 $std_item->getFormat()
1194 $full_item->setParameters($form->getInput(
"full_parameters"));
1199 $this->
object->update();
1200 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
1201 $this->
ctrl->redirect($this,
"edit");
1203 $this->form_gui->setValuesByPost();
1204 $tpl->setContent($this->form_gui->getHTML());
1213 $this->showUsagesObject(
true);
1220 public function showUsagesObject(
1224 $ilTabs = $this->tabs;
1226 $ilCtrl = $this->ctrl;
1230 $lng->txt(
"cont_current_usages"),
1231 $ilCtrl->getLinkTarget($this,
"showUsages")
1236 $lng->txt(
"cont_all_usages"),
1237 $ilCtrl->getLinkTarget($this,
"showAllUsages")
1241 $ilTabs->activateSubTab(
"all_usages");
1242 $cmd =
"showAllUsages";
1244 $ilTabs->activateSubTab(
"current_usages");
1245 $cmd =
"showUsages";
1249 $mob = $this->object;
1256 $tpl->setContent($usages_table->getHTML());
1268 $lom_services =
$DIC->learningObjectMetadata();
1269 $media_manager =
$DIC->mediaObjects()->internal()->domain()->mediaObject();
1271 $tpl =
new ilTemplate(
"tpl.media_info.html",
true,
true,
"components/ILIAS/MediaObjects");
1272 $types = array(
"Standard",
"Fullscreen");
1273 foreach ($types as $type) {
1283 $tpl->setCurrentBlock(
"media_info");
1284 if ($type ==
"Standard") {
1285 $tpl->setVariable(
"TXT_PURPOSE",
$lng->txt(
"cont_std_view"));
1287 $tpl->setVariable(
"TXT_PURPOSE",
$lng->txt(
"cont_fullscreen"));
1289 $tpl->setVariable(
"TXT_TYPE",
$lng->txt(
"cont_" . strtolower($med->getLocationType())));
1290 $tpl->setVariable(
"VAL_LOCATION", $med->getLocation());
1291 if ($med->getLocationType() ==
"LocalFile") {
1294 $info = $media_manager->getInfoOfEntry($med->getMobId(),
"/" . $med->getLocation());
1295 }
catch (Exception
$e) {
1298 $size =
$info[
"size"] ?? 0;
1299 $tpl->setVariable(
"VAL_FILE_SIZE",
" ($size " .
$lng->txt(
"bytes") .
")");
1301 $tpl->setVariable(
"TXT_FORMAT",
$lng->txt(
"cont_format"));
1302 $tpl->setVariable(
"VAL_FORMAT", $med->getFormat());
1303 if ($med->getWidth() !=
"" && $med->getHeight() !=
"") {
1304 $tpl->setCurrentBlock(
"size");
1305 $tpl->setVariable(
"TXT_SIZE",
$lng->txt(
"size"));
1306 $tpl->setVariable(
"VAL_SIZE", $med->getWidth() .
"x" . $med->getHeight());
1307 $tpl->parseCurrentBlock();
1311 if ($orig_size = $med->getOriginalSize()) {
1312 if (($orig_size[
"width"] ??
"") !== $med->getWidth() ||
1313 ($orig_size[
"height"] ??
"") !== $med->getHeight()) {
1314 $tpl->setCurrentBlock(
"orig_size");
1315 $tpl->setVariable(
"TXT_ORIG_SIZE",
$lng->txt(
"cont_orig_size"));
1316 $tpl->setVariable(
"ORIG_WIDTH", $orig_size[
"width"]);
1317 $tpl->setVariable(
"ORIG_HEIGHT", $orig_size[
"height"]);
1318 $tpl->parseCurrentBlock();
1323 if (strlen($med->getCaption())) {
1324 $tpl->setCurrentBlock(
'additional_info');
1325 $tpl->setVariable(
'ADD_INFO',
$lng->txt(
'cont_caption') .
': ' . $med->getCaption());
1326 $tpl->parseCurrentBlock();
1330 if ($type ==
"Standard") {
1331 $keyword_data = $lom_services
1332 ->read(0, $med->getMobId(),
'mob', $lom_services->paths()->keywords())
1333 ->allData($lom_services->paths()->keywords());
1334 $presentable_keywords = $lom_services->dataHelper()->makePresentableAsList(
1338 if ($presentable_keywords !==
'') {
1339 $tpl->setCurrentBlock(
'additional_info');
1340 $tpl->setVariable(
'ADD_INFO',
$lng->txt(
'keywords') .
': ' . $presentable_keywords);
1341 $tpl->parseCurrentBlock();
1345 $tpl->setCurrentBlock(
"media_info");
1346 $tpl->parseCurrentBlock();
1361 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject") {
1363 $this->tpl->setTitle($this->
object->getTitle());
1367 $this->tpl->setTitle($this->
lng->txt(
"cont_create_mob"));
1373 $ilHelp = $this->help;
1375 $ilHelp->setScreenIdComponent(
"mob");
1377 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject"
1378 && $this->
object->getId() > 0) {
1380 $this->tabs_gui->addTarget(
1381 "cont_mob_def_prop",
1382 $this->
ctrl->getLinkTarget($this,
"edit"),
1387 $st_item = $this->
object->getMediaItem(
"Standard");
1391 if (is_object($st_item) && $this->getEnabledMapAreas()) {
1392 $format = $st_item->getFormat();
1393 if (substr($format, 0, 5) ==
"image" && !is_int(strpos($format,
"svg"))) {
1394 $this->tabs_gui->addTarget(
1395 "cont_def_map_areas",
1396 $this->
ctrl->getLinkTargetByClass(
1397 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
1401 "ilimagemapeditorgui"
1407 $this->tabs_gui->addTarget(
1409 $this->
ctrl->getLinkTarget($this,
"showUsages"),
1415 $std_item = $this->
object->getMediaItem(
"Standard");
1416 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1418 if ($mset->get(
"file_manager_always") ||
1419 ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1420 (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1422 $this->tabs_gui->addTarget(
1424 $this->
ctrl->getLinkTargetByClass(
1425 array(
"ilobjmediaobjectgui", ilContainerResourceGUI::class),
1429 "ilContainerResourceGUI"
1434 $mdtab = $mdgui->getTab(
"ilobjmediaobjectgui");
1436 $this->tabs_gui->addTarget(
1446 if ($this->back_title !=
"") {
1447 $this->tabs_gui->setBackTarget(
1449 $this->
ctrl->getParentReturn($this)
1464 if ($a_tpl ==
null) {
1469 $a_tpl->addJavaScript(
"components/ILIAS/COPage/js/ilCOPagePres.js");
1477 $ilTabs = $this->
tabs;
1478 $ilCtrl = $this->ctrl;
1481 $ilTabs->activateTab(
"cont_mob_def_prop");
1485 $lng->txt(
"mob_general"),
1486 $ilCtrl->getLinkTarget($this,
"edit")
1489 if ($this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/webm" ||
1490 $this->object->getMediaItem(
"Standard")->getFormat() ==
"video/mp4") {
1493 $lng->txt(
"mob_subtitles"),
1494 $ilCtrl->getLinkTarget($this,
"listSubtitleFiles")
1498 $ilTabs->activateSubTab($a_active);
1501 public function listSubtitleFilesObject(): void
1503 $ilToolbar = $this->toolbar;
1505 $ilCtrl = $this->ctrl;
1507 $ilUser = $this->user;
1509 $this->setPropertiesSubTabs(
"subtitles");
1510 $this->media_manager->generateMissingVTT($this->
object->getId());
1512 if (!in_array(
"vtt", $this->file_service_settings->getWhiteListedSuffixes())) {
1513 $tpl->setOnScreenMessage(
"info",
$lng->txt(
"mob_srt_not_allowed"));
1517 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1518 $fi =
new ilFileInputGUI(
$lng->txt(
"mob_subtitle_file") .
" (.vtt)",
"subtitle_file");
1519 $fi->setSuffixes(array(
"vtt"));
1520 $ilToolbar->addInputItem($fi,
true);
1523 $options = $this->md->getLOMLanguagesForSelectInputs();
1526 $si->setValue($ilUser->getLanguage());
1527 $ilToolbar->addInputItem($si,
true);
1529 $ilToolbar->addFormButton(
$lng->txt(
"upload"),
"uploadSubtitleFile");
1531 $ilToolbar->addSeparator();
1532 $ilToolbar->addFormButton(
$lng->txt(
"mob_upload_multi_srt"),
"uploadMultipleSubtitleFileForm");
1539 $mob = $this->object;
1542 $tpl->setContent($tab->getHTML());
1548 $ilCtrl = $this->ctrl;
1550 if ($this->
object->uploadSrtFile(
1551 $_FILES[
"subtitle_file"][
"tmp_name"],
1552 $this->sub_title_request->getLanguage()
1554 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
1556 $ilCtrl->redirect($this,
"listSubtitleFiles");
1564 $ilCtrl = $this->ctrl;
1568 $lng->loadLanguageModule(
"meta");
1570 $srts = $this->sub_title_request->getSrtFiles();
1571 if (count($srts) == 0) {
1572 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"no_checkbox"),
true);
1573 $ilCtrl->redirect($this,
"listSubtitleFiles");
1576 $cgui->setFormAction($ilCtrl->getFormAction($this));
1577 $cgui->setHeaderText(
$lng->txt(
"mob_really_delete_srt"));
1578 $cgui->setCancel(
$lng->txt(
"cancel"),
"listSubtitleFiles");
1579 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteSrtFiles");
1580 foreach ($srts as $i) {
1581 $p = explode(
":", $i);
1582 $cgui->addItem(
"srt[]", $i,
"subtitle_" . $p[0] .
"." . $p[1] .
" (" .
$lng->txt(
"meta_l_" . $p[0]) .
")");
1585 $tpl->setContent($cgui->getHTML());
1595 $ilCtrl = $this->ctrl;
1597 $srts = $this->sub_title_request->getSrtFiles();
1599 foreach ($srts as $i) {
1600 if (strlen($i) == 6 && !is_int(strpos($i,
"."))) {
1601 $p = explode(
":", $i);
1602 $this->
object->removeAdditionalFile(
"srt/subtitle_" . $p[0] .
"." . $p[1]);
1607 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"mob_srt_files_deleted"),
true);
1609 $ilCtrl->redirect($this,
"listSubtitleFiles");
1614 $ilToolbar = $this->toolbar;
1616 $ilCtrl = $this->ctrl;
1618 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"mob_upload_multi_srt_howto"));
1620 $this->setPropertiesSubTabs(
"subtitles");
1623 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1624 $fi =
new ilFileInputGUI(
$lng->txt(
"mob_subtitle_file") .
" (.zip)",
"subtitle_file");
1625 $fi->setSuffixes(array(
"zip"));
1626 $ilToolbar->addInputItem($fi,
true);
1628 $ilToolbar->addFormButton(
$lng->txt(
"upload"),
"uploadMultipleSubtitleFile");
1635 $this->
ctrl->redirect($this,
"showMultiSubtitleConfirmationTable");
1637 $this->tpl->setOnScreenMessage(
'failure',
$e->getMessage(),
true);
1638 $this->
ctrl->redirect($this,
"uploadMultipleSubtitleFileForm");
1649 $this->setPropertiesSubTabs(
"subtitles");
1652 $tpl->setContent($tab->getHTML());
1660 $this->
object->clearMultiSrtDirectory();
1661 $this->
ctrl->redirect($this,
"listSubtitleFiles");
1669 $ilCtrl = $this->ctrl;
1670 $srt_files = $this->
object->getMultiSrtFiles();
1671 $files = $this->sub_title_request->getFiles();
1672 foreach ($files as
$f) {
1673 foreach ($srt_files as $srt_file) {
1674 if (
$f == $srt_file[
"filename"]) {
1675 $this->
object->uploadSrtFile($this->
object->getMultiSrtUploadDir() .
"/" . $srt_file[
"filename"], $srt_file[
"lang"],
"rename");
1679 $this->
object->clearMultiSrtDirectory();
1680 $ilCtrl->redirect($this,
"listSubtitleFiles");
1685 $this->media_manager->generateMissingVTT($this->
object->getId());
1686 $this->
ctrl->redirect($this,
"listSubtitleFiles");
static stripSlashesArray(array $a_arr, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Error Handling & global info handling.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
User interface class for map editor.
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a non editable value in a property form.
Class ilObjectGUI Basic methods of all Output classes.
setDescription(string $description)
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
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 stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static secureLink(string $a_str)
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc