4 require_once (
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
5 require_once (
"./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
6 require_once (
"./Services/Object/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 =
"";
36 $lng->loadLanguageModule(
"mob");
41 $this->header = $a_title;
56 $this->enabledmapareas = $a_enabledmapareas;
76 $this->width_preset = $a_val;
86 return $this->width_preset;
96 $this->height_preset = $a_val;
106 return $this->height_preset;
116 return $this->form_gui;
129 $this->ctrl->returnToParent($this);
140 $next_class = $this->ctrl->getNextClass($this);
141 $cmd = $this->ctrl->getCmd();
145 case 'ilmdeditorgui':
146 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
148 $md_gui =&
new ilMDEditorGUI(0, $this->object->getId(), $this->
object->getType());
149 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
151 $this->ctrl->forwardCommand($md_gui);
154 case "ilimagemapeditorgui":
155 require_once(
"./Services/MediaObjects/classes/class.ilImageMapEditorGUI.php");
157 $ret = $this->ctrl->forwardCommand($image_map_edit);
158 $tpl->setContent(
$ret);
161 case "ilfilesystemgui":
162 include_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
165 $fs_gui->setTableId(
"mobfs".$this->object->getId());
166 $fs_gui->labelFile($this->object->getMediaItem(
"Standard")->getLocation(),
167 $this->lng->txt(
"cont_std_view"));
168 if($this->object->hasFullscreenItem())
170 $fs_gui->labelFile($this->object->getMediaItem(
"Fullscreen")->getLocation(),
171 $this->lng->txt(
"cont_fullscreen"));
173 $fs_gui->addCommand($this,
"assignStandardObject", $this->lng->txt(
"cont_assign_std"));
174 $fs_gui->addCommand($this,
"assignFullscreenObject", $this->lng->txt(
"cont_assign_full"));
175 $ret =& $this->ctrl->forwardCommand($fs_gui);
180 if (isset(
$_POST[
"editImagemapForward"]) ||
181 isset(
$_POST[
"editImagemapForward_x"]) ||
182 isset(
$_POST[
"editImagemapForward_y"]))
184 $cmd =
"editImagemapForward";
199 $this->back_title = $a_title;
207 global
$tpl, $ilHelp;
209 $ilHelp->setScreenId(
"create");
211 $tpl->setContent($this->form_gui->getHTML());
221 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
223 if ($a_mode ==
"edit")
225 $std_item = $this->
object->getMediaItem(
"Standard");
231 $title =
new ilTextInputGUI($lng->txt(
"title"),
"standard_title");
233 $title->setMaxLength(120);
234 $this->form_gui->addItem($title);
241 $radio_prop->addOption($op1);
244 $ref->
setInfo($lng->txt(
"cont_ref_helptext"));
245 $op2->addSubItem($ref);
246 $radio_prop->addOption($op2);
247 $radio_prop->setValue(
"File");
248 $this->form_gui->addItem($radio_prop);
251 if ($a_mode ==
"edit")
254 $format->
setValue($std_item->getFormat());
255 $this->form_gui->addItem($format);
260 if ($a_mode ==
"edit")
262 if ($orig_size = $std_item->getOriginalSize())
264 $add_str =
" (".$orig_size[
"width"].
" x ".$orig_size[
"height"].
")";
266 $op1 =
new ilRadioOption($lng->txt(
"cont_resource_size").$add_str,
"original");
267 $op2 =
new ilRadioOption($lng->txt(
"cont_custom_size"),
"selected");
271 $op1 =
new ilRadioOption($lng->txt(
"cont_orig_size"),
"original");
272 $op2 =
new ilRadioOption($lng->txt(
"cont_adjust_size"),
"selected");
274 $radio_size->addOption($op1);
277 include_once(
"./Services/MediaObjects/classes/class.ilWidthHeightInputGUI.php");
279 " / ".$lng->txt(
"cont_height"),
"standard_width_height");
281 $op2->addSubItem($width_height);
284 if ($a_mode ==
"edit")
286 $std_item = $this->
object->getMediaItem(
"Standard");
287 if (is_int(strpos($std_item->getFormat(),
"image"))
288 && $std_item->getLocationType() ==
"LocalFile")
291 ,
"standard_resize");
296 $radio_size->setValue(
"original");
299 $radio_size->setValue(
"selected");
303 $radio_size->addOption($op2);
304 $this->form_gui->addItem($radio_size);
309 $caption->setRows(2);
310 $this->form_gui->addItem($caption);
318 if ($a_mode ==
"edit" && is_int(strpos($std_item->getFormat(),
"image")))
323 $ta->setInfo($lng->txt(
"text_repr_info"));
324 $this->form_gui->addItem($ta);
328 if ($a_mode ==
"edit" &&
332 $std_item->getFormat()))
335 $this->form_gui->addItem($auto);
342 $this->form_gui->addItem($par);
346 if ($a_mode ==
"edit")
348 $full_item = $this->
object->getMediaItem(
"Fullscreen");
353 $fs_sec->setTitle($lng->txt(
"cont_fullscreen"));
354 $this->form_gui->addItem($fs_sec);
358 $radio_prop2->addOption($op1);
359 $op4 =
new ilRadioOption($lng->txt(
"cont_use_same_resource_as_above"),
"Standard");
360 $radio_prop2->addOption($op4);
365 $op2->addSubItem($up);
366 $radio_prop2->addOption($op2);
369 $ref->
setInfo($lng->txt(
"cont_ref_helptext"));
370 $op3->addSubItem($ref);
371 $radio_prop2->addOption($op3);
372 $radio_prop2->setValue(
"None");
373 $this->form_gui->addItem($radio_prop2);
376 if ($a_mode ==
"edit")
378 if ($this->object->hasFullscreenItem())
381 $format->
setValue($full_item->getFormat());
382 $this->form_gui->addItem($format);
388 if ($a_mode ==
"edit")
391 if ($this->object->hasFullscreenItem() && ($orig_size = $full_item->getOriginalSize()))
393 $add_str =
" (".$orig_size[
"width"].
" x ".$orig_size[
"height"].
")";
395 $op1 =
new ilRadioOption($lng->txt(
"cont_resource_size").$add_str,
"original");
396 $op2 =
new ilRadioOption($lng->txt(
"cont_custom_size"),
"selected");
400 $op1 =
new ilRadioOption($lng->txt(
"cont_orig_size"),
"original");
401 $op2 =
new ilRadioOption($lng->txt(
"cont_adjust_size"),
"selected");
403 $radio_size->addOption($op1);
407 " / ".$lng->txt(
"cont_height"),
"full_width_height");
409 $op2->addSubItem($width_height);
412 if ($a_mode ==
"edit")
414 $full_item = $this->
object->getMediaItem(
"Fullscreen");
415 if ($this->object->hasFullscreenItem() &&
416 is_int(strpos($full_item->getFormat(),
"image")) &&
417 $full_item->getLocationType() ==
"LocalFile")
425 $radio_size->setValue(
"original");
426 $radio_size->addOption($op2);
427 $this->form_gui->addItem($radio_size);
432 $caption->setRows(2);
433 $this->form_gui->addItem($caption);
441 if ($a_mode ==
"edit" && $this->object->hasFullscreenItem() && is_int(strpos($std_item->getFormat(),
"image")))
446 $ta->setInfo($lng->txt(
"text_repr_info"));
447 $this->form_gui->addItem($ta);
452 if ($a_mode ==
"edit" && $this->object->hasFullscreenItem() &&
456 $full_item->getFormat()))
459 $this->form_gui->addItem($auto);
466 $this->form_gui->addItem($par);
470 $this->form_gui->setTitle($lng->txt(
"cont_insert_mob"));
471 if ($a_mode ==
"edit")
473 $this->form_gui->addCommandButton(
"saveProperties", $lng->txt(
"save"));
477 $this->form_gui->addCommandButton(
"save", $lng->txt(
"save"));
478 $this->form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
480 $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
492 $values[
"standard_title"] = $this->
object->getTitle();
494 $std_item = $this->
object->getMediaItem(
"Standard");
495 if ($std_item->getLocationType() ==
"LocalFile")
497 $values[
"standard_type"] =
"File";
498 $values[
"standard_file"] = $std_item->getLocation();
502 $values[
"standard_type"] =
"Reference";
503 $values[
"standard_reference"] = $std_item->getLocation();
505 $values[
"standard_format"] = $std_item->getFormat();
506 $values[
"standard_width_height"][
"width"] = $std_item->getWidth();
507 $values[
"standard_width_height"][
"height"] = $std_item->getHeight();
508 $values[
"standard_width_height"][
"constr_prop"] =
true;
510 $values[
"standard_size"] =
"selected";
512 if ($orig_size = $std_item->getOriginalSize())
514 if ($orig_size[
"width"] == $std_item->getWidth() &&
515 $orig_size[
"height"] == $std_item->getHeight())
517 $values[
"standard_size"] =
"original";
520 $values[
"standard_caption"] = $std_item->getCaption();
521 $values[
"text_representation"] = $std_item->getTextRepresentation();
523 $std_item->getFormat()))
525 $par = $std_item->getParameters();
526 if ($par[
"autostart"])
528 $values[
"standard_autostart"] =
true;
533 $values[
"standard_parameters"] = $std_item->getParameterString();
536 $values[
"full_type"] =
"None";
537 $values[
"full_size"] =
"original";
538 if ($this->object->hasFullScreenItem())
540 $full_item = $this->
object->getMediaItem(
"Fullscreen");
541 if ($full_item->getLocationType() ==
"LocalFile")
543 $values[
"full_type"] =
"File";
544 $values[
"full_file"] = $full_item->getLocation();
548 $values[
"full_type"] =
"Reference";
549 $values[
"full_reference"] = $full_item->getLocation();
551 $values[
"full_format"] = $full_item->getFormat();
552 $values[
"full_width_height"][
"width"] = $full_item->getWidth();
553 $values[
"full_width_height"][
"height"] = $full_item->getHeight();
554 $values[
"full_width_height"][
"constr_prop"] =
true;
556 $values[
"full_size"] =
"selected";
558 if ($orig_size = $full_item->getOriginalSize())
560 if ($orig_size[
"width"] == $full_item->getWidth() &&
561 $orig_size[
"height"] == $full_item->getHeight())
563 $values[
"full_size"] =
"original";
566 $values[
"full_caption"] = $full_item->getCaption();
568 $full_item->getFormat()))
570 $par = $full_item->getParameters();
571 if ($par[
"autostart"])
573 $values[
"full_autostart"] =
true;
578 $values[
"full_parameters"] = $full_item->getParameterString();
580 $values[
"full_text_representation"] = $full_item->getTextRepresentation();
583 $this->form_gui->setValuesByArray($values);
594 if ($this->form_gui->checkInput())
603 $this->form_gui->setValuesByPost();
604 $tpl->setContent($this->form_gui->getHTML());
617 if (!$this->form_gui->checkInput())
619 $this->form_gui->setValuesByPost();
632 if (trim(
$_POST[
"standard_title"]) !=
"")
634 $title = trim(
$_POST[
"standard_title"]);
638 if (
$_POST[
"standard_type"] ==
"File")
640 $title = $_FILES[
'standard_file'][
'name'];
648 $a_mob->setTitle($title);
649 $a_mob->setDescription(
"");
654 $a_mob->createDirectory();
658 $a_mob->addMediaItem($media_item);
659 $media_item->setPurpose(
"Standard");
661 if (
$_POST[
"standard_type"] ==
"File")
663 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
665 $_FILES[
'standard_file'][
'name'],
$file);
669 $location = $_FILES[
'standard_file'][
'name'];
672 if (
$_POST[
"standard_size"] !=
"original" &&
673 is_int(strpos($format,
"image")))
676 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
680 $media_item->setFormat($format);
682 $media_item->setLocationType(
"LocalFile");
687 $media_item->setFormat($format);
689 $media_item->setLocationType(
"Reference");
691 $a_mob->setDescription($format);
695 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $media_item->getLocation(),
696 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
697 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
698 $media_item->setWidth($wh[
"width"]);
699 $media_item->setHeight($wh[
"height"]);
700 if ($wh[
"info"] !=
"")
705 if ($_POST[
"standard_caption"] !=
"")
711 $media_item->setHAlign(
"Left");
714 if ($_POST[
"full_type"] !=
"None")
717 $a_mob->addMediaItem($media_item2);
718 $media_item2->setPurpose(
"Fullscreen");
721 if ($_POST[
"full_type"] ==
"File")
724 if ($_FILES[
'full_file'][
'name'] !=
"")
726 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
728 $_FILES[
'full_file'][
'name'],
$file);
730 $location = $_FILES[
'full_file'][
'name'];
733 else if ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File")
735 $location = $_FILES[
'standard_file'][
'name'];
739 if ($_POST[
"full_type"] ==
"File" ||
740 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File"))
742 if (($_POST[
"full_size"] !=
"original" &&
743 is_int(strpos($format,
"image")))
747 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"constr_prop"]);
750 $media_item2->setFormat($format);
752 $media_item2->setLocationType(
"LocalFile");
756 if ($_POST[
"full_type"] ==
"Reference")
759 if ($_POST[
"full_reference"] !=
"")
766 if ($_POST[
"full_type"] ==
"Reference" ||
767 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"Reference"))
769 $media_item2->setFormat($format);
771 $media_item2->setLocationType(
"Reference");
777 $type, $mob_dir.
"/".
$location, $media_item2->getLocation(),
778 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
779 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
781 $media_item2->setWidth($wh[
"width"]);
782 $media_item2->setHeight($wh[
"height"]);
784 if ($_POST[
"full_caption"] !=
"")
801 $this->ctrl->returnToParent($this);
815 $tpl->setContent($this->form_gui->getHTML());
828 $std_item =& $this->
object->getMediaItem(
"Standard");
829 if ($std_item->getLocationType() ==
"LocalFile" &&
830 is_int(strpos($std_item->getFormat(),
"image"))
833 $file = $mob_dir.
"/".$std_item->getLocation();
835 $std_item->getHeight());
841 if($this->object->hasFullScreenItem())
843 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
844 if ($full_item->getLocationType() ==
"LocalFile" &&
845 is_int(strpos($full_item->getFormat(),
"image"))
848 $file = $mob_dir.
"/".$full_item->getLocation();
850 $full_item->getHeight());
852 $full_item->update();
856 $this->ctrl->redirect($this,
"edit");
865 $std_item = $this->
object->getMediaItem(
"Standard");
868 if ($std_item->getLocationType() ==
"LocalFile")
870 $file = $mob_dir.
"/".$std_item->getLocation();
872 $std_item->setWidth(
$size[0]);
873 $std_item->setHeight(
$size[1]);
874 $this->
object->update();
876 $this->ctrl->redirect($this,
"edit");
885 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
888 if ($full_item->getLocationType() ==
"LocalFile")
890 $file = $mob_dir.
"/".$full_item->getLocation();
892 $full_item->setWidth(
$size[0]);
893 $full_item->setHeight(
$size[1]);
894 $this->
object->update();
896 $this->ctrl->redirect($this,
"edit");
907 if ($this->form_gui->checkInput())
909 $title = trim(
$_POST[
"standard_title"]);
910 $this->
object->setTitle($title);
912 $std_item = $this->
object->getMediaItem(
"Standard");
914 $format = $std_item->getFormat();
915 if (
$_POST[
"standard_type"] ==
"Reference")
918 $std_item->setFormat($format);
920 $std_item->setLocationType(
"Reference");
923 if (
$_POST[
"standard_type"] ==
"File")
926 if ($_FILES[
'standard_file'][
'name'] !=
"")
928 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
930 $_FILES[
'standard_file'][
'name'],
$file);
934 $location = $_FILES[
'standard_file'][
'name'];
938 else if (
$_POST[
"standard_resize"])
947 if (
$_POST[
"standard_size"] !=
"original" &&
948 is_int(strpos($format,
"image")))
951 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
953 $std_item->setFormat($format);
957 $std_item->setLocationType(
"LocalFile");
959 $this->
object->setDescription($format);
963 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $std_item->getLocation(),
964 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
965 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
966 if ($wh[
"info"] !=
"")
971 $std_item->setWidth($wh[
"width"]);
972 $std_item->setHeight($wh[
"height"]);
984 $std_item->getFormat()))
986 if ($_POST[
"standard_autostart"])
988 $std_item->setParameters(
'autostart="true"');
992 $std_item->setParameters(
"");
1002 if ($_POST[
"full_type"] ==
"None")
1004 if ($this->object->hasFullscreenItem())
1006 $this->
object->removeMediaItem(
"Fullscreen");
1011 if ($this->object->hasFullscreenItem())
1013 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1018 $this->
object->addMediaItem($full_item);
1019 $full_item->setPurpose(
"Fullscreen");
1022 $format = $full_item->getFormat();
1023 if ($_POST[
"full_type"] ==
"Reference")
1026 $full_item->setFormat($format);
1027 $full_item->setLocationType(
"Reference");
1029 $type =
"Reference";
1032 if ($_POST[
"full_type"] ==
"File")
1035 if ($_FILES[
'full_file'][
'name'] !=
"")
1037 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
1039 $_FILES[
'full_file'][
'name'],
$file);
1042 $location = $_FILES[
'full_file'][
'name'];
1046 else if ($_POST[
"full_resize"])
1055 if ($_POST[
"full_size"] !=
"original" &&
1056 is_int(strpos($format,
"image")))
1059 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1061 $full_item->setFormat($format);
1065 $full_item->setLocationType(
"LocalFile");
1068 if ($_POST[
"full_type"] ==
"Standard")
1070 $format = $std_item->getFormat();
1072 $full_item->setLocationType($std_item->getLocationType());
1073 $full_item->setFormat($format);
1075 $type = $std_item->getLocationType();
1076 if ($type ==
"LocalFile")
1082 if ($_POST[
"full_size"] !=
"original" &&
1083 is_int(strpos($format,
"image")) &&
1084 $full_item->getLocationType() ==
"LocalFile")
1088 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1094 $type, $mob_dir.
"/".
$location, $full_item->getLocation(),
1095 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
1096 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
1097 if ($wh[
"info"] !=
"")
1102 $full_item->setWidth($wh[
"width"]);
1103 $full_item->setHeight($wh[
"height"]);
1116 $std_item->getFormat()))
1118 if ($_POST[
"full_autostart"])
1120 $full_item->setParameters(
'autostart="true"');
1124 $full_item->setParameters(
"");
1136 $this->
object->update();
1138 $this->ctrl->redirect($this,
"edit");
1142 $this->form_gui->setValuesByPost();
1143 $tpl->setContent($this->form_gui->getHTML());
1154 $std_item =& $this->
object->getMediaItem(
"Standard");
1155 if($this->object->hasFullscreenItem())
1157 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1161 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
1165 $cur_subdir =
$_GET[
"cdir"];
1166 if(
$_GET[
"newdir"] ==
"..")
1168 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir,
"/"));
1172 if (!empty(
$_GET[
"newdir"]))
1174 if (!empty($cur_subdir))
1176 $cur_subdir = $cur_subdir.
"/".
$_GET[
"newdir"];
1180 $cur_subdir =
$_GET[
"newdir"];
1185 $cur_subdir = str_replace(
".",
"", $cur_subdir);
1187 $cur_dir = (!empty($cur_subdir))
1188 ? $mob_dir.
"/".$cur_subdir
1192 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_files.html",
"Services/MediaObjects");
1194 $this->ctrl->setParameter($this,
"cdir", urlencode($cur_subdir));
1195 $this->tpl->setVariable(
"FORMACTION1", $this->ctrl->getFormAction($this));
1198 $this->tpl->setVariable(
"TXT_NEW_DIRECTORY", $this->lng->txt(
"cont_new_dir"));
1199 $this->tpl->setVariable(
"TXT_NEW_FILE", $this->lng->txt(
"cont_new_file"));
1200 $this->tpl->setVariable(
"CMD_NEW_DIR",
"createDirectory");
1201 $this->tpl->setVariable(
"CMD_NEW_FILE",
"uploadFile");
1202 $this->tpl->setVariable(
"BTN_NEW_DIR", $this->lng->txt(
"create"));
1203 $this->tpl->setVariable(
"BTN_NEW_FILE", $this->lng->txt(
"upload"));
1206 $this->tpl->addBlockfile(
"FILE_TABLE",
"files",
"tpl.table.html");
1209 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.mob_file_row.html",
"Services/MediaObjects");
1213 $obj_str = ($this->call_by_reference) ?
"" :
"&obj_id=".$this->obj_id;
1214 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1216 $tbl->setTitle($this->lng->txt(
"cont_files").
" ".$cur_subdir);
1219 $tbl->setHeaderNames(array(
"",
"", $this->lng->txt(
"cont_dir_file"),
1220 $this->lng->txt(
"cont_size"), $this->lng->txt(
"cont_purpose")));
1222 $cols = array(
"",
"",
"dir_file",
"size",
"purpose");
1223 $header_params = array(
"ref_id" =>
$_GET[
"ref_id"],
"obj_id" =>
$_GET[
"obj_id"],
1224 "cmd" =>
"editFiles",
"hier_id" =>
$_GET[
"hier_id"],
"item_id" =>
$_GET[
"item_id"]);
1225 $tbl->setHeaderVars($cols, $header_params);
1226 $tbl->setColumnWidth(array(
"1%",
"1%",
"33%",
"33%",
"32%"));
1229 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
1230 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
1231 $tbl->setLimit(
$_GET[
"limit"]);
1232 $tbl->setOffset(
$_GET[
"offset"]);
1233 $tbl->setMaxCount($this->maxcount);
1236 $this->tpl->setVariable(
"COLUMN_COUNTS", 5);
1240 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1241 $this->tpl->setVariable(
"BTN_NAME",
"deleteFile");
1242 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
1243 $this->tpl->parseCurrentBlock();
1245 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1246 $this->tpl->setVariable(
"BTN_NAME",
"assignStandard");
1247 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_std"));
1248 $this->tpl->parseCurrentBlock();
1250 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1251 $this->tpl->setVariable(
"BTN_NAME",
"assignFullscreen");
1252 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_full"));
1253 $this->tpl->parseCurrentBlock();
1256 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1262 $tbl->setMaxCount(count($entries));
1263 $entries = array_slice($entries,
$_GET[
"offset"],
$_GET[
"limit"]);
1266 if(count($entries) > 0)
1269 foreach($entries as $entry)
1271 if(($entry[
"entry"] ==
".") || ($entry[
"entry"] ==
".." && empty($cur_subdir)))
1277 if($entry[
"type"] ==
"dir")
1279 $this->tpl->setCurrentBlock(
"FileLink");
1280 $this->ctrl->setParameter($this,
"cdir", $cur_subdir);
1281 $this->ctrl->setParameter($this,
"newdir", rawurlencode($entry[
"entry"]));
1282 $this->tpl->setVariable(
"LINK_FILENAME", $this->ctrl->getLinkTarget($this,
"editFiles"));
1283 $this->tpl->setVariable(
"TXT_FILENAME", $entry[
"entry"]);
1284 $this->tpl->parseCurrentBlock();
1286 $this->tpl->setVariable(
"ICON",
"<img src=\"".
1291 $this->tpl->setCurrentBlock(
"File");
1292 $this->tpl->setVariable(
"TXT_FILENAME2", $entry[
"entry"]);
1293 $this->tpl->parseCurrentBlock();
1296 $this->tpl->setCurrentBlock(
"tbl_content");
1298 $this->tpl->setVariable(
"CSS_ROW", $css_row);
1300 $this->tpl->setVariable(
"TXT_SIZE", $entry[
"size"]);
1301 $this->tpl->setVariable(
"CHECKBOX_ID", $entry[
"entry"]);
1302 $compare = (!empty($cur_subdir))
1303 ? $cur_subdir.
"/".$entry[
"entry"]
1306 if ($std_item->getLocation() == $compare)
1308 $purpose[] = $this->lng->txt(
"cont_std_view");
1310 if($this->object->hasFullscreenItem())
1312 if ($full_item->getLocation() == $compare)
1314 $purpose[] = $this->lng->txt(
"cont_fullscreen");
1317 $this->tpl->setVariable(
"TXT_PURPOSE", implode($purpose,
", "));
1319 $this->tpl->parseCurrentBlock();
1324 $this->tpl->setCurrentBlock(
"notfound");
1325 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
1326 $this->tpl->setVariable(
"NUM_COLS", 4);
1327 $this->tpl->parseCurrentBlock();
1330 $this->tpl->parseCurrentBlock();
1341 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1343 $cur_dir = (!empty($cur_subdir))
1344 ? $mob_dir.
"/".$cur_subdir
1347 $new_dir = str_replace(
".",
"",
$_POST[
"new_dir"]);
1348 $new_dir = str_replace(
"/",
"", $new_dir);
1350 if (!empty($new_dir))
1354 $this->ctrl->saveParameter($this,
"cdir");
1355 $this->ctrl->redirect($this,
"editFiles");
1364 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1366 $cur_dir = (!empty($cur_subdir))
1367 ? $mob_dir.
"/".$cur_subdir
1369 if (is_file($_FILES[
"new_file"][
"tmp_name"]))
1373 $file = $cur_dir.
"/".$_FILES[
"new_file"][
"name"];
1375 $_FILES[
'new_file'][
'name'],
$file);
1379 $this->ctrl->saveParameter($this,
"cdir");
1380 $this->ctrl->redirect($this,
"editFiles");
1388 if (!isset(
$_POST[
"file"]))
1390 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1393 if (count(
$_POST[
"file"]) > 1)
1395 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1399 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1401 $cur_dir = (!empty($cur_subdir))
1402 ? $mob_dir.
"/".$cur_subdir
1406 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1411 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1414 $std_item =& $this->
object->getMediaItem(
"Standard");
1415 $std_item->setLocationType(
"LocalFile");
1418 $std_item->setFormat($format);
1419 $this->
object->update();
1421 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1430 if (!isset(
$_POST[
"file"]))
1432 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1435 if (count(
$_POST[
"file"]) > 1)
1437 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1441 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1443 $cur_dir = (!empty($cur_subdir))
1444 ? $mob_dir.
"/".$cur_subdir
1448 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1453 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1456 if(!$this->object->hasFullScreenItem())
1458 $std_item =& $this->
object->getMediaItem(
"Standard");
1462 $full_item->setMobId($std_item->getMobId());
1464 $full_item->setLocationType(
"LocalFile");
1466 $full_item->setPurpose(
"Fullscreen");
1467 $this->
object->addMediaItem($full_item);
1471 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1473 $full_item->setLocationType(
"LocalFile");
1476 $full_item->setFormat($format);
1478 $this->
object->update();
1480 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1489 $this->
object->removeMediaItem(
"Fullscreen");
1490 $this->
object->update();
1492 $this->ctrl->redirect($this,
"edit");
1501 if (!$this->object->hasFullScreenItem())
1503 $std_item =& $this->
object->getMediaItem(
"Standard");
1505 $full_item->setMobId($std_item->getMobId());
1506 $full_item->setLocation($std_item->getLocation());
1507 $full_item->setLocationType($std_item->getLocationType());
1508 $full_item->setFormat($std_item->getFormat());
1509 $full_item->setWidth($std_item->getWidth());
1510 $full_item->setHeight($std_item->getHeight());
1511 $full_item->setCaption($std_item->getCaption());
1512 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1513 $full_item->setPurpose(
"Fullscreen");
1514 $this->
object->addMediaItem($full_item);
1516 $this->
object->update();
1519 $this->ctrl->redirect($this,
"edit");
1528 if (!isset(
$_POST[
"file"]))
1530 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1533 if (count(
$_POST[
"file"]) > 1)
1535 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1538 if (
$_POST[
"file"][0] ==
"..")
1540 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1543 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1545 $cur_dir = (!empty($cur_subdir))
1546 ? $mob_dir.
"/".$cur_subdir
1550 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1553 $full_item =& $this->object->getMediaItem(
"Fullscreen");
1554 $std_item =& $this->
object->getMediaItem(
"Standard");
1556 if (
$location == $std_item->getLocation())
1558 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
1561 if($this->object->hasFullScreenItem())
1563 if (
$location == $full_item->getLocation())
1565 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
1573 $this->ilias->raiseError($this->lng->txt(
"cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1576 if($this->object->hasFullScreenItem())
1580 $this->ilias->raiseError($this->lng->txt(
"cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1585 if (@is_file(
$file))
1595 $this->ctrl->saveParameter($this,
"cdir");
1596 $this->ctrl->redirect($this,
"editFiles");
1615 $ilTabs->addSubTab(
"current_usages", $lng->txt(
"cont_current_usages"),
1616 $ilCtrl->getLinkTarget($this,
"showUsages"));
1618 $ilTabs->addSubTab(
"all_usages", $lng->txt(
"cont_all_usages"),
1619 $ilCtrl->getLinkTarget($this,
"showAllUsages"));
1623 $ilTabs->activateSubTab(
"all_usages");
1624 $cmd =
"showAllUsages";
1628 $ilTabs->activateSubTab(
"current_usages");
1629 $cmd =
"showUsages";
1632 include_once(
"./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1634 $this->
object, $a_all);
1635 $tpl->setContent($usages_table->getHTML());
1645 $tpl =&
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1646 $types = array(
"Standard",
"Fullscreen");
1647 foreach ($types as $type)
1649 if($type ==
"Fullscreen" && !$a_mob->hasFullScreenItem())
1654 $med = $a_mob->getMediaItem($type);
1660 $tpl->setCurrentBlock(
"media_info");
1661 if ($type ==
"Standard")
1663 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_std_view"));
1667 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_fullscreen"));
1669 $tpl->setVariable(
"TXT_TYPE", $lng->txt(
"cont_".strtolower($med->getLocationType())));
1670 $tpl->setVariable(
"VAL_LOCATION", $med->getLocation());
1671 if ($med->getLocationType() ==
"LocalFile")
1682 $tpl->setVariable(
"VAL_FILE_SIZE",
" ($size ".$lng->txt(
"bytes").
")");
1684 $tpl->setVariable(
"TXT_FORMAT", $lng->txt(
"cont_format"));
1685 $tpl->setVariable(
"VAL_FORMAT", $med->getFormat());
1686 if ($med->getWidth() !=
"" && $med->getHeight() !=
"")
1688 $tpl->setCurrentBlock(
"size");
1689 $tpl->setVariable(
"TXT_SIZE", $lng->txt(
"size"));
1690 $tpl->setVariable(
"VAL_SIZE", $med->getWidth().
"x".$med->getHeight());
1691 $tpl->parseCurrentBlock();
1695 if ($orig_size = $med->getOriginalSize())
1697 if ($orig_size[
"width"] != $med->getWidth() ||
1698 $orig_size[
"height"] != $med->getHeight())
1700 $tpl->setCurrentBlock(
"orig_size");
1701 $tpl->setVariable(
"TXT_ORIG_SIZE", $lng->txt(
"cont_orig_size"));
1702 $tpl->setVariable(
"ORIG_WIDTH", $orig_size[
"width"]);
1703 $tpl->setVariable(
"ORIG_HEIGHT", $orig_size[
"height"]);
1704 $tpl->parseCurrentBlock();
1707 $tpl->setCurrentBlock(
"media_info");
1708 $tpl->parseCurrentBlock();
1723 $this->
getTabs($this->tabs_gui);
1726 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject")
1729 $this->tpl->setTitle($this->object->getTitle());
1735 $this->tpl->setTitle($this->lng->txt(
"cont_create_mob"));
1745 global $ilTabs, $ilHelp;
1747 $ilHelp->setScreenIdComponent(
"mob");
1750 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject"
1751 && $this->object->getId() > 0)
1754 $ilTabs->addTarget(
"cont_mob_def_prop",
1755 $this->ctrl->getLinkTarget($this,
"edit"),
"edit",
1758 $st_item =& $this->
object->getMediaItem(
"Standard");
1761 if (substr($st_item->getFormat(), 0, 6) ==
"video/" && DEVMODE)
1763 $ilTabs->addTarget(
"mob_video_tools",
1764 $this->ctrl->getLinkTargetByClass(
"ilobjmediaobjectgui",
"showVideoTool"),
1765 "showVideoTool",
"ilobjmediaobjectgui");
1772 $format = $st_item->getFormat();
1773 if (substr($format, 0, 5) ==
"image")
1775 $ilTabs->addTarget(
"cont_def_map_areas",
1776 $this->ctrl->getLinkTargetByClass(
1777 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
"editMapAreas"),
"editMapAreas",
1778 "ilimagemapeditorgui");
1783 $ilTabs->addTarget(
"cont_mob_usages",
1784 $this->ctrl->getLinkTarget($this,
"showUsages"),
"showUsages",
1788 $std_item = $this->
object->getMediaItem(
"Standard");
1789 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1791 if ($mset->get(
"file_manager_always") ||
1800 $ilTabs->addTarget(
"cont_files",
1801 $this->ctrl->getLinkTargetByClass(
1802 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
"listFiles"),
"",
1806 $ilTabs->addTarget(
"meta_data",
1807 $this->ctrl->getLinkTargetByClass(
1808 array(
"ilobjmediaobjectgui",
"ilmdeditorgui"),
'listSection'),
1809 "",
"ilmdeditorgui");
1814 if ($this->back_title !=
"")
1816 $tabs_gui->setBackTarget($this->back_title,
1817 $this->ctrl->getParentReturn($this));
1831 include_once(
"./Services/MediaObjects/classes/class.ilFFmpeg.php");
1838 $formats_str = implode($formats,
"<br />");
1839 $tpl->setContent($formats_str);
1855 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1856 iljQueryUtil::initjQUery($a_tpl);
1857 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1859 $a_tpl->addJavascript(
"./Services/COPage/js/ilCOPagePres.js");
1861 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1874 $ilTabs->activateTab(
"cont_mob_def_prop");
1876 $ilTabs->addSubTab(
"general",
1877 $lng->txt(
"mob_general"),
1878 $ilCtrl->getLinkTarget($this,
"edit"));
1880 if ($this->object->getMediaItem(
"Standard")->getFormat() ==
"video/webm" ||
1881 $this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/mp4")
1883 $ilTabs->addSubTab(
"subtitles",
1884 $lng->txt(
"mob_subtitles"),
1885 $ilCtrl->getLinkTarget($this,
"listSubtitleFiles"));
1888 $ilTabs->activateSubTab($a_active);
1904 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1905 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1906 $fi =
new ilFileInputGUI($lng->txt(
"mob_subtitle_file").
" (.srt)",
"subtitle_file");
1908 $ilToolbar->addInputItem($fi,
true);
1911 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1912 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
1916 $si->setValue($ilUser->getLanguage());
1917 $ilToolbar->addInputItem(
$si,
true);
1919 $ilToolbar->addFormButton($lng->txt(
"upload"),
"uploadSubtitleFile");
1921 include_once(
"./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1924 $tpl->setContent(
$tab->getHTML());
1941 $ilCtrl->redirect($this,
"listSubtitleFiles");
1951 $lng->loadLanguageModule(
"meta");
1953 if (!is_array(
$_POST[
"srt"]) || count(
$_POST[
"srt"]) == 0)
1956 $ilCtrl->redirect($this,
"listSubtitleFiles");
1960 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1962 $cgui->setFormAction($ilCtrl->getFormAction($this));
1963 $cgui->setHeaderText($lng->txt(
"mob_really_delete_srt"));
1964 $cgui->setCancel($lng->txt(
"cancel"),
"listSubtitleFiles");
1965 $cgui->setConfirm($lng->txt(
"delete"),
"deleteSrtFiles");
1967 foreach (
$_POST[
"srt"] as $i)
1969 $cgui->addItem(
"srt[]", $i,
"subtitle_".$i.
".srt (".$lng->txt(
"meta_l_".$i).
")");
1972 $tpl->setContent($cgui->getHTML());
1983 foreach (
$_POST[
"srt"] as $i)
1985 if (strlen($i) == 2 && !is_int(strpos($i,
".")))
1987 $this->
object->removeAdditionalFile(
"srt/subtitle_".$i.
".srt");
1991 $ilCtrl->redirect($this,
"listSubtitleFiles");