4 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
5 require_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
6 require_once(
"./Services/Object/classes/class.ilObjectGUI.php");
56 public function __construct($a_data, $a_id = 0, $a_call_by_reference =
false, $a_prepare_output =
false)
60 $this->tpl = $DIC[
"tpl"];
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();
71 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
73 $this->back_title =
"";
76 $lng->loadLanguageModule(
"mob");
96 $this->enabledmapareas = $a_enabledmapareas;
116 $this->width_preset = $a_val;
126 return $this->width_preset;
136 $this->height_preset = $a_val;
146 return $this->height_preset;
156 return $this->form_gui;
161 if ($this->
id != 0) {
168 $this->ctrl->returnToParent($this);
181 $next_class = $this->ctrl->getNextClass($this);
182 $cmd = $this->ctrl->getCmd();
184 switch ($next_class) {
185 case 'ilobjectmetadatagui':
186 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
189 $md_gui->
addMDObserver($this->
object,
'MDUpdateListener',
'General');
190 $this->ctrl->forwardCommand($md_gui);
193 case "ilimagemapeditorgui":
194 require_once(
"./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
196 $ret = $this->ctrl->forwardCommand($image_map_edit);
201 case "ilfilesystemgui":
202 include_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
206 $fs_gui->activateLabels(
true, $this->lng->txt(
"cont_purpose"));
207 $fs_gui->setTableId(
"mobfs" . $this->
object->getId());
209 $this->
object->getMediaItem(
"Standard")->getLocation(),
210 $this->lng->txt(
"cont_std_view")
212 if ($this->
object->hasFullscreenItem()) {
214 $this->
object->getMediaItem(
"Fullscreen")->getLocation(),
215 $this->lng->txt(
"cont_fullscreen")
218 $fs_gui->addCommand($this,
"assignStandardObject", $this->lng->txt(
"cont_assign_std"));
219 $fs_gui->addCommand($this,
"assignFullscreenObject", $this->lng->txt(
"cont_assign_full"));
221 $ret = $this->ctrl->forwardCommand($fs_gui);
223 include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
229 if (isset(
$_POST[
"editImagemapForward"]) ||
230 isset(
$_POST[
"editImagemapForward_x"]) ||
231 isset(
$_POST[
"editImagemapForward_y"])) {
232 $cmd =
"editImagemapForward";
235 $ret = $this->$cmd();
247 $this->back_title = $a_title;
258 $ilHelp->setScreenId(
"create");
260 $tpl->setContent($this->form_gui->getHTML());
271 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
273 if ($a_mode ==
"edit") {
274 $std_item = $this->
object->getMediaItem(
"Standard");
282 $title->setMaxLength(120);
283 $this->form_gui->addItem(
$title);
290 if ($a_mode ==
"create" || $std_item->getLocationType() !=
"LocalFile") {
291 $up->setRequired(
true);
294 $radio_prop->addOption($op1);
298 $ref->setRequired(
true);
300 $radio_prop->addOption($op2);
301 $radio_prop->setValue(
"File");
302 $this->form_gui->addItem($radio_prop);
305 if ($a_mode ==
"edit") {
307 $format->setValue($std_item->getFormat());
308 $this->form_gui->addItem(
$format);
313 if ($a_mode ==
"edit") {
314 if ($orig_size = $std_item->getOriginalSize()) {
315 $add_str =
" (" . $orig_size[
"width"] .
" x " . $orig_size[
"height"] .
")";
317 $op1 =
new ilRadioOption(
$lng->txt(
"cont_resource_size") . $add_str,
"original");
318 $op1->
setInfo(
$lng->txt(
"cont_resource_size_info"));
322 $op1->
setInfo(
$lng->txt(
"cont_resource_size_info"));
325 $radio_size->addOption($op1);
328 include_once(
"./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
330 " / " .
$lng->txt(
"cont_height"),
"standard_width_height");
332 $op2->addSubItem($width_height);
335 if ($a_mode ==
"edit") {
336 $std_item = $this->
object->getMediaItem(
"Standard");
337 if (is_int(strpos($std_item->getFormat(),
"image"))
338 && $std_item->getLocationType() ==
"LocalFile") {
344 $radio_size->setValue(
"original");
346 $radio_size->setValue(
"selected");
350 $radio_size->addOption($op2);
351 $this->form_gui->addItem($radio_size);
356 $caption->setRows(2);
357 $this->form_gui->addItem($caption);
365 if ($a_mode ==
"edit" && is_int(strpos($std_item->getFormat(),
"image"))) {
369 $ta->setInfo(
$lng->txt(
"text_repr_info"));
370 $this->form_gui->addItem($ta);
374 if ($a_mode ==
"edit" &&
377 $std_item->getLocation(),
378 $std_item->getFormat()
381 $this->form_gui->addItem($auto);
386 $this->form_gui->addItem($par);
390 if ($a_mode ==
"edit") {
391 $full_item = $this->
object->getMediaItem(
"Fullscreen");
396 $fs_sec->setTitle(
$lng->txt(
"cont_fullscreen"));
397 $this->form_gui->addItem($fs_sec);
401 $radio_prop2->addOption($op1);
402 $op4 =
new ilRadioOption(
$lng->txt(
"cont_use_same_resource_as_above"),
"Standard");
403 $radio_prop2->addOption($op4);
409 if ($a_mode ==
"create" || !$full_item || $full_item->getLocationType() !=
"LocalFile") {
410 $up->setRequired(
true);
413 $radio_prop2->addOption($op2);
417 $ref->setRequired(
true);
419 $radio_prop2->addOption($op3);
420 $radio_prop2->setValue(
"None");
421 $this->form_gui->addItem($radio_prop2);
424 if ($a_mode ==
"edit") {
425 if ($this->
object->hasFullscreenItem()) {
427 $format->setValue($full_item->getFormat());
428 $this->form_gui->addItem(
$format);
434 if ($a_mode ==
"edit") {
436 if ($this->
object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize())) {
437 $add_str =
" (" . $orig_size[
"width"] .
" x " . $orig_size[
"height"] .
")";
439 $op1 =
new ilRadioOption(
$lng->txt(
"cont_resource_size") . $add_str,
"original");
440 $op1->
setInfo(
$lng->txt(
"cont_resource_size_info"));
444 $op1->
setInfo(
$lng->txt(
"cont_resource_size_info"));
447 $radio_size->addOption($op1);
451 " / " .
$lng->txt(
"cont_height"),
"full_width_height");
453 $op2->addSubItem($width_height);
456 if ($a_mode ==
"edit") {
457 $full_item = $this->
object->getMediaItem(
"Fullscreen");
458 if ($this->
object->hasFullscreenItem() &&
459 is_int(strpos($full_item->getFormat(),
"image")) &&
460 $full_item->getLocationType() ==
"LocalFile") {
462 $lng->txt(
"cont_resize_img"),
469 $radio_size->setValue(
"original");
470 $radio_size->addOption($op2);
471 $this->form_gui->addItem($radio_size);
476 $caption->setRows(2);
477 $this->form_gui->addItem($caption);
485 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(),
"image"))) {
489 $ta->setInfo(
$lng->txt(
"text_repr_info"));
490 $this->form_gui->addItem($ta);
495 if ($a_mode ==
"edit" && $this->
object->hasFullscreenItem() &&
498 $full_item->getLocation(),
499 $full_item->getFormat()
502 $this->form_gui->addItem($auto);
507 $this->form_gui->addItem($par);
511 $this->form_gui->setTitle(
$lng->txt(
"cont_insert_mob"));
512 if ($a_mode ==
"edit") {
513 $this->form_gui->addCommandButton(
"saveProperties",
$lng->txt(
"save"));
515 $this->form_gui->addCommandButton(
"save",
$lng->txt(
"save"));
516 $this->form_gui->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
518 $this->form_gui->setFormAction(
$ilCtrl->getFormAction($this));
529 $std_item = $this->
object->getMediaItem(
"Standard");
530 if ($std_item->getWidth() ==
"" || $std_item->getHeight() ==
"") {
544 $values[
"standard_title"] = $this->
object->getTitle();
546 $std_item = $this->
object->getMediaItem(
"Standard");
547 if ($std_item->getLocationType() ==
"LocalFile") {
548 $values[
"standard_type"] =
"File";
549 $values[
"standard_file"] = $std_item->getLocation();
551 $values[
"standard_type"] =
"Reference";
552 $values[
"standard_reference"] = $std_item->getLocation();
554 $values[
"standard_format"] = $std_item->getFormat();
555 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
556 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
557 $values[
"standard_width_height"][
"constr_prop"] =
true;
559 $values[
"standard_size"] =
"selected";
561 $orig_size = $std_item->getOriginalSize();
562 if ($std_item->getWidth() ==
"" && $std_item->getHeight() ==
"") {
563 $values[
"standard_size"] =
"original";
564 $values[
"standard_width_height"][
"width"] = $orig_size[
"width"];
565 $values[
"standard_width_height"][
"height"] = $orig_size[
"height"];
568 $values[
"standard_caption"] = $std_item->getCaption();
569 $values[
"text_representation"] = $std_item->getTextRepresentation();
571 $std_item->getLocation(),
572 $std_item->getFormat()
574 $par = $std_item->getParameters();
575 if ($par[
"autostart"]) {
576 $values[
"standard_autostart"] =
true;
579 $values[
"standard_parameters"] = $std_item->getParameterString();
582 $values[
"full_type"] =
"None";
583 $values[
"full_size"] =
"original";
584 if ($this->
object->hasFullScreenItem()) {
585 $full_item = $this->
object->getMediaItem(
"Fullscreen");
586 if ($full_item->getLocationType() ==
"LocalFile") {
587 $values[
"full_type"] =
"File";
588 $values[
"full_file"] = $full_item->getLocation();
590 $values[
"full_type"] =
"Reference";
591 $values[
"full_reference"] = $full_item->getLocation();
593 $values[
"full_format"] = $full_item->getFormat();
594 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
595 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
596 $values[
"full_width_height"][
"constr_prop"] =
true;
598 $values[
"full_size"] =
"selected";
600 $orig_size = $full_item->getOriginalSize();
601 if ($full_item->getWidth() ==
"" &&
602 $full_item->getHeight() ==
"") {
603 $values[
"full_size"] =
"original";
604 $values[
"full_width_height"][
"width"] = $orig_size[
"width"];
605 $values[
"full_width_height"][
"height"] = $orig_size[
"height"];
607 $values[
"full_caption"] = $full_item->getCaption();
609 $full_item->getLocation(),
610 $full_item->getFormat()
612 $par = $full_item->getParameters();
613 if ($par[
"autostart"]) {
614 $values[
"full_autostart"] =
true;
617 $values[
"full_parameters"] = $full_item->getParameterString();
619 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
622 $this->form_gui->setValuesByArray($values);
634 if ($this->form_gui->checkInput()) {
640 $this->form_gui->setValuesByPost();
641 $tpl->setContent($this->form_gui->getHTML());
654 if (!$this->form_gui->checkInput()) {
655 $this->form_gui->setValuesByPost();
668 if (trim(
$_POST[
"standard_title"]) !=
"") {
671 if (
$_POST[
"standard_type"] ==
"File") {
672 $title = $_FILES[
'standard_file'][
'name'];
679 $a_mob->setDescription(
"");
684 $a_mob->createDirectory();
688 $a_mob->addMediaItem($media_item);
689 $media_item->setPurpose(
"Standard");
691 if (
$_POST[
"standard_type"] ==
"File") {
693 $file = $mob_dir .
"/" . $file_name;
694 ilUtil::moveUploadedFile(
695 $_FILES[
'standard_file'][
'tmp_name'],
705 if (
$_POST[
"standard_size"] !=
"original" &&
706 is_int(strpos(
$format,
"image"))) {
709 (
int)
$_POST[
"standard_width_height"][
"width"],
710 (
int) $_POST[
"standard_width_height"][
"height"],
711 (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]
716 $media_item->setFormat(
$format);
718 $media_item->setLocationType(
"LocalFile");
721 $media_item->setFormat(
$format);
723 $media_item->setLocationType(
"Reference");
725 $a_mob->setDescription(
$format);
732 $media_item->getLocation(),
733 $_POST[
"standard_width_height"][
"constr_prop"],
734 (
$_POST[
"standard_size"] ==
"original"),
735 $_POST[
"standard_width_height"][
"width"],
736 $_POST[
"standard_width_height"][
"height"]
738 $media_item->setWidth($wh[
"width"]);
739 $media_item->setHeight($wh[
"height"]);
740 if ($wh[
"info"] !=
"") {
744 if ($_POST[
"standard_caption"] !=
"") {
749 $media_item->setHAlign(
"Left");
752 if ($_POST[
"full_type"] !=
"None") {
754 $a_mob->addMediaItem($media_item2);
755 $media_item2->setPurpose(
"Fullscreen");
758 if ($_POST[
"full_type"] ==
"File") {
760 if ($_FILES[
'full_file'][
'name'] !=
"") {
762 $file = $mob_dir .
"/" . $full_file_name;
763 ilUtil::moveUploadedFile(
764 $_FILES[
'full_file'][
'tmp_name'],
769 $location = $full_file_name;
771 } elseif ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File") {
772 $location = $file_name;
776 if ($_POST[
"full_type"] ==
"File" ||
777 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File")) {
778 if (($_POST[
"full_size"] !=
"original" &&
779 is_int(strpos(
$format,
"image")))
783 (
int) $_POST[
"full_width_height"][
"width"],
784 (
int) $_POST[
"full_width_height"][
"height"],
785 (
boolean) $_POST[
"full_width_height"][
"constr_prop"]
789 $media_item2->setFormat(
$format);
790 $media_item2->setLocation($location);
791 $media_item2->setLocationType(
"LocalFile");
795 if ($_POST[
"full_type"] ==
"Reference") {
797 if ($_POST[
"full_reference"] !=
"") {
803 if ($_POST[
"full_type"] ==
"Reference" ||
804 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"Reference")) {
805 $media_item2->setFormat(
$format);
806 $media_item2->setLocation($location);
807 $media_item2->setLocationType(
"Reference");
815 $mob_dir .
"/" . $location,
816 $media_item2->getLocation(),
817 $_POST[
"full_width_height"][
"constr_prop"],
818 ($_POST[
"full_size"] ==
"original"),
819 $_POST[
"full_width_height"][
"width"],
820 $_POST[
"full_width_height"][
"height"]
823 $media_item2->setWidth($wh[
"width"]);
824 $media_item2->setHeight($wh[
"height"]);
826 if ($_POST[
"full_caption"] !=
"") {
832 include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
843 $this->ctrl->returnToParent($this);
857 $tpl->setContent($this->form_gui->getHTML());
870 $std_item = $this->
object->getMediaItem(
"Standard");
871 if ($std_item->getLocationType() ==
"LocalFile" &&
872 is_int(strpos($std_item->getFormat(),
"image"))
874 $file = $mob_dir .
"/" . $std_item->getLocation();
877 $std_item->getWidth(),
878 $std_item->getHeight()
885 if ($this->
object->hasFullScreenItem()) {
886 $full_item = $this->
object->getMediaItem(
"Fullscreen");
887 if ($full_item->getLocationType() ==
"LocalFile" &&
888 is_int(strpos($full_item->getFormat(),
"image"))
890 $file = $mob_dir .
"/" . $full_item->getLocation();
893 $full_item->getWidth(),
894 $full_item->getHeight()
897 $full_item->update();
901 $this->ctrl->redirect($this,
"edit");
910 $std_item = $this->
object->getMediaItem(
"Standard");
913 if ($std_item->getLocationType() ==
"LocalFile") {
914 $file = $mob_dir .
"/" . $std_item->getLocation();
916 include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
919 $std_item->setWidth(
$size[0]);
920 $std_item->setHeight(
$size[1]);
921 $this->
object->update();
923 $this->ctrl->redirect($this,
"edit");
932 $full_item = $this->
object->getMediaItem(
"Fullscreen");
935 if ($full_item->getLocationType() ==
"LocalFile") {
936 $file = $mob_dir .
"/" . $full_item->getLocation();
937 include_once(
"./Services/MediaObjects/classes/class.ilMediaImageUtil.php");
939 $full_item->setWidth(
$size[0]);
940 $full_item->setHeight(
$size[1]);
941 $this->
object->update();
943 $this->ctrl->redirect($this,
"edit");
955 if ($this->form_gui->checkInput()) {
957 $this->
object->setTitle(
$title);
959 $std_item = $this->
object->getMediaItem(
"Standard");
961 $format = $std_item->getFormat();
962 if (
$_POST[
"standard_type"] ==
"Reference") {
966 $std_item->setLocationType(
"Reference");
969 if (
$_POST[
"standard_type"] ==
"File") {
971 if ($_FILES[
'standard_file'][
'name'] !=
"") {
973 $file = $mob_dir .
"/" . $file_name;
974 ilUtil::moveUploadedFile(
975 $_FILES[
'standard_file'][
'tmp_name'],
985 } elseif (
$_POST[
"standard_resize"]) {
992 if (
$_POST[
"standard_size"] !=
"original" &&
993 is_int(strpos(
$format,
"image"))) {
996 (
int)
$_POST[
"standard_width_height"][
"width"],
997 (
int) $_POST[
"standard_width_height"][
"height"],
998 (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]
1001 $std_item->setFormat(
$format);
1005 $std_item->setLocationType(
"LocalFile");
1007 $this->
object->setDescription(
$format);
1013 $std_item->getLocation(),
1014 $_POST[
"standard_width_height"][
"constr_prop"],
1015 (
$_POST[
"standard_size"] ==
"original"),
1016 $_POST[
"standard_width_height"][
"width"],
1017 $_POST[
"standard_width_height"][
"height"]
1019 if ($wh[
"info"] !=
"") {
1022 $std_item->setWidth($wh[
"width"]);
1023 $std_item->setHeight($wh[
"height"]);
1034 $std_item->getLocation(),
1035 $std_item->getFormat()
1037 if ($_POST[
"standard_autostart"]) {
1038 $std_item->setParameters(
'autostart="true"');
1040 $std_item->setParameters(
"");
1048 if ($_POST[
"full_type"] ==
"None") {
1049 if ($this->
object->hasFullscreenItem()) {
1050 $this->
object->removeMediaItem(
"Fullscreen");
1053 if ($this->
object->hasFullscreenItem()) {
1054 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1057 $this->
object->addMediaItem($full_item);
1058 $full_item->setPurpose(
"Fullscreen");
1060 $location = $full_item->getLocation();
1061 $format = $full_item->getFormat();
1062 if ($_POST[
"full_type"] ==
"Reference") {
1064 $full_item->setFormat(
$format);
1065 $full_item->setLocationType(
"Reference");
1067 $type =
"Reference";
1070 if ($_POST[
"full_type"] ==
"File") {
1072 if ($_FILES[
'full_file'][
'name'] !=
"") {
1074 $file = $mob_dir .
"/" . $full_file_name;
1075 ilUtil::moveUploadedFile(
1076 $_FILES[
'full_file'][
'tmp_name'],
1082 $location = $full_file_name;
1085 } elseif ($_POST[
"full_resize"]) {
1092 if ($_POST[
"full_size"] !=
"original" &&
1093 is_int(strpos(
$format,
"image"))) {
1096 (
int) $_POST[
"full_width_height"][
"width"],
1097 (
int) $_POST[
"full_width_height"][
"height"],
1098 (
boolean) $_POST[
"full_width_height"][
"contr_prop"]
1101 $full_item->setFormat(
$format);
1102 $full_item->setLocation($location);
1105 $full_item->setLocationType(
"LocalFile");
1108 if ($_POST[
"full_type"] ==
"Standard") {
1109 $format = $std_item->getFormat();
1110 $location = $std_item->getLocation();
1111 $full_item->setLocationType($std_item->getLocationType());
1112 $full_item->setFormat(
$format);
1113 $full_item->setLocation($location);
1114 $type = $std_item->getLocationType();
1115 if (
$type ==
"LocalFile") {
1120 if ($_POST[
"full_size"] !=
"original" &&
1121 is_int(strpos(
$format,
"image")) &&
1122 $full_item->getLocationType() ==
"LocalFile") {
1126 (
int) $_POST[
"full_width_height"][
"width"],
1127 (
int) $_POST[
"full_width_height"][
"height"],
1128 (
boolean) $_POST[
"full_width_height"][
"contr_prop"]
1137 $mob_dir .
"/" . $location,
1138 $full_item->getLocation(),
1139 $_POST[
"full_width_height"][
"constr_prop"],
1140 ($_POST[
"full_size"] ==
"original"),
1141 $_POST[
"full_width_height"][
"width"],
1142 $_POST[
"full_width_height"][
"height"]
1144 if ($wh[
"info"] !=
"") {
1148 $full_item->setWidth($wh[
"width"]);
1149 $full_item->setHeight($wh[
"height"]);
1150 $full_item->setLocation($location);
1161 $std_item->getLocation(),
1162 $std_item->getFormat()
1164 if ($_POST[
"full_autostart"]) {
1165 $full_item->setParameters(
'autostart="true"');
1167 $full_item->setParameters(
"");
1176 include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1179 $this->
object->update();
1181 $this->ctrl->redirect($this,
"edit");
1183 $this->form_gui->setValuesByPost();
1184 $tpl->setContent($this->form_gui->getHTML());
1195 $std_item = $this->
object->getMediaItem(
"Standard");
1196 if ($this->
object->hasFullscreenItem()) {
1197 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1201 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
1205 $cur_subdir =
$_GET[
"cdir"];
1206 if (
$_GET[
"newdir"] ==
"..") {
1207 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir,
"/"));
1209 if (!empty(
$_GET[
"newdir"])) {
1210 if (!empty($cur_subdir)) {
1211 $cur_subdir = $cur_subdir .
"/" .
$_GET[
"newdir"];
1213 $cur_subdir =
$_GET[
"newdir"];
1218 $cur_subdir = str_replace(
".",
"", $cur_subdir);
1220 $cur_dir = (!empty($cur_subdir))
1221 ? $mob_dir .
"/" . $cur_subdir
1225 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_files.html",
"Services/MediaObjects");
1227 $this->ctrl->setParameter($this,
"cdir", urlencode($cur_subdir));
1228 $this->tpl->setVariable(
"FORMACTION1", $this->ctrl->getFormAction($this));
1231 $this->tpl->setVariable(
"TXT_NEW_DIRECTORY", $this->lng->txt(
"cont_new_dir"));
1232 $this->tpl->setVariable(
"TXT_NEW_FILE", $this->lng->txt(
"cont_new_file"));
1233 $this->tpl->setVariable(
"CMD_NEW_DIR",
"createDirectory");
1234 $this->tpl->setVariable(
"CMD_NEW_FILE",
"uploadFile");
1235 $this->tpl->setVariable(
"BTN_NEW_DIR", $this->lng->txt(
"create"));
1236 $this->tpl->setVariable(
"BTN_NEW_FILE", $this->lng->txt(
"upload"));
1239 $this->tpl->addBlockfile(
"FILE_TABLE",
"files",
"tpl.table.html");
1242 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.mob_file_row.html",
"Services/MediaObjects");
1246 $obj_str = ($this->call_by_reference) ?
"" :
"&obj_id=" . $this->obj_id;
1247 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1249 $tbl->setTitle($this->lng->txt(
"cont_files") .
" " . $cur_subdir);
1252 $tbl->setHeaderNames(
array(
"",
"", $this->lng->txt(
"cont_dir_file"),
1253 $this->lng->txt(
"cont_size"), $this->lng->txt(
"cont_purpose")));
1255 $cols =
array(
"",
"",
"dir_file",
"size",
"purpose");
1256 $header_params =
array(
"ref_id" =>
$_GET[
"ref_id"],
"obj_id" =>
$_GET[
"obj_id"],
1257 "cmd" =>
"editFiles",
"hier_id" =>
$_GET[
"hier_id"],
"item_id" =>
$_GET[
"item_id"]);
1258 $tbl->setHeaderVars(
$cols, $header_params);
1259 $tbl->setColumnWidth(
array(
"1%",
"1%",
"33%",
"33%",
"32%"));
1263 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
1266 $tbl->setMaxCount($this->maxcount);
1269 $this->tpl->setVariable(
"COLUMN_COUNTS", 5);
1273 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1274 $this->tpl->setVariable(
"BTN_NAME",
"deleteFile");
1275 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
1276 $this->tpl->parseCurrentBlock();
1278 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1279 $this->tpl->setVariable(
"BTN_NAME",
"assignStandard");
1280 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_std"));
1281 $this->tpl->parseCurrentBlock();
1283 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1284 $this->tpl->setVariable(
"BTN_NAME",
"assignFullscreen");
1285 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_full"));
1286 $this->tpl->parseCurrentBlock();
1289 $tbl->setFooter(
"tblfooter", $this->lng->txt(
"previous"), $this->lng->txt(
"next"));
1295 $tbl->setMaxCount(count($entries));
1296 $entries = array_slice($entries,
$_GET[
"offset"],
$_GET[
"limit"]);
1299 if (count($entries) > 0) {
1301 foreach ($entries as $entry) {
1302 if (($entry[
"entry"] ==
".") || ($entry[
"entry"] ==
".." && empty($cur_subdir))) {
1307 if ($entry[
"type"] ==
"dir") {
1308 $this->tpl->setCurrentBlock(
"FileLink");
1309 $this->ctrl->setParameter($this,
"cdir", $cur_subdir);
1310 $this->ctrl->setParameter($this,
"newdir", rawurlencode($entry[
"entry"]));
1311 $this->tpl->setVariable(
"LINK_FILENAME", $this->ctrl->getLinkTarget($this,
"editFiles"));
1312 $this->tpl->setVariable(
"TXT_FILENAME", $entry[
"entry"]);
1313 $this->tpl->parseCurrentBlock();
1315 $this->tpl->setVariable(
"ICON",
"<img src=\"" .
1318 $this->tpl->setCurrentBlock(
"File");
1319 $this->tpl->setVariable(
"TXT_FILENAME2", $entry[
"entry"]);
1320 $this->tpl->parseCurrentBlock();
1323 $this->tpl->setCurrentBlock(
"tbl_content");
1325 $this->tpl->setVariable(
"CSS_ROW", $css_row);
1327 $this->tpl->setVariable(
"TXT_SIZE", $entry[
"size"]);
1328 $this->tpl->setVariable(
"CHECKBOX_ID", $entry[
"entry"]);
1329 $compare = (!empty($cur_subdir))
1330 ? $cur_subdir .
"/" . $entry[
"entry"]
1333 if ($std_item->getLocation() == $compare) {
1334 $purpose[] = $this->lng->txt(
"cont_std_view");
1336 if ($this->
object->hasFullscreenItem()) {
1337 if ($full_item->getLocation() == $compare) {
1338 $purpose[] = $this->lng->txt(
"cont_fullscreen");
1341 $this->tpl->setVariable(
"TXT_PURPOSE", implode($purpose,
", "));
1343 $this->tpl->parseCurrentBlock();
1347 $this->tpl->setCurrentBlock(
"notfound");
1348 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
1349 $this->tpl->setVariable(
"NUM_COLS", 4);
1350 $this->tpl->parseCurrentBlock();
1353 $this->tpl->parseCurrentBlock();
1364 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1366 $cur_dir = (!empty($cur_subdir))
1367 ? $mob_dir .
"/" . $cur_subdir
1370 $new_dir = str_replace(
".",
"",
$_POST[
"new_dir"]);
1371 $new_dir = str_replace(
"/",
"", $new_dir);
1373 if (!empty($new_dir)) {
1376 $this->ctrl->saveParameter($this,
"cdir");
1377 $this->ctrl->redirect($this,
"editFiles");
1386 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1388 $cur_dir = (!empty($cur_subdir))
1389 ? $mob_dir .
"/" . $cur_subdir
1391 if (is_file($_FILES[
"new_file"][
"tmp_name"])) {
1393 $file = $cur_dir .
"/" . $file_name;
1394 ilUtil::moveUploadedFile(
1395 $_FILES[
'new_file'][
'tmp_name'],
1401 include_once(
"./Services/MediaObjects/classes/class.ilMediaSvgSanitizer.php");
1404 $this->ctrl->saveParameter($this,
"cdir");
1405 $this->ctrl->redirect($this,
"editFiles");
1414 $cur_subdir = dirname($a_file);
1416 $cur_dir = (!empty($cur_subdir))
1417 ? $mob_dir .
"/" . $cur_subdir
1419 $file = $cur_dir .
"/" . basename($a_file);
1422 if (!is_file(
$file)) {
1423 $this->
ilias->raiseError($this->lng->txt(
"cont_select_file"), $this->
ilias->error_obj->MESSAGE);
1426 $std_item = $this->
object->getMediaItem(
"Standard");
1427 $std_item->setLocationType(
"LocalFile");
1430 $std_item->setFormat(
$format);
1431 $this->
object->update();
1433 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1443 $cur_subdir = dirname($a_file);
1445 $cur_dir = (!empty($cur_subdir))
1446 ? $mob_dir .
"/" . $cur_subdir
1448 $file = $cur_dir .
"/" . basename($a_file);
1451 if (!is_file(
$file)) {
1452 $this->
ilias->raiseError($this->lng->txt(
"cont_select_file"), $this->
ilias->error_obj->MESSAGE);
1455 if (!$this->
object->hasFullScreenItem()) {
1456 $std_item = $this->
object->getMediaItem(
"Standard");
1460 $full_item->setMobId($std_item->getMobId());
1462 $full_item->setLocationType(
"LocalFile");
1464 $full_item->setPurpose(
"Fullscreen");
1465 $this->
object->addMediaItem($full_item);
1467 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1469 $full_item->setLocationType(
"LocalFile");
1472 $full_item->setFormat(
$format);
1474 $this->
object->update();
1476 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1485 $this->
object->removeMediaItem(
"Fullscreen");
1486 $this->
object->update();
1488 $this->ctrl->redirect($this,
"edit");
1497 if (!$this->
object->hasFullScreenItem()) {
1498 $std_item = $this->
object->getMediaItem(
"Standard");
1500 $full_item->setMobId($std_item->getMobId());
1501 $full_item->setLocation($std_item->getLocation());
1502 $full_item->setLocationType($std_item->getLocationType());
1503 $full_item->setFormat($std_item->getFormat());
1504 $full_item->setWidth($std_item->getWidth());
1505 $full_item->setHeight($std_item->getHeight());
1506 $full_item->setCaption($std_item->getCaption());
1507 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1508 $full_item->setPurpose(
"Fullscreen");
1509 $this->
object->addMediaItem($full_item);
1511 $this->
object->update();
1514 $this->ctrl->redirect($this,
"edit");
1523 if (!isset(
$_POST[
"file"])) {
1524 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->
ilias->error_obj->MESSAGE);
1527 if (count(
$_POST[
"file"]) > 1) {
1528 $this->
ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"), $this->
ilias->error_obj->MESSAGE);
1531 if (
$_POST[
"file"][0] ==
"..") {
1532 $this->
ilias->raiseError($this->lng->txt(
"no_checkbox"), $this->
ilias->error_obj->MESSAGE);
1535 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1537 $cur_dir = (!empty($cur_subdir))
1538 ? $mob_dir .
"/" . $cur_subdir
1542 ? $cur_subdir .
"/" .
$_POST[
"file"][0]
1545 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1546 $std_item = $this->
object->getMediaItem(
"Standard");
1548 if (
$location == $std_item->getLocation()) {
1549 $this->
ilias->raiseError($this->lng->txt(
"cont_cant_del_std"), $this->
ilias->error_obj->MESSAGE);
1552 if ($this->
object->hasFullScreenItem()) {
1553 if (
$location == $full_item->getLocation()) {
1554 $this->
ilias->raiseError($this->lng->txt(
"cont_cant_del_full"), $this->
ilias->error_obj->MESSAGE);
1558 if (@is_dir(
$file)) {
1560 $this->
ilias->raiseError($this->lng->txt(
"cont_std_is_in_dir"), $this->
ilias->error_obj->MESSAGE);
1563 if ($this->
object->hasFullScreenItem()) {
1565 $this->
ilias->raiseError($this->lng->txt(
"cont_full_is_in_dir"), $this->
ilias->error_obj->MESSAGE);
1570 if (@is_file(
$file)) {
1574 if (@is_dir(
$file)) {
1578 $this->ctrl->saveParameter($this,
"cdir");
1579 $this->ctrl->redirect($this,
"editFiles");
1604 $lng->txt(
"cont_current_usages"),
1605 $ilCtrl->getLinkTarget($this,
"showUsages")
1610 $lng->txt(
"cont_all_usages"),
1611 $ilCtrl->getLinkTarget($this,
"showAllUsages")
1615 $ilTabs->activateSubTab(
"all_usages");
1616 $cmd =
"showAllUsages";
1618 $ilTabs->activateSubTab(
"current_usages");
1619 $cmd =
"showUsages";
1622 include_once(
"./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1629 $tpl->setContent($usages_table->getHTML());
1639 $lng = $DIC->language();
1641 $tpl =
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1642 $types =
array(
"Standard",
"Fullscreen");
1643 foreach ($types as
$type) {
1644 if ($type ==
"Fullscreen" && !$a_mob->hasFullScreenItem()) {
1648 $med = $a_mob->getMediaItem($type);
1653 $tpl->setCurrentBlock(
"media_info");
1654 if ($type ==
"Standard") {
1655 $tpl->setVariable(
"TXT_PURPOSE",
$lng->txt(
"cont_std_view"));
1657 $tpl->setVariable(
"TXT_PURPOSE",
$lng->txt(
"cont_fullscreen"));
1659 $tpl->setVariable(
"TXT_TYPE",
$lng->txt(
"cont_" . strtolower($med->getLocationType())));
1660 $tpl->setVariable(
"VAL_LOCATION", $med->getLocation());
1661 if ($med->getLocationType() ==
"LocalFile") {
1663 if (is_file(
$file)) {
1668 $tpl->setVariable(
"VAL_FILE_SIZE",
" ($size " .
$lng->txt(
"bytes") .
")");
1670 $tpl->setVariable(
"TXT_FORMAT",
$lng->txt(
"cont_format"));
1671 $tpl->setVariable(
"VAL_FORMAT", $med->getFormat());
1672 if ($med->getWidth() !=
"" && $med->getHeight() !=
"") {
1673 $tpl->setCurrentBlock(
"size");
1674 $tpl->setVariable(
"TXT_SIZE",
$lng->txt(
"size"));
1675 $tpl->setVariable(
"VAL_SIZE", $med->getWidth() .
"x" . $med->getHeight());
1676 $tpl->parseCurrentBlock();
1680 if ($orig_size = $med->getOriginalSize()) {
1681 if ($orig_size[
"width"] != $med->getWidth() ||
1682 $orig_size[
"height"] != $med->getHeight()) {
1683 $tpl->setCurrentBlock(
"orig_size");
1684 $tpl->setVariable(
"TXT_ORIG_SIZE",
$lng->txt(
"cont_orig_size"));
1685 $tpl->setVariable(
"ORIG_WIDTH", $orig_size[
"width"]);
1686 $tpl->setVariable(
"ORIG_HEIGHT", $orig_size[
"height"]);
1687 $tpl->parseCurrentBlock();
1692 if ($med && strlen($med->getCaption())) {
1693 $tpl->setCurrentBlock(
'additional_info');
1694 $tpl->setVariable(
'ADD_INFO',
$lng->txt(
'cont_caption') .
': ' . $med->getCaption());
1695 $tpl->parseCurrentBlock();
1699 if ($type ==
"Standard") {
1700 include_once
'./Services/MetaData/classes/class.ilMDKeyword.php';
1702 $tpl->setCurrentBlock(
'additional_info');
1703 $tpl->setVariable(
'ADD_INFO',
$lng->txt(
'keywords') .
': ' . implode(
', ', $kws));
1704 $tpl->parseCurrentBlock();
1708 $tpl->setCurrentBlock(
"media_info");
1709 $tpl->parseCurrentBlock();
1727 $this->tpl->clearHeader();
1728 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject") {
1730 $this->tpl->setTitle($this->
object->getTitle());
1734 $this->tpl->setTitle($this->lng->txt(
"cont_create_mob"));
1746 $ilHelp->setScreenIdComponent(
"mob");
1749 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject" 1750 && $this->
object->getId() > 0) {
1752 $this->tabs_gui->addTarget(
1753 "cont_mob_def_prop",
1754 $this->ctrl->getLinkTarget($this,
"edit"),
1759 $st_item = $this->
object->getMediaItem(
"Standard");
1764 $format = $st_item->getFormat();
1765 if (substr(
$format, 0, 5) ==
"image" && !is_int(strpos(
$format,
"svg"))) {
1766 $this->tabs_gui->addTarget(
1767 "cont_def_map_areas",
1768 $this->ctrl->getLinkTargetByClass(
1769 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
1773 "ilimagemapeditorgui" 1779 $this->tabs_gui->addTarget(
1781 $this->ctrl->getLinkTarget($this,
"showUsages"),
1787 $std_item = $this->
object->getMediaItem(
"Standard");
1788 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1790 if ($mset->get(
"file_manager_always") ||
1798 $this->tabs_gui->addTarget(
1800 $this->ctrl->getLinkTargetByClass(
1801 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
1809 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
1811 $mdtab = $mdgui->
getTab(
"ilobjmediaobjectgui");
1813 $this->tabs_gui->addTarget(
1823 if ($this->back_title !=
"") {
1824 $this->tabs_gui->setBackTarget(
1826 $this->ctrl->getParentReturn($this)
1841 include_once(
"./Services/MediaObjects/classes/class.ilFFmpeg.php");
1848 $formats_str = implode(
$formats,
"<br />");
1849 $tpl->setContent($formats_str);
1862 if ($a_tpl == null) {
1866 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1867 iljQueryUtil::initjQUery($a_tpl);
1868 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1870 $a_tpl->addJavascript(
"./Services/COPage/js/ilCOPagePres.js");
1872 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1887 $ilTabs->activateTab(
"cont_mob_def_prop");
1891 $lng->txt(
"mob_general"),
1892 $ilCtrl->getLinkTarget($this,
"edit")
1895 if ($this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/webm" ||
1896 $this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/mp4") {
1899 $lng->txt(
"mob_subtitles"),
1900 $ilCtrl->getLinkTarget($this,
"listSubtitleFiles")
1904 $ilTabs->activateSubTab($a_active);
1924 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this),
true);
1925 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1926 $fi =
new ilFileInputGUI(
$lng->txt(
"mob_subtitle_file") .
" (.srt)",
"subtitle_file");
1928 $ilToolbar->addInputItem($fi,
true);
1931 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1932 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
1937 $ilToolbar->addInputItem(
$si,
true);
1939 $ilToolbar->addFormButton(
$lng->txt(
"upload"),
"uploadSubtitleFile");
1941 $ilToolbar->addSeparator();
1942 $ilToolbar->addFormButton(
$lng->txt(
"mob_upload_multi_srt"),
"uploadMultipleSubtitleFileForm");
1944 include_once(
"./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1964 $ilCtrl->redirect($this,
"listSubtitleFiles");
1976 $lng->loadLanguageModule(
"meta");
1978 if (!is_array(
$_POST[
"srt"]) || count(
$_POST[
"srt"]) == 0) {
1980 $ilCtrl->redirect($this,
"listSubtitleFiles");
1982 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1984 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
1985 $cgui->setHeaderText(
$lng->txt(
"mob_really_delete_srt"));
1986 $cgui->setCancel(
$lng->txt(
"cancel"),
"listSubtitleFiles");
1987 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteSrtFiles");
1990 $cgui->addItem(
"srt[]", $i,
"subtitle_" . $i .
".srt (" .
$lng->txt(
"meta_l_" . $i) .
")");
1993 $tpl->setContent($cgui->getHTML());
2006 if (strlen($i) == 2 && !is_int(strpos($i,
"."))) {
2007 $this->
object->removeAdditionalFile(
"srt/subtitle_" . $i .
".srt");
2011 $ilCtrl->redirect($this,
"listSubtitleFiles");
2031 $ilToolbar->setFormAction(
$ilCtrl->getFormAction($this),
true);
2032 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
2033 $fi =
new ilFileInputGUI(
$lng->txt(
"mob_subtitle_file") .
" (.zip)",
"subtitle_file");
2035 $ilToolbar->addInputItem($fi,
true);
2037 $ilToolbar->addFormButton(
$lng->txt(
"upload"),
"uploadMultipleSubtitleFile");
2047 $this->ctrl->redirect($this,
"showMultiSubtitleConfirmationTable");
2050 $this->ctrl->redirect($this,
"uploadMultipleSubtitleFileForm");
2063 include_once(
"./Services/MediaObjects/classes/class.ilMultiSrtConfirmationTable2GUI.php");
2073 $this->
object->clearMultiSrtDirectory();
2074 $this->ctrl->redirect($this,
"listSubtitleFiles");
2083 $srt_files = $this->
object->getMultiSrtFiles();
2084 if (is_array(
$_POST[
"file"])) {
2085 foreach (
$_POST[
"file"] as $f) {
2086 foreach ($srt_files as $srt_file) {
2087 if ($f == $srt_file[
"filename"]) {
2088 $this->
object->uploadSrtFile($this->
object->getMultiSrtUploadDir() .
"/" . $srt_file[
"filename"], $srt_file[
"lang"],
"rename");
2093 $this->
object->clearMultiSrtDirectory();
2094 $ilCtrl->redirect($this,
"listSubtitleFiles");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents an option in a radio group.
TableGUI class for subtitle list.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static getSupportedFormatsInfo()
Get all supported formats.
setInfo($a_info)
Set Info.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
List srt files from zip file for upload confirmation.
addSubItem($a_item)
Add Subitem.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilObjectGUI Basic methods of all Output classes.
special template class to simplify handling of ITX/PEAR
setAllowedSuffixes($a_suffixes)
Set allowed Suffixes.
This class represents a text property in a property form.
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
setCols($a_cols)
Set Cols.
redirection script todo: (a better solution should control the processing via a xml file) ...
Add a drawing to the header
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
User interface class for map editor.
static secureLink($a_str)
This class represents a non editable value in a property form.
setRows($a_rows)
Set Rows.
Create new PHPExcel object
obj_idprivate
This class represents a text area property in a property form.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static getLocalMaphilightPath()
Get local path of maphilight file.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
File System Explorer GUI class.
static lookupKeywords($a_rbac_id, $a_obj_id, $a_return_ids=false)
Lookup Keywords.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Confirmation screen class.