21 $this->media_object = $a_media_object;
31 $next_class = $ilCtrl->getNextClass($this);
32 $cmd = $ilCtrl->getCmd();
36 case "ilinternallinkgui":
37 require_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
39 $link_gui->setMode(
"link");
40 $link_gui->setSetLinkTargetScript(
41 $ilCtrl->getLinkTarget($this,
43 $link_gui->filterLinkType(
"File");
44 $link_gui->setMode(
"asynch");
45 $ret = $ilCtrl->forwardCommand($link_gui);
49 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
51 if (isset(
$_POST[
"editImagemapForward"]) ||
52 isset(
$_POST[
"editImagemapForward_x"]) ||
53 isset(
$_POST[
"editImagemapForward_y"]))
55 $cmd =
"editImagemapForward";
71 $_SESSION[
"il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this,
"addArea",
75 $this->tpl =
new ilTemplate(
"tpl.map_edit.html",
true,
true,
"Services/MediaObjects");
76 $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
82 $this->tpl->setVariable(
"IMAGE_MAP",
$output);
84 $this->tpl->setVariable(
"TOOLBAR", $this->
getToolbar()->getHTML());
89 return $this->tpl->get();
103 $tb->setFormAction($ilCtrl->getFormAction($this));
104 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
106 "WholePicture" => $lng->txt(
"cont_WholePicture"),
107 "Rect" => $lng->txt(
"cont_Rect"),
108 "Circle" => $lng->txt(
"cont_Circle"),
109 "Poly" => $lng->txt(
"cont_Poly"),
113 $tb->addInputItem($si,
true);
114 $tb->addFormButton($lng->txt(
"cont_add_area"),
"addNewArea");
148 return $lng->txt(
"cont_imagemap");
157 include_once(
"./Services/MediaObjects/classes/class.ilImageMapTableGUI.php");
158 $image_map_table =
new ilImageMapTableGUI($this,
"editMapAreas", $this->media_object);
159 return $image_map_table->getHTML();
167 if(
$_GET[
"ref_id"] !=
"")
172 if(
$_GET[
"obj_id"] !=
"")
177 if(
$_GET[
"hier_id"] !=
"")
182 if(
$_GET[
"pc_id"] !=
"")
194 $item->outputMapWorkCopy();
204 $st_item = $this->media_object->getMediaItem(
"Standard");
206 for ($i=1; $i<=$max; $i++)
208 $area =
new ilMapArea($st_item->getId(), $i);
216 $ilCtrl->redirect($this,
"editMapAreas");
228 case "Circle":
return $this->
addCircle();
240 $_SESSION[
"il_map_edit_area_type"] =
"WholePicture";
251 $_SESSION[
"il_map_edit_area_type"] =
"Rect";
261 $_SESSION[
"il_map_edit_area_type"] =
"Circle";
271 $_SESSION[
"il_map_edit_area_type"] =
"Poly";
303 $area_type =
$_SESSION[
"il_map_edit_area_type"];
305 include_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
318 else if ($cnt_coords == 2)
326 if ($cnt_coords <= 1)
332 if ($cnt_coords == 2)
336 $coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
350 else if ($cnt_coords < 3)
375 function editMapArea($a_get_next_coordinate =
false, $a_output_new_area =
false,
376 $a_save_form =
false, $a_edit_property =
"", $a_area_nr = 0)
380 $area_type =
$_SESSION[
"il_map_edit_area_type"];
382 include_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
385 $this->tpl =
new ilTemplate(
"tpl.map_edit.html",
true,
true,
"Services/MediaObjects");
387 $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
389 if ($a_edit_property !=
"link")
395 if ($cnt_coords == 0)
399 if ($cnt_coords == 1)
407 if ($cnt_coords == 0)
411 if ($cnt_coords == 1)
419 if ($cnt_coords == 0)
423 else if ($cnt_coords < 3)
439 if ($a_edit_property !=
"shape")
442 $ilCtrl->setParameter($this,
"linkmode",
"map");
443 include_once(
"./Services/Link/classes/class.ilInternalLinkGUI.php");
444 $this->tpl->setCurrentBlock(
"int_link_prep");
446 $ilCtrl->getLinkTargetByClass(
"ilinternallinkgui",
447 "",
false,
true,
false)));
448 $this->tpl->parseCurrentBlock();
451 $this->tpl->setVariable(
"FORM", $form->getHTML());
455 $a_output_new_area, $area_type,
$coords);
457 $edit_mode = ($a_get_next_coordinate)
459 : (($a_output_new_area)
463 $this->tpl->setVariable(
"IMAGE_MAP",
$output);
465 return $this->tpl->get();
477 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
479 $form->setOpenTag(
false);
480 $form->setCloseTag(
false);
483 if ($a_edit_property !=
"shape")
487 if (
$_SESSION[
"il_map_il_ltype"] !=
"int")
495 $radg->setValue(
"ext");
500 $radg->setValue(
"int");
505 $radg->addOption($ext);
508 $ti->setMaxLength(200);
512 $ti->setValue(
$_SESSION[
"il_map_el_href"]);
516 $ti->setValue(
"http://");
518 $ext->addSubItem($ti);
522 $radg->addOption($int);
531 $ne->setValue($link_str.
532 ' <a id="iosEditInternalLinkTrigger" href="#">'.
533 "[".$lng->txt(
"cont_get_link").
"]".
536 $int->addSubItem($ne);
540 $radg->addOption($no);
542 $form->addItem($radg);
547 if ($a_edit_property !=
"link" && $a_edit_property !=
"shape")
556 if ($a_edit_property ==
"")
558 $form->setTitle($lng->txt(
"cont_new_area"));
559 $form->addCommandButton(
"saveArea", $lng->txt(
"save"));
563 $form->setTitle($lng->txt(
"cont_new_area"));
564 $form->addCommandButton(
"saveArea", $lng->txt(
"save"));
576 $a_output_new_area =
false, $a_area_type =
"", $a_coords =
"")
579 $st_item = $this->media_object->getMediaItem(
"Standard");
581 if ($a_edit_property ==
"shape")
583 $st_item->makeMapWorkCopy($a_area_nr,
true);
587 $st_item->makeMapWorkCopy($a_area_nr,
false);
590 if ($a_output_new_area)
592 $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
603 $st_item = $this->media_object->getMediaItem(
"Standard");
611 $xsl = file_get_contents(
"./Services/COPage/xsl/page.xsl");
613 $args =
array(
'/_xml' => $xml,
'/_xsl' => $xsl );
619 'map_item' => $st_item->getId(),
620 'map_mob_id' => $this->media_object->getId(),
622 'media_mode' =>
'enable',
623 'image_map_link' => $ilCtrl->getLinkTarget($this,
"showImageMap",
"",
false,
false),
624 'link_params' =>
"ref_id=".$_GET[
"ref_id"].
"&rand=".rand(1,999999),
625 'ref_id' =>
$_GET[
"ref_id"],
628 'webspace_path' => $wb_path);
629 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args,
$params);
677 $t_arr = explode(
"_", $a_target);
680 $frame_str =
" (".$a_frame.
" Frame)";
684 case "StructureObject":
685 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
687 $link_str = $lng->txt(
"chapter").
688 ": ".$title.
" [".$t_arr[count($t_arr) - 1].
"]".$frame_str;
692 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
694 $link_str = $lng->txt(
"page").
695 ": ".$title.
" [".$t_arr[count($t_arr) - 1].
"]".$frame_str;
699 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
701 $link_str = $lng->txt(
"term").
702 ": ".$term->getTerm().
" [".$t_arr[count($t_arr) - 1].
"]".$frame_str;
706 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
708 $link_str = $lng->txt(
"mob").
709 ": ".$mob->getTitle().
" [".$t_arr[count($t_arr) - 1].
"]".$frame_str;
712 case "RepositoryItem":
715 $link_str = $lng->txt(
"obj_".$t_arr[count($t_arr) - 2]).
716 ": ".$title.
" [".$t_arr[count($t_arr) - 1].
"]".$frame_str;
730 if (
$_SESSION[
"il_map_edit_coords"] !=
"")
735 $_SESSION[
"il_map_edit_coords"] .=
$_POST[
"editImagemapForward_x"].
",".
736 $_POST[
"editImagemapForward_y"];
764 $st_item = $this->media_object->getMediaItem(
"Standard");
771 $area->setType(
$_SESSION[
"il_map_il_type"]);
772 $area->setTarget(
$_SESSION[
"il_map_il_target"]);
773 $area->setTargetFrame(
$_SESSION[
"il_map_il_targetframe"]);
792 $st_item = $this->media_object->getMediaItem(
"Standard");
797 $area->setCoords(
$_SESSION[
"il_map_edit_coords"]);
803 $area_type =
$_SESSION[
"il_map_edit_area_type"];
806 $st_item = $this->media_object->getMediaItem(
"Standard");
811 $area->setItemId($st_item->getId());
812 $area->setShape($area_type);
814 $area->setNr($max + 1);
816 switch(
$_POST[
"area_link_type"])
820 $area->setHref(
$_POST[
"area_link_ext"]);
825 $area->setType(
$_SESSION[
"il_map_il_type"]);
826 $area->setTarget(
$_SESSION[
"il_map_il_target"]);
827 $area->setTargetFrame(
$_SESSION[
"il_map_il_targetframe"]);
832 $st_item->addMapArea($area);
833 $this->media_object->update();
839 $ilCtrl->redirect($this,
"editMapAreas");
879 if (!isset(
$_POST[
"area"]))
882 $ilCtrl->redirect($this,
"editMapAreas");
885 if (count(
$_POST[
"area"]) > 1)
889 $ilCtrl->redirect($this,
"editMapAreas");
893 if (
$_SESSION[
"il_map_edit_mode"] !=
"edit_link")
897 $_SESSION[
"il_map_edit_mode"] =
"edit_link";
898 $_SESSION[
"il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this,
"setLink");
919 $st_item = $this->media_object->getMediaItem(
"Standard");
920 $area = $st_item->getMapArea($a_nr);
921 return $area->getLinkType();
929 $st_item = $this->media_object->getMediaItem(
"Standard");
930 $area = $st_item->getMapArea($a_nr);
931 return $area->getType();
939 $st_item = $this->media_object->getMediaItem(
"Standard");
940 $area = $st_item->getMapArea($a_nr);
941 return $area->getTarget();
949 $st_item = $this->media_object->getMediaItem(
"Standard");
950 $area = $st_item->getMapArea($a_nr);
951 return $area->getTargetFrame();
959 $st_item = $this->media_object->getMediaItem(
"Standard");
960 $area = $st_item->getMapArea($a_nr);
961 return $area->getHref();
971 if (!isset(
$_POST[
"area"]))
974 $ilCtrl->redirect($this,
"editMapAreas");
977 $st_item = $this->media_object->getMediaItem(
"Standard");
980 if (count(
$_POST[
"area"]) > 0)
984 foreach (
$_POST[
"area"] as $area_nr)
986 $st_item->deleteMapArea($area_nr - $i);
990 $this->media_object->update();
994 $ilCtrl->redirect($this,
"editMapAreas");
1008 $_SESSION[
"il_map_il_targetframe"] =
"";
1019 $_SESSION[
"il_map_edit_area_type"] =
"WholePicture";
1029 $_SESSION[
"il_map_edit_area_type"] =
"Rect";
1039 $_SESSION[
"il_map_edit_area_type"] =
"Circle";
1049 $_SESSION[
"il_map_edit_area_type"] =
"Poly";
1064 if(
$_POST[
"areatype2"] !=
"")
1072 if (!isset(
$_POST[
"area"]))
1075 $ilCtrl->redirect($this,
"editMapAreas");
1078 if (count(
$_POST[
"area"]) > 1)
1081 $ilCtrl->redirect($this,
"editMapAreas");
1084 if (
$_SESSION[
"il_map_edit_mode"] !=
"edit_shape")
1087 $_SESSION[
"il_map_edit_mode"] =
"edit_shape";
1088 $_SESSION[
"il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this,
"setShape",
"",
false,
false);
1092 $area_type =
$_SESSION[
"il_map_edit_area_type"];
1101 if ($cnt_coords < 2)
1105 else if ($cnt_coords == 2)
1113 if ($cnt_coords <= 1)
1119 if ($cnt_coords == 2)
1122 $coords = $c[0].
",".$c[1].
",";
1123 $coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
1133 if ($cnt_coords < 1)
1137 else if ($cnt_coords < 3)
1148 case "WholePicture":
1164 $st_item = $this->media_object->getMediaItem(
"Standard");
1170 $ilCtrl->redirect($this,
"editMapAreas");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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.
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)
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
updateAreas()
Update map areas.
setHighlight()
Set highlight settings.
setLink($a_handle=true)
Set link.
if(!is_array($argv)) $options
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setTitle($a_title)
set (tooltip)title of area
editLink()
Edit existing link.
setMaxLength($a_maxlength)
Set Max Length.
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
Create styles array
The data for the language used.
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)
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.
TableGUI class for image map editor.
addCircle()
Add a new circle.
executeCommand()
Execute current command.
addRectangle()
Add a new rectangle.
makeMapWorkCopy($a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
Make work file for editing.
getImageMapTableHTML()
Get table HTML.
setLinkType($a_link_type)
set link type
static redirect($a_script)
http redirect to other script
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)