29 protected \ILIAS\MediaObjects\Video\GUIService
$video_gui;
46 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager
$media_type;
57 bool $a_call_by_reference =
false,
58 bool $a_prepare_output =
false 62 $this->
access = $DIC->access();
63 $this->error = $DIC[
"ilErr"];
64 $this->
help = $DIC[
"ilHelp"];
65 $this->
tabs = $DIC->tabs();
66 $this->
toolbar = $DIC->toolbar();
67 $this->
user = $DIC->user();
68 $lng = $DIC->language();
69 $ilCtrl = $DIC->ctrl();
70 $this->media_type = $DIC->mediaObjects()
75 $this->
ctrl = $ilCtrl;
78 $this->back_title =
"";
81 $this->sub_title_request = $DIC->mediaObjects()
88 $this->file_service_settings = $DIC->fileServiceSettings();
89 $this->video_gui = $DIC->mediaObjects()->internal()->gui()->video();
99 string $a_adv_subtype =
"-" 101 $this->adv_ref_id = $a_adv_ref_id;
102 $this->adv_type = $a_adv_type;
103 $this->adv_subtype = $a_adv_subtype;
112 if ($this->adv_type == null) {
132 bool $a_enabledmapareas
134 $this->enabledmapareas = $a_enabledmapareas;
147 $this->width_preset = $a_val;
160 $this->height_preset = $a_val;
175 if ($this->
id != 0) {
185 $this->
ctrl->returnToParent($this);
195 $next_class = $this->
ctrl->getNextClass($this);
196 $cmd = $this->
ctrl->getCmd();
199 switch ($next_class) {
200 case 'ilobjectmetadatagui':
203 $md_gui->
addMDObserver($this->
object,
'MDUpdateListener',
'General');
206 if ($this->adv_type !=
"") {
207 $md_gui->setAdvMdRecordObject($this->adv_ref_id, $this->adv_type, $this->adv_subtype);
210 $this->
ctrl->forwardCommand($md_gui);
213 case "ilimagemapeditorgui":
217 $ret = $this->
ctrl->forwardCommand($image_map_edit);
222 case "ilfilesystemgui":
224 $fs_gui->
setAllowedSuffixes(iterator_to_array($this->media_type->getAllowedSuffixes()));
226 $fs_gui->activateLabels(
true, $this->
lng->txt(
"cont_purpose"));
227 $fs_gui->setTableId(
"mobfs" . $this->
object->getId());
229 $this->
object->getMediaItem(
"Standard")->getLocation(),
230 $this->
lng->txt(
"cont_std_view")
232 if ($this->
object->hasFullscreenItem()) {
234 $this->
object->getMediaItem(
"Fullscreen")->getLocation(),
235 $this->
lng->txt(
"cont_fullscreen")
238 $fs_gui->addCommand($this,
"assignStandardObject", $this->
lng->txt(
"cont_assign_std"));
239 $fs_gui->addCommand($this,
"assignFullscreenObject", $this->
lng->txt(
"cont_assign_full"));
241 $ret = $this->
ctrl->forwardCommand($fs_gui);
255 $ret = $this->$cmd();
262 $this->back_title = $a_title;
275 public function initForm(
string $a_mode =
"create"): void
283 if ($a_mode ==
"edit") {
284 $std_item = $this->
object->getMediaItem(
"Standard");
292 $title->setMaxLength(120);
293 $this->form_gui->addItem($title);
297 $up->setSuffixes(iterator_to_array($this->media_type->getAllowedSuffixes()));
300 if ($a_mode ==
"create" || $std_item->getLocationType() !=
"LocalFile") {
301 $up->setRequired(
true);
304 $radio_prop->addOption($op1);
308 $ref->setRequired(
true);
310 $radio_prop->addOption($op2);
311 $radio_prop->setValue(
"File");
312 $this->form_gui->addItem($radio_prop);
315 if ($a_mode ==
"edit") {
317 $format->setValue($std_item->getFormat());
318 $this->form_gui->addItem($format);
323 if ($a_mode ==
"edit") {
324 if ($orig_size = $std_item->getOriginalSize()) {
325 $add_str =
" (" . ($orig_size[
"width"] ??
"") .
" x " . ($orig_size[
"height"] ??
"") .
")";
335 $radio_size->addOption($op1);
339 " / " .
$lng->
txt(
"cont_height"),
"standard_width_height");
340 if ($a_mode ==
"edit" && is_int(strpos($std_item->getFormat(),
"image"))
341 && $std_item->getLocationType() ==
"LocalFile") {
343 $width_height->setConstrainProportions(
true);
345 $op2->addSubItem($width_height);
348 if ($a_mode ==
"edit") {
349 $std_item = $this->
object->getMediaItem(
"Standard");
350 if (is_int(strpos($std_item->getFormat(),
"image"))
351 && $std_item->getLocationType() ==
"LocalFile") {
353 $op2->addSubItem($resize);
357 $radio_size->setValue(
"original");
359 $radio_size->setValue(
"selected");
363 $radio_size->addOption($op2);
364 $this->form_gui->addItem($radio_size);
369 $caption->setRows(2);
370 $this->form_gui->addItem($caption);
378 if ($a_mode ==
"edit" && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
382 $ta->setInfo(
$lng->
txt(
"text_repr_info"));
383 $this->form_gui->addItem($ta);
387 $this->video_gui->addPreviewInput($this->form_gui, $this->
object->getId());
391 if ($a_mode ==
"edit" &&
392 $this->media_type->usesParameterProperty($std_item->getFormat())) {
393 if ($this->media_type->usesAutoStartParameterOnly(
394 $std_item->getLocation(),
395 $std_item->getFormat()
403 $this->form_gui->addItem($par);
407 if ($a_mode ==
"edit") {
408 $full_item = $this->
object->getMediaItem(
"Fullscreen");
413 $fs_sec->setTitle(
$lng->
txt(
"cont_fullscreen"));
414 $this->form_gui->addItem($fs_sec);
418 $radio_prop2->addOption($op1);
420 $radio_prop2->addOption($op4);
423 $up->setSuffixes(iterator_to_array($this->media_type->getAllowedSuffixes()));
426 if ($a_mode ==
"create" || !$full_item || $full_item->getLocationType() !=
"LocalFile") {
427 $up->setRequired(
true);
430 $radio_prop2->addOption($op2);
434 $ref->setRequired(
true);
436 $radio_prop2->addOption($op3);
437 $radio_prop2->setValue(
"None");
438 $this->form_gui->addItem($radio_prop2);
441 if ($a_mode ==
"edit") {
442 if ($this->
object->hasFullscreenItem()) {
444 $format->setValue($full_item->getFormat());
445 $this->form_gui->addItem($format);
450 $full_support_constraint_props =
false;
452 if ($a_mode ==
"edit") {
454 if ($this->
object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
455 $add_str =
" (" . ($orig_size[
"width"] ??
"") .
" x " . ($orig_size[
"height"] ??
"") .
")";
457 if (is_int(strpos($full_item->getFormat(),
"image"))
458 && $full_item->getLocationType() ==
"LocalFile") {
459 $full_support_constraint_props =
true;
470 $radio_size->addOption($op1);
474 " / " .
$lng->
txt(
"cont_height"),
"full_width_height");
475 if ($full_support_constraint_props) {
477 $width_height->setConstrainProportions(
true);
479 $op2->addSubItem($width_height);
482 if ($a_mode ==
"edit") {
483 $full_item = $this->
object->getMediaItem(
"Fullscreen");
484 if ($this->
object->hasFullscreenItem() &&
485 is_int(strpos($full_item->getFormat(),
"image")) &&
486 $full_item->getLocationType() ==
"LocalFile") {
491 $op2->addSubItem($resize);
495 $radio_size->setValue(
"original");
496 $radio_size->addOption($op2);
497 $this->form_gui->addItem($radio_size);
502 $caption->setRows(2);
503 $this->form_gui->addItem($caption);
511 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() && $this->media_type->usesAltTextProperty($std_item->getFormat())) {
515 $ta->setInfo(
$lng->
txt(
"text_repr_info"));
516 $this->form_gui->addItem($ta);
521 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() &&
522 $this->media_type->usesParameterProperty($full_item->getFormat())) {
523 if ($this->media_type->usesAutoStartParameterOnly(
524 $full_item->getLocation(),
525 $full_item->getFormat()
533 $this->form_gui->addItem($par);
538 if ($a_mode ==
"edit") {
539 $this->form_gui->setTitle(
$lng->
txt(
"cont_edit_mob"));
540 $this->form_gui->addCommandButton(
"saveProperties",
$lng->
txt(
"save"));
542 $this->form_gui->setTitle(
$lng->
txt(
"cont_insert_mob"));
543 $this->form_gui->addCommandButton(
"save",
$lng->
txt(
"save"));
544 $this->form_gui->addCommandButton(
"cancel",
$lng->
txt(
"cancel"));
546 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
554 $std_item = $this->
object->getMediaItem(
"Standard");
555 if ($std_item->getWidth() ==
"" || $std_item->getHeight() ==
"") {
556 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"mob_no_fixed_size_map_editing"));
568 $values[
"standard_title"] = $this->
object->getTitle();
570 $std_item = $this->
object->getMediaItem(
"Standard");
571 if ($std_item->getLocationType() ==
"LocalFile") {
572 $values[
"standard_type"] =
"File";
573 $values[
"standard_file"] = $std_item->getLocation();
575 $values[
"standard_type"] =
"Reference";
576 $values[
"standard_reference"] = $std_item->getLocation();
578 $values[
"standard_format"] = $std_item->getFormat();
579 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
580 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
581 $values[
"standard_width_height"][
"constr_prop"] =
true;
583 $values[
"standard_size"] =
"selected";
585 $orig_size = $std_item->getOriginalSize();
586 if ($std_item->getWidth() ==
"" && $std_item->getHeight() ==
"") {
587 $values[
"standard_size"] =
"original";
588 $values[
"standard_width_height"][
"width"] = $orig_size[
"width"] ??
"";
589 $values[
"standard_width_height"][
"height"] = $orig_size[
"height"] ??
"";
592 $values[
"standard_caption"] = $std_item->getCaption();
593 $values[
"text_representation"] = $std_item->getTextRepresentation();
594 if ($this->media_type->usesAutoStartParameterOnly(
595 $std_item->getLocation(),
596 $std_item->getFormat()
603 $values[
"standard_parameters"] = $std_item->getParameterString();
606 $values[
"full_type"] =
"None";
607 $values[
"full_size"] =
"original";
608 if ($this->
object->hasFullscreenItem()) {
609 $full_item = $this->
object->getMediaItem(
"Fullscreen");
610 if ($full_item->getLocationType() ==
"LocalFile") {
611 $values[
"full_type"] =
"File";
612 $values[
"full_file"] = $full_item->getLocation();
614 $values[
"full_type"] =
"Reference";
615 $values[
"full_reference"] = $full_item->getLocation();
617 $values[
"full_format"] = $full_item->getFormat();
618 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
619 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
620 $values[
"full_width_height"][
"constr_prop"] =
true;
622 $values[
"full_size"] =
"selected";
624 $orig_size = $full_item->getOriginalSize();
625 if ($full_item->getWidth() ==
"" &&
626 $full_item->getHeight() ==
"") {
627 $values[
"full_size"] =
"original";
628 $values[
"full_width_height"][
"width"] = $orig_size[
"width"] ??
"";
629 $values[
"full_width_height"][
"height"] = $orig_size[
"height"] ??
"";
631 $values[
"full_caption"] = $full_item->getCaption();
632 if ($this->media_type->usesAutoStartParameterOnly(
633 $full_item->getLocation(),
634 $full_item->getFormat()
641 $values[
"full_parameters"] = $full_item->getParameterString();
643 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
646 $this->form_gui->setValuesByArray($values);
657 if ($this->form_gui->checkInput()) {
660 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"saved_media_object"),
true);
662 $this->form_gui->setValuesByPost();
669 if (!$this->form_gui->checkInput()) {
670 $this->form_gui->setValuesByPost();
691 if (trim($form->getInput(
"standard_title")) !=
"") {
692 $title = trim($form->getInput(
"standard_title"));
694 if ($form->getInput(
"standard_type") ==
"File") {
695 $title = $_FILES[
'standard_file'][
'name'];
697 $title = $form->getInput(
"standard_reference");
712 $media_item->setPurpose(
"Standard");
714 if ($form->getInput(
"standard_type") ==
"File") {
716 $file = $mob_dir .
"/" . $file_name;
718 $_FILES[
'standard_file'][
'tmp_name'],
728 if ($form->getInput(
"standard_size") !=
"original" &&
729 is_int(strpos($format,
"image"))) {
730 $wh_input = $form->getInput(
"standard_width_height");
734 (
int) $wh_input[
"width"],
735 (
int) $wh_input[
"height"],
736 (
bool) ($wh_input[
"constr_prop"] ??
false)
741 $media_item->setFormat($format);
743 $media_item->setLocationType(
"LocalFile");
744 $a_mob->generatePreviewPic(320, 240);
747 $media_item->setFormat($format);
749 $media_item->setLocationType(
"Reference");
758 $wh_input = $form->getInput(
"standard_width_height");
761 $form->getInput(
"standard_type"),
763 $media_item->getLocation(),
764 (bool) ($wh_input[
"constr_prop"] ??
false),
765 ($form->getInput(
"standard_size") ==
"original"),
766 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
767 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
769 $media_item->setWidth($wh[
"width"]);
770 $media_item->setHeight($wh[
"height"]);
771 if ($wh[
"info"] !=
"") {
772 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
775 if ($form->getInput(
"standard_caption") !=
"") {
776 $media_item->setCaption($form->getInput(
"standard_caption"));
780 $media_item->setHAlign(
"Left");
783 if ($form->getInput(
"full_type") !=
"None") {
786 $media_item2->setPurpose(
"Fullscreen");
789 if ($form->getInput(
"full_type") ==
"File") {
791 if ($_FILES[
'full_file'][
'name'] !=
"") {
793 $file = $mob_dir .
"/" . $full_file_name;
795 $_FILES[
'full_file'][
'tmp_name'],
802 } elseif ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"File") {
807 if ($form->getInput(
"full_type") ==
"File" ||
808 ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"File")) {
809 if (($form->getInput(
"full_size") !=
"original" &&
810 is_int(strpos($format,
"image")))
812 $full_wh_input = $form->getInput(
"full_width_height");
815 (
int) $full_wh_input[
"width"],
816 (
int) $full_wh_input[
"height"],
817 (
bool) ($full_wh_input[
"constr_prop"] ??
false)
821 $media_item2->setFormat($format);
823 $media_item2->setLocationType(
"LocalFile");
827 if ($form->getInput(
"full_type") ==
"Reference") {
829 if ($form->getInput(
"full_reference") !=
"") {
835 if ($form->getInput(
"full_type") ==
"Reference" ||
836 ($form->getInput(
"full_type") ==
"Standard" && $form->getInput(
"standard_type") ==
"Reference")) {
837 $media_item2->setFormat($format);
839 $media_item2->setLocationType(
"Reference");
844 $wh_input = $form->getInput(
"full_width_height");
849 $media_item2->getLocation(),
850 (bool) ($wh_input[
"constr_prop"] ??
false),
851 ($form->getInput(
"full_size") ==
"original"),
852 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
853 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
856 $media_item2->setWidth($wh[
"width"]);
857 $media_item2->setHeight($wh[
"height"]);
859 if ($form->getInput(
"full_caption") !=
"") {
860 $media_item2->setCaption($form->getInput(
"full_caption"));
876 $this->
ctrl->returnToParent($this);
884 $this->video_gui->addPreviewExtractionToToolbar(
896 $this->video_gui->handleExtractionRequest(
911 $std_item = $this->
object->getMediaItem(
"Standard");
912 if ($std_item->getLocationType() ==
"LocalFile" &&
913 is_int(strpos($std_item->getFormat(),
"image"))
915 $file = $mob_dir .
"/" . $std_item->getLocation();
918 $std_item->getWidth(),
919 $std_item->getHeight()
926 if ($this->
object->hasFullscreenItem()) {
927 $full_item = $this->
object->getMediaItem(
"Fullscreen");
928 if ($full_item->getLocationType() ==
"LocalFile" &&
929 is_int(strpos($full_item->getFormat(),
"image"))
931 $file = $mob_dir .
"/" . $full_item->getLocation();
934 $full_item->getWidth(),
935 $full_item->getHeight()
938 $full_item->update();
942 $this->
ctrl->redirect($this,
"edit");
951 $std_item = $this->
object->getMediaItem(
"Standard");
954 if ($std_item->getLocationType() ==
"LocalFile") {
955 $file = $mob_dir .
"/" . $std_item->getLocation();
959 $std_item->setWidth($size[0]);
960 $std_item->setHeight($size[1]);
961 $this->
object->update();
963 $this->
ctrl->redirect($this,
"edit");
972 $full_item = $this->
object->getMediaItem(
"Fullscreen");
975 if ($full_item->getLocationType() ==
"LocalFile") {
976 $file = $mob_dir .
"/" . $full_item->getLocation();
978 $full_item->setWidth($size[0]);
979 $full_item->setHeight($size[1]);
980 $this->
object->update();
982 $this->
ctrl->redirect($this,
"edit");
995 if ($form->checkInput()) {
996 $title = trim($form->getInput(
"standard_title"));
999 $std_item = $this->
object->getMediaItem(
"Standard");
1001 $format = $std_item->getFormat();
1002 if ($form->getInput(
"standard_type") ==
"Reference") {
1004 $std_item->setFormat($format);
1006 $std_item->setLocationType(
"Reference");
1009 if ($form->getInput(
"standard_type") ==
"File") {
1011 if ($_FILES[
'standard_file'][
'name'] !=
"") {
1013 $file = $mob_dir .
"/" . $file_name;
1015 $_FILES[
'standard_file'][
'tmp_name'],
1025 } elseif ($form->getInput(
"standard_resize")) {
1032 if ($form->getInput(
"standard_size") !=
"original" &&
1033 is_int(strpos($format,
"image"))) {
1034 $wh_input = $form->getInput(
"standard_width_height");
1037 (
int) $wh_input[
"width"],
1038 (
int) $wh_input[
"height"],
1039 (
bool) ($wh_input[
"constr_prop"] ??
false)
1042 $std_item->setFormat($format);
1046 $std_item->setLocationType(
"LocalFile");
1048 $this->
object->setDescription($format);
1050 $wh_input = $form->getInput(
"standard_width_height");
1053 $form->getInput(
"standard_type"),
1055 $std_item->getLocation(),
1056 (bool) ($wh_input[
"constr_prop"] ??
false),
1057 ($form->getInput(
"standard_size") ==
"original"),
1058 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
1059 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
1061 if ($wh[
"info"] !=
"") {
1062 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
1064 $std_item->setWidth($wh[
"width"]);
1065 $std_item->setHeight($wh[
"height"]);
1068 $std_item->setCaption($form->getInput(
"standard_caption"));
1071 $std_item->setTextRepresentation($form->getInput(
"text_representation"));
1073 $this->video_gui->savePreviewInput($form, $this->
object->getId());
1076 if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1077 if ($this->media_type->usesAutoStartParameterOnly(
1078 $std_item->getLocation(),
1079 $std_item->getFormat()
1088 $std_item->setParameters($form->getInput(
"standard_parameters"));
1093 if ($form->getInput(
"full_type") ==
"None") {
1094 if ($this->
object->hasFullscreenItem()) {
1095 $this->
object->removeMediaItem(
"Fullscreen");
1098 if ($this->
object->hasFullscreenItem()) {
1099 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1102 $this->
object->addMediaItem($full_item);
1103 $full_item->setPurpose(
"Fullscreen");
1106 $format = $full_item->getFormat();
1107 if ($form->getInput(
"full_type") ==
"Reference") {
1109 $full_item->setFormat($format);
1110 $full_item->setLocationType(
"Reference");
1112 $type =
"Reference";
1116 if ($form->getInput(
"full_type") ==
"File") {
1118 if ($_FILES[
'full_file'][
'name'] !=
"") {
1120 $file = $mob_dir .
"/" . $full_file_name;
1122 $_FILES[
'full_file'][
'tmp_name'],
1131 } elseif ($form->getInput(
"full_resize")) {
1138 if ($form->getInput(
"full_size") !=
"original" &&
1139 is_int(strpos($format,
"image"))) {
1140 $wh_input = $form->getInput(
"full_width_height");
1143 (
int) $wh_input[
"width"],
1144 (
int) $wh_input[
"height"],
1145 (
bool) ($wh_input[
"constr_prop"] ??
false)
1148 $full_item->setFormat($format);
1152 $full_item->setLocationType(
"LocalFile");
1155 if ($form->getInput(
"full_type") ==
"Standard") {
1156 $format = $std_item->getFormat();
1158 $full_item->setLocationType($std_item->getLocationType());
1159 $full_item->setFormat($format);
1161 $type = $std_item->getLocationType();
1162 if (
$type ==
"LocalFile") {
1167 if ($form->getInput(
"full_size") !=
"original" &&
1168 is_int(strpos($format,
"image")) &&
1169 $full_item->getLocationType() ==
"LocalFile") {
1171 $wh_input = $form->getInput(
"full_width_height");
1174 (
int) $wh_input[
"width"],
1175 (
int) $wh_input[
"height"],
1176 (
bool) ($wh_input[
"constr_prop"] ??
false)
1182 $wh_input = $form->getInput(
"full_width_height");
1187 $full_item->getLocation(),
1188 (bool) ($wh_input[
"constr_prop"] ??
false),
1189 ($form->getInput(
"full_size") ==
"original"),
1190 ($wh_input[
"width"] ==
"") ? null : (
int) $wh_input[
"width"],
1191 ($wh_input[
"height"] ==
"") ? null : (
int) $wh_input[
"height"]
1193 if ($wh[
"info"] !=
"") {
1194 $this->tpl->setOnScreenMessage(
'info', $wh[
"info"],
true);
1197 $full_item->setWidth($wh[
"width"]);
1198 $full_item->setHeight($wh[
"height"]);
1199 $full_item->setLocation($location);
1201 $full_item->setCaption($form->getInput(
"full_caption"));
1204 $full_item->setTextRepresentation($form->getInput(
"full_text_representation"));
1208 if ($this->media_type->usesParameterProperty($std_item->getFormat())) {
1209 if ($this->media_type->usesAutoStartParameterOnly(
1210 $std_item->getLocation(),
1211 $std_item->getFormat()
1220 $full_item->setParameters($form->getInput(
"full_parameters"));
1228 $this->
object->update();
1229 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1230 $this->
ctrl->redirect($this,
"edit");
1232 $this->form_gui->setValuesByPost();
1244 $cur_subdir = dirname($a_file);
1246 $cur_dir = (!empty($cur_subdir))
1247 ? $mob_dir .
"/" . $cur_subdir
1249 $file = $cur_dir .
"/" . basename($a_file);
1252 if (!is_file($file)) {
1253 $this->
ilias->raiseError($this->
lng->txt(
"cont_select_file"), $this->
ilias->error_obj->MESSAGE);
1256 $std_item = $this->
object->getMediaItem(
"Standard");
1257 $std_item->setLocationType(
"LocalFile");
1260 $std_item->setFormat($format);
1261 $this->
object->update();
1263 $this->
ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1274 $cur_subdir = dirname($a_file);
1276 $cur_dir = (!empty($cur_subdir))
1277 ? $mob_dir .
"/" . $cur_subdir
1279 $file = $cur_dir .
"/" . basename($a_file);
1282 if (!is_file($file)) {
1283 $this->
ilias->raiseError($this->
lng->txt(
"cont_select_file"), $this->
ilias->error_obj->MESSAGE);
1286 if (!$this->
object->hasFullscreenItem()) {
1287 $std_item = $this->
object->getMediaItem(
"Standard");
1291 $full_item->setMobId($std_item->getMobId());
1293 $full_item->setLocationType(
"LocalFile");
1295 $full_item->setPurpose(
"Fullscreen");
1296 $this->
object->addMediaItem($full_item);
1298 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1300 $full_item->setLocationType(
"LocalFile");
1303 $full_item->setFormat($format);
1305 $this->
object->update();
1307 $this->
ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1316 $this->
object->removeMediaItem(
"Fullscreen");
1317 $this->
object->update();
1319 $this->
ctrl->redirect($this,
"edit");
1327 if (!$this->
object->hasFullscreenItem()) {
1328 $std_item = $this->
object->getMediaItem(
"Standard");
1330 $full_item->setMobId($std_item->getMobId());
1331 $full_item->setLocation($std_item->getLocation());
1332 $full_item->setLocationType($std_item->getLocationType());
1333 $full_item->setFormat($std_item->getFormat());
1334 $full_item->setWidth($std_item->getWidth());
1335 $full_item->setHeight($std_item->getHeight());
1336 $full_item->setCaption($std_item->getCaption());
1337 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1338 $full_item->setPurpose(
"Fullscreen");
1339 $this->
object->addMediaItem($full_item);
1341 $this->
object->update();
1344 $this->
ctrl->redirect($this,
"edit");
1352 $this->showUsagesObject(
true);
1359 public function showUsagesObject(
1369 $lng->
txt(
"cont_current_usages"),
1370 $ilCtrl->getLinkTarget($this,
"showUsages")
1376 $ilCtrl->getLinkTarget($this,
"showAllUsages")
1380 $ilTabs->activateSubTab(
"all_usages");
1381 $cmd =
"showAllUsages";
1383 $ilTabs->activateSubTab(
"current_usages");
1384 $cmd =
"showUsages";
1406 $lng = $DIC->language();
1408 $tpl =
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1409 $types = array(
"Standard",
"Fullscreen");
1410 foreach ($types as
$type) {
1421 if ($type ==
"Standard") {
1428 if ($med->getLocationType() ==
"LocalFile") {
1430 if (is_file($file)) {
1431 $size = filesize($file);
1439 if ($med->getWidth() !=
"" && $med->getHeight() !=
"") {
1442 $tpl->
setVariable(
"VAL_SIZE", $med->getWidth() .
"x" . $med->getHeight());
1447 if ($orig_size = $med->getOriginalSize()) {
1448 if (($orig_size[
"width"] ??
"") !== $med->getWidth() ||
1449 ($orig_size[
"height"] ??
"") !== $med->getHeight()) {
1459 if (strlen($med->getCaption())) {
1466 if ($type ==
"Standard") {
1490 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject") {
1492 $this->tpl->setTitle($this->
object->getTitle());
1496 $this->tpl->setTitle($this->
lng->txt(
"cont_create_mob"));
1506 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject" 1507 && $this->
object->getId() > 0) {
1509 $this->tabs_gui->addTarget(
1510 "cont_mob_def_prop",
1511 $this->
ctrl->getLinkTarget($this,
"edit"),
1516 $st_item = $this->
object->getMediaItem(
"Standard");
1521 $format = $st_item->getFormat();
1522 if (substr($format, 0, 5) ==
"image" && !is_int(strpos($format,
"svg"))) {
1523 $this->tabs_gui->addTarget(
1524 "cont_def_map_areas",
1525 $this->
ctrl->getLinkTargetByClass(
1526 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
1530 "ilimagemapeditorgui" 1536 $this->tabs_gui->addTarget(
1538 $this->
ctrl->getLinkTarget($this,
"showUsages"),
1544 $std_item = $this->
object->getMediaItem(
"Standard");
1545 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1547 if ($mset->get(
"file_manager_always") ||
1548 ($this->media_type->usesParameterProperty($std_item->getFormat()) ||
1549 (is_object($full_item) && $this->media_type->usesParameterProperty($full_item->getFormat())))
1551 $this->tabs_gui->addTarget(
1553 $this->
ctrl->getLinkTargetByClass(
1554 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
1563 $mdtab = $mdgui->
getTab(
"ilobjmediaobjectgui");
1565 $this->tabs_gui->addTarget(
1575 if ($this->back_title !=
"") {
1576 $this->tabs_gui->setBackTarget(
1578 $this->
ctrl->getParentReturn($this)
1593 if ($a_tpl == null) {
1599 $a_tpl->addJavaScript(
"./Services/COPage/js/ilCOPagePres.js");
1611 $ilTabs->activateTab(
"cont_mob_def_prop");
1616 $ilCtrl->getLinkTarget($this,
"edit")
1619 if ($this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/webm" ||
1620 $this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/mp4") {
1624 $ilCtrl->getLinkTarget($this,
"listSubtitleFiles")
1628 $ilTabs->activateSubTab($a_active);
1631 public function listSubtitleFilesObject():
void 1641 if (!in_array(
"srt", $this->file_service_settings->getWhiteListedSuffixes())) {
1646 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1649 $ilToolbar->addInputItem($fi,
true);
1655 $si->setValue($ilUser->getLanguage());
1656 $ilToolbar->addInputItem($si,
true);
1658 $ilToolbar->addFormButton(
$lng->
txt(
"upload"),
"uploadSubtitleFile");
1660 $ilToolbar->addSeparator();
1661 $ilToolbar->addFormButton(
$lng->
txt(
"mob_upload_multi_srt"),
"uploadMultipleSubtitleFileForm");
1676 if ($this->
object->uploadSrtFile(
1677 $_FILES[
"subtitle_file"][
"tmp_name"],
1678 $this->sub_title_request->getLanguage()
1680 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"msg_obj_modified"),
true);
1682 $ilCtrl->
redirect($this,
"listSubtitleFiles");
1696 $srts = $this->sub_title_request->getSrtFiles();
1697 if (count($srts) == 0) {
1698 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"no_checkbox"),
true);
1699 $ilCtrl->redirect($this,
"listSubtitleFiles");
1702 $cgui->setFormAction($ilCtrl->getFormAction($this));
1703 $cgui->setHeaderText(
$lng->
txt(
"mob_really_delete_srt"));
1704 $cgui->setCancel(
$lng->
txt(
"cancel"),
"listSubtitleFiles");
1705 $cgui->setConfirm(
$lng->
txt(
"delete"),
"deleteSrtFiles");
1707 foreach ($srts as $i) {
1708 $cgui->addItem(
"srt[]", $i,
"subtitle_" . $i .
".srt (" .
$lng->
txt(
"meta_l_" . $i) .
")");
1723 $srts = $this->sub_title_request->getSrtFiles();
1724 foreach ($srts as $i) {
1725 if (strlen($i) == 2 && !is_int(strpos($i,
"."))) {
1726 $this->
object->removeAdditionalFile(
"srt/subtitle_" . $i .
".srt");
1729 $this->tpl->setOnScreenMessage(
'success',
$lng->
txt(
"mob_srt_files_deleted"),
true);
1730 $ilCtrl->
redirect($this,
"listSubtitleFiles");
1739 $this->tpl->setOnScreenMessage(
'info',
$lng->
txt(
"mob_upload_multi_srt_howto"));
1744 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1747 $ilToolbar->addInputItem($fi,
true);
1749 $ilToolbar->addFormButton(
$lng->
txt(
"upload"),
"uploadMultipleSubtitleFile");
1756 $this->
ctrl->redirect($this,
"showMultiSubtitleConfirmationTable");
1758 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage(),
true);
1759 $this->
ctrl->redirect($this,
"uploadMultipleSubtitleFileForm");
1781 $this->
object->clearMultiSrtDirectory();
1782 $this->
ctrl->redirect($this,
"listSubtitleFiles");
1791 $srt_files = $this->
object->getMultiSrtFiles();
1792 $files = $this->sub_title_request->getFiles();
1793 foreach ($files as
$f) {
1794 foreach ($srt_files as $srt_file) {
1795 if ($f == $srt_file[
"filename"]) {
1796 $this->
object->uploadSrtFile($this->
object->getMultiSrtUploadDir() .
"/" . $srt_file[
"filename"], $srt_file[
"lang"],
"rename");
1800 $this->
object->clearMultiSrtDirectory();
1801 $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...
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)
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.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
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.
setDescription(string $description)
static stripSlashesArray(array $a_arr, bool $a_strip_html=true, string $a_allow="")
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.