45 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager
$media_type;
56 bool $a_call_by_reference =
false,
57 bool $a_prepare_output =
false 61 $this->
access = $DIC->access();
62 $this->error = $DIC[
"ilErr"];
63 $this->
help = $DIC[
"ilHelp"];
64 $this->
tabs = $DIC->tabs();
65 $this->
toolbar = $DIC->toolbar();
66 $this->
user = $DIC->user();
67 $lng = $DIC->language();
68 $ilCtrl = $DIC->ctrl();
69 $this->media_type = $DIC->mediaObjects()
74 $this->
ctrl = $ilCtrl;
77 $this->back_title =
"";
80 $this->sub_title_request = $DIC->mediaObjects()
87 $this->file_service_settings = $DIC->fileServiceSettings();
97 string $a_adv_subtype =
"-" 99 $this->adv_ref_id = $a_adv_ref_id;
100 $this->adv_type = $a_adv_type;
101 $this->adv_subtype = $a_adv_subtype;
110 if ($this->adv_type == null) {
121 $this->header = $a_title;
130 bool $a_enabledmapareas
132 $this->enabledmapareas = $a_enabledmapareas;
145 $this->width_preset = $a_val;
158 $this->height_preset = $a_val;
173 if ($this->
id != 0) {
183 $this->
ctrl->returnToParent($this);
193 $next_class = $this->
ctrl->getNextClass($this);
194 $cmd = $this->
ctrl->getCmd();
197 switch ($next_class) {
198 case 'ilobjectmetadatagui':
201 $md_gui->
addMDObserver($this->
object,
'MDUpdateListener',
'General');
204 if ($this->adv_type !=
"") {
205 $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
208 $this->
ctrl->forwardCommand($md_gui);
211 case "ilimagemapeditorgui":
215 $ret = $this->
ctrl->forwardCommand($image_map_edit);
220 case "ilfilesystemgui":
224 $fs_gui->activateLabels(
true, $this->
lng->txt(
"cont_purpose"));
225 $fs_gui->setTableId(
"mobfs" . $this->
object->getId());
227 $this->
object->getMediaItem(
"Standard")->getLocation(),
228 $this->
lng->txt(
"cont_std_view")
230 if ($this->
object->hasFullscreenItem()) {
232 $this->
object->getMediaItem(
"Fullscreen")->getLocation(),
233 $this->
lng->txt(
"cont_fullscreen")
236 $fs_gui->addCommand($this,
"assignStandardObject", $this->
lng->txt(
"cont_assign_std"));
237 $fs_gui->addCommand($this,
"assignFullscreenObject", $this->
lng->txt(
"cont_assign_full"));
239 $ret = $this->
ctrl->forwardCommand($fs_gui);
253 $ret = $this->$cmd();
260 $this->back_title = $a_title;
273 public function initForm(
string $a_mode =
"create"): void
281 if ($a_mode ==
"edit") {
282 $std_item = $this->
object->getMediaItem(
"Standard");
290 $title->setMaxLength(120);
291 $this->form_gui->addItem($title);
298 if ($a_mode ==
"create" || $std_item->getLocationType() !=
"LocalFile") {
299 $up->setRequired(
true);
302 $radio_prop->addOption($op1);
306 $ref->setRequired(
true);
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"] ??
"") .
")";
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") {
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") {
355 $radio_size->setValue(
"original");
357 $radio_size->setValue(
"selected");
361 $radio_size->addOption($op2);
362 $this->form_gui->addItem($radio_size);
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 if ($a_mode ==
"edit" &&
386 $this->media_type->usesParameterProperty($std_item->getFormat())) {
387 if ($this->media_type->usesAutoStartParameterOnly(
388 $std_item->getLocation(),
389 $std_item->getFormat()
397 $this->form_gui->addItem($par);
401 if ($a_mode ==
"edit") {
402 $full_item = $this->
object->getMediaItem(
"Fullscreen");
407 $fs_sec->setTitle(
$lng->
txt(
"cont_fullscreen"));
408 $this->form_gui->addItem($fs_sec);
412 $radio_prop2->addOption($op1);
414 $radio_prop2->addOption($op4);
420 if ($a_mode ==
"create" || !$full_item || $full_item->getLocationType() !=
"LocalFile") {
421 $up->setRequired(
true);
424 $radio_prop2->addOption($op2);
428 $ref->setRequired(
true);
430 $radio_prop2->addOption($op3);
431 $radio_prop2->setValue(
"None");
432 $this->form_gui->addItem($radio_prop2);
435 if ($a_mode ==
"edit") {
436 if ($this->
object->hasFullscreenItem()) {
438 $format->setValue($full_item->getFormat());
439 $this->form_gui->addItem(
$format);
444 $full_support_constraint_props =
false;
446 if ($a_mode ==
"edit") {
448 if ($this->
object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
449 $add_str =
" (" . ($orig_size[
"width"] ??
"") .
" x " . ($orig_size[
"height"] ??
"") .
")";
451 if (is_int(strpos($full_item->getFormat(),
"image"))
452 && $full_item->getLocationType() ==
"LocalFile") {
453 $full_support_constraint_props =
true;
464 $radio_size->addOption($op1);
468 " / " .
$lng->
txt(
"cont_height"),
"full_width_height");
469 if ($full_support_constraint_props) {
471 $width_height->setConstrainProportions(
true);
473 $op2->addSubItem($width_height);
476 if ($a_mode ==
"edit") {
477 $full_item = $this->
object->getMediaItem(
"Fullscreen");
478 if ($this->
object->hasFullscreenItem() &&
479 is_int(strpos($full_item->getFormat(),
"image")) &&
480 $full_item->getLocationType() ==
"LocalFile") {
489 $radio_size->setValue(
"original");
490 $radio_size->addOption($op2);
491 $this->form_gui->addItem($radio_size);
496 $caption->setRows(2);
497 $this->form_gui->addItem($caption);
505 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
509 $ta->setInfo(
$lng->
txt(
"text_repr_info"));
510 $this->form_gui->addItem($ta);
515 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() &&
516 $this->media_type->usesParameterProperty($full_item->getFormat())) {
517 if ($this->media_type->usesAutoStartParameterOnly(
518 $full_item->getLocation(),
519 $full_item->getFormat()
527 $this->form_gui->addItem($par);
532 if ($a_mode ==
"edit") {
533 $this->form_gui->setTitle(
$lng->
txt(
"cont_edit_mob"));
534 $this->form_gui->addCommandButton(
"saveProperties",
$lng->
txt(
"save"));
536 $this->form_gui->setTitle(
$lng->
txt(
"cont_insert_mob"));
537 $this->form_gui->addCommandButton(
"save",
$lng->
txt(
"save"));
538 $this->form_gui->addCommandButton(
"cancel",
$lng->
txt(
"cancel"));
540 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
548 $std_item = $this->
object->getMediaItem(
"Standard");
549 if ($std_item->getWidth() ==
"" || $std_item->getHeight() ==
"") {
550 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"mob_no_fixed_size_map_editing"));
562 $values[
"standard_title"] = $this->
object->getTitle();
564 $std_item = $this->
object->getMediaItem(
"Standard");
565 if ($std_item->getLocationType() ==
"LocalFile") {
566 $values[
"standard_type"] =
"File";
567 $values[
"standard_file"] = $std_item->getLocation();
569 $values[
"standard_type"] =
"Reference";
570 $values[
"standard_reference"] = $std_item->getLocation();
572 $values[
"standard_format"] = $std_item->getFormat();
573 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
574 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
575 $values[
"standard_width_height"][
"constr_prop"] =
true;
577 $values[
"standard_size"] =
"selected";
579 $orig_size = $std_item->getOriginalSize();
580 if ($std_item->getWidth() ==
"" && $std_item->getHeight() ==
"") {
581 $values[
"standard_size"] =
"original";
582 $values[
"standard_width_height"][
"width"] = $orig_size[
"width"] ??
"";
583 $values[
"standard_width_height"][
"height"] = $orig_size[
"height"] ??
"";
586 $values[
"standard_caption"] = $std_item->getCaption();
587 $values[
"text_representation"] = $std_item->getTextRepresentation();
588 if ($this->media_type->usesAutoStartParameterOnly(
589 $std_item->getLocation(),
590 $std_item->getFormat()
597 $values[
"standard_parameters"] = $std_item->getParameterString();
600 $values[
"full_type"] =
"None";
601 $values[
"full_size"] =
"original";
602 if ($this->
object->hasFullscreenItem()) {
603 $full_item = $this->
object->getMediaItem(
"Fullscreen");
604 if ($full_item->getLocationType() ==
"LocalFile") {
605 $values[
"full_type"] =
"File";
606 $values[
"full_file"] = $full_item->getLocation();
608 $values[
"full_type"] =
"Reference";
609 $values[
"full_reference"] = $full_item->getLocation();
611 $values[
"full_format"] = $full_item->getFormat();
612 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
613 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
614 $values[
"full_width_height"][
"constr_prop"] =
true;
616 $values[
"full_size"] =
"selected";
618 $orig_size = $full_item->getOriginalSize();
619 if ($full_item->getWidth() ==
"" &&
620 $full_item->getHeight() ==
"") {
621 $values[
"full_size"] =
"original";
622 $values[
"full_width_height"][
"width"] = $orig_size[
"width"] ??
"";
623 $values[
"full_width_height"][
"height"] = $orig_size[
"height"] ??
"";
625 $values[
"full_caption"] = $full_item->getCaption();
626 if ($this->media_type->usesAutoStartParameterOnly(
627 $full_item->getLocation(),
628 $full_item->getFormat()
635 $values[
"full_parameters"] = $full_item->getParameterString();
637 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
640 $this->form_gui->setValuesByArray($values);
651 if ($this->form_gui->checkInput()) {
654 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"saved_media_object"),
true);
656 $this->form_gui->setValuesByPost();
663 if (!$this->form_gui->checkInput()) {
664 $this->form_gui->setValuesByPost();
685 if (trim($form->getInput(
"standard_title")) !=
"") {
686 $title = trim($form->getInput(
"standard_title"));
688 if ($form->getInput(
"standard_type") ==
"File") {
689 $title = $_FILES[
'standard_file'][
'name'];
691 $title = $form->getInput(
"standard_reference");
706 $media_item->setPurpose(
"Standard");
708 if ($form->getInput(
"standard_type") ==
"File") {
710 $file = $mob_dir .
"/" . $file_name;
712 $_FILES[
'standard_file'][
'tmp_name'],
722 if ($form->getInput(
"standard_size") !=
"original" &&
723 is_int(strpos(
$format,
"image"))) {
724 $wh_input = $form->getInput(
"standard_width_height");
728 (
int) $wh_input[
"width"],
729 (
int) $wh_input[
"height"],
730 (
bool) ($wh_input[
"constr_prop"] ??
false)
735 $media_item->setFormat(
$format);
737 $media_item->setLocationType(
"LocalFile");
738 $a_mob->generatePreviewPic(320, 240);
741 $media_item->setFormat(
$format);
743 $media_item->setLocationType(
"Reference");
752 $wh_input = $form->getInput(
"standard_width_height");
755 $form->getInput(
"standard_type"),
757 $media_item->getLocation(),
758 (bool) ($wh_input[
"constr_prop"] ??
false),
759 ($form->getInput(
"standard_size") ==
"original"),
760 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
761 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
763 $media_item->setWidth($wh[
"width"]);
764 $media_item->setHeight($wh[
"height"]);
765 if ($wh[
"info"] !=
"") {
766 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
769 if ($form->getInput(
"standard_caption") !=
"") {
770 $media_item->setCaption($form->getInput(
"standard_caption"));
774 $media_item->setHAlign(
"Left");
777 if ($form->getInput(
"full_type") !=
"None") {
780 $media_item2->setPurpose(
"Fullscreen");
783 if ($form->getInput(
"full_type") ==
"File") {
785 if ($_FILES[
'full_file'][
'name'] !=
"") {
787 $file = $mob_dir .
"/" . $full_file_name;
789 $_FILES[
'full_file'][
'tmp_name'],
796 } elseif ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"File") {
801 if ($form->getInput(
"full_type") ==
"File" ||
802 ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"File")) {
803 if (($form->getInput(
"full_size") !=
"original" &&
804 is_int(strpos(
$format,
"image")))
806 $full_wh_input = $form->getInput(
"full_width_height");
809 (
int) $full_wh_input[
"width"],
810 (
int) $full_wh_input[
"height"],
811 (
bool) ($full_wh_input[
"constr_prop"] ??
false)
815 $media_item2->setFormat(
$format);
817 $media_item2->setLocationType(
"LocalFile");
821 if ($form->getInput(
"full_type") ==
"Reference") {
823 if ($form->getInput(
"full_reference") !=
"") {
829 if ($form->getInput(
"full_type") ==
"Reference" ||
830 ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"Reference")) {
831 $media_item2->setFormat(
$format);
833 $media_item2->setLocationType(
"Reference");
838 $wh_input = $form->getInput(
"full_width_height");
843 $media_item2->getLocation(),
844 (bool) ($wh_input[
"constr_prop"] ??
false),
845 ($form->getInput(
"full_size") ==
"original"),
846 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
847 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
850 $media_item2->setWidth($wh[
"width"]);
851 $media_item2->setHeight($wh[
"height"]);
853 if ($form->getInput(
"full_caption") !=
"") {
854 $media_item2->setCaption($form->getInput(
"full_caption"));
870 $this->
ctrl->returnToParent($this);
894 $std_item = $this->
object->getMediaItem(
"Standard");
895 if ($std_item->getLocationType() ==
"LocalFile" &&
896 is_int(strpos($std_item->getFormat(),
"image"))
898 $file = $mob_dir .
"/" . $std_item->getLocation();
901 $std_item->getWidth(),
902 $std_item->getHeight()
909 if ($this->
object->hasFullscreenItem()) {
910 $full_item = $this->
object->getMediaItem(
"Fullscreen");
911 if ($full_item->getLocationType() ==
"LocalFile" &&
912 is_int(strpos($full_item->getFormat(),
"image"))
914 $file = $mob_dir .
"/" . $full_item->getLocation();
917 $full_item->getWidth(),
918 $full_item->getHeight()
921 $full_item->update();
925 $this->
ctrl->redirect($this,
"edit");
934 $std_item = $this->
object->getMediaItem(
"Standard");
937 if ($std_item->getLocationType() ==
"LocalFile") {
938 $file = $mob_dir .
"/" . $std_item->getLocation();
942 $std_item->setWidth($size[0]);
943 $std_item->setHeight($size[1]);
944 $this->
object->update();
946 $this->
ctrl->redirect($this,
"edit");
955 $full_item = $this->
object->getMediaItem(
"Fullscreen");
958 if ($full_item->getLocationType() ==
"LocalFile") {
959 $file = $mob_dir .
"/" . $full_item->getLocation();
961 $full_item->setWidth($size[0]);
962 $full_item->setHeight($size[1]);
963 $this->
object->update();
965 $this->
ctrl->redirect($this,
"edit");
978 if ($form->checkInput()) {
979 $title = trim($form->getInput(
"standard_title"));
982 $std_item = $this->
object->getMediaItem(
"Standard");
984 $format = $std_item->getFormat();
985 if ($form->getInput(
"standard_type") ==
"Reference") {
989 $std_item->setLocationType(
"Reference");
992 if ($form->getInput(
"standard_type") ==
"File") {
994 if ($_FILES[
'standard_file'][
'name'] !=
"") {
996 $file = $mob_dir .
"/" . $file_name;
998 $_FILES[
'standard_file'][
'tmp_name'],
1008 } elseif ($form->getInput(
"standard_resize")) {
1015 if ($form->getInput(
"standard_size") !=
"original" &&
1016 is_int(strpos(
$format,
"image"))) {
1017 $wh_input = $form->getInput(
"standard_width_height");
1020 (
int) $wh_input[
"width"],
1021 (
int) $wh_input[
"height"],
1022 (
bool) ($wh_input[
"constr_prop"] ??
false)
1025 $std_item->setFormat(
$format);
1029 $std_item->setLocationType(
"LocalFile");
1031 $this->
object->setDescription(
$format);
1033 $wh_input = $form->getInput(
"standard_width_height");
1036 $form->getInput(
"standard_type"),
1038 $std_item->getLocation(),
1039 (bool) ($wh_input[
"constr_prop"] ??
false),
1040 ($form->getInput(
"standard_size") ==
"original"),
1041 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
1042 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
1044 if ($wh[
"info"] !=
"") {
1045 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
1047 $std_item->setWidth($wh[
"width"]);
1048 $std_item->setHeight($wh[
"height"]);
1051 $std_item->setCaption($form->getInput(
"standard_caption"));
1054 $std_item->setTextRepresentation($form->getInput(
"text_representation"));
1057 if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1058 if ($this->media_type->usesAutoStartParameterOnly(
1059 $std_item->getLocation(),
1060 $std_item->getFormat()
1069 $std_item->setParameters(utf8_decode($form->getInput(
"standard_parameters")));
1074 if ($form->getInput(
"full_type") ==
"None") {
1075 if ($this->
object->hasFullscreenItem()) {
1076 $this->
object->removeMediaItem(
"Fullscreen");
1079 if ($this->
object->hasFullscreenItem()) {
1080 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1083 $this->
object->addMediaItem($full_item);
1084 $full_item->setPurpose(
"Fullscreen");
1087 $format = $full_item->getFormat();
1088 if ($form->getInput(
"full_type") ==
"Reference") {
1090 $full_item->setFormat(
$format);
1091 $full_item->setLocationType(
"Reference");
1093 $type =
"Reference";
1097 if ($form->getInput(
"full_type") ==
"File") {
1099 if ($_FILES[
'full_file'][
'name'] !=
"") {
1101 $file = $mob_dir .
"/" . $full_file_name;
1103 $_FILES[
'full_file'][
'tmp_name'],
1112 } elseif ($form->getInput(
"full_resize")) {
1119 if ($form->getInput(
"full_size") !=
"original" &&
1120 is_int(strpos(
$format,
"image"))) {
1121 $wh_input = $form->getInput(
"full_width_height");
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") {
1148 if ($form->getInput(
"full_size") !=
"original" &&
1149 is_int(strpos(
$format,
"image")) &&
1150 $full_item->getLocationType() ==
"LocalFile") {
1152 $wh_input = $form->getInput(
"full_width_height");
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"]);
1180 $full_item->setLocation($location);
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()
1201 $full_item->setParameters(utf8_decode($form->getInput(
"full_parameters")));
1209 $this->
object->update();
1210 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1211 $this->
ctrl->redirect($this,
"edit");
1213 $this->form_gui->setValuesByPost();
1225 $cur_subdir = dirname($a_file);
1227 $cur_dir = (!empty($cur_subdir))
1228 ? $mob_dir .
"/" . $cur_subdir
1230 $file = $cur_dir .
"/" . basename($a_file);
1233 if (!is_file($file)) {
1234 $this->
ilias->raiseError($this->
lng->txt(
"cont_select_file"), $this->
ilias->error_obj->MESSAGE);
1237 $std_item = $this->
object->getMediaItem(
"Standard");
1238 $std_item->setLocationType(
"LocalFile");
1241 $std_item->setFormat(
$format);
1242 $this->
object->update();
1244 $this->
ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1255 $cur_subdir = dirname($a_file);
1257 $cur_dir = (!empty($cur_subdir))
1258 ? $mob_dir .
"/" . $cur_subdir
1260 $file = $cur_dir .
"/" . basename($a_file);
1263 if (!is_file($file)) {
1264 $this->
ilias->raiseError($this->
lng->txt(
"cont_select_file"), $this->
ilias->error_obj->MESSAGE);
1267 if (!$this->
object->hasFullscreenItem()) {
1268 $std_item = $this->
object->getMediaItem(
"Standard");
1272 $full_item->setMobId($std_item->getMobId());
1274 $full_item->setLocationType(
"LocalFile");
1276 $full_item->setPurpose(
"Fullscreen");
1277 $this->
object->addMediaItem($full_item);
1279 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1281 $full_item->setLocationType(
"LocalFile");
1284 $full_item->setFormat(
$format);
1286 $this->
object->update();
1288 $this->
ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1297 $this->
object->removeMediaItem(
"Fullscreen");
1298 $this->
object->update();
1300 $this->
ctrl->redirect($this,
"edit");
1308 if (!$this->
object->hasFullscreenItem()) {
1309 $std_item = $this->
object->getMediaItem(
"Standard");
1311 $full_item->setMobId($std_item->getMobId());
1312 $full_item->setLocation($std_item->getLocation());
1313 $full_item->setLocationType($std_item->getLocationType());
1314 $full_item->setFormat($std_item->getFormat());
1315 $full_item->setWidth($std_item->getWidth());
1316 $full_item->setHeight($std_item->getHeight());
1317 $full_item->setCaption($std_item->getCaption());
1318 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1319 $full_item->setPurpose(
"Fullscreen");
1320 $this->
object->addMediaItem($full_item);
1322 $this->
object->update();
1325 $this->
ctrl->redirect($this,
"edit");
1333 $this->showUsagesObject(
true);
1340 public function showUsagesObject(
1350 $lng->
txt(
"cont_current_usages"),
1351 $ilCtrl->getLinkTarget($this,
"showUsages")
1357 $ilCtrl->getLinkTarget($this,
"showAllUsages")
1361 $ilTabs->activateSubTab(
"all_usages");
1362 $cmd =
"showAllUsages";
1364 $ilTabs->activateSubTab(
"current_usages");
1365 $cmd =
"showUsages";
1387 $lng = $DIC->language();
1389 $tpl =
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1390 $types = array(
"Standard",
"Fullscreen");
1391 foreach ($types as
$type) {
1402 if ($type ==
"Standard") {
1409 if ($med->getLocationType() ==
"LocalFile") {
1411 if (is_file($file)) {
1412 $size = filesize($file);
1420 if ($med->getWidth() !=
"" && $med->getHeight() !=
"") {
1423 $tpl->
setVariable(
"VAL_SIZE", $med->getWidth() .
"x" . $med->getHeight());
1428 if ($orig_size = $med->getOriginalSize()) {
1429 if (($orig_size[
"width"] ??
"") !== $med->getWidth() ||
1430 ($orig_size[
"height"] ??
"") !== $med->getHeight()) {
1440 if (strlen($med->getCaption())) {
1447 if ($type ==
"Standard") {
1471 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject") {
1473 $this->tpl->setTitle($this->
object->getTitle());
1477 $this->tpl->setTitle($this->
lng->txt(
"cont_create_mob"));
1487 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject" 1488 && $this->
object->getId() > 0) {
1490 $this->tabs_gui->addTarget(
1491 "cont_mob_def_prop",
1492 $this->
ctrl->getLinkTarget($this,
"edit"),
1497 $st_item = $this->
object->getMediaItem(
"Standard");
1502 $format = $st_item->getFormat();
1503 if (substr(
$format, 0, 5) ==
"image" && !is_int(strpos(
$format,
"svg"))) {
1504 $this->tabs_gui->addTarget(
1505 "cont_def_map_areas",
1506 $this->
ctrl->getLinkTargetByClass(
1507 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
1511 "ilimagemapeditorgui" 1517 $this->tabs_gui->addTarget(
1519 $this->
ctrl->getLinkTarget($this,
"showUsages"),
1525 $std_item = $this->
object->getMediaItem(
"Standard");
1526 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1528 if ($mset->get(
"file_manager_always") ||
1529 ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1530 (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1532 $this->tabs_gui->addTarget(
1534 $this->
ctrl->getLinkTargetByClass(
1535 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
1544 $mdtab = $mdgui->
getTab(
"ilobjmediaobjectgui");
1546 $this->tabs_gui->addTarget(
1556 if ($this->back_title !=
"") {
1557 $this->tabs_gui->setBackTarget(
1559 $this->
ctrl->getParentReturn($this)
1574 if ($a_tpl == null) {
1580 $a_tpl->addJavaScript(
"./Services/COPage/js/ilCOPagePres.js");
1592 $ilTabs->activateTab(
"cont_mob_def_prop");
1597 $ilCtrl->getLinkTarget($this,
"edit")
1600 if ($this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/webm" ||
1601 $this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/mp4") {
1605 $ilCtrl->getLinkTarget($this,
"listSubtitleFiles")
1609 $ilTabs->activateSubTab($a_active);
1612 public function listSubtitleFilesObject():
void 1622 if (!in_array(
"srt", $this->file_service_settings->getWhiteListedSuffixes())) {
1627 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1630 $ilToolbar->addInputItem($fi,
true);
1635 $si->setOptions($options);
1636 $si->setValue(
$ilUser->getLanguage());
1637 $ilToolbar->addInputItem($si,
true);
1639 $ilToolbar->addFormButton(
$lng->
txt(
"upload"),
"uploadSubtitleFile");
1641 $ilToolbar->addSeparator();
1642 $ilToolbar->addFormButton(
$lng->
txt(
"mob_upload_multi_srt"),
"uploadMultipleSubtitleFileForm");
1657 if ($this->
object->uploadSrtFile(
1658 $_FILES[
"subtitle_file"][
"tmp_name"],
1659 $this->sub_title_request->getLanguage()
1661 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1663 $ilCtrl->
redirect($this,
"listSubtitleFiles");
1677 $srts = $this->sub_title_request->getSrtFiles();
1678 if (count($srts) == 0) {
1679 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_checkbox"),
true);
1680 $ilCtrl->redirect($this,
"listSubtitleFiles");
1683 $cgui->setFormAction($ilCtrl->getFormAction($this));
1684 $cgui->setHeaderText(
$lng->
txt(
"mob_really_delete_srt"));
1685 $cgui->setCancel(
$lng->
txt(
"cancel"),
"listSubtitleFiles");
1686 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteSrtFiles");
1688 foreach ($srts as
$i) {
1689 $cgui->addItem(
"srt[]", $i,
"subtitle_" . $i .
".srt (" .
$lng->
txt(
"meta_l_" . $i) .
")");
1704 $srts = $this->sub_title_request->getSrtFiles();
1705 foreach ($srts as
$i) {
1706 if (strlen($i) == 2 && !is_int(strpos($i,
"."))) {
1707 $this->
object->removeAdditionalFile(
"srt/subtitle_" . $i .
".srt");
1710 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"mob_srt_files_deleted"),
true);
1711 $ilCtrl->
redirect($this,
"listSubtitleFiles");
1720 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"mob_upload_multi_srt_howto"));
1725 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1728 $ilToolbar->addInputItem($fi,
true);
1730 $ilToolbar->addFormButton(
$lng->
txt(
"upload"),
"uploadMultipleSubtitleFile");
1737 $this->
ctrl->redirect($this,
"showMultiSubtitleConfirmationTable");
1739 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage(),
true);
1740 $this->
ctrl->redirect($this,
"uploadMultipleSubtitleFileForm");
1762 $this->
object->clearMultiSrtDirectory();
1763 $this->
ctrl->redirect($this,
"listSubtitleFiles");
1772 $srt_files = $this->
object->getMultiSrtFiles();
1773 $files = $this->sub_title_request->getFiles();
1774 foreach ($files as
$f) {
1775 foreach ($srt_files as $srt_file) {
1776 if ($f == $srt_file[
"filename"]) {
1777 $this->
object->uploadSrtFile($this->
object->getMultiSrtUploadDir() .
"/" . $srt_file[
"filename"], $srt_file[
"lang"],
"rename");
1781 $this->
object->clearMultiSrtDirectory();
1782 $ilCtrl->
redirect($this,
"listSubtitleFiles");
static getWebspaceDir(string $mode="filesystem")
get webspace directory
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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
$location
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...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
loadLanguageModule(string $a_module)
Load language module.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static secureLink(string $a_str)
setDescription(string $desc)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setScreenId(string $a_id)
setContent(string $a_html)
Sets content for standard template.
setAllowedSuffixes(array $a_suffixes)
setScreenIdComponent(string $a_comp)
Class ilObjectGUI Basic methods of all Output classes.
static lookupKeywords(int $a_rbac_id, int $a_obj_id, bool $a_return_ids=false)
header include for all ilias files.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
User interface class for map editor.
Error Handling & global info handling uses PEAR error class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
This class represents a text area property in a property form.
static getLocalMaphilightPath()
Get local path of maphilight file.
File System Explorer GUI class.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
static stripSlashesArray(array $a_arr, bool $a_strip_html=true, string $a_allow="")
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...