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);
238 $radio_prop->addOption($op1);
241 $ref->
setInfo($lng->txt(
"cont_ref_helptext"));
242 $op2->addSubItem($ref);
243 $radio_prop->addOption($op2);
244 $radio_prop->setValue(
"File");
245 $this->form_gui->addItem($radio_prop);
248 if ($a_mode ==
"edit")
251 $format->
setValue($std_item->getFormat());
252 $this->form_gui->addItem($format);
257 if ($a_mode ==
"edit")
259 if ($orig_size = $std_item->getOriginalSize())
261 $add_str =
" (".$orig_size[
"width"].
" x ".$orig_size[
"height"].
")";
263 $op1 =
new ilRadioOption($lng->txt(
"cont_resource_size").$add_str,
"original");
264 $op2 =
new ilRadioOption($lng->txt(
"cont_custom_size"),
"selected");
268 $op1 =
new ilRadioOption($lng->txt(
"cont_orig_size"),
"original");
269 $op2 =
new ilRadioOption($lng->txt(
"cont_adjust_size"),
"selected");
271 $radio_size->addOption($op1);
274 include_once(
"./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
276 " / ".$lng->txt(
"cont_height"),
"standard_width_height");
278 $op2->addSubItem($width_height);
281 if ($a_mode ==
"edit")
283 $std_item = $this->
object->getMediaItem(
"Standard");
284 if (is_int(strpos($std_item->getFormat(),
"image"))
285 && $std_item->getLocationType() ==
"LocalFile")
288 ,
"standard_resize");
293 $radio_size->setValue(
"original");
296 $radio_size->setValue(
"selected");
300 $radio_size->addOption($op2);
301 $this->form_gui->addItem($radio_size);
304 $caption =
new ilTextInputGUI($lng->txt(
"cont_caption"),
"standard_caption");
306 $caption->setMaxLength(200);
307 $this->form_gui->addItem($caption);
310 if ($a_mode ==
"edit" && is_int(strpos($std_item->getFormat(),
"image")))
315 $ta->setInfo($lng->txt(
"text_repr_info"));
316 $this->form_gui->addItem($ta);
320 if ($a_mode ==
"edit" &&
324 $std_item->getFormat()))
327 $this->form_gui->addItem($auto);
334 $this->form_gui->addItem($par);
338 if ($a_mode ==
"edit")
340 $full_item = $this->
object->getMediaItem(
"Fullscreen");
345 $fs_sec->setTitle($lng->txt(
"cont_fullscreen"));
346 $this->form_gui->addItem($fs_sec);
350 $radio_prop2->addOption($op1);
351 $op4 =
new ilRadioOption($lng->txt(
"cont_use_same_resource_as_above"),
"Standard");
352 $radio_prop2->addOption($op4);
356 $op2->addSubItem($up);
357 $radio_prop2->addOption($op2);
360 $ref->
setInfo($lng->txt(
"cont_ref_helptext"));
361 $op3->addSubItem($ref);
362 $radio_prop2->addOption($op3);
363 $radio_prop2->setValue(
"None");
364 $this->form_gui->addItem($radio_prop2);
367 if ($a_mode ==
"edit")
369 if ($this->object->hasFullscreenItem())
372 $format->
setValue($full_item->getFormat());
373 $this->form_gui->addItem($format);
379 if ($a_mode ==
"edit")
382 if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize()))
384 $add_str =
" (".$orig_size[
"width"].
" x ".$orig_size[
"height"].
")";
386 $op1 =
new ilRadioOption($lng->txt(
"cont_resource_size").$add_str,
"original");
387 $op2 =
new ilRadioOption($lng->txt(
"cont_custom_size"),
"selected");
391 $op1 =
new ilRadioOption($lng->txt(
"cont_orig_size"),
"original");
392 $op2 =
new ilRadioOption($lng->txt(
"cont_adjust_size"),
"selected");
394 $radio_size->addOption($op1);
398 " / ".$lng->txt(
"cont_height"),
"full_width_height");
400 $op2->addSubItem($width_height);
403 if ($a_mode ==
"edit")
405 $full_item = $this->
object->getMediaItem(
"Fullscreen");
406 if ($this->object->hasFullscreenItem() &&
407 is_int(strpos($full_item->getFormat(),
"image")) &&
408 $full_item->getLocationType() ==
"LocalFile")
416 $radio_size->setValue(
"original");
417 $radio_size->addOption($op2);
418 $this->form_gui->addItem($radio_size);
421 $caption =
new ilTextInputGUI($lng->txt(
"cont_caption"),
"full_caption");
423 $caption->setMaxLength(200);
424 $this->form_gui->addItem($caption);
427 if ($a_mode ==
"edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(),
"image")))
432 $ta->setInfo($lng->txt(
"text_repr_info"));
433 $this->form_gui->addItem($ta);
438 if ($a_mode ==
"edit" && $this->object->hasFullscreenItem() &&
442 $full_item->getFormat()))
445 $this->form_gui->addItem($auto);
452 $this->form_gui->addItem($par);
456 $this->form_gui->setTitle($lng->txt(
"cont_insert_mob"));
457 if ($a_mode ==
"edit")
459 $this->form_gui->addCommandButton(
"saveProperties", $lng->txt(
"save"));
463 $this->form_gui->addCommandButton(
"save", $lng->txt(
"save"));
464 $this->form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
466 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
478 $values[
"standard_title"] = $this->
object->getTitle();
480 $std_item = $this->
object->getMediaItem(
"Standard");
481 if ($std_item->getLocationType() ==
"LocalFile")
483 $values[
"standard_type"] =
"File";
484 $values[
"standard_file"] = $std_item->getLocation();
488 $values[
"standard_type"] =
"Reference";
489 $values[
"standard_reference"] = $std_item->getLocation();
491 $values[
"standard_format"] = $std_item->getFormat();
492 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
493 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
494 $values[
"standard_width_height"][
"constr_prop"] =
true;
496 $values[
"standard_size"] =
"selected";
498 if ($orig_size = $std_item->getOriginalSize())
500 if ($orig_size[
"width"] == $std_item->getWidth() &&
501 $orig_size[
"height"] == $std_item->getHeight())
503 $values[
"standard_size"] =
"original";
506 $values[
"standard_caption"] = $std_item->getCaption();
507 $values[
"text_representation"] = $std_item->getTextRepresentation();
509 $std_item->getFormat()))
511 $par = $std_item->getParameters();
512 if ($par[
"autostart"])
514 $values[
"standard_autostart"] =
true;
519 $values[
"standard_parameters"] = $std_item->getParameterString();
522 $values[
"full_type"] =
"None";
523 $values[
"full_size"] =
"original";
524 if ($this->object->hasFullScreenItem())
526 $full_item = $this->
object->getMediaItem(
"Fullscreen");
527 if ($full_item->getLocationType() ==
"LocalFile")
529 $values[
"full_type"] =
"File";
530 $values[
"full_file"] = $full_item->getLocation();
534 $values[
"full_type"] =
"Reference";
535 $values[
"full_reference"] = $full_item->getLocation();
537 $values[
"full_format"] = $full_item->getFormat();
538 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
539 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
540 $values[
"full_width_height"][
"constr_prop"] =
true;
542 $values[
"full_size"] =
"selected";
544 if ($orig_size = $full_item->getOriginalSize())
546 if ($orig_size[
"width"] == $full_item->getWidth() &&
547 $orig_size[
"height"] == $full_item->getHeight())
549 $values[
"full_size"] =
"original";
552 $values[
"full_caption"] = $full_item->getCaption();
554 $full_item->getFormat()))
556 $par = $full_item->getParameters();
557 if ($par[
"autostart"])
559 $values[
"full_autostart"] =
true;
564 $values[
"full_parameters"] = $full_item->getParameterString();
566 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
569 $this->form_gui->setValuesByArray($values);
580 if ($this->form_gui->checkInput())
589 $this->form_gui->setValuesByPost();
590 $tpl->setContent($this->form_gui->getHTML());
601 if (trim(
$_POST[
"standard_title"]) !=
"")
607 if (
$_POST[
"standard_type"] ==
"File")
609 $title = $_FILES[
'standard_file'][
'name'];
618 $a_mob->setDescription(
"");
623 $a_mob->createDirectory();
627 $a_mob->addMediaItem($media_item);
628 $media_item->setPurpose(
"Standard");
630 if (
$_POST[
"standard_type"] ==
"File")
632 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
634 $_FILES[
'standard_file'][
'name'],
$file);
638 $location = $_FILES[
'standard_file'][
'name'];
641 if (
$_POST[
"standard_size"] !=
"original" &&
642 is_int(strpos($format,
"image")))
645 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
649 $media_item->setFormat($format);
651 $media_item->setLocationType(
"LocalFile");
656 $media_item->setFormat($format);
658 $media_item->setLocationType(
"Reference");
660 $a_mob->setDescription($format);
664 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $media_item->getLocation(),
665 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
666 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
667 $media_item->setWidth($wh[
"width"]);
668 $media_item->setHeight($wh[
"height"]);
669 if ($wh[
"info"] !=
"")
674 if ($_POST[
"standard_caption"] !=
"")
680 $media_item->setHAlign(
"Left");
683 if ($_POST[
"full_type"] !=
"None")
686 $a_mob->addMediaItem($media_item2);
687 $media_item2->setPurpose(
"Fullscreen");
690 if ($_POST[
"full_type"] ==
"File")
693 if ($_FILES[
'full_file'][
'name'] !=
"")
695 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
697 $_FILES[
'full_file'][
'name'],
$file);
699 $location = $_FILES[
'full_file'][
'name'];
702 else if ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File")
704 $location = $_FILES[
'standard_file'][
'name'];
708 if ($_POST[
"full_type"] ==
"File" ||
709 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File"))
711 if (($_POST[
"full_size"] !=
"original" &&
712 is_int(strpos($format,
"image")))
716 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"constr_prop"]);
719 $media_item2->setFormat($format);
721 $media_item2->setLocationType(
"LocalFile");
725 if ($_POST[
"full_type"] ==
"Reference")
728 if ($_POST[
"full_reference"] !=
"")
735 if ($_POST[
"full_type"] ==
"Reference" ||
736 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"Reference"))
738 $media_item2->setFormat($format);
740 $media_item2->setLocationType(
"Reference");
747 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
748 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
750 $media_item2->setWidth($wh[
"width"]);
751 $media_item2->setHeight($wh[
"height"]);
753 if ($_POST[
"full_caption"] !=
"")
770 $this->ctrl->returnToParent($this);
782 $tpl->setContent($this->form_gui->getHTML());
795 $std_item =& $this->
object->getMediaItem(
"Standard");
796 if ($std_item->getLocationType() ==
"LocalFile" &&
797 is_int(strpos($std_item->getFormat(),
"image"))
800 $file = $mob_dir.
"/".$std_item->getLocation();
802 $std_item->getHeight());
808 if($this->object->hasFullScreenItem())
810 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
811 if ($full_item->getLocationType() ==
"LocalFile" &&
812 is_int(strpos($full_item->getFormat(),
"image"))
815 $file = $mob_dir.
"/".$full_item->getLocation();
817 $full_item->getHeight());
819 $full_item->update();
823 $this->ctrl->redirect($this,
"edit");
832 $std_item = $this->
object->getMediaItem(
"Standard");
835 if ($std_item->getLocationType() ==
"LocalFile")
837 $file = $mob_dir.
"/".$std_item->getLocation();
838 $size = getimagesize(
$file);
839 $std_item->setWidth($size[0]);
840 $std_item->setHeight($size[1]);
841 $this->
object->update();
843 $this->ctrl->redirect($this,
"edit");
852 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
855 if ($full_item->getLocationType() ==
"LocalFile")
857 $file = $mob_dir.
"/".$full_item->getLocation();
858 $size = getimagesize(
$file);
859 $full_item->setWidth($size[0]);
860 $full_item->setHeight($size[1]);
861 $this->
object->update();
863 $this->ctrl->redirect($this,
"edit");
874 if ($this->form_gui->checkInput())
877 $this->
object->setTitle(
$title);
879 $std_item = $this->
object->getMediaItem(
"Standard");
881 $format = $std_item->getFormat();
882 if (
$_POST[
"standard_type"] ==
"Reference")
885 $std_item->setFormat($format);
887 $std_item->setLocationType(
"Reference");
890 if (
$_POST[
"standard_type"] ==
"File")
893 if ($_FILES[
'standard_file'][
'name'] !=
"")
895 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
897 $_FILES[
'standard_file'][
'name'],
$file);
901 $location = $_FILES[
'standard_file'][
'name'];
905 else if (
$_POST[
"standard_resize"])
914 if (
$_POST[
"standard_size"] !=
"original" &&
915 is_int(strpos($format,
"image")))
918 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
920 $std_item->setFormat($format);
924 $std_item->setLocationType(
"LocalFile");
926 $this->
object->setDescription($format);
930 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $std_item->getLocation(),
931 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
932 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
933 if ($wh[
"info"] !=
"")
938 $std_item->setWidth($wh[
"width"]);
939 $std_item->setHeight($wh[
"height"]);
951 $std_item->getFormat()))
953 if ($_POST[
"standard_autostart"])
955 $std_item->setParameters(
'autostart="true"');
959 $std_item->setParameters(
"");
969 if ($_POST[
"full_type"] ==
"None")
971 if ($this->object->hasFullscreenItem())
973 $this->
object->removeMediaItem(
"Fullscreen");
978 if ($this->object->hasFullscreenItem())
980 $full_item = $this->
object->getMediaItem(
"Fullscreen");
985 $this->
object->addMediaItem($full_item);
986 $full_item->setPurpose(
"Fullscreen");
989 $format = $full_item->getFormat();
990 if ($_POST[
"full_type"] ==
"Reference")
993 $full_item->setFormat($format);
995 $full_item->setLocationType(
"Reference");
999 if ($_POST[
"full_type"] ==
"File")
1002 if ($_FILES[
'full_file'][
'name'] !=
"")
1004 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
1006 $_FILES[
'full_file'][
'name'],
$file);
1009 $location = $_FILES[
'full_file'][
'name'];
1013 else if ($_POST[
"full_resize"])
1022 if ($_POST[
"full_size"] !=
"original" &&
1023 is_int(strpos($format,
"image")))
1026 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1028 $full_item->setFormat($format);
1032 $full_item->setLocationType(
"LocalFile");
1035 if ($_POST[
"full_type"] ==
"Standard")
1037 $format = $std_item->getFormat();
1039 $full_item->setLocationType($std_item->getLocationType());
1040 $full_item->setFormat($format);
1042 $type = $std_item->getLocationType();
1043 if (
$type ==
"LocalFile")
1049 if ($_POST[
"full_size"] !=
"original" &&
1050 is_int(strpos($format,
"image")) &&
1051 $full_item->getLocationType() ==
"LocalFile")
1055 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1062 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
1063 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
1064 if ($wh[
"info"] !=
"")
1069 $full_item->setWidth($wh[
"width"]);
1070 $full_item->setHeight($wh[
"height"]);
1083 $std_item->getFormat()))
1085 if ($_POST[
"full_autostart"])
1087 $full_item->setParameters(
'autostart="true"');
1091 $full_item->setParameters(
"");
1103 $this->
object->update();
1105 $this->ctrl->redirect($this,
"edit");
1109 $this->form_gui->setValuesByPost();
1110 $tpl->setContent($this->form_gui->getHTML());
1121 $std_item =& $this->
object->getMediaItem(
"Standard");
1122 if($this->object->hasFullscreenItem())
1124 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1128 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
1132 $cur_subdir =
$_GET[
"cdir"];
1133 if(
$_GET[
"newdir"] ==
"..")
1135 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir,
"/"));
1139 if (!empty(
$_GET[
"newdir"]))
1141 if (!empty($cur_subdir))
1143 $cur_subdir = $cur_subdir.
"/".
$_GET[
"newdir"];
1147 $cur_subdir =
$_GET[
"newdir"];
1152 $cur_subdir = str_replace(
".",
"", $cur_subdir);
1154 $cur_dir = (!empty($cur_subdir))
1155 ? $mob_dir.
"/".$cur_subdir
1159 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_files.html",
"Services/MediaObjects");
1161 $this->ctrl->setParameter($this,
"cdir", urlencode($cur_subdir));
1162 $this->tpl->setVariable(
"FORMACTION1", $this->ctrl->getFormAction($this));
1165 $this->tpl->setVariable(
"TXT_NEW_DIRECTORY", $this->lng->txt(
"cont_new_dir"));
1166 $this->tpl->setVariable(
"TXT_NEW_FILE", $this->lng->txt(
"cont_new_file"));
1167 $this->tpl->setVariable(
"CMD_NEW_DIR",
"createDirectory");
1168 $this->tpl->setVariable(
"CMD_NEW_FILE",
"uploadFile");
1169 $this->tpl->setVariable(
"BTN_NEW_DIR", $this->lng->txt(
"create"));
1170 $this->tpl->setVariable(
"BTN_NEW_FILE", $this->lng->txt(
"upload"));
1173 $this->tpl->addBlockfile(
"FILE_TABLE",
"files",
"tpl.table.html");
1176 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.mob_file_row.html",
"Services/MediaObjects");
1180 $obj_str = ($this->call_by_reference) ?
"" :
"&obj_id=".$this->obj_id;
1181 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1183 $tbl->setTitle($this->lng->txt(
"cont_files").
" ".$cur_subdir);
1186 $tbl->setHeaderNames(array(
"",
"", $this->lng->txt(
"cont_dir_file"),
1187 $this->lng->txt(
"cont_size"), $this->lng->txt(
"cont_purpose")));
1189 $cols = array(
"",
"",
"dir_file",
"size",
"purpose");
1190 $header_params = array(
"ref_id" =>
$_GET[
"ref_id"],
"obj_id" =>
$_GET[
"obj_id"],
1191 "cmd" =>
"editFiles",
"hier_id" =>
$_GET[
"hier_id"],
"item_id" =>
$_GET[
"item_id"]);
1192 $tbl->setHeaderVars($cols, $header_params);
1193 $tbl->setColumnWidth(array(
"1%",
"1%",
"33%",
"33%",
"32%"));
1196 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
1197 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
1198 $tbl->setLimit(
$_GET[
"limit"]);
1199 $tbl->setOffset(
$_GET[
"offset"]);
1200 $tbl->setMaxCount($this->maxcount);
1203 $this->tpl->setVariable(
"COLUMN_COUNTS", 5);
1207 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1208 $this->tpl->setVariable(
"BTN_NAME",
"deleteFile");
1209 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
1210 $this->tpl->parseCurrentBlock();
1212 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1213 $this->tpl->setVariable(
"BTN_NAME",
"assignStandard");
1214 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_std"));
1215 $this->tpl->parseCurrentBlock();
1217 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1218 $this->tpl->setVariable(
"BTN_NAME",
"assignFullscreen");
1219 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_full"));
1220 $this->tpl->parseCurrentBlock();
1223 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1229 $tbl->setMaxCount(count($entries));
1230 $entries = array_slice($entries,
$_GET[
"offset"],
$_GET[
"limit"]);
1233 if(count($entries) > 0)
1236 foreach($entries as $entry)
1238 if(($entry[
"entry"] ==
".") || ($entry[
"entry"] ==
".." && empty($cur_subdir)))
1244 if($entry[
"type"] ==
"dir")
1246 $this->tpl->setCurrentBlock(
"FileLink");
1247 $this->ctrl->setParameter($this,
"cdir", $cur_subdir);
1248 $this->ctrl->setParameter($this,
"newdir", rawurlencode($entry[
"entry"]));
1249 $this->tpl->setVariable(
"LINK_FILENAME", $this->ctrl->getLinkTarget($this,
"editFiles"));
1250 $this->tpl->setVariable(
"TXT_FILENAME", $entry[
"entry"]);
1251 $this->tpl->parseCurrentBlock();
1253 $this->tpl->setVariable(
"ICON",
"<img src=\"".
1258 $this->tpl->setCurrentBlock(
"File");
1259 $this->tpl->setVariable(
"TXT_FILENAME2", $entry[
"entry"]);
1260 $this->tpl->parseCurrentBlock();
1263 $this->tpl->setCurrentBlock(
"tbl_content");
1265 $this->tpl->setVariable(
"CSS_ROW", $css_row);
1267 $this->tpl->setVariable(
"TXT_SIZE", $entry[
"size"]);
1268 $this->tpl->setVariable(
"CHECKBOX_ID", $entry[
"entry"]);
1269 $compare = (!empty($cur_subdir))
1270 ? $cur_subdir.
"/".$entry[
"entry"]
1273 if ($std_item->getLocation() == $compare)
1275 $purpose[] = $this->lng->txt(
"cont_std_view");
1277 if($this->object->hasFullscreenItem())
1279 if ($full_item->getLocation() == $compare)
1281 $purpose[] = $this->lng->txt(
"cont_fullscreen");
1284 $this->tpl->setVariable(
"TXT_PURPOSE", implode($purpose,
", "));
1286 $this->tpl->parseCurrentBlock();
1291 $this->tpl->setCurrentBlock(
"notfound");
1292 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
1293 $this->tpl->setVariable(
"NUM_COLS", 4);
1294 $this->tpl->parseCurrentBlock();
1297 $this->tpl->parseCurrentBlock();
1308 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1310 $cur_dir = (!empty($cur_subdir))
1311 ? $mob_dir.
"/".$cur_subdir
1314 $new_dir = str_replace(
".",
"",
$_POST[
"new_dir"]);
1315 $new_dir = str_replace(
"/",
"", $new_dir);
1317 if (!empty($new_dir))
1321 $this->ctrl->saveParameter($this,
"cdir");
1322 $this->ctrl->redirect($this,
"editFiles");
1331 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1333 $cur_dir = (!empty($cur_subdir))
1334 ? $mob_dir.
"/".$cur_subdir
1336 if (is_file($_FILES[
"new_file"][
"tmp_name"]))
1340 $file = $cur_dir.
"/".$_FILES[
"new_file"][
"name"];
1342 $_FILES[
'new_file'][
'name'],
$file);
1346 $this->ctrl->saveParameter($this,
"cdir");
1347 $this->ctrl->redirect($this,
"editFiles");
1355 if (!isset(
$_POST[
"file"]))
1357 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1360 if (count(
$_POST[
"file"]) > 1)
1362 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1366 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1368 $cur_dir = (!empty($cur_subdir))
1369 ? $mob_dir.
"/".$cur_subdir
1373 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1378 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1381 $std_item =& $this->
object->getMediaItem(
"Standard");
1382 $std_item->setLocationType(
"LocalFile");
1385 $std_item->setFormat($format);
1386 $this->
object->update();
1388 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1397 if (!isset(
$_POST[
"file"]))
1399 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1402 if (count(
$_POST[
"file"]) > 1)
1404 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1408 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1410 $cur_dir = (!empty($cur_subdir))
1411 ? $mob_dir.
"/".$cur_subdir
1415 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1420 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1423 if(!$this->object->hasFullScreenItem())
1425 $std_item =& $this->
object->getMediaItem(
"Standard");
1429 $full_item->setMobId($std_item->getMobId());
1431 $full_item->setLocationType(
"LocalFile");
1433 $full_item->setPurpose(
"Fullscreen");
1434 $this->
object->addMediaItem($full_item);
1438 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1440 $full_item->setLocationType(
"LocalFile");
1443 $full_item->setFormat($format);
1445 $this->
object->update();
1447 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1456 $this->
object->removeMediaItem(
"Fullscreen");
1457 $this->
object->update();
1459 $this->ctrl->redirect($this,
"edit");
1468 if (!$this->object->hasFullScreenItem())
1470 $std_item =& $this->
object->getMediaItem(
"Standard");
1472 $full_item->setMobId($std_item->getMobId());
1473 $full_item->setLocation($std_item->getLocation());
1474 $full_item->setLocationType($std_item->getLocationType());
1475 $full_item->setFormat($std_item->getFormat());
1476 $full_item->setWidth($std_item->getWidth());
1477 $full_item->setHeight($std_item->getHeight());
1478 $full_item->setCaption($std_item->getCaption());
1479 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1480 $full_item->setPurpose(
"Fullscreen");
1481 $this->
object->addMediaItem($full_item);
1483 $this->
object->update();
1486 $this->ctrl->redirect($this,
"edit");
1495 if (!isset(
$_POST[
"file"]))
1497 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1500 if (count(
$_POST[
"file"]) > 1)
1502 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1505 if (
$_POST[
"file"][0] ==
"..")
1507 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1510 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1512 $cur_dir = (!empty($cur_subdir))
1513 ? $mob_dir.
"/".$cur_subdir
1517 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1520 $full_item =& $this->object->getMediaItem(
"Fullscreen");
1521 $std_item =& $this->
object->getMediaItem(
"Standard");
1523 if (
$location == $std_item->getLocation())
1525 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
1528 if($this->object->hasFullScreenItem())
1530 if (
$location == $full_item->getLocation())
1532 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
1540 $this->ilias->raiseError($this->lng->txt(
"cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1543 if($this->object->hasFullScreenItem())
1547 $this->ilias->raiseError($this->lng->txt(
"cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1552 if (@is_file(
$file))
1562 $this->ctrl->saveParameter($this,
"cdir");
1563 $this->ctrl->redirect($this,
"editFiles");
1573 include_once(
"./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1576 $tpl->setContent($usages_table->getHTML());
1586 $tpl =&
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1587 $types = array(
"Standard",
"Fullscreen");
1588 foreach ($types as
$type)
1590 if($type ==
"Fullscreen" && !$a_mob->hasFullScreenItem())
1595 $med =& $a_mob->getMediaItem($type);
1596 $tpl->setCurrentBlock(
"media_info");
1597 if ($type ==
"Standard")
1599 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_std_view"));
1603 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_fullscreen"));
1605 $tpl->setVariable(
"TXT_TYPE", $lng->txt(
"cont_".strtolower($med->getLocationType())));
1606 $tpl->setVariable(
"VAL_LOCATION", $med->getLocation());
1607 if ($med->getLocationType() ==
"LocalFile")
1612 $size = filesize(
$file);
1618 $tpl->setVariable(
"VAL_FILE_SIZE",
" ($size ".$lng->txt(
"bytes").
")");
1620 $tpl->setVariable(
"TXT_FORMAT", $lng->txt(
"cont_format"));
1621 $tpl->setVariable(
"VAL_FORMAT", $med->getFormat());
1622 if ($med->getWidth() !=
"" && $med->getHeight() !=
"")
1624 $tpl->setCurrentBlock(
"size");
1625 $tpl->setVariable(
"TXT_SIZE", $lng->txt(
"size"));
1626 $tpl->setVariable(
"VAL_SIZE", $med->getWidth().
"x".$med->getHeight());
1627 $tpl->parseCurrentBlock();
1631 if ($orig_size = $med->getOriginalSize())
1633 if ($orig_size[
"width"] != $med->getWidth() ||
1634 $orig_size[
"height"] != $med->getHeight())
1636 $tpl->setCurrentBlock(
"orig_size");
1637 $tpl->setVariable(
"TXT_ORIG_SIZE", $lng->txt(
"cont_orig_size"));
1638 $tpl->setVariable(
"ORIG_WIDTH", $orig_size[
"width"]);
1639 $tpl->setVariable(
"ORIG_HEIGHT", $orig_size[
"height"]);
1640 $tpl->parseCurrentBlock();
1643 $tpl->setCurrentBlock(
"media_info");
1644 $tpl->parseCurrentBlock();
1659 $this->
getTabs($this->tabs_gui);
1662 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject")
1665 $this->tpl->setCurrentBlock();
1666 $title = $this->
object->getTitle();
1667 $this->tpl->setVariable(
"HEADER",
$title);
1673 $this->tpl->setVariable(
"HEADER", $this->lng->txt(
"cont_create_mob"));
1686 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject"
1687 && $this->object->getId() > 0)
1690 $ilTabs->addTarget(
"cont_mob_def_prop",
1691 $this->ctrl->getLinkTarget($this,
"edit"),
"edit",
1695 $st_item =& $this->
object->getMediaItem(
"Standard");
1698 $format = $st_item->getFormat();
1699 if (substr($format, 0, 5) ==
"image")
1701 $ilTabs->addTarget(
"cont_def_map_areas",
1702 $this->ctrl->getLinkTargetByClass(
1703 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
"editMapAreas"),
"editMapAreas",
1704 "ilimagemapeditorgui");
1709 $ilTabs->addTarget(
"cont_mob_usages",
1710 $this->ctrl->getLinkTarget($this,
"showUsages"),
"showUsages",
1714 $std_item = $this->
object->getMediaItem(
"Standard");
1715 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1717 if ($mset->get(
"file_manager_always") ||
1726 $ilTabs->addTarget(
"cont_files",
1727 $this->ctrl->getLinkTargetByClass(
1728 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
"listFiles"),
"",
1732 $ilTabs->addTarget(
"meta_data",
1733 $this->ctrl->getLinkTargetByClass(
1734 array(
"ilobjmediaobjectgui",
"ilmdeditorgui"),
'listSection'),
1735 "",
"ilmdeditorgui");
1740 if ($this->back_title !=
"")
1742 $tabs_gui->setBackTarget($this->back_title,
1743 $this->ctrl->getParentReturn($this));