4 require_once (
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
5 require_once (
"./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
6 require_once (
"classes/class.ilObjectGUI.php");
26 function ilObjMediaObjectGUI($a_data, $a_id = 0, $a_call_by_reference =
false, $a_prepare_output =
false)
33 $this->back_title =
"";
39 $this->header = $a_title;
54 $this->enabledmapareas = $a_enabledmapareas;
74 $this->width_preset = $a_val;
84 return $this->width_preset;
94 $this->height_preset = $a_val;
104 return $this->height_preset;
114 return $this->form_gui;
127 $this->ctrl->returnToParent($this);
138 $next_class = $this->ctrl->getNextClass($this);
139 $cmd = $this->ctrl->getCmd();
143 case 'ilmdeditorgui':
145 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
147 $md_gui =&
new ilMDEditorGUI(0, $this->object->getId(), $this->
object->getType());
148 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
150 $this->ctrl->forwardCommand($md_gui);
153 case "ilimagemapeditorgui":
154 require_once(
"./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
156 $ret = $this->ctrl->forwardCommand($image_map_edit);
157 $tpl->setContent(
$ret);
160 case "ilfilesystemgui":
161 include_once(
"./classes/class.ilFileSystemGUI.php");
164 $fs_gui->setTableId(
"mobfs".$this->object->getId());
165 $fs_gui->labelFile($this->object->getMediaItem(
"Standard")->getLocation(),
166 $this->lng->txt(
"cont_std_view"));
167 if($this->object->hasFullscreenItem())
169 $fs_gui->labelFile($this->object->getMediaItem(
"Fullscreen")->getLocation(),
170 $this->lng->txt(
"cont_fullscreen"));
172 $fs_gui->addCommand($this,
"assignStandardObject", $this->lng->txt(
"cont_assign_std"));
173 $fs_gui->addCommand($this,
"assignFullscreenObject", $this->lng->txt(
"cont_assign_full"));
174 $ret =& $this->ctrl->forwardCommand($fs_gui);
179 if (isset(
$_POST[
"editImagemapForward"]) ||
180 isset(
$_POST[
"editImagemapForward_x"]) ||
181 isset(
$_POST[
"editImagemapForward_y"]))
183 $cmd =
"editImagemapForward";
198 $this->back_title = $a_title;
209 $tpl->setContent($this->form_gui->getHTML());
219 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
221 if ($a_mode ==
"edit")
223 $std_item = $this->
object->getMediaItem(
"Standard");
231 $title->setMaxLength(120);
232 $this->form_gui->addItem(
$title);
239 $radio_prop->addOption($op1);
242 $ref->
setInfo($lng->txt(
"cont_ref_helptext"));
243 $op2->addSubItem($ref);
244 $radio_prop->addOption($op2);
245 $radio_prop->setValue(
"File");
246 $this->form_gui->addItem($radio_prop);
249 if ($a_mode ==
"edit")
252 $format->
setValue($std_item->getFormat());
253 $this->form_gui->addItem($format);
258 if ($a_mode ==
"edit")
260 if ($orig_size = $std_item->getOriginalSize())
262 $add_str =
" (".$orig_size[
"width"].
" x ".$orig_size[
"height"].
")";
264 $op1 =
new ilRadioOption($lng->txt(
"cont_resource_size").$add_str,
"original");
265 $op2 =
new ilRadioOption($lng->txt(
"cont_custom_size"),
"selected");
269 $op1 =
new ilRadioOption($lng->txt(
"cont_orig_size"),
"original");
270 $op2 =
new ilRadioOption($lng->txt(
"cont_adjust_size"),
"selected");
272 $radio_size->addOption($op1);
275 include_once(
"./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
277 " / ".$lng->txt(
"cont_height"),
"standard_width_height");
279 $op2->addSubItem($width_height);
282 if ($a_mode ==
"edit")
284 $std_item = $this->
object->getMediaItem(
"Standard");
285 if (is_int(strpos($std_item->getFormat(),
"image"))
286 && $std_item->getLocationType() ==
"LocalFile")
289 ,
"standard_resize");
294 $radio_size->setValue(
"original");
297 $radio_size->setValue(
"selected");
301 $radio_size->addOption($op2);
302 $this->form_gui->addItem($radio_size);
307 $caption->setRows(2);
308 $this->form_gui->addItem($caption);
316 if ($a_mode ==
"edit" && is_int(strpos($std_item->getFormat(),
"image")))
321 $ta->setInfo($lng->txt(
"text_repr_info"));
322 $this->form_gui->addItem($ta);
326 if ($a_mode ==
"edit" &&
330 $std_item->getFormat()))
333 $this->form_gui->addItem($auto);
340 $this->form_gui->addItem($par);
344 if ($a_mode ==
"edit")
346 $full_item = $this->
object->getMediaItem(
"Fullscreen");
351 $fs_sec->setTitle($lng->txt(
"cont_fullscreen"));
352 $this->form_gui->addItem($fs_sec);
356 $radio_prop2->addOption($op1);
357 $op4 =
new ilRadioOption($lng->txt(
"cont_use_same_resource_as_above"),
"Standard");
358 $radio_prop2->addOption($op4);
363 $op2->addSubItem($up);
364 $radio_prop2->addOption($op2);
367 $ref->
setInfo($lng->txt(
"cont_ref_helptext"));
368 $op3->addSubItem($ref);
369 $radio_prop2->addOption($op3);
370 $radio_prop2->setValue(
"None");
371 $this->form_gui->addItem($radio_prop2);
374 if ($a_mode ==
"edit")
376 if ($this->object->hasFullscreenItem())
379 $format->
setValue($full_item->getFormat());
380 $this->form_gui->addItem($format);
386 if ($a_mode ==
"edit")
389 if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize()))
391 $add_str =
" (".$orig_size[
"width"].
" x ".$orig_size[
"height"].
")";
393 $op1 =
new ilRadioOption($lng->txt(
"cont_resource_size").$add_str,
"original");
394 $op2 =
new ilRadioOption($lng->txt(
"cont_custom_size"),
"selected");
398 $op1 =
new ilRadioOption($lng->txt(
"cont_orig_size"),
"original");
399 $op2 =
new ilRadioOption($lng->txt(
"cont_adjust_size"),
"selected");
401 $radio_size->addOption($op1);
405 " / ".$lng->txt(
"cont_height"),
"full_width_height");
407 $op2->addSubItem($width_height);
410 if ($a_mode ==
"edit")
412 $full_item = $this->
object->getMediaItem(
"Fullscreen");
413 if ($this->object->hasFullscreenItem() &&
414 is_int(strpos($full_item->getFormat(),
"image")) &&
415 $full_item->getLocationType() ==
"LocalFile")
423 $radio_size->setValue(
"original");
424 $radio_size->addOption($op2);
425 $this->form_gui->addItem($radio_size);
430 $caption->setRows(2);
431 $this->form_gui->addItem($caption);
439 if ($a_mode ==
"edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(),
"image")))
444 $ta->setInfo($lng->txt(
"text_repr_info"));
445 $this->form_gui->addItem($ta);
450 if ($a_mode ==
"edit" && $this->object->hasFullscreenItem() &&
454 $full_item->getFormat()))
457 $this->form_gui->addItem($auto);
464 $this->form_gui->addItem($par);
468 $this->form_gui->setTitle($lng->txt(
"cont_insert_mob"));
469 if ($a_mode ==
"edit")
471 $this->form_gui->addCommandButton(
"saveProperties", $lng->txt(
"save"));
475 $this->form_gui->addCommandButton(
"save", $lng->txt(
"save"));
476 $this->form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
478 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
490 $values[
"standard_title"] = $this->
object->getTitle();
492 $std_item = $this->
object->getMediaItem(
"Standard");
493 if ($std_item->getLocationType() ==
"LocalFile")
495 $values[
"standard_type"] =
"File";
496 $values[
"standard_file"] = $std_item->getLocation();
500 $values[
"standard_type"] =
"Reference";
501 $values[
"standard_reference"] = $std_item->getLocation();
503 $values[
"standard_format"] = $std_item->getFormat();
504 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
505 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
506 $values[
"standard_width_height"][
"constr_prop"] =
true;
508 $values[
"standard_size"] =
"selected";
510 if ($orig_size = $std_item->getOriginalSize())
512 if ($orig_size[
"width"] == $std_item->getWidth() &&
513 $orig_size[
"height"] == $std_item->getHeight())
515 $values[
"standard_size"] =
"original";
518 $values[
"standard_caption"] = $std_item->getCaption();
519 $values[
"text_representation"] = $std_item->getTextRepresentation();
521 $std_item->getFormat()))
523 $par = $std_item->getParameters();
524 if ($par[
"autostart"])
526 $values[
"standard_autostart"] =
true;
531 $values[
"standard_parameters"] = $std_item->getParameterString();
534 $values[
"full_type"] =
"None";
535 $values[
"full_size"] =
"original";
536 if ($this->object->hasFullScreenItem())
538 $full_item = $this->
object->getMediaItem(
"Fullscreen");
539 if ($full_item->getLocationType() ==
"LocalFile")
541 $values[
"full_type"] =
"File";
542 $values[
"full_file"] = $full_item->getLocation();
546 $values[
"full_type"] =
"Reference";
547 $values[
"full_reference"] = $full_item->getLocation();
549 $values[
"full_format"] = $full_item->getFormat();
550 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
551 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
552 $values[
"full_width_height"][
"constr_prop"] =
true;
554 $values[
"full_size"] =
"selected";
556 if ($orig_size = $full_item->getOriginalSize())
558 if ($orig_size[
"width"] == $full_item->getWidth() &&
559 $orig_size[
"height"] == $full_item->getHeight())
561 $values[
"full_size"] =
"original";
564 $values[
"full_caption"] = $full_item->getCaption();
566 $full_item->getFormat()))
568 $par = $full_item->getParameters();
569 if ($par[
"autostart"])
571 $values[
"full_autostart"] =
true;
576 $values[
"full_parameters"] = $full_item->getParameterString();
578 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
581 $this->form_gui->setValuesByArray($values);
592 if ($this->form_gui->checkInput())
601 $this->form_gui->setValuesByPost();
602 $tpl->setContent($this->form_gui->getHTML());
615 if (!$this->form_gui->checkInput())
617 $this->form_gui->setValuesByPost();
630 if (trim(
$_POST[
"standard_title"]) !=
"")
636 if (
$_POST[
"standard_type"] ==
"File")
638 $title = $_FILES[
'standard_file'][
'name'];
647 $a_mob->setDescription(
"");
652 $a_mob->createDirectory();
656 $a_mob->addMediaItem($media_item);
657 $media_item->setPurpose(
"Standard");
659 if (
$_POST[
"standard_type"] ==
"File")
661 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
663 $_FILES[
'standard_file'][
'name'],
$file);
667 $location = $_FILES[
'standard_file'][
'name'];
670 if (
$_POST[
"standard_size"] !=
"original" &&
671 is_int(strpos($format,
"image")))
674 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
678 $media_item->setFormat($format);
680 $media_item->setLocationType(
"LocalFile");
685 $media_item->setFormat($format);
687 $media_item->setLocationType(
"Reference");
689 $a_mob->setDescription($format);
693 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $media_item->getLocation(),
694 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
695 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
696 $media_item->setWidth($wh[
"width"]);
697 $media_item->setHeight($wh[
"height"]);
698 if ($wh[
"info"] !=
"")
703 if ($_POST[
"standard_caption"] !=
"")
709 $media_item->setHAlign(
"Left");
712 if ($_POST[
"full_type"] !=
"None")
715 $a_mob->addMediaItem($media_item2);
716 $media_item2->setPurpose(
"Fullscreen");
719 if ($_POST[
"full_type"] ==
"File")
722 if ($_FILES[
'full_file'][
'name'] !=
"")
724 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
726 $_FILES[
'full_file'][
'name'],
$file);
728 $location = $_FILES[
'full_file'][
'name'];
731 else if ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File")
733 $location = $_FILES[
'standard_file'][
'name'];
737 if ($_POST[
"full_type"] ==
"File" ||
738 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File"))
740 if (($_POST[
"full_size"] !=
"original" &&
741 is_int(strpos($format,
"image")))
745 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"constr_prop"]);
748 $media_item2->setFormat($format);
750 $media_item2->setLocationType(
"LocalFile");
754 if ($_POST[
"full_type"] ==
"Reference")
757 if ($_POST[
"full_reference"] !=
"")
764 if ($_POST[
"full_type"] ==
"Reference" ||
765 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"Reference"))
767 $media_item2->setFormat($format);
769 $media_item2->setLocationType(
"Reference");
775 $type, $mob_dir.
"/".
$location, $media_item2->getLocation(),
776 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
777 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
779 $media_item2->setWidth($wh[
"width"]);
780 $media_item2->setHeight($wh[
"height"]);
782 if ($_POST[
"full_caption"] !=
"")
799 $this->ctrl->returnToParent($this);
811 $tpl->setContent($this->form_gui->getHTML());
824 $std_item =& $this->
object->getMediaItem(
"Standard");
825 if ($std_item->getLocationType() ==
"LocalFile" &&
826 is_int(strpos($std_item->getFormat(),
"image"))
829 $file = $mob_dir.
"/".$std_item->getLocation();
831 $std_item->getHeight());
837 if($this->object->hasFullScreenItem())
839 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
840 if ($full_item->getLocationType() ==
"LocalFile" &&
841 is_int(strpos($full_item->getFormat(),
"image"))
844 $file = $mob_dir.
"/".$full_item->getLocation();
846 $full_item->getHeight());
848 $full_item->update();
852 $this->ctrl->redirect($this,
"edit");
861 $std_item = $this->
object->getMediaItem(
"Standard");
864 if ($std_item->getLocationType() ==
"LocalFile")
866 $file = $mob_dir.
"/".$std_item->getLocation();
868 $std_item->setWidth(
$size[0]);
869 $std_item->setHeight(
$size[1]);
870 $this->
object->update();
872 $this->ctrl->redirect($this,
"edit");
881 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
884 if ($full_item->getLocationType() ==
"LocalFile")
886 $file = $mob_dir.
"/".$full_item->getLocation();
888 $full_item->setWidth(
$size[0]);
889 $full_item->setHeight(
$size[1]);
890 $this->
object->update();
892 $this->ctrl->redirect($this,
"edit");
903 if ($this->form_gui->checkInput())
906 $this->
object->setTitle(
$title);
908 $std_item = $this->
object->getMediaItem(
"Standard");
910 $format = $std_item->getFormat();
911 if (
$_POST[
"standard_type"] ==
"Reference")
914 $std_item->setFormat($format);
916 $std_item->setLocationType(
"Reference");
919 if (
$_POST[
"standard_type"] ==
"File")
922 if ($_FILES[
'standard_file'][
'name'] !=
"")
924 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
926 $_FILES[
'standard_file'][
'name'],
$file);
930 $location = $_FILES[
'standard_file'][
'name'];
934 else if (
$_POST[
"standard_resize"])
943 if (
$_POST[
"standard_size"] !=
"original" &&
944 is_int(strpos($format,
"image")))
947 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
949 $std_item->setFormat($format);
953 $std_item->setLocationType(
"LocalFile");
955 $this->
object->setDescription($format);
959 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $std_item->getLocation(),
960 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
961 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
962 if ($wh[
"info"] !=
"")
967 $std_item->setWidth($wh[
"width"]);
968 $std_item->setHeight($wh[
"height"]);
980 $std_item->getFormat()))
982 if ($_POST[
"standard_autostart"])
984 $std_item->setParameters(
'autostart="true"');
988 $std_item->setParameters(
"");
998 if ($_POST[
"full_type"] ==
"None")
1000 if ($this->object->hasFullscreenItem())
1002 $this->
object->removeMediaItem(
"Fullscreen");
1007 if ($this->object->hasFullscreenItem())
1009 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1014 $this->
object->addMediaItem($full_item);
1015 $full_item->setPurpose(
"Fullscreen");
1018 $format = $full_item->getFormat();
1019 if ($_POST[
"full_type"] ==
"Reference")
1022 $full_item->setFormat($format);
1023 $full_item->setLocationType(
"Reference");
1025 $type =
"Reference";
1028 if ($_POST[
"full_type"] ==
"File")
1031 if ($_FILES[
'full_file'][
'name'] !=
"")
1033 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
1035 $_FILES[
'full_file'][
'name'],
$file);
1038 $location = $_FILES[
'full_file'][
'name'];
1042 else if ($_POST[
"full_resize"])
1051 if ($_POST[
"full_size"] !=
"original" &&
1052 is_int(strpos($format,
"image")))
1055 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1057 $full_item->setFormat($format);
1061 $full_item->setLocationType(
"LocalFile");
1064 if ($_POST[
"full_type"] ==
"Standard")
1066 $format = $std_item->getFormat();
1068 $full_item->setLocationType($std_item->getLocationType());
1069 $full_item->setFormat($format);
1071 $type = $std_item->getLocationType();
1072 if ($type ==
"LocalFile")
1078 if ($_POST[
"full_size"] !=
"original" &&
1079 is_int(strpos($format,
"image")) &&
1080 $full_item->getLocationType() ==
"LocalFile")
1084 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1090 $type, $mob_dir.
"/".
$location, $full_item->getLocation(),
1091 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
1092 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
1093 if ($wh[
"info"] !=
"")
1098 $full_item->setWidth($wh[
"width"]);
1099 $full_item->setHeight($wh[
"height"]);
1112 $std_item->getFormat()))
1114 if ($_POST[
"full_autostart"])
1116 $full_item->setParameters(
'autostart="true"');
1120 $full_item->setParameters(
"");
1132 $this->
object->update();
1134 $this->ctrl->redirect($this,
"edit");
1138 $this->form_gui->setValuesByPost();
1139 $tpl->setContent($this->form_gui->getHTML());
1150 $std_item =& $this->
object->getMediaItem(
"Standard");
1151 if($this->object->hasFullscreenItem())
1153 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1157 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
1161 $cur_subdir =
$_GET[
"cdir"];
1162 if(
$_GET[
"newdir"] ==
"..")
1164 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir,
"/"));
1168 if (!empty(
$_GET[
"newdir"]))
1170 if (!empty($cur_subdir))
1172 $cur_subdir = $cur_subdir.
"/".
$_GET[
"newdir"];
1176 $cur_subdir =
$_GET[
"newdir"];
1181 $cur_subdir = str_replace(
".",
"", $cur_subdir);
1183 $cur_dir = (!empty($cur_subdir))
1184 ? $mob_dir.
"/".$cur_subdir
1188 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_files.html",
"Services/MediaObjects");
1190 $this->ctrl->setParameter($this,
"cdir", urlencode($cur_subdir));
1191 $this->tpl->setVariable(
"FORMACTION1", $this->ctrl->getFormAction($this));
1194 $this->tpl->setVariable(
"TXT_NEW_DIRECTORY", $this->lng->txt(
"cont_new_dir"));
1195 $this->tpl->setVariable(
"TXT_NEW_FILE", $this->lng->txt(
"cont_new_file"));
1196 $this->tpl->setVariable(
"CMD_NEW_DIR",
"createDirectory");
1197 $this->tpl->setVariable(
"CMD_NEW_FILE",
"uploadFile");
1198 $this->tpl->setVariable(
"BTN_NEW_DIR", $this->lng->txt(
"create"));
1199 $this->tpl->setVariable(
"BTN_NEW_FILE", $this->lng->txt(
"upload"));
1202 $this->tpl->addBlockfile(
"FILE_TABLE",
"files",
"tpl.table.html");
1205 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.mob_file_row.html",
"Services/MediaObjects");
1209 $obj_str = ($this->call_by_reference) ?
"" :
"&obj_id=".$this->obj_id;
1210 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1212 $tbl->setTitle($this->lng->txt(
"cont_files").
" ".$cur_subdir);
1215 $tbl->setHeaderNames(array(
"",
"", $this->lng->txt(
"cont_dir_file"),
1216 $this->lng->txt(
"cont_size"), $this->lng->txt(
"cont_purpose")));
1218 $cols = array(
"",
"",
"dir_file",
"size",
"purpose");
1219 $header_params = array(
"ref_id" =>
$_GET[
"ref_id"],
"obj_id" =>
$_GET[
"obj_id"],
1220 "cmd" =>
"editFiles",
"hier_id" =>
$_GET[
"hier_id"],
"item_id" =>
$_GET[
"item_id"]);
1221 $tbl->setHeaderVars($cols, $header_params);
1222 $tbl->setColumnWidth(array(
"1%",
"1%",
"33%",
"33%",
"32%"));
1225 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
1226 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
1227 $tbl->setLimit(
$_GET[
"limit"]);
1228 $tbl->setOffset(
$_GET[
"offset"]);
1229 $tbl->setMaxCount($this->maxcount);
1232 $this->tpl->setVariable(
"COLUMN_COUNTS", 5);
1236 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1237 $this->tpl->setVariable(
"BTN_NAME",
"deleteFile");
1238 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
1239 $this->tpl->parseCurrentBlock();
1241 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1242 $this->tpl->setVariable(
"BTN_NAME",
"assignStandard");
1243 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_std"));
1244 $this->tpl->parseCurrentBlock();
1246 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1247 $this->tpl->setVariable(
"BTN_NAME",
"assignFullscreen");
1248 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_full"));
1249 $this->tpl->parseCurrentBlock();
1252 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1258 $tbl->setMaxCount(count($entries));
1259 $entries = array_slice($entries,
$_GET[
"offset"],
$_GET[
"limit"]);
1262 if(count($entries) > 0)
1265 foreach($entries as $entry)
1267 if(($entry[
"entry"] ==
".") || ($entry[
"entry"] ==
".." && empty($cur_subdir)))
1273 if($entry[
"type"] ==
"dir")
1275 $this->tpl->setCurrentBlock(
"FileLink");
1276 $this->ctrl->setParameter($this,
"cdir", $cur_subdir);
1277 $this->ctrl->setParameter($this,
"newdir", rawurlencode($entry[
"entry"]));
1278 $this->tpl->setVariable(
"LINK_FILENAME", $this->ctrl->getLinkTarget($this,
"editFiles"));
1279 $this->tpl->setVariable(
"TXT_FILENAME", $entry[
"entry"]);
1280 $this->tpl->parseCurrentBlock();
1282 $this->tpl->setVariable(
"ICON",
"<img src=\"".
1287 $this->tpl->setCurrentBlock(
"File");
1288 $this->tpl->setVariable(
"TXT_FILENAME2", $entry[
"entry"]);
1289 $this->tpl->parseCurrentBlock();
1292 $this->tpl->setCurrentBlock(
"tbl_content");
1294 $this->tpl->setVariable(
"CSS_ROW", $css_row);
1296 $this->tpl->setVariable(
"TXT_SIZE", $entry[
"size"]);
1297 $this->tpl->setVariable(
"CHECKBOX_ID", $entry[
"entry"]);
1298 $compare = (!empty($cur_subdir))
1299 ? $cur_subdir.
"/".$entry[
"entry"]
1302 if ($std_item->getLocation() == $compare)
1304 $purpose[] = $this->lng->txt(
"cont_std_view");
1306 if($this->object->hasFullscreenItem())
1308 if ($full_item->getLocation() == $compare)
1310 $purpose[] = $this->lng->txt(
"cont_fullscreen");
1313 $this->tpl->setVariable(
"TXT_PURPOSE", implode($purpose,
", "));
1315 $this->tpl->parseCurrentBlock();
1320 $this->tpl->setCurrentBlock(
"notfound");
1321 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
1322 $this->tpl->setVariable(
"NUM_COLS", 4);
1323 $this->tpl->parseCurrentBlock();
1326 $this->tpl->parseCurrentBlock();
1337 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1339 $cur_dir = (!empty($cur_subdir))
1340 ? $mob_dir.
"/".$cur_subdir
1343 $new_dir = str_replace(
".",
"",
$_POST[
"new_dir"]);
1344 $new_dir = str_replace(
"/",
"", $new_dir);
1346 if (!empty($new_dir))
1350 $this->ctrl->saveParameter($this,
"cdir");
1351 $this->ctrl->redirect($this,
"editFiles");
1360 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1362 $cur_dir = (!empty($cur_subdir))
1363 ? $mob_dir.
"/".$cur_subdir
1365 if (is_file($_FILES[
"new_file"][
"tmp_name"]))
1369 $file = $cur_dir.
"/".$_FILES[
"new_file"][
"name"];
1371 $_FILES[
'new_file'][
'name'],
$file);
1375 $this->ctrl->saveParameter($this,
"cdir");
1376 $this->ctrl->redirect($this,
"editFiles");
1384 if (!isset(
$_POST[
"file"]))
1386 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1389 if (count(
$_POST[
"file"]) > 1)
1391 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1395 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1397 $cur_dir = (!empty($cur_subdir))
1398 ? $mob_dir.
"/".$cur_subdir
1402 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1407 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1410 $std_item =& $this->
object->getMediaItem(
"Standard");
1411 $std_item->setLocationType(
"LocalFile");
1414 $std_item->setFormat($format);
1415 $this->
object->update();
1417 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1426 if (!isset(
$_POST[
"file"]))
1428 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1431 if (count(
$_POST[
"file"]) > 1)
1433 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1437 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1439 $cur_dir = (!empty($cur_subdir))
1440 ? $mob_dir.
"/".$cur_subdir
1444 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1449 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1452 if(!$this->object->hasFullScreenItem())
1454 $std_item =& $this->
object->getMediaItem(
"Standard");
1458 $full_item->setMobId($std_item->getMobId());
1460 $full_item->setLocationType(
"LocalFile");
1462 $full_item->setPurpose(
"Fullscreen");
1463 $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())
1499 $std_item =& $this->
object->getMediaItem(
"Standard");
1501 $full_item->setMobId($std_item->getMobId());
1502 $full_item->setLocation($std_item->getLocation());
1503 $full_item->setLocationType($std_item->getLocationType());
1504 $full_item->setFormat($std_item->getFormat());
1505 $full_item->setWidth($std_item->getWidth());
1506 $full_item->setHeight($std_item->getHeight());
1507 $full_item->setCaption($std_item->getCaption());
1508 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1509 $full_item->setPurpose(
"Fullscreen");
1510 $this->
object->addMediaItem($full_item);
1512 $this->
object->update();
1515 $this->ctrl->redirect($this,
"edit");
1524 if (!isset(
$_POST[
"file"]))
1526 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1529 if (count(
$_POST[
"file"]) > 1)
1531 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1534 if (
$_POST[
"file"][0] ==
"..")
1536 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1539 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1541 $cur_dir = (!empty($cur_subdir))
1542 ? $mob_dir.
"/".$cur_subdir
1546 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1549 $full_item =& $this->object->getMediaItem(
"Fullscreen");
1550 $std_item =& $this->
object->getMediaItem(
"Standard");
1552 if (
$location == $std_item->getLocation())
1554 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
1557 if($this->object->hasFullScreenItem())
1559 if (
$location == $full_item->getLocation())
1561 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
1569 $this->ilias->raiseError($this->lng->txt(
"cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1572 if($this->object->hasFullScreenItem())
1576 $this->ilias->raiseError($this->lng->txt(
"cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1581 if (@is_file(
$file))
1591 $this->ctrl->saveParameter($this,
"cdir");
1592 $this->ctrl->redirect($this,
"editFiles");
1611 $ilTabs->addSubTab(
"current_usages", $lng->txt(
"cont_current_usages"),
1612 $ilCtrl->getLinkTarget($this,
"showUsages"));
1614 $ilTabs->addSubTab(
"all_usages", $lng->txt(
"cont_all_usages"),
1615 $ilCtrl->getLinkTarget($this,
"showAllUsages"));
1619 $ilTabs->activateSubTab(
"all_usages");
1620 $cmd =
"showAllUsages";
1624 $ilTabs->activateSubTab(
"current_usages");
1625 $cmd =
"showUsages";
1628 include_once(
"./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1630 $this->
object, $a_all);
1631 $tpl->setContent($usages_table->getHTML());
1641 $tpl =&
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1642 $types = array(
"Standard",
"Fullscreen");
1643 foreach ($types as $type)
1645 if($type ==
"Fullscreen" && !$a_mob->hasFullScreenItem())
1650 $med =& $a_mob->getMediaItem($type);
1651 $tpl->setCurrentBlock(
"media_info");
1652 if ($type ==
"Standard")
1654 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_std_view"));
1658 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_fullscreen"));
1660 $tpl->setVariable(
"TXT_TYPE", $lng->txt(
"cont_".strtolower($med->getLocationType())));
1661 $tpl->setVariable(
"VAL_LOCATION", $med->getLocation());
1662 if ($med->getLocationType() ==
"LocalFile")
1673 $tpl->setVariable(
"VAL_FILE_SIZE",
" ($size ".$lng->txt(
"bytes").
")");
1675 $tpl->setVariable(
"TXT_FORMAT", $lng->txt(
"cont_format"));
1676 $tpl->setVariable(
"VAL_FORMAT", $med->getFormat());
1677 if ($med->getWidth() !=
"" && $med->getHeight() !=
"")
1679 $tpl->setCurrentBlock(
"size");
1680 $tpl->setVariable(
"TXT_SIZE", $lng->txt(
"size"));
1681 $tpl->setVariable(
"VAL_SIZE", $med->getWidth().
"x".$med->getHeight());
1682 $tpl->parseCurrentBlock();
1686 if ($orig_size = $med->getOriginalSize())
1688 if ($orig_size[
"width"] != $med->getWidth() ||
1689 $orig_size[
"height"] != $med->getHeight())
1691 $tpl->setCurrentBlock(
"orig_size");
1692 $tpl->setVariable(
"TXT_ORIG_SIZE", $lng->txt(
"cont_orig_size"));
1693 $tpl->setVariable(
"ORIG_WIDTH", $orig_size[
"width"]);
1694 $tpl->setVariable(
"ORIG_HEIGHT", $orig_size[
"height"]);
1695 $tpl->parseCurrentBlock();
1698 $tpl->setCurrentBlock(
"media_info");
1699 $tpl->parseCurrentBlock();
1714 $this->
getTabs($this->tabs_gui);
1717 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject")
1720 $this->tpl->setTitle($this->object->getTitle());
1726 $this->tpl->setTitle($this->lng->txt(
"cont_create_mob"));
1739 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject"
1740 && $this->object->getId() > 0)
1743 $ilTabs->addTarget(
"cont_mob_def_prop",
1744 $this->ctrl->getLinkTarget($this,
"edit"),
"edit",
1748 $st_item =& $this->
object->getMediaItem(
"Standard");
1751 $format = $st_item->getFormat();
1752 if (substr($format, 0, 5) ==
"image")
1754 $ilTabs->addTarget(
"cont_def_map_areas",
1755 $this->ctrl->getLinkTargetByClass(
1756 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
"editMapAreas"),
"editMapAreas",
1757 "ilimagemapeditorgui");
1762 $ilTabs->addTarget(
"cont_mob_usages",
1763 $this->ctrl->getLinkTarget($this,
"showUsages"),
"showUsages",
1767 $std_item = $this->
object->getMediaItem(
"Standard");
1768 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1770 if ($mset->get(
"file_manager_always") ||
1779 $ilTabs->addTarget(
"cont_files",
1780 $this->ctrl->getLinkTargetByClass(
1781 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
"listFiles"),
"",
1785 $ilTabs->addTarget(
"meta_data",
1786 $this->ctrl->getLinkTargetByClass(
1787 array(
"ilobjmediaobjectgui",
"ilmdeditorgui"),
'listSection'),
1788 "",
"ilmdeditorgui");
1793 if ($this->back_title !=
"")
1795 $tabs_gui->setBackTarget($this->back_title,
1796 $this->ctrl->getParentReturn($this));