24 require_once (
"./Services/COPage/classes/class.ilPageContentGUI.php");
25 require_once (
"./Services/COPage/classes/class.ilMediaAliasItem.php");
26 require_once (
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
58 $this->header = $a_title;
73 $this->enabledmapareas = $a_enabledmapareas;
83 return $this->enabledmapareas;
94 $next_class = $this->ctrl->getNextClass($this);
97 $cmd = $this->ctrl->getCmd();
99 if (is_object ($this->content_obj))
102 $this->
getTabs($this->tabs_gui);
103 $tpl->setVariable(
"HEADER", $lng->txt(
"mob").
": ".
104 $this->content_obj->getMediaObject()->getTitle());
106 $mob_gui =&
new ilObjMediaObjectGUI(
"", $this->content_obj->getMediaObject()->getId(),
false,
false);
109 $mob_gui->getTabs($this->tabs_gui);
117 case "ilobjmediaobjectgui":
118 include_once (
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
120 $this->tpl->setTitle($this->lng->txt(
"mob").
": ".
121 $this->content_obj->getMediaObject()->getTitle());
122 $mob_gui =&
new ilObjMediaObjectGUI(
"", $this->content_obj->getMediaObject()->getId(),
false,
false);
125 $ret =& $this->ctrl->forwardCommand($mob_gui);
129 case "ilpcimagemapeditorgui":
130 require_once(
"./Services/COPage/classes/class.ilPCImageMapEditorGUI.php");
131 $ilTabs->setTabActive(
"cont_inst_map_areas");
134 $ret = $this->ctrl->forwardCommand($image_map_edit);
135 $tpl->setContent(
$ret);
149 function insert($a_post_cmd =
"edpost", $a_submit_cmd =
"create_mob")
153 if (
$_GET[
"subCmd"] ==
"insertNew")
155 $_SESSION[
"cont_media_insert"] =
"insertNew";
157 if (
$_GET[
"subCmd"] ==
"insertFromPool")
159 $_SESSION[
"cont_media_insert"] =
"insertFromPool";
162 if ((
$_GET[
"subCmd"] ==
"") &&
$_SESSION[
"cont_media_insert"] !=
"")
167 switch (
$_GET[
"subCmd"])
169 case "insertFromPool":
173 case "poolSelection":
184 $ilTabs->setSubTabActive(
"cont_new_mob");
186 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_new.html",
187 "./Services/MediaObjects");
188 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_insert_mob"));
189 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
194 $this->tpl->setVariable(
"TXT_STANDARD_VIEW", $this->lng->txt(
"cont_std_view"));
195 $this->tpl->setVariable(
"TXT_FILE", $this->lng->txt(
"cont_file"));
196 $this->tpl->setVariable(
"TXT_REFERENCE", $this->lng->txt(
"cont_reference"));
197 $this->tpl->setVariable(
"TXT_REF_HELPTEXT", $this->lng->txt(
"cont_ref_helptext"));
198 $this->tpl->setVariable(
"TXT_WIDTH", $this->lng->txt(
"cont_width"));
199 $this->tpl->setVariable(
"TXT_HEIGHT", $this->lng->txt(
"cont_height"));
200 $this->tpl->setVariable(
"TXT_ORIGINAL_SIZE", $this->lng->txt(
"cont_orig_size"));
201 $this->tpl->setVariable(
"TXT_CAPTION", $this->lng->txt(
"cont_caption"));
202 $this->tpl->setVariable(
"TXT_FULLSCREEN_VIEW", $this->lng->txt(
"cont_fullscreen"));
203 $this->tpl->setVariable(
"TXT_PARAMETER", $this->lng->txt(
"cont_parameter"));
204 $this->tpl->setVariable(
"TXT_RESIZE", $this->lng->txt(
"cont_resize_image"));
205 $this->tpl->setVariable(
"TXT_RESIZE_EXPLANATION", $this->lng->txt(
"cont_resize_explanation"));
209 $this->tpl->setCurrentBlock(
"commands");
210 $this->tpl->setVariable(
"BTN_NAME", $a_submit_cmd);
211 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
212 $this->tpl->setVariable(
"BTN_CANCEL",
"cancelCreate");
213 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
214 $this->tpl->parseCurrentBlock();
227 if (
$_SESSION[
"cont_media_pool"] !=
"" &&
228 $ilAccess->checkAccess(
"write",
"",
$_SESSION[
"cont_media_pool"])
231 $tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
232 $tpl->setCurrentBlock(
"btn_cell");
233 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
234 $tpl->setVariable(
"BTN_LINK",
235 $ilCtrl->getLinkTarget($this,
"insert"));
236 $ilCtrl->setParameter($this,
"subCmd",
"");
237 $tpl->setVariable(
"BTN_TXT", $lng->txt(
"cont_select_media_pool"));
238 $tpl->parseCurrentBlock();
241 $ilTabs->setSubTabActive(
"cont_mob_from_media_pool");
243 include_once(
"./Modules/MediaPool/classes/class.ilObjMediaPool.php");
244 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolTableGUI.php");
246 $ilCtrl->setParameter($this,
"subCmd",
"insertFromPool");
250 $tpl->setContent($mpool_table->getHTML());
266 $ilCtrl->setParameter($this,
"subCmd",
"insertFromPool");
267 $ilCtrl->redirect($this,
"insert");
278 $ilTabs->setSubTabActive(
"cont_mob_from_media_pool");
280 include_once
"./Services/COPage/classes/class.ilPoolSelectorGUI.php";
282 if (
$_GET[
"expand"] ==
"")
284 $expanded = $tree->readRootId();
288 $expanded =
$_GET[
"expand"];
290 $exp->setExpand($expanded);
292 $exp->setTargetGet(
"sel_id");
293 $this->ctrl->setParameter($this,
"target_type", $a_type);
294 $ilCtrl->setParameter($this,
"subCmd",
"poolSelection");
295 $exp->setParamsGet($this->ctrl->getParameterArray($this,
"insert"));
298 $exp->setFiltered(
true);
300 $exp->addFilter(
"root");
301 $exp->addFilter(
"cat");
302 $exp->addFilter(
"grp");
303 $exp->addFilter(
"fold");
304 $exp->addFilter(
"crs");
305 $exp->addFilter(
"mep");
307 $sel_types = array(
'mep');
311 $tpl->setContent($exp->getOutput());
323 if (
$_GET[
"subCmd"] ==
"insertFromPool")
325 if (is_array($_POST[
"id"]))
327 for($i = count($_POST[
"id"]) - 1; $i>=0; $i--)
329 include_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
331 $this->content_obj->readMediaObject($_POST[
"id"][$i]);
332 $this->content_obj->createAlias($this->pg_obj,
$_GET[
"hier_id"], $this->pc_id);
334 $this->updated = $this->pg_obj->update();
337 $ilCtrl->returnToParent($this);
341 if ($_POST[
"standard_type"] ==
"File")
343 $title = $_FILES[
'standard_file'][
'name'];
347 $title = $_POST[
"standard_reference"];
351 include_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
353 $this->content_obj->createMediaObject();
354 $media_obj = $this->content_obj->getMediaObject();
355 $media_obj->setTitle(
$title);
357 $media_obj->setDescription(
"");
358 $media_obj->create();
361 $media_obj->createDirectory();
365 $media_obj->addMediaItem($media_item);
366 $media_item->setPurpose(
"Standard");
368 if ($_POST[
"standard_type"] ==
"File")
370 $file = $mob_dir.
"/".$_FILES[
'standard_file'][
'name'];
373 $_FILES[
'standard_file'][
'name'],
$file,
false))
375 $media_obj->delete();
376 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
382 $location = $_FILES[
'standard_file'][
'name'];
385 if ($_POST[
"standard_size"] !=
"original" &&
386 $_POST[
"standard_resize"] ==
"y" &&
387 is_int(strpos($format,
"image")))
390 $_POST[
"standard_height"]);
394 $media_item->setFormat($format);
396 $media_item->setLocationType(
"LocalFile");
397 $media_obj->setTitle($_FILES[
'standard_file'][
'name']);
402 $media_item->setFormat($format);
403 $media_item->setLocation($_POST[
"standard_reference"]);
404 $media_item->setLocationType(
"Reference");
405 $media_obj->setTitle($_POST[
"standard_reference"]);
408 $media_obj->setDescription($format);
411 if ($_POST[
"standard_size"] ==
"original")
416 $media_item->setWidth(
$size[0]);
417 $media_item->setHeight(
$size[1]);
421 $media_item->setWidth(500);
422 $media_item->setHeight(400);
427 $media_item->setWidth($_POST[
"standard_width"]);
428 $media_item->setHeight($_POST[
"standard_height"]);
431 if ($_POST[
"standard_caption"] !=
"")
436 if ($_POST[
"standard_param"] !=
"")
441 $media_item->setHAlign(
"Left");
444 if ($_POST[
"fullscreen"] ==
"y")
447 $media_obj->addMediaItem($media_item);
448 $media_item->setPurpose(
"Fullscreen");
451 if ($_POST[
"full_type"] ==
"File")
453 if ($_FILES[
'full_file'][
'name'] !=
"")
455 $file = $mob_dir.
"/".$_FILES[
'full_file'][
'name'];
458 $_FILES[
'full_file'][
'name'],
$file,
false))
460 $media_obj->delete();
461 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
466 if ($_FILES[
'full_file'][
'name'] !=
"" ||
467 ($_POST[
"full_size"] !=
"original" &&
468 $_POST[
"full_resize"] ==
"y" &&
469 is_int(strpos($format,
"image")))
474 $location = $_FILES[
'full_file'][
'name'];
477 if ($_POST[
"full_size"] !=
"original" &&
478 $_POST[
"full_resize"] ==
"y" &&
479 is_int(strpos($format,
"image")))
482 $_POST[
"full_height"]);
486 $media_item->setFormat($format);
488 $media_item->setLocationType(
"LocalFile");
493 if ($_POST[
"full_reference"] !=
"")
496 $media_item->setFormat($format);
497 $media_item->setLocation($_POST[
"full_reference"]);
498 $media_item->setLocationType(
"Reference");
503 if ($_POST[
"full_size"] ==
"original")
508 $media_item->setWidth(
$size[0]);
509 $media_item->setHeight(
$size[1]);
513 $media_item->setWidth(500);
514 $media_item->setHeight(400);
519 $media_item->setWidth($_POST[
"full_width"]);
520 $media_item->setHeight($_POST[
"full_height"]);
523 if ($_POST[
"full_caption"] !=
"")
528 if ($_POST[
"full_param"] !=
"")
535 $media_obj->update();
542 $this->content_obj->createAlias($this->pg_obj, $this->hier_id, $this->pc_id);
543 $this->updated = $this->pg_obj->update();
544 if ($this->updated ===
true)
546 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
566 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
570 $this->content_obj->getPcId());
571 $std_item =& $this->content_obj->getMediaObject()->getMediaItem(
"Standard");
574 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.mob_alias_properties.html",
"Services/COPage");
575 $this->tpl->setVariable(
"TXT_ACTION", $this->lng->txt(
"cont_edit_mob_alias_prop"));
576 $this->tpl->setVariable(
"TXT_STANDARD_VIEW", $this->lng->txt(
"cont_std_view"));
577 $this->tpl->setVariable(
"TXT_DERIVE", $this->lng->txt(
"cont_derive_from_obj"));
578 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"cont_".strtolower($std_item->getLocationType())));
579 $this->tpl->setVariable(
"TXT_LOCATION", $std_item->getLocation());
580 $this->tpl->setVariable(
"TXT_FORMAT", $this->lng->txt(
"cont_format"));
581 $this->tpl->setVariable(
"VAL_FORMAT", $std_item->getFormat());
582 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
587 $this->tpl->setVariable(
"TXT_MOB_WIDTH", $this->lng->txt(
"cont_width"));
588 $this->tpl->setVariable(
"INPUT_MOB_WIDTH",
"mob_width");
589 $this->tpl->setVariable(
"VAL_MOB_WIDTH", $std_alias_item->getWidth());
592 $this->tpl->setVariable(
"TXT_MOB_HEIGHT", $this->lng->txt(
"cont_height"));
593 $this->tpl->setVariable(
"INPUT_MOB_HEIGHT",
"mob_height");
594 $this->tpl->setVariable(
"VAL_MOB_HEIGHT", $std_alias_item->getHeight());
597 $this->tpl->setVariable(
"TXT_CAPTION", $this->lng->txt(
"cont_caption"));
598 $this->tpl->setVariable(
"INPUT_CAPTION",
"mob_caption");
599 $this->tpl->setVariable(
"VAL_CAPTION", $std_alias_item->getCaption());
603 $this->tpl->setVariable(
"TXT_PARAMETER", $this->lng->txt(
"cont_parameter"));
604 $this->tpl->setVariable(
"INPUT_PARAMETERS",
"mob_parameters");
605 $this->tpl->setVariable(
"VAL_PARAMETERS", $std_alias_item->getParameterString());
609 $this->tpl->setVariable(
"VAL_OBJ_ST_SIZE", $std_item->
getWidth().
" / ".$std_item->
getHeight());
610 $this->tpl->setVariable(
"VAL_OBJ_ST_CAPTION", $std_item->
getCaption());
612 if ($std_alias_item->definesSize())
614 $this->tpl->setVariable(
"DERIVE_ST_SIZE_N",
"checked=\"1\"");
618 $this->tpl->setVariable(
"DERIVE_ST_SIZE_Y",
"checked=\"1\"");
620 if ($std_alias_item->definesCaption())
622 $this->tpl->setVariable(
"DERIVE_ST_CAPTION_N",
"checked=\"1\"");
626 $this->tpl->setVariable(
"DERIVE_ST_CAPTION_Y",
"checked=\"1\"");
628 if ($std_alias_item->definesParameters())
630 $this->tpl->setVariable(
"DERIVE_ST_PARAMETER_N",
"checked=\"1\"");
634 $this->tpl->setVariable(
"DERIVE_ST_PARAMETER_Y",
"checked=\"1\"");
638 if($this->content_obj->getMediaObject()->hasFullScreenItem())
640 $this->tpl->setCurrentBlock(
"fullscreen");
642 $this->content_obj->getPcId());
643 $full_item =& $this->content_obj->getMediaObject()->getMediaItem(
"Fullscreen");
645 $this->tpl->setVariable(
"TXT_FULLSCREEN_VIEW", $this->lng->txt(
"cont_fullscreen"));
646 $this->tpl->setVariable(
"TXT_FULL_TYPE", $this->lng->txt(
"cont_".strtolower($full_item->getLocationType())));
647 $this->tpl->setVariable(
"TXT_FULL_LOCATION", $full_item->getLocation());
649 $this->tpl->setVariable(
"TXT_FULL_FORMAT", $this->lng->txt(
"cont_format"));
650 $this->tpl->setVariable(
"VAL_FULL_FORMAT", $full_item->getFormat());
653 $this->tpl->setVariable(
"TXT_FULL_WIDTH", $this->lng->txt(
"cont_width"));
654 $this->tpl->setVariable(
"INPUT_FULL_WIDTH",
"full_width");
657 $this->tpl->setVariable(
"TXT_FULL_HEIGHT", $this->lng->txt(
"cont_height"));
658 $this->tpl->setVariable(
"INPUT_FULL_HEIGHT",
"full_height");
661 $this->tpl->setVariable(
"TXT_FULL_CAPTION", $this->lng->txt(
"cont_caption"));
662 $this->tpl->setVariable(
"INPUT_FULL_CAPTION",
"full_caption");
665 $this->tpl->setVariable(
"TXT_FULL_PARAMETER", $this->lng->txt(
"cont_parameter"));
666 $this->tpl->setVariable(
"INPUT_FULL_PARAMETERS",
"full_parameters");
669 $this->tpl->setVariable(
"VAL_OBJ_FULL_SIZE", $full_item->
getWidth().
" / ".$full_item->
getHeight());
670 $this->tpl->setVariable(
"VAL_OBJ_FULL_CAPTION", $full_item->
getCaption());
672 if ($full_alias_item->definesSize())
674 $this->tpl->setVariable(
"DERIVE_FULL_SIZE_N",
"checked=\"1\"");
678 $this->tpl->setVariable(
"DERIVE_FULL_SIZE_Y",
"checked=\"1\"");
680 if ($full_alias_item->definesCaption())
682 $this->tpl->setVariable(
"DERIVE_FULL_CAPTION_N",
"checked=\"1\"");
686 $this->tpl->setVariable(
"DERIVE_FULL_CAPTION_Y",
"checked=\"1\"");
688 if ($full_alias_item->definesParameters())
690 $this->tpl->setVariable(
"DERIVE_FULL_PARAMETER_N",
"checked=\"1\"");
694 $this->tpl->setVariable(
"DERIVE_FULL_PARAMETER_Y",
"checked=\"1\"");
697 if ($full_alias_item->exists())
699 $this->tpl->setVariable(
"FULLSCREEN_CHECKED",
"checked=\"1\"");
702 $this->tpl->setVariable(
"VAL_FULL_WIDTH", $full_alias_item->getWidth());
705 $this->tpl->setVariable(
"VAL_FULL_HEIGHT", $full_alias_item->getHeight());
708 $this->tpl->setVariable(
"VAL_FULL_CAPTION", $full_alias_item->getCaption());
711 $this->tpl->setVariable(
"VAL_FULL_PARAMETERS", $full_alias_item->getParameterString());
714 $this->tpl->parseCurrentBlock();
718 $this->tpl->setCurrentBlock(
"commands");
719 $this->tpl->setVariable(
"BTN_NAME",
"saveAliasProperties");
720 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
721 $this->tpl->parseCurrentBlock();
732 $this->content_obj->getPcId());
734 $this->content_obj->getPcId());
737 if($_POST[
"derive_st_size"] ==
"y")
743 $std_item->setWidth($_POST[
"mob_width"]);
744 $std_item->setHeight($_POST[
"mob_height"]);
748 if($_POST[
"derive_st_caption"] ==
"y")
750 $std_item->deriveCaption();
758 if($_POST[
"derive_st_parameter"] ==
"y")
760 $std_item->deriveParameters();
767 if($this->content_obj->getMediaObject()->hasFullscreenItem())
769 if ($_POST[
"fullscreen"] ==
"y")
771 if (!$full_item->
exists())
777 if($_POST[
"derive_full_size"] ==
"y")
783 $full_item->
setWidth($_POST[
"full_width"]);
784 $full_item->
setHeight($_POST[
"full_height"]);
788 if($_POST[
"derive_full_caption"] ==
"y")
798 if($_POST[
"derive_full_parameter"] ==
"y")
816 $this->updated = $this->pg_obj->update();
817 if ($this->updated ===
true)
819 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
823 $this->pg_obj->addHierIDs();
833 $this->ilias->account->addObjectToClipboard($this->content_obj->getMediaObject()->getId(), $this->content_obj->getMediaObject()->getType()
834 , $this->content_obj->getMediaObject()->getTitle());
836 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
845 $this->content_obj->getPcId());
847 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
848 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
857 $this->content_obj->getPcId());
859 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
860 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
869 $this->content_obj->getPcId());
871 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
872 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
881 $this->content_obj->getPcId());
883 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
884 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
893 $this->content_obj->getPcId());
895 $_SESSION[
"il_pg_error"] = $this->pg_obj->update();
896 $this->ctrl->returnToParent($this,
"jump".$this->hier_id);
905 function getTabs(&$tab_gui, $a_create =
false)
911 $ilTabs->addTarget(
"cont_mob_inst_prop",
912 $ilCtrl->getLinkTarget($this,
"editAlias"),
"editAlias",
917 $ilTabs->addTarget(
"cont_inst_map_areas",
918 $ilCtrl->getLinkTargetByClass(
"ilpcimagemapeditorgui",
"editMapAreas"), array(),
919 get_class(
"ilpcimagemapeditorgui"));
924 $ilCtrl->setParameter($this,
"subCmd",
"insertNew");
925 $ilTabs->addSubTabTarget(
"cont_new_mob",
926 $ilCtrl->getLinkTarget($this,
"insert"),
"insert");
928 $ilCtrl->setParameter($this,
"subCmd",
"insertFromPool");
929 $ilTabs->addSubTabTarget(
"cont_mob_from_media_pool",
930 $ilCtrl->getLinkTarget($this,
"insert"),
"insert");
931 $ilCtrl->setParameter($this,
"subCmd",
"");