4 require_once (
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
5 require_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
6 require_once (
"./Services/Object/classes/class.ilObjectGUI.php");
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")
664 $file = $mob_dir.
"/".$file_name;
673 if (
$_POST[
"standard_size"] !=
"original" &&
674 is_int(strpos($format,
"image")))
677 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
681 $media_item->setFormat($format);
683 $media_item->setLocationType(
"LocalFile");
688 $media_item->setFormat($format);
690 $media_item->setLocationType(
"Reference");
692 $a_mob->setDescription($format);
696 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $media_item->getLocation(),
697 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
698 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
699 $media_item->setWidth($wh[
"width"]);
700 $media_item->setHeight($wh[
"height"]);
701 if ($wh[
"info"] !=
"")
706 if ($_POST[
"standard_caption"] !=
"")
712 $media_item->setHAlign(
"Left");
715 if ($_POST[
"full_type"] !=
"None")
718 $a_mob->addMediaItem($media_item2);
719 $media_item2->setPurpose(
"Fullscreen");
722 if ($_POST[
"full_type"] ==
"File")
725 if ($_FILES[
'full_file'][
'name'] !=
"")
728 $file = $mob_dir.
"/".$full_file_name;
730 $full_file_name,
$file);
735 else if ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File")
741 if ($_POST[
"full_type"] ==
"File" ||
742 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"File"))
744 if (($_POST[
"full_size"] !=
"original" &&
745 is_int(strpos($format,
"image")))
749 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"constr_prop"]);
752 $media_item2->setFormat($format);
754 $media_item2->setLocationType(
"LocalFile");
758 if ($_POST[
"full_type"] ==
"Reference")
761 if ($_POST[
"full_reference"] !=
"")
768 if ($_POST[
"full_type"] ==
"Reference" ||
769 ($_POST[
"full_type"] ==
"Standard" && $_POST[
"standard_type"] ==
"Reference"))
771 $media_item2->setFormat($format);
773 $media_item2->setLocationType(
"Reference");
779 $type, $mob_dir.
"/".
$location, $media_item2->getLocation(),
780 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
781 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
783 $media_item2->setWidth($wh[
"width"]);
784 $media_item2->setHeight($wh[
"height"]);
786 if ($_POST[
"full_caption"] !=
"")
803 $this->ctrl->returnToParent($this);
817 $tpl->setContent($this->form_gui->getHTML());
830 $std_item =& $this->
object->getMediaItem(
"Standard");
831 if ($std_item->getLocationType() ==
"LocalFile" &&
832 is_int(strpos($std_item->getFormat(),
"image"))
835 $file = $mob_dir.
"/".$std_item->getLocation();
837 $std_item->getHeight());
843 if($this->object->hasFullScreenItem())
845 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
846 if ($full_item->getLocationType() ==
"LocalFile" &&
847 is_int(strpos($full_item->getFormat(),
"image"))
850 $file = $mob_dir.
"/".$full_item->getLocation();
852 $full_item->getHeight());
854 $full_item->update();
858 $this->ctrl->redirect($this,
"edit");
867 $std_item = $this->
object->getMediaItem(
"Standard");
870 if ($std_item->getLocationType() ==
"LocalFile")
872 $file = $mob_dir.
"/".$std_item->getLocation();
874 $std_item->setWidth(
$size[0]);
875 $std_item->setHeight(
$size[1]);
876 $this->
object->update();
878 $this->ctrl->redirect($this,
"edit");
887 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
890 if ($full_item->getLocationType() ==
"LocalFile")
892 $file = $mob_dir.
"/".$full_item->getLocation();
894 $full_item->setWidth(
$size[0]);
895 $full_item->setHeight(
$size[1]);
896 $this->
object->update();
898 $this->ctrl->redirect($this,
"edit");
909 if ($this->form_gui->checkInput())
911 $title = trim(
$_POST[
"standard_title"]);
912 $this->
object->setTitle($title);
914 $std_item = $this->
object->getMediaItem(
"Standard");
916 $format = $std_item->getFormat();
917 if (
$_POST[
"standard_type"] ==
"Reference")
920 $std_item->setFormat($format);
922 $std_item->setLocationType(
"Reference");
925 if (
$_POST[
"standard_type"] ==
"File")
928 if ($_FILES[
'standard_file'][
'name'] !=
"")
931 $file = $mob_dir.
"/".$file_name;
941 else if (
$_POST[
"standard_resize"])
950 if (
$_POST[
"standard_size"] !=
"original" &&
951 is_int(strpos($format,
"image")))
954 (
int) $_POST[
"standard_width_height"][
"height"], (
boolean) $_POST[
"standard_width_height"][
"contr_prop"]);
956 $std_item->setFormat($format);
960 $std_item->setLocationType(
"LocalFile");
962 $this->
object->setDescription($format);
966 $_POST[
"standard_type"], $mob_dir.
"/".
$location, $std_item->getLocation(),
967 $_POST[
"standard_width_height"][
"constr_prop"], (
$_POST[
"standard_size"] ==
"original"),
968 $_POST[
"standard_width_height"][
"width"], $_POST[
"standard_width_height"][
"height"]);
969 if ($wh[
"info"] !=
"")
974 $std_item->setWidth($wh[
"width"]);
975 $std_item->setHeight($wh[
"height"]);
987 $std_item->getFormat()))
989 if ($_POST[
"standard_autostart"])
991 $std_item->setParameters(
'autostart="true"');
995 $std_item->setParameters(
"");
1005 if ($_POST[
"full_type"] ==
"None")
1007 if ($this->object->hasFullscreenItem())
1009 $this->
object->removeMediaItem(
"Fullscreen");
1014 if ($this->object->hasFullscreenItem())
1016 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1021 $this->
object->addMediaItem($full_item);
1022 $full_item->setPurpose(
"Fullscreen");
1025 $format = $full_item->getFormat();
1026 if ($_POST[
"full_type"] ==
"Reference")
1029 $full_item->setFormat($format);
1030 $full_item->setLocationType(
"Reference");
1032 $type =
"Reference";
1035 if ($_POST[
"full_type"] ==
"File")
1038 if ($_FILES[
'full_file'][
'name'] !=
"")
1041 $file = $mob_dir.
"/".$full_file_name;
1043 $full_file_name,
$file);
1050 else if ($_POST[
"full_resize"])
1059 if ($_POST[
"full_size"] !=
"original" &&
1060 is_int(strpos($format,
"image")))
1063 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1065 $full_item->setFormat($format);
1069 $full_item->setLocationType(
"LocalFile");
1072 if ($_POST[
"full_type"] ==
"Standard")
1074 $format = $std_item->getFormat();
1076 $full_item->setLocationType($std_item->getLocationType());
1077 $full_item->setFormat($format);
1079 $type = $std_item->getLocationType();
1080 if ($type ==
"LocalFile")
1086 if ($_POST[
"full_size"] !=
"original" &&
1087 is_int(strpos($format,
"image")) &&
1088 $full_item->getLocationType() ==
"LocalFile")
1092 (
int) $_POST[
"full_width_height"][
"height"], (
boolean) $_POST[
"full_width_height"][
"contr_prop"]);
1098 $type, $mob_dir.
"/".
$location, $full_item->getLocation(),
1099 $_POST[
"full_width_height"][
"constr_prop"], ($_POST[
"full_size"] ==
"original"),
1100 $_POST[
"full_width_height"][
"width"], $_POST[
"full_width_height"][
"height"]);
1101 if ($wh[
"info"] !=
"")
1106 $full_item->setWidth($wh[
"width"]);
1107 $full_item->setHeight($wh[
"height"]);
1120 $std_item->getFormat()))
1122 if ($_POST[
"full_autostart"])
1124 $full_item->setParameters(
'autostart="true"');
1128 $full_item->setParameters(
"");
1140 $this->
object->update();
1142 $this->ctrl->redirect($this,
"edit");
1146 $this->form_gui->setValuesByPost();
1147 $tpl->setContent($this->form_gui->getHTML());
1158 $std_item =& $this->
object->getMediaItem(
"Standard");
1159 if($this->object->hasFullscreenItem())
1161 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1165 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
1169 $cur_subdir =
$_GET[
"cdir"];
1170 if(
$_GET[
"newdir"] ==
"..")
1172 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir,
"/"));
1176 if (!empty(
$_GET[
"newdir"]))
1178 if (!empty($cur_subdir))
1180 $cur_subdir = $cur_subdir.
"/".
$_GET[
"newdir"];
1184 $cur_subdir =
$_GET[
"newdir"];
1189 $cur_subdir = str_replace(
".",
"", $cur_subdir);
1191 $cur_dir = (!empty($cur_subdir))
1192 ? $mob_dir.
"/".$cur_subdir
1196 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_files.html",
"Services/MediaObjects");
1198 $this->ctrl->setParameter($this,
"cdir", urlencode($cur_subdir));
1199 $this->tpl->setVariable(
"FORMACTION1", $this->ctrl->getFormAction($this));
1202 $this->tpl->setVariable(
"TXT_NEW_DIRECTORY", $this->lng->txt(
"cont_new_dir"));
1203 $this->tpl->setVariable(
"TXT_NEW_FILE", $this->lng->txt(
"cont_new_file"));
1204 $this->tpl->setVariable(
"CMD_NEW_DIR",
"createDirectory");
1205 $this->tpl->setVariable(
"CMD_NEW_FILE",
"uploadFile");
1206 $this->tpl->setVariable(
"BTN_NEW_DIR", $this->lng->txt(
"create"));
1207 $this->tpl->setVariable(
"BTN_NEW_FILE", $this->lng->txt(
"upload"));
1210 $this->tpl->addBlockfile(
"FILE_TABLE",
"files",
"tpl.table.html");
1213 $this->tpl->addBlockfile(
"TBL_CONTENT",
"tbl_content",
"tpl.mob_file_row.html",
"Services/MediaObjects");
1217 $obj_str = ($this->call_by_reference) ?
"" :
"&obj_id=".$this->obj_id;
1218 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
1220 $tbl->setTitle($this->lng->txt(
"cont_files").
" ".$cur_subdir);
1223 $tbl->setHeaderNames(array(
"",
"", $this->lng->txt(
"cont_dir_file"),
1224 $this->lng->txt(
"cont_size"), $this->lng->txt(
"cont_purpose")));
1226 $cols = array(
"",
"",
"dir_file",
"size",
"purpose");
1227 $header_params = array(
"ref_id" =>
$_GET[
"ref_id"],
"obj_id" =>
$_GET[
"obj_id"],
1228 "cmd" =>
"editFiles",
"hier_id" =>
$_GET[
"hier_id"],
"item_id" =>
$_GET[
"item_id"]);
1229 $tbl->setHeaderVars($cols, $header_params);
1230 $tbl->setColumnWidth(array(
"1%",
"1%",
"33%",
"33%",
"32%"));
1233 $tbl->setOrderColumn(
$_GET[
"sort_by"]);
1234 $tbl->setOrderDirection(
$_GET[
"sort_order"]);
1235 $tbl->setLimit(
$_GET[
"limit"]);
1236 $tbl->setOffset(
$_GET[
"offset"]);
1237 $tbl->setMaxCount($this->maxcount);
1240 $this->tpl->setVariable(
"COLUMN_COUNTS", 5);
1244 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1245 $this->tpl->setVariable(
"BTN_NAME",
"deleteFile");
1246 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
1247 $this->tpl->parseCurrentBlock();
1249 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1250 $this->tpl->setVariable(
"BTN_NAME",
"assignStandard");
1251 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_std"));
1252 $this->tpl->parseCurrentBlock();
1254 $this->tpl->setCurrentBlock(
"tbl_action_btn");
1255 $this->tpl->setVariable(
"BTN_NAME",
"assignFullscreen");
1256 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"cont_assign_full"));
1257 $this->tpl->parseCurrentBlock();
1260 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
1266 $tbl->setMaxCount(count($entries));
1267 $entries = array_slice($entries,
$_GET[
"offset"],
$_GET[
"limit"]);
1270 if(count($entries) > 0)
1273 foreach($entries as $entry)
1275 if(($entry[
"entry"] ==
".") || ($entry[
"entry"] ==
".." && empty($cur_subdir)))
1281 if($entry[
"type"] ==
"dir")
1283 $this->tpl->setCurrentBlock(
"FileLink");
1284 $this->ctrl->setParameter($this,
"cdir", $cur_subdir);
1285 $this->ctrl->setParameter($this,
"newdir", rawurlencode($entry[
"entry"]));
1286 $this->tpl->setVariable(
"LINK_FILENAME", $this->ctrl->getLinkTarget($this,
"editFiles"));
1287 $this->tpl->setVariable(
"TXT_FILENAME", $entry[
"entry"]);
1288 $this->tpl->parseCurrentBlock();
1290 $this->tpl->setVariable(
"ICON",
"<img src=\"".
1295 $this->tpl->setCurrentBlock(
"File");
1296 $this->tpl->setVariable(
"TXT_FILENAME2", $entry[
"entry"]);
1297 $this->tpl->parseCurrentBlock();
1300 $this->tpl->setCurrentBlock(
"tbl_content");
1302 $this->tpl->setVariable(
"CSS_ROW", $css_row);
1304 $this->tpl->setVariable(
"TXT_SIZE", $entry[
"size"]);
1305 $this->tpl->setVariable(
"CHECKBOX_ID", $entry[
"entry"]);
1306 $compare = (!empty($cur_subdir))
1307 ? $cur_subdir.
"/".$entry[
"entry"]
1310 if ($std_item->getLocation() == $compare)
1312 $purpose[] = $this->lng->txt(
"cont_std_view");
1314 if($this->object->hasFullscreenItem())
1316 if ($full_item->getLocation() == $compare)
1318 $purpose[] = $this->lng->txt(
"cont_fullscreen");
1321 $this->tpl->setVariable(
"TXT_PURPOSE", implode($purpose,
", "));
1323 $this->tpl->parseCurrentBlock();
1328 $this->tpl->setCurrentBlock(
"notfound");
1329 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
1330 $this->tpl->setVariable(
"NUM_COLS", 4);
1331 $this->tpl->parseCurrentBlock();
1334 $this->tpl->parseCurrentBlock();
1345 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1347 $cur_dir = (!empty($cur_subdir))
1348 ? $mob_dir.
"/".$cur_subdir
1351 $new_dir = str_replace(
".",
"",
$_POST[
"new_dir"]);
1352 $new_dir = str_replace(
"/",
"", $new_dir);
1354 if (!empty($new_dir))
1358 $this->ctrl->saveParameter($this,
"cdir");
1359 $this->ctrl->redirect($this,
"editFiles");
1368 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1370 $cur_dir = (!empty($cur_subdir))
1371 ? $mob_dir.
"/".$cur_subdir
1373 if (is_file($_FILES[
"new_file"][
"tmp_name"]))
1378 $file = $cur_dir.
"/".$file_name;
1384 $this->ctrl->saveParameter($this,
"cdir");
1385 $this->ctrl->redirect($this,
"editFiles");
1393 if (!isset(
$_POST[
"file"]))
1395 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1398 if (count(
$_POST[
"file"]) > 1)
1400 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1404 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1406 $cur_dir = (!empty($cur_subdir))
1407 ? $mob_dir.
"/".$cur_subdir
1411 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1416 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1419 $std_item =& $this->
object->getMediaItem(
"Standard");
1420 $std_item->setLocationType(
"LocalFile");
1423 $std_item->setFormat($format);
1424 $this->
object->update();
1426 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1435 if (!isset(
$_POST[
"file"]))
1437 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1440 if (count(
$_POST[
"file"]) > 1)
1442 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1446 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1448 $cur_dir = (!empty($cur_subdir))
1449 ? $mob_dir.
"/".$cur_subdir
1453 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1458 $this->ilias->raiseError($this->lng->txt(
"cont_select_file"),$this->ilias->error_obj->MESSAGE);
1461 if(!$this->object->hasFullScreenItem())
1463 $std_item =& $this->
object->getMediaItem(
"Standard");
1467 $full_item->setMobId($std_item->getMobId());
1469 $full_item->setLocationType(
"LocalFile");
1471 $full_item->setPurpose(
"Fullscreen");
1472 $this->
object->addMediaItem($full_item);
1476 $full_item =& $this->
object->getMediaItem(
"Fullscreen");
1478 $full_item->setLocationType(
"LocalFile");
1481 $full_item->setFormat($format);
1483 $this->
object->update();
1485 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
1494 $this->
object->removeMediaItem(
"Fullscreen");
1495 $this->
object->update();
1497 $this->ctrl->redirect($this,
"edit");
1506 if (!$this->object->hasFullScreenItem())
1508 $std_item =& $this->
object->getMediaItem(
"Standard");
1510 $full_item->setMobId($std_item->getMobId());
1511 $full_item->setLocation($std_item->getLocation());
1512 $full_item->setLocationType($std_item->getLocationType());
1513 $full_item->setFormat($std_item->getFormat());
1514 $full_item->setWidth($std_item->getWidth());
1515 $full_item->setHeight($std_item->getHeight());
1516 $full_item->setCaption($std_item->getCaption());
1517 $full_item->setTextRepresentation($std_item->getTextRepresentation());
1518 $full_item->setPurpose(
"Fullscreen");
1519 $this->
object->addMediaItem($full_item);
1521 $this->
object->update();
1524 $this->ctrl->redirect($this,
"edit");
1533 if (!isset(
$_POST[
"file"]))
1535 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1538 if (count(
$_POST[
"file"]) > 1)
1540 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
1543 if (
$_POST[
"file"][0] ==
"..")
1545 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
1548 $cur_subdir = str_replace(
".",
"",
$_GET[
"cdir"]);
1550 $cur_dir = (!empty($cur_subdir))
1551 ? $mob_dir.
"/".$cur_subdir
1555 ? $cur_subdir.
"/".
$_POST[
"file"][0]
1558 $full_item =& $this->object->getMediaItem(
"Fullscreen");
1559 $std_item =& $this->
object->getMediaItem(
"Standard");
1561 if (
$location == $std_item->getLocation())
1563 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_std"),$this->ilias->error_obj->MESSAGE);
1566 if($this->object->hasFullScreenItem())
1568 if (
$location == $full_item->getLocation())
1570 $this->ilias->raiseError($this->lng->txt(
"cont_cant_del_full"),$this->ilias->error_obj->MESSAGE);
1578 $this->ilias->raiseError($this->lng->txt(
"cont_std_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1581 if($this->object->hasFullScreenItem())
1585 $this->ilias->raiseError($this->lng->txt(
"cont_full_is_in_dir"),$this->ilias->error_obj->MESSAGE);
1590 if (@is_file(
$file))
1600 $this->ctrl->saveParameter($this,
"cdir");
1601 $this->ctrl->redirect($this,
"editFiles");
1620 $ilTabs->addSubTab(
"current_usages", $lng->txt(
"cont_current_usages"),
1621 $ilCtrl->getLinkTarget($this,
"showUsages"));
1623 $ilTabs->addSubTab(
"all_usages", $lng->txt(
"cont_all_usages"),
1624 $ilCtrl->getLinkTarget($this,
"showAllUsages"));
1628 $ilTabs->activateSubTab(
"all_usages");
1629 $cmd =
"showAllUsages";
1633 $ilTabs->activateSubTab(
"current_usages");
1634 $cmd =
"showUsages";
1637 include_once(
"./Services/MediaObjects/classes/class.ilMediaObjectUsagesTableGUI.php");
1639 $this->
object, $a_all);
1640 $tpl->setContent($usages_table->getHTML());
1650 $tpl =&
new ilTemplate(
"tpl.media_info.html",
true,
true,
"Services/MediaObjects");
1651 $types = array(
"Standard",
"Fullscreen");
1652 foreach ($types as $type)
1654 if($type ==
"Fullscreen" && !$a_mob->hasFullScreenItem())
1659 $med = $a_mob->getMediaItem($type);
1665 $tpl->setCurrentBlock(
"media_info");
1666 if ($type ==
"Standard")
1668 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_std_view"));
1672 $tpl->setVariable(
"TXT_PURPOSE", $lng->txt(
"cont_fullscreen"));
1674 $tpl->setVariable(
"TXT_TYPE", $lng->txt(
"cont_".strtolower($med->getLocationType())));
1675 $tpl->setVariable(
"VAL_LOCATION", $med->getLocation());
1676 if ($med->getLocationType() ==
"LocalFile")
1687 $tpl->setVariable(
"VAL_FILE_SIZE",
" ($size ".$lng->txt(
"bytes").
")");
1689 $tpl->setVariable(
"TXT_FORMAT", $lng->txt(
"cont_format"));
1690 $tpl->setVariable(
"VAL_FORMAT", $med->getFormat());
1691 if ($med->getWidth() !=
"" && $med->getHeight() !=
"")
1693 $tpl->setCurrentBlock(
"size");
1694 $tpl->setVariable(
"TXT_SIZE", $lng->txt(
"size"));
1695 $tpl->setVariable(
"VAL_SIZE", $med->getWidth().
"x".$med->getHeight());
1696 $tpl->parseCurrentBlock();
1700 if ($orig_size = $med->getOriginalSize())
1702 if ($orig_size[
"width"] != $med->getWidth() ||
1703 $orig_size[
"height"] != $med->getHeight())
1705 $tpl->setCurrentBlock(
"orig_size");
1706 $tpl->setVariable(
"TXT_ORIG_SIZE", $lng->txt(
"cont_orig_size"));
1707 $tpl->setVariable(
"ORIG_WIDTH", $orig_size[
"width"]);
1708 $tpl->setVariable(
"ORIG_HEIGHT", $orig_size[
"height"]);
1709 $tpl->parseCurrentBlock();
1714 if($med && strlen($med->getCaption()))
1716 $tpl->setCurrentBlock(
'additional_info');
1717 $tpl->setVariable(
'ADD_INFO',$lng->txt(
'cont_caption').
': '.$med->getCaption());
1718 $tpl->parseCurrentBlock();
1722 if ($type ==
"Standard")
1724 include_once
'./Services/MetaData/classes/class.ilMDKeyword.php';
1727 $tpl->setCurrentBlock(
'additional_info');
1728 $tpl->setVariable(
'ADD_INFO',$lng->txt(
'keywords').
': '.implode(
', ',$kws));
1729 $tpl->parseCurrentBlock();
1733 $tpl->setCurrentBlock(
"media_info");
1734 $tpl->parseCurrentBlock();
1749 $this->
getTabs($this->tabs_gui);
1752 $this->tpl->clearHeader();
1753 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject")
1756 $this->tpl->setTitle($this->object->getTitle());
1762 $this->tpl->setTitle($this->lng->txt(
"cont_create_mob"));
1772 global $ilTabs, $ilHelp;
1774 $ilHelp->setScreenIdComponent(
"mob");
1777 if (is_object($this->
object) && strtolower(get_class($this->
object)) ==
"ilobjmediaobject"
1778 && $this->object->getId() > 0)
1781 $ilTabs->addTarget(
"cont_mob_def_prop",
1782 $this->ctrl->getLinkTarget($this,
"edit"),
"edit",
1785 $st_item =& $this->
object->getMediaItem(
"Standard");
1788 if (substr($st_item->getFormat(), 0, 6) ==
"video/" && DEVMODE)
1790 $ilTabs->addTarget(
"mob_video_tools",
1791 $this->ctrl->getLinkTargetByClass(
"ilobjmediaobjectgui",
"showVideoTool"),
1792 "showVideoTool",
"ilobjmediaobjectgui");
1799 $format = $st_item->getFormat();
1800 if (substr($format, 0, 5) ==
"image")
1802 $ilTabs->addTarget(
"cont_def_map_areas",
1803 $this->ctrl->getLinkTargetByClass(
1804 array(
"ilobjmediaobjectgui",
"ilimagemapeditorgui"),
"editMapAreas"),
"editMapAreas",
1805 "ilimagemapeditorgui");
1810 $ilTabs->addTarget(
"cont_mob_usages",
1811 $this->ctrl->getLinkTarget($this,
"showUsages"),
"showUsages",
1815 $std_item = $this->
object->getMediaItem(
"Standard");
1816 $full_item = $this->
object->getMediaItem(
"Fullscreen");
1818 if ($mset->get(
"file_manager_always") ||
1827 $ilTabs->addTarget(
"cont_files",
1828 $this->ctrl->getLinkTargetByClass(
1829 array(
"ilobjmediaobjectgui",
"ilfilesystemgui"),
"listFiles"),
"",
1833 $ilTabs->addTarget(
"meta_data",
1834 $this->ctrl->getLinkTargetByClass(
1835 array(
"ilobjmediaobjectgui",
"ilmdeditorgui"),
'listSection'),
1836 "",
"ilmdeditorgui");
1841 if ($this->back_title !=
"")
1843 $tabs_gui->setBackTarget($this->back_title,
1844 $this->ctrl->getParentReturn($this));
1858 include_once(
"./Services/MediaObjects/classes/class.ilFFmpeg.php");
1865 $formats_str = implode($formats,
"<br />");
1866 $tpl->setContent($formats_str);
1882 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1883 iljQueryUtil::initjQUery($a_tpl);
1884 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1886 $a_tpl->addJavascript(
"./Services/COPage/js/ilCOPagePres.js");
1888 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
1901 $ilTabs->activateTab(
"cont_mob_def_prop");
1903 $ilTabs->addSubTab(
"general",
1904 $lng->txt(
"mob_general"),
1905 $ilCtrl->getLinkTarget($this,
"edit"));
1907 if ($this->object->getMediaItem(
"Standard")->getFormat() ==
"video/webm" ||
1908 $this->
object->getMediaItem(
"Standard")->getFormat() ==
"video/mp4")
1910 $ilTabs->addSubTab(
"subtitles",
1911 $lng->txt(
"mob_subtitles"),
1912 $ilCtrl->getLinkTarget($this,
"listSubtitleFiles"));
1915 $ilTabs->activateSubTab($a_active);
1931 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
1932 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
1933 $fi =
new ilFileInputGUI($lng->txt(
"mob_subtitle_file").
" (.srt)",
"subtitle_file");
1935 $ilToolbar->addInputItem($fi,
true);
1938 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1939 include_once(
"./Services/MetaData/classes/class.ilMDLanguageItem.php");
1943 $si->setValue($ilUser->getLanguage());
1944 $ilToolbar->addInputItem(
$si,
true);
1946 $ilToolbar->addFormButton($lng->txt(
"upload"),
"uploadSubtitleFile");
1948 include_once(
"./Services/MediaObjects/classes/class.ilMobSubtitleTableGUI.php");
1951 $tpl->setContent(
$tab->getHTML());
1968 $ilCtrl->redirect($this,
"listSubtitleFiles");
1978 $lng->loadLanguageModule(
"meta");
1980 if (!is_array(
$_POST[
"srt"]) || count(
$_POST[
"srt"]) == 0)
1983 $ilCtrl->redirect($this,
"listSubtitleFiles");
1987 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
1989 $cgui->setFormAction($ilCtrl->getFormAction($this));
1990 $cgui->setHeaderText($lng->txt(
"mob_really_delete_srt"));
1991 $cgui->setCancel($lng->txt(
"cancel"),
"listSubtitleFiles");
1992 $cgui->setConfirm($lng->txt(
"delete"),
"deleteSrtFiles");
1994 foreach (
$_POST[
"srt"] as $i)
1996 $cgui->addItem(
"srt[]", $i,
"subtitle_".$i.
".srt (".$lng->txt(
"meta_l_".$i).
")");
1999 $tpl->setContent($cgui->getHTML());
2010 foreach (
$_POST[
"srt"] as $i)
2012 if (strlen($i) == 2 && !is_int(strpos($i,
".")))
2014 $this->
object->removeAdditionalFile(
"srt/subtitle_".$i.
".srt");
2018 $ilCtrl->redirect($this,
"listSubtitleFiles");