43 $this->ctrl = $DIC->ctrl();
44 $this->tpl = $DIC[
"tpl"];
45 $this->lng = $DIC->language();
46 $this->toolbar = $DIC->toolbar();
47 $this->media_object = $a_media_object;
58 $next_class = $ilCtrl->getNextClass($this);
59 $cmd = $ilCtrl->getCmd();
61 switch ($next_class) {
62 case "ilinternallinkgui":
63 require_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
65 $link_gui->setSetLinkTargetScript(
66 $ilCtrl->getLinkTarget(
71 $link_gui->filterLinkType(
"File");
72 $ret = $ilCtrl->forwardCommand($link_gui);
76 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
78 if (isset(
$_POST[
"editImagemapForward"]) ||
79 isset(
$_POST[
"editImagemapForward_x"]) ||
80 isset(
$_POST[
"editImagemapForward_y"])) {
81 $cmd =
"editImagemapForward";
99 $_SESSION[
"il_map_edit_target_script"] = $ilCtrl->getLinkTarget(
108 $this->tpl =
new ilTemplate(
"tpl.map_edit.html",
true,
true,
"Services/MediaObjects");
109 $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
115 $this->tpl->setVariable(
"IMAGE_MAP", $output);
117 $this->tpl->setVariable(
"TOOLBAR", $this->
getToolbar()->getHTML());
122 return $this->tpl->get();
138 $tb->setFormAction($ilCtrl->getFormAction($this));
139 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
141 "WholePicture" =>
$lng->txt(
"cont_WholePicture"),
142 "Rect" =>
$lng->txt(
"cont_Rect"),
143 "Circle" =>
$lng->txt(
"cont_Circle"),
144 "Poly" =>
$lng->txt(
"cont_Poly"),
147 $si->setOptions($options);
148 $tb->addInputItem($si,
true);
149 $tb->addFormButton(
$lng->txt(
"cont_add_area"),
"addNewArea");
183 return $lng->txt(
"cont_imagemap");
192 include_once(
"./Services/MediaObjects/classes/class.ilImageMapTableGUI.php");
193 $image_map_table =
new ilImageMapTableGUI($this,
"editMapAreas", $this->media_object);
194 return $image_map_table->getHTML();
202 if (
$_GET[
"ref_id"] !=
"") {
206 if (
$_GET[
"obj_id"] !=
"") {
210 if (
$_GET[
"hier_id"] !=
"") {
214 if (
$_GET[
"pc_id"] !=
"") {
225 $item->outputMapWorkCopy();
236 $st_item = $this->media_object->getMediaItem(
"Standard");
238 for (
$i = 1;
$i <= $max;
$i++) {
246 ilUtil::sendSuccess(
$lng->txt(
"cont_saved_map_data"),
true);
247 $ilCtrl->redirect($this,
"editMapAreas");
255 switch (
$_POST[
"shape"]) {
258 case "Circle":
return $this->
addCircle();
270 $_SESSION[
"il_map_edit_area_type"] =
"WholePicture";
281 $_SESSION[
"il_map_edit_area_type"] =
"Rect";
291 $_SESSION[
"il_map_edit_area_type"] =
"Circle";
301 $_SESSION[
"il_map_edit_area_type"] =
"Poly";
332 $area_type =
$_SESSION[
"il_map_edit_area_type"];
333 $coords =
$_SESSION[
"il_map_edit_coords"];
334 include_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
338 switch ($area_type) {
341 if ($cnt_coords < 2) {
344 } elseif ($cnt_coords == 2) {
351 if ($cnt_coords <= 1) {
354 if ($cnt_coords == 2) {
355 $c = explode(
",", $coords);
356 $coords =
$c[0] .
"," .
$c[1] .
",";
357 $coords .= round(sqrt(pow(abs(
$c[3] -
$c[1]), 2) + pow(abs(
$c[2] -
$c[0]), 2)));
359 $_SESSION[
"il_map_edit_coords"] = $coords;
367 if ($cnt_coords < 1) {
369 } elseif ($cnt_coords < 3) {
392 $a_get_next_coordinate =
false,
393 $a_output_new_area =
false,
394 $a_save_form =
false,
395 $a_edit_property =
"",
402 $area_type =
$_SESSION[
"il_map_edit_area_type"];
403 $coords =
$_SESSION[
"il_map_edit_coords"];
404 include_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
407 $this->tpl =
new ilTemplate(
"tpl.map_edit.html",
true,
true,
"Services/MediaObjects");
409 $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
411 if ($a_edit_property !=
"link") {
412 switch ($area_type) {
415 if ($cnt_coords == 0) {
418 if ($cnt_coords == 1) {
425 if ($cnt_coords == 0) {
428 if ($cnt_coords == 1) {
435 if ($cnt_coords == 0) {
437 } elseif ($cnt_coords < 3) {
449 if ($a_edit_property !=
"shape") {
451 $ilCtrl->setParameter($this,
"linkmode",
"map");
452 include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
453 $this->tpl->setCurrentBlock(
"int_link_prep");
455 $ilCtrl->getLinkTargetByClass(
463 $this->tpl->parseCurrentBlock();
466 $this->tpl->setVariable(
"FORM", $form->getHTML());
477 $edit_mode = ($a_get_next_coordinate)
479 : (($a_output_new_area)
483 $this->tpl->setVariable(
"IMAGE_MAP", $output);
485 return $this->tpl->get();
498 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
500 $form->setOpenTag(
false);
501 $form->setCloseTag(
false);
504 if ($a_edit_property !=
"shape") {
507 if (
$_SESSION[
"il_map_il_ltype"] !=
"int") {
511 $radg->setValue(
"ext");
514 $radg->setValue(
"int");
519 $radg->addOption($ext);
522 $ti->setMaxLength(800);
525 $ti->setValue(
$_SESSION[
"il_map_el_href"]);
527 $ti->setValue(
"http://");
529 $ext->addSubItem($ti);
533 $radg->addOption($int);
537 if (
$_SESSION[
"il_map_il_target"] !=
"") {
546 ' <a id="iosEditInternalLinkTrigger" href="#">' .
547 "[" .
$lng->txt(
"cont_get_link") .
"]" .
550 $int->addSubItem($ne);
554 $radg->addOption($no);
556 $form->addItem($radg);
561 if ($a_edit_property !=
"link" && $a_edit_property !=
"shape") {
563 $ti->setMaxLength(200);
569 if ($a_edit_property ==
"") {
570 $form->setTitle(
$lng->txt(
"cont_new_area"));
571 $form->addCommandButton(
"saveArea",
$lng->txt(
"save"));
573 $form->setTitle(
$lng->txt(
"cont_new_area"));
574 $form->addCommandButton(
"saveArea",
$lng->txt(
"save"));
586 $a_edit_property =
"",
588 $a_output_new_area =
false,
593 $st_item = $this->media_object->getMediaItem(
"Standard");
595 if ($a_edit_property ==
"shape") {
596 $st_item->makeMapWorkCopy($a_area_nr,
true);
598 $st_item->makeMapWorkCopy($a_area_nr,
false);
601 if ($a_output_new_area) {
602 $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
613 $st_item = $this->media_object->getMediaItem(
"Standard");
621 $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
623 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
629 $random = new \ilRandom();
630 $params = array(
'map_edit_mode' => $a_map_edit_mode,
631 'map_item' => $st_item->getId(),
632 'map_mob_id' => $this->media_object->getId(),
634 'media_mode' =>
'enable',
635 'image_map_link' => $ilCtrl->getLinkTarget($this,
"showImageMap",
"",
false,
false),
636 'link_params' =>
"ref_id=" .
$_GET[
"ref_id"] .
"&rand=" . $random->int(1, 999999),
637 'ref_id' =>
$_GET[
"ref_id"],
640 'webspace_path' => $wb_path);
641 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", null, $args, $params);
689 $t_arr = explode(
"_", $a_target);
690 if ($a_frame !=
"") {
691 $frame_str =
" (" . $a_frame .
" Frame)";
694 case "StructureObject":
695 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
697 $link_str =
$lng->txt(
"chapter") .
698 ": " . $title .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
702 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
704 $link_str =
$lng->txt(
"page") .
705 ": " . $title .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
710 $link_str =
$lng->txt(
"term") .
711 ": " . $term->getTerm() .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
715 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
717 $link_str =
$lng->txt(
"mob") .
718 ": " . $mob->getTitle() .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
721 case "RepositoryItem":
725 $link_str =
$lng->txt(
"obj_" . $t_arr[count($t_arr) - 2]) .
726 ": " . $title .
" [" . $t_arr[count($t_arr) - 1] .
"]" . $frame_str;
740 if (
$_SESSION[
"il_map_edit_coords"] !=
"") {
744 $_SESSION[
"il_map_edit_coords"] .=
$_POST[
"editImagemapForward_x"] .
"," .
745 $_POST[
"editImagemapForward_y"];
773 $st_item = $this->media_object->getMediaItem(
"Standard");
779 $area->setType(
$_SESSION[
"il_map_il_type"]);
780 $area->setTarget(
$_SESSION[
"il_map_il_target"]);
781 $area->setTargetFrame(
$_SESSION[
"il_map_il_targetframe"]);
795 $st_item = $this->media_object->getMediaItem(
"Standard");
800 $area->setCoords(
$_SESSION[
"il_map_edit_coords"]);
806 $area_type =
$_SESSION[
"il_map_edit_area_type"];
807 $coords =
$_SESSION[
"il_map_edit_coords"];
809 $st_item = $this->media_object->getMediaItem(
"Standard");
814 $area->setItemId($st_item->getId());
815 $area->setShape($area_type);
816 $area->setCoords($coords);
817 $area->setNr($max + 1);
819 switch (
$_POST[
"area_link_type"]) {
822 $area->setHref(
$_POST[
"area_link_ext"]);
827 $area->setType(
$_SESSION[
"il_map_il_type"]);
828 $area->setTarget(
$_SESSION[
"il_map_il_target"]);
829 $area->setTargetFrame(
$_SESSION[
"il_map_il_targetframe"]);
834 $st_item->addMapArea($area);
835 $this->media_object->update();
840 ilUtil::sendSuccess(
$lng->txt(
"cont_saved_map_area"),
true);
841 $ilCtrl->redirect($this,
"editMapAreas");
880 if (!isset(
$_POST[
"area"])) {
882 $ilCtrl->redirect($this,
"editMapAreas");
885 if (count(
$_POST[
"area"]) > 1) {
888 $ilCtrl->redirect($this,
"editMapAreas");
892 if (
$_SESSION[
"il_map_edit_mode"] !=
"edit_link") {
895 $_SESSION[
"il_map_edit_mode"] =
"edit_link";
896 $_SESSION[
"il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this,
"setLink");
914 $st_item = $this->media_object->getMediaItem(
"Standard");
915 $area = $st_item->getMapArea($a_nr);
916 return $area->getLinkType();
924 $st_item = $this->media_object->getMediaItem(
"Standard");
925 $area = $st_item->getMapArea($a_nr);
926 return $area->getType();
934 $st_item = $this->media_object->getMediaItem(
"Standard");
935 $area = $st_item->getMapArea($a_nr);
936 return $area->getTarget();
944 $st_item = $this->media_object->getMediaItem(
"Standard");
945 $area = $st_item->getMapArea($a_nr);
946 return $area->getTargetFrame();
954 $st_item = $this->media_object->getMediaItem(
"Standard");
955 $area = $st_item->getMapArea($a_nr);
956 return $area->getHref();
967 if (!isset(
$_POST[
"area"])) {
969 $ilCtrl->redirect($this,
"editMapAreas");
972 $st_item = $this->media_object->getMediaItem(
"Standard");
975 if (count(
$_POST[
"area"]) > 0) {
978 foreach (
$_POST[
"area"] as $area_nr) {
979 $st_item->deleteMapArea($area_nr -
$i);
983 $this->media_object->update();
984 ilUtil::sendSuccess(
$lng->txt(
"cont_areas_deleted"),
true);
987 $ilCtrl->redirect($this,
"editMapAreas");
1001 $_SESSION[
"il_map_il_targetframe"] =
"";
1012 $_SESSION[
"il_map_edit_area_type"] =
"WholePicture";
1022 $_SESSION[
"il_map_edit_area_type"] =
"Rect";
1032 $_SESSION[
"il_map_edit_area_type"] =
"Circle";
1042 $_SESSION[
"il_map_edit_area_type"] =
"Poly";
1057 if (
$_POST[
"areatype2"] !=
"") {
1060 if (
$_SESSION[
"il_map_area_nr"] !=
"") {
1063 if (!isset(
$_POST[
"area"])) {
1065 $ilCtrl->redirect($this,
"editMapAreas");
1068 if (count(
$_POST[
"area"]) > 1) {
1070 $ilCtrl->redirect($this,
"editMapAreas");
1073 if (
$_SESSION[
"il_map_edit_mode"] !=
"edit_shape") {
1075 $_SESSION[
"il_map_edit_mode"] =
"edit_shape";
1076 $_SESSION[
"il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this,
"setShape",
"",
false,
false);
1080 $area_type =
$_SESSION[
"il_map_edit_area_type"];
1081 $coords =
$_SESSION[
"il_map_edit_coords"];
1085 switch ($area_type) {
1088 if ($cnt_coords < 2) {
1090 } elseif ($cnt_coords == 2) {
1097 if ($cnt_coords <= 1) {
1100 if ($cnt_coords == 2) {
1101 $c = explode(
",", $coords);
1102 $coords =
$c[0] .
"," .
$c[1] .
",";
1103 $coords .= round(sqrt(pow(abs(
$c[3] -
$c[1]), 2) + pow(abs(
$c[2] -
$c[0]), 2)));
1105 $_SESSION[
"il_map_edit_coords"] = $coords;
1113 if ($cnt_coords < 1) {
1115 } elseif ($cnt_coords < 3) {
1123 case "WholePicture":
1139 $st_item = $this->media_object->getMediaItem(
"Standard");
1144 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1145 $ilCtrl->redirect($this,
"editMapAreas");
This class represents an option in a radio group.
static getInitHTML($a_url)
Get initialisation HTML to use interna link editing.
addPolygon()
Add a new polygon.
getImageMapOutput($a_map_edit_mode="")
Render the image map.
editShapeWholePicture()
Edit an existing shape (make it a whole picture link)
getEditorTitle()
Get editor title.
saveArea()
Save new or updated map area.
getLinkTypeOfArea($a_nr)
Get Link Type of Area.
clearSessionVars()
Clear Session Vars.
getTargetFrameOfArea($a_nr)
Get TargetFrame of Area (only internal link)
static _lookupTitle($a_id)
lookup object title
showImageMap()
show image map
static _lookupTitle($a_obj_id)
Lookup title.
editMapArea( $a_get_next_coordinate=false, $a_output_new_area=false, $a_save_form=false, $a_edit_property="", $a_area_nr=0)
Edit a single map area.
setInternalLink()
Set internal link.
initAreaEditingForm($a_edit_property)
Init area editing form.
getMapAreaLinkString($a_target, $a_type, $a_frame)
Get text name of internal link.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
editShapeCircle()
Edit an existing shape (make it a circle)
updateAreas()
Update map areas.
setHighlight()
Set highlight settings.
setLink($a_handle=true)
Set link.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
setTitle($a_title)
set (tooltip)title of area
editLink()
Edit existing link.
outputPostProcessing($a_output)
Output post processing.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
deleteAreas()
Delete map areas.
setShape($a_handle=true)
edit shape of existing map area
handleMapParameters()
handle parameter during map area editing (storing to session)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
editMapAreas()
Show map areas.
User interface class for map editor.
getHrefOfArea($a_nr)
Get Href of Area (only external link)
addArea($a_handle=true)
Handle adding new area process.
static _recoverParameters()
Recover parameters from session variables (static)
editShapePolygon()
Edit an existing shape (make it a polygon)
editImagemapForward()
Get image map coordinates.
setShape($a_shape)
set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE)
__construct($a_media_object)
Constructor.
This class represents a non editable value in a property form.
linkWholePicture()
Link the whole picture.
static _getMaxNr($a_item_id)
get maximum nr of media item (static)
getAdditionalPageXML()
Get additional page xml (to be overwritten)
getTypeOfArea($a_nr)
Get Type of Area (only internal link)
TableGUI class for image map editor.
addCircle()
Add a new circle.
executeCommand()
Execute current command.
addRectangle()
Add a new rectangle.
getImageMapTableHTML()
Get table HTML.
setLinkType($a_link_type)
set link type
static redirect($a_script)
makeMapWorkCopy( $a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
Make work file for editing.
static getWebspaceDir($mode="filesystem")
get webspace directory
static countCoords($c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
getTargetOfArea($a_nr)
Get Target of Area (only internal link)
editShapeRectangle()
Edit an existing shape (make it a rectangle)