ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilImageMapEditorGUI Class Reference

User interface class for map editor. More...

+ Inheritance diagram for ilImageMapEditorGUI:
+ Collaboration diagram for ilImageMapEditorGUI:

Public Member Functions

 __construct ($a_media_object)
 Constructor. More...
 
 executeCommand ()
 Execute current command. More...
 
 editMapAreas ()
 Show map areas. More...
 
 getToolbar ()
 Get toolbar. More...
 
 getEditorTitle ()
 Get editor title. More...
 
 getImageMapTableHTML ()
 Get table HTML. More...
 
 handleMapParameters ()
 handle parameter during map area editing (storing to session) More...
 
 showImageMap ()
 show image map More...
 
 updateAreas ()
 Update map areas. More...
 
 addNewArea ()
 Add area. More...
 
 linkWholePicture ()
 Link the whole picture. More...
 
 addRectangle ()
 Add a new rectangle. More...
 
 addCircle ()
 Add a new circle. More...
 
 addPolygon ()
 Add a new polygon. More...
 
 clearSessionVars ()
 Clear Session Vars. More...
 
 addArea ($a_handle=true)
 Handle adding new area process. More...
 
 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. More...
 
 initAreaEditingForm ($a_edit_property)
 Init area editing form. More...
 
 makeMapWorkCopy ($a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
 Make work file for editing. More...
 
 getImageMapOutput ($a_map_edit_mode="")
 Render the image map. More...
 
 getAdditionalPageXML ()
 Get additional page xml (to be overwritten) More...
 
 outputPostProcessing ($a_output)
 Output post processing. More...
 
 getAliasXML ()
 
 getMapAreaLinkString ($a_target, $a_type, $a_frame)
 Get text name of internal link. More...
 
 editImagemapForward ()
 Get image map coordinates. More...
 
 _recoverParameters ()
 Recover parameters from session variables (static) More...
 
 saveArea ()
 Save new or updated map area. More...
 
 setInternalLink ()
 Set internal link. More...
 
 setLink ($a_handle=true)
 Set link. More...
 
 getLinkTypeOfArea ($a_nr)
 Get Link Type of Area. More...
 
 getTypeOfArea ($a_nr)
 Get Type of Area (only internal link) More...
 
 getTargetOfArea ($a_nr)
 Get Target of Area (only internal link) More...
 
 getTargetFrameOfArea ($a_nr)
 Get TargetFrame of Area (only internal link) More...
 
 getHrefOfArea ($a_nr)
 Get Href of Area (only external link) More...
 
 deleteAreas ()
 Delete map areas. More...
 
 editLink ()
 Edit existing link. More...
 
 editShapeWholePicture ()
 Edit an existing shape (make it a whole picture link) More...
 
 editShapeRectangle ()
 Edit an existing shape (make it a rectangle) More...
 
 editShapeCircle ()
 Edit an existing shape (make it a circle) More...
 
 editShapePolygon ()
 Edit an existing shape (make it a polygon) More...
 
 setShape ($a_handle=true)
 edit shape of existing map area More...
 
 setHighlight ()
 Set highlight settings. More...
 

Detailed Description

User interface class for map editor.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilImageMapEditorGUI: ilInternalLinkGUI

Definition at line 14 of file class.ilImageMapEditorGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilImageMapEditorGUI::__construct (   $a_media_object)

Constructor.

Definition at line 19 of file class.ilImageMapEditorGUI.php.

20 {
21 $this->media_object = $a_media_object;
22 }

Member Function Documentation

◆ _recoverParameters()

ilImageMapEditorGUI::_recoverParameters ( )

Recover parameters from session variables (static)

Definition at line 745 of file class.ilImageMapEditorGUI.php.

746 {
747 $_GET["ref_id"] = $_SESSION["il_map_edit_ref_id"];
748 $_GET["obj_id"] = $_SESSION["il_map_edit_obj_id"];
749 $_GET["hier_id"] = $_SESSION["il_map_edit_hier_id"];
750 $_GET["pc_id"] = $_SESSION["il_map_edit_pc_id"];
751 }
$_GET["client_id"]
$_SESSION["AccountId"]

References $_GET, and $_SESSION.

Referenced by editImagemapForward(), and ilInternalLinkGUI\renderLink().

+ Here is the caller graph for this function:

◆ addArea()

ilImageMapEditorGUI::addArea (   $a_handle = true)

Handle adding new area process.

Definition at line 294 of file class.ilImageMapEditorGUI.php.

295 {
296
297 // handle map parameters
298 if($a_handle)
299 {
300 $this->handleMapParameters();
301 }
302
303 $area_type = $_SESSION["il_map_edit_area_type"];
304 $coords = $_SESSION["il_map_edit_coords"];
305 include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
306 $cnt_coords = ilMapArea::countCoords($coords);
307
308 // decide what to do next
309 switch ($area_type)
310 {
311 // Rectangle
312 case "Rect" :
313 if ($cnt_coords < 2)
314 {
315 $html = $this->editMapArea(true, false, false);
316 return $html;
317 }
318 else if ($cnt_coords == 2)
319 {
320 return $this->editMapArea(false, true, true);
321 }
322 break;
323
324 // Circle
325 case "Circle":
326 if ($cnt_coords <= 1)
327 {
328 return $this->editMapArea(true, false, false);
329 }
330 else
331 {
332 if ($cnt_coords == 2)
333 {
334 $c = explode(",",$coords);
335 $coords = $c[0].",".$c[1].","; // determine radius
336 $coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
337 }
338 $_SESSION["il_map_edit_coords"] = $coords;
339
340 return $this->editMapArea(false, true, true);
341 }
342 break;
343
344 // Polygon
345 case "Poly":
346 if ($cnt_coords < 1)
347 {
348 return $this->editMapArea(true, false, false);
349 }
350 else if ($cnt_coords < 3)
351 {
352 return $this->editMapArea(true, true, false);
353 }
354 else
355 {
356 return $this->editMapArea(true, true, true);
357 }
358 break;
359
360 // Whole picture
361 case "WholePicture":
362 return $this->editMapArea(false, false, true);
363 break;
364 }
365 }
handleMapParameters()
handle parameter during map area editing (storing to session)
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.
countCoords($c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,...
$html
Definition: example_001.php:87
$coords
Definition: example_030.php:88

References $_SESSION, $coords, $html, ilMapArea\countCoords(), editMapArea(), and handleMapParameters().

Referenced by addCircle(), addPolygon(), addRectangle(), and setInternalLink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCircle()

ilImageMapEditorGUI::addCircle ( )

Add a new circle.

Definition at line 258 of file class.ilImageMapEditorGUI.php.

259 {
260 $this->clearSessionVars();
261 $_SESSION["il_map_edit_area_type"] = "Circle";
262 return $this->addArea(false);
263 }
clearSessionVars()
Clear Session Vars.
addArea($a_handle=true)
Handle adding new area process.

References $_SESSION, addArea(), and clearSessionVars().

Referenced by addNewArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addNewArea()

ilImageMapEditorGUI::addNewArea ( )

Add area.

Reimplemented in ilPCIIMTriggerEditorGUI.

Definition at line 222 of file class.ilImageMapEditorGUI.php.

223 {
224 switch ($_POST["shape"])
225 {
226 case "WholePicture": return $this->linkWholePicture();
227 case "Rect": return $this->addRectangle();
228 case "Circle": return $this->addCircle();
229 case "Poly": return $this->addPolygon();
230 }
231 }
linkWholePicture()
Link the whole picture.
addPolygon()
Add a new polygon.
addRectangle()
Add a new rectangle.
$_POST['username']
Definition: cron.php:12

References $_POST, addCircle(), addPolygon(), addRectangle(), and linkWholePicture().

+ Here is the call graph for this function:

◆ addPolygon()

ilImageMapEditorGUI::addPolygon ( )

Add a new polygon.

Definition at line 268 of file class.ilImageMapEditorGUI.php.

269 {
270 $this->clearSessionVars();
271 $_SESSION["il_map_edit_area_type"] = "Poly";
272 return $this->addArea(false);
273 }

References $_SESSION, addArea(), and clearSessionVars().

Referenced by addNewArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRectangle()

ilImageMapEditorGUI::addRectangle ( )

Add a new rectangle.

Definition at line 248 of file class.ilImageMapEditorGUI.php.

249 {
250 $this->clearSessionVars();
251 $_SESSION["il_map_edit_area_type"] = "Rect";
252 return $this->addArea(false);
253 }

References $_SESSION, addArea(), and clearSessionVars().

Referenced by addNewArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearSessionVars()

ilImageMapEditorGUI::clearSessionVars ( )

Clear Session Vars.

Definition at line 278 of file class.ilImageMapEditorGUI.php.

279 {
280 $_SESSION["il_map_area_nr"] = "";
281 $_SESSION["il_map_edit_coords"] = "";
282 $_SESSION["il_map_edit_mode"] = "";
283 $_SESSION["il_map_el_href"] = "";
284 $_SESSION["il_map_il_type"] = "";
285 $_SESSION["il_map_il_ltype"] = "";
286 $_SESSION["il_map_il_target"] = "";
287 $_SESSION["il_map_il_targetframe"] = "";
288 $_SESSION["il_map_edit_area_type"] = "";
289 }

References $_SESSION.

Referenced by addCircle(), addPolygon(), addRectangle(), editShapeCircle(), editShapePolygon(), editShapeRectangle(), editShapeWholePicture(), and linkWholePicture().

+ Here is the caller graph for this function:

◆ deleteAreas()

ilImageMapEditorGUI::deleteAreas ( )

Delete map areas.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 967 of file class.ilImageMapEditorGUI.php.

968 {
969 global $ilCtrl, $lng;
970
971 if (!isset($_POST["area"]))
972 {
973 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
974 $ilCtrl->redirect($this, "editMapAreas");
975 }
976
977 $st_item = $this->media_object->getMediaItem("Standard");
978 $max = ilMapArea::_getMaxNr($st_item->getId());
979
980 if (count($_POST["area"]) > 0)
981 {
982 $i = 0;
983
984 foreach ($_POST["area"] as $area_nr)
985 {
986 $st_item->deleteMapArea($area_nr - $i);
987 $i++;
988 }
989
990 $this->media_object->update();
991 ilUtil::sendSuccess($lng->txt("cont_areas_deleted"), true);
992 }
993
994 $ilCtrl->redirect($this, "editMapAreas");
995 }
_getMaxNr($a_item_id)
get maximum nr of media item (static)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $_POST, $ilCtrl, $lng, ilMapArea\_getMaxNr(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ editImagemapForward()

ilImageMapEditorGUI::editImagemapForward ( )

Get image map coordinates.

Definition at line 726 of file class.ilImageMapEditorGUI.php.

727 {
729
730 if ($_SESSION["il_map_edit_coords"] != "")
731 {
732 $_SESSION["il_map_edit_coords"] .= ",";
733 }
734
735 $_SESSION["il_map_edit_coords"] .= $_POST["editImagemapForward_x"].",".
736 $_POST["editImagemapForward_y"];
737
738 // call editing script
739 ilUtil::redirect($_SESSION["il_map_edit_target_script"]);
740 }
_recoverParameters()
Recover parameters from session variables (static)
static redirect($a_script)
http redirect to other script

References $_POST, $_SESSION, _recoverParameters(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ editLink()

ilImageMapEditorGUI::editLink ( )

Edit existing link.

Definition at line 1000 of file class.ilImageMapEditorGUI.php.

1001 {
1002 $_SESSION["il_map_edit_coords"] = "";
1003 $_SESSION["il_map_edit_mode"] = "";
1004 $_SESSION["il_map_el_href"] = "";
1005 $_SESSION["il_map_il_type"] = "";
1006 $_SESSION["il_map_il_ltype"] = "";
1007 $_SESSION["il_map_il_target"] = "";
1008 $_SESSION["il_map_il_targetframe"] = "";
1009 $_SESSION["il_map_area_nr"] = "";
1010 return $this->setLink(false);
1011 }
setLink($a_handle=true)
Set link.

References $_SESSION, and setLink().

+ Here is the call graph for this function:

◆ editMapArea()

ilImageMapEditorGUI::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.

Parameters
boolean$a_get_next_coordinateenable next coordinate input
boolean$a_output_new_areaoutput the new area
boolean$a_save_fromoutput save form
string$a_edit_property"" | "link" | "shape"

Definition at line 375 of file class.ilImageMapEditorGUI.php.

377 {
378 global $ilCtrl, $lng, $tpl;
379
380 $area_type = $_SESSION["il_map_edit_area_type"];
381 $coords = $_SESSION["il_map_edit_coords"];
382 include_once("./Services/MediaObjects/classes/class.ilMapArea.php");
383 $cnt_coords = ilMapArea::countCoords($coords);
384
385 $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
386
387 $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
388
389 if ($a_edit_property != "link")
390 {
391 switch ($area_type)
392 {
393 // rectangle
394 case "Rect" :
395 if ($cnt_coords == 0)
396 {
397 ilUtil::sendInfo($lng->txt("cont_click_tl_corner"));
398 }
399 if ($cnt_coords == 1)
400 {
401 ilUtil::sendInfo($lng->txt("cont_click_br_corner"));
402 }
403 break;
404
405 // circle
406 case "Circle" :
407 if ($cnt_coords == 0)
408 {
409 ilUtil::sendInfo($lng->txt("cont_click_center"));
410 }
411 if ($cnt_coords == 1)
412 {
413 ilUtil::sendInfo($lng->txt("cont_click_circle"));
414 }
415 break;
416
417 // polygon
418 case "Poly" :
419 if ($cnt_coords == 0)
420 {
421 ilUtil::sendInfo($lng->txt("cont_click_starting_point"));
422 }
423 else if ($cnt_coords < 3)
424 {
425 ilUtil::sendInfo($lng->txt("cont_click_next_point"));
426 }
427 else
428 {
429 ilUtil::sendInfo($lng->txt("cont_click_next_or_save"));
430 }
431 break;
432 }
433 }
434
435
436 // map properties input fields (name and link)
437 if ($a_save_form)
438 {
439 if ($a_edit_property != "shape")
440 {
441 // prepare link gui
442 $ilCtrl->setParameter($this, "linkmode", "map");
443 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
444 $this->tpl->setCurrentBlock("int_link_prep");
445 $this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
446 $ilCtrl->getLinkTargetByClass("ilinternallinkgui",
447 "", false, true, false)));
448 $this->tpl->parseCurrentBlock();
449 }
450 $form = $this->initAreaEditingForm($a_edit_property);
451 $this->tpl->setVariable("FORM", $form->getHTML());
452 }
453
454 $this->makeMapWorkCopy($a_edit_property, $a_area_nr,
455 $a_output_new_area, $area_type, $coords);
456
457 $edit_mode = ($a_get_next_coordinate)
458 ? "get_coords"
459 : (($a_output_new_area)
460 ? "new_area"
461 :"");
462 $output = $this->getImageMapOutput($edit_mode);
463 $this->tpl->setVariable("IMAGE_MAP", $output);
464
465 return $this->tpl->get();
466 }
global $tpl
Definition: ilias.php:8
getImageMapOutput($a_map_edit_mode="")
Render the image map.
makeMapWorkCopy($a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
Make work file for editing.
initAreaEditingForm($a_edit_property)
Init area editing form.
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
special template class to simplify handling of ITX/PEAR
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_SESSION, $coords, $ilCtrl, $lng, $tpl, ilMapArea\countCoords(), getImageMapOutput(), ilInternalLinkGUI\getInitHTML(), initAreaEditingForm(), makeMapWorkCopy(), and ilUtil\sendInfo().

Referenced by addArea(), linkWholePicture(), setLink(), and setShape().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editMapAreas()

ilImageMapEditorGUI::editMapAreas ( )

Show map areas.

Definition at line 67 of file class.ilImageMapEditorGUI.php.

68 {
69 global $ilCtrl, $lng, $ilToolbar;
70
71 $_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "addArea",
72 "", false, false);
73 $this->handleMapParameters();
74
75 $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
76 $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
77
78 // create/update imagemap work copy
79 $this->makeMapWorkCopy();
80
81 $output = $this->getImageMapOutput();
82 $this->tpl->setVariable("IMAGE_MAP", $output);
83
84 $this->tpl->setVariable("TOOLBAR", $this->getToolbar()->getHTML());
85
86 // table
87 $this->tpl->setVariable("MAP_AREA_TABLE", $this->getImageMapTableHTML());
88
89 return $this->tpl->get();
90 }
getImageMapTableHTML()
Get table HTML.

References $_SESSION, $ilCtrl, $lng, getImageMapOutput(), getImageMapTableHTML(), getToolbar(), handleMapParameters(), and makeMapWorkCopy().

+ Here is the call graph for this function:

◆ editShapeCircle()

ilImageMapEditorGUI::editShapeCircle ( )

Edit an existing shape (make it a circle)

Definition at line 1036 of file class.ilImageMapEditorGUI.php.

1037 {
1038 $this->clearSessionVars();
1039 $_SESSION["il_map_edit_area_type"] = "Circle";
1040 return $this->setShape(false);
1041 }
setShape($a_handle=true)
edit shape of existing map area

References $_SESSION, clearSessionVars(), and setShape().

+ Here is the call graph for this function:

◆ editShapePolygon()

ilImageMapEditorGUI::editShapePolygon ( )

Edit an existing shape (make it a polygon)

Definition at line 1046 of file class.ilImageMapEditorGUI.php.

1047 {
1048 $this->clearSessionVars();
1049 $_SESSION["il_map_edit_area_type"] = "Poly";
1050 return $this->setShape(false);
1051 }

References $_SESSION, clearSessionVars(), and setShape().

+ Here is the call graph for this function:

◆ editShapeRectangle()

ilImageMapEditorGUI::editShapeRectangle ( )

Edit an existing shape (make it a rectangle)

Definition at line 1026 of file class.ilImageMapEditorGUI.php.

1027 {
1028 $this->clearSessionVars();
1029 $_SESSION["il_map_edit_area_type"] = "Rect";
1030 return $this->setShape(false);
1031 }

References $_SESSION, clearSessionVars(), and setShape().

+ Here is the call graph for this function:

◆ editShapeWholePicture()

ilImageMapEditorGUI::editShapeWholePicture ( )

Edit an existing shape (make it a whole picture link)

Definition at line 1016 of file class.ilImageMapEditorGUI.php.

1017 {
1018 $this->clearSessionVars();
1019 $_SESSION["il_map_edit_area_type"] = "WholePicture";
1020 return $this->setShape(false);
1021 }

References $_SESSION, clearSessionVars(), and setShape().

+ Here is the call graph for this function:

◆ executeCommand()

ilImageMapEditorGUI::executeCommand ( )

Execute current command.

Definition at line 27 of file class.ilImageMapEditorGUI.php.

28 {
29 global $ilCtrl, $tpl;
30
31 $next_class = $ilCtrl->getNextClass($this);
32 $cmd = $ilCtrl->getCmd();
33
34 switch($next_class)
35 {
36 case "ilinternallinkgui":
37 require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
38 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
39 $link_gui->setMode("link");
40 $link_gui->setSetLinkTargetScript(
41 $ilCtrl->getLinkTarget($this,
42 "setInternalLink"));
43 $link_gui->filterLinkType("File");
44 $link_gui->setMode("asynch");
45 $ret = $ilCtrl->forwardCommand($link_gui);
46 break;
47
48 default:
49 require_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
51 if (isset($_POST["editImagemapForward"]) ||
52 isset($_POST["editImagemapForward_x"]) ||
53 isset($_POST["editImagemapForward_y"]))
54 {
55 $cmd = "editImagemapForward";
56 }
57 $ret = $this->$cmd();
58 break;
59 }
60
61 return $ret;
62 }
Class ilInternalLinkGUI.
includePresentationJS($a_tpl=null)
Include media object presentation JS.
$cmd
Definition: sahs_server.php:35

References $_POST, $cmd, $ilCtrl, $ret, $tpl, and ilObjMediaObjectGUI\includePresentationJS().

+ Here is the call graph for this function:

◆ getAdditionalPageXML()

ilImageMapEditorGUI::getAdditionalPageXML ( )

Get additional page xml (to be overwritten)

Returns
string additional page xml

Reimplemented in ilPCIIMTriggerEditorGUI.

Definition at line 643 of file class.ilImageMapEditorGUI.php.

644 {
645 return "";
646 }

Referenced by getImageMapOutput().

+ Here is the caller graph for this function:

◆ getAliasXML()

ilImageMapEditorGUI::getAliasXML ( )

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 659 of file class.ilImageMapEditorGUI.php.

660 {
661 return $this->media_object->getXML(IL_MODE_ALIAS);
662 }
const IL_MODE_ALIAS

References IL_MODE_ALIAS.

Referenced by getImageMapOutput().

+ Here is the caller graph for this function:

◆ getEditorTitle()

ilImageMapEditorGUI::getEditorTitle ( )

Get editor title.

Returns
string editor title

Reimplemented in ilPCIIMTriggerEditorGUI.

Definition at line 144 of file class.ilImageMapEditorGUI.php.

145 {
146 global $lng;
147
148 return $lng->txt("cont_imagemap");
149 }

References $lng.

◆ getHrefOfArea()

ilImageMapEditorGUI::getHrefOfArea (   $a_nr)

Get Href of Area (only external link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 957 of file class.ilImageMapEditorGUI.php.

958 {
959 $st_item = $this->media_object->getMediaItem("Standard");
960 $area = $st_item->getMapArea($a_nr);
961 return $area->getHref();
962 }

Referenced by setLink().

+ Here is the caller graph for this function:

◆ getImageMapOutput()

ilImageMapEditorGUI::getImageMapOutput (   $a_map_edit_mode = "")

Render the image map.

Definition at line 599 of file class.ilImageMapEditorGUI.php.

600 {
601 global $ilCtrl;
602
603 $st_item = $this->media_object->getMediaItem("Standard");
604
605 // output image map
606 $xml = "<dummy>";
607 $xml.= $this->getAliasXML();
608 $xml.= $this->media_object->getXML(IL_MODE_OUTPUT);
609 $xml.= $this->getAdditionalPageXML();
610 $xml.="</dummy>";
611 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
612//echo htmlentities($xml); exit;
613 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
614 $xh = xslt_create();
615 $wb_path = ilUtil::getWebspaceDir("output")."/";
616 $mode = "media";
617//echo htmlentities($ilCtrl->getLinkTarget($this, "showImageMap"));
618 $params = array ('map_edit_mode' => $a_map_edit_mode,
619 'map_item' => $st_item->getId(),
620 'map_mob_id' => $this->media_object->getId(),
621 'mode' => $mode,
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"],
626 'pg_frame' => "",
627 'enlarge_path' => ilUtil::getImagePath("enlarge.svg"),
628 'webspace_path' => $wb_path);
629 $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
630 echo xslt_error($xh);
631 xslt_free($xh);
632
633 $output = $this->outputPostProcessing($output);
634
635 return $output;
636 }
const IL_MODE_OUTPUT
getAdditionalPageXML()
Get additional page xml (to be overwritten)
outputPostProcessing($a_output)
Output post processing.
static getWebspaceDir($mode="filesystem")
get webspace directory
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$params
Definition: example_049.php:96
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()

References $_GET, $ilCtrl, $params, getAdditionalPageXML(), getAliasXML(), ilUtil\getImagePath(), ilUtil\getWebspaceDir(), IL_MODE_OUTPUT, outputPostProcessing(), xslt_create(), xslt_error(), and xslt_free().

Referenced by editMapArea(), and editMapAreas().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageMapTableHTML()

ilImageMapEditorGUI::getImageMapTableHTML ( )

Get table HTML.

Reimplemented in ilPCIIMTriggerEditorGUI, and ilPCImageMapEditorGUI.

Definition at line 155 of file class.ilImageMapEditorGUI.php.

156 {
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();
160 }
TableGUI class for image map editor.

Referenced by editMapAreas().

+ Here is the caller graph for this function:

◆ getLinkTypeOfArea()

ilImageMapEditorGUI::getLinkTypeOfArea (   $a_nr)

Get Link Type of Area.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 917 of file class.ilImageMapEditorGUI.php.

918 {
919 $st_item = $this->media_object->getMediaItem("Standard");
920 $area = $st_item->getMapArea($a_nr);
921 return $area->getLinkType();
922 }

Referenced by setLink().

+ Here is the caller graph for this function:

◆ getMapAreaLinkString()

ilImageMapEditorGUI::getMapAreaLinkString (   $a_target,
  $a_type,
  $a_frame 
)

Get text name of internal link.

Parameters
string$a_targettarget object link id
string$a_typetype
string$a_frametarget frame

@access private

Definition at line 673 of file class.ilImageMapEditorGUI.php.

674 {
675 global $lng;
676
677 $t_arr = explode("_", $a_target);
678 if ($a_frame != "")
679 {
680 $frame_str = " (".$a_frame." Frame)";
681 }
682 switch($a_type)
683 {
684 case "StructureObject":
685 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
686 $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
687 $link_str = $lng->txt("chapter").
688 ": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
689 break;
690
691 case "PageObject":
692 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
693 $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
694 $link_str = $lng->txt("page").
695 ": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
696 break;
697
698 case "GlossaryItem":
699 require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
700 $term =& new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
701 $link_str = $lng->txt("term").
702 ": ".$term->getTerm()." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
703 break;
704
705 case "MediaObject":
706 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
707 $mob =& new ilObjMediaObject($t_arr[count($t_arr) - 1]);
708 $link_str = $lng->txt("mob").
709 ": ".$mob->getTitle()." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
710 break;
711
712 case "RepositoryItem":
713 $title = ilObject::_lookupTitle(
714 ilObject::_lookupObjId($t_arr[count($t_arr) - 1]));
715 $link_str = $lng->txt("obj_".$t_arr[count($t_arr) - 2]).
716 ": ".$title." [".$t_arr[count($t_arr) - 1]."]".$frame_str;
717 break;
718 }
719
720 return $link_str;
721 }
Class ilGlossaryTerm.
static _lookupTitle($a_obj_id)
Lookup title.
Class ilObjMediaObject.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title

References $lng, ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilLMObject\_lookupTitle().

Referenced by initAreaEditingForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetFrameOfArea()

ilImageMapEditorGUI::getTargetFrameOfArea (   $a_nr)

Get TargetFrame of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 947 of file class.ilImageMapEditorGUI.php.

948 {
949 $st_item = $this->media_object->getMediaItem("Standard");
950 $area = $st_item->getMapArea($a_nr);
951 return $area->getTargetFrame();
952 }

Referenced by setLink().

+ Here is the caller graph for this function:

◆ getTargetOfArea()

ilImageMapEditorGUI::getTargetOfArea (   $a_nr)

Get Target of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 937 of file class.ilImageMapEditorGUI.php.

938 {
939 $st_item = $this->media_object->getMediaItem("Standard");
940 $area = $st_item->getMapArea($a_nr);
941 return $area->getTarget();
942 }

Referenced by setLink().

+ Here is the caller graph for this function:

◆ getToolbar()

ilImageMapEditorGUI::getToolbar ( )

Get toolbar.

Returns
object toolbar

Reimplemented in ilPCIIMTriggerEditorGUI.

Definition at line 97 of file class.ilImageMapEditorGUI.php.

98 {
99 global $ilCtrl, $lng, $tpl;
100
101 // toolbar
102 $tb = new ilToolbarGUI();
103 $tb->setFormAction($ilCtrl->getFormAction($this));
104 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
105 $options = array(
106 "WholePicture" => $lng->txt("cont_WholePicture"),
107 "Rect" => $lng->txt("cont_Rect"),
108 "Circle" => $lng->txt("cont_Circle"),
109 "Poly" => $lng->txt("cont_Poly"),
110 );
111 $si = new ilSelectInputGUI($lng->txt("cont_shape"), "shape");
112 $si->setOptions($options);
113 $tb->addInputItem($si, true);
114 $tb->addFormButton($lng->txt("cont_add_area"), "addNewArea");
115
116
117 // highlight mode
118/* if (strtolower(get_class($this)) == "ilimagemapeditorgui")
119 {
120 $st_item = $this->media_object->getMediaItem("Standard");
121 $tb->addSeparator();
122 $options = ilMapArea::getAllHighlightModes();
123 $hl = new ilSelectInputGUI($lng->txt("cont_highlight_mode"), "highlight_mode");
124 $hl->setOptions($options);
125// $hl->setValue($st_item->getHighlightMode());
126 $tb->addInputItem($hl, true);
127 $options = ilMapArea::getAllHighlightClasses();
128 $hc = new ilSelectInputGUI($lng->txt("cont_highlight_class"), "highlight_class");
129 $hc->setOptions($options);
130// $hc->setValue($st_item->getHighlightClass());
131 $tb->addInputItem($hc, false);
132 $tb->addFormButton($lng->txt("cont_set"), "setHighlight");
133 }*/
134
135 return $tb;
136 }
This class represents a selection list property in a property form.
if(!is_array($argv)) $options

References $ilCtrl, $lng, $options, $si, and $tpl.

Referenced by editMapAreas().

+ Here is the caller graph for this function:

◆ getTypeOfArea()

ilImageMapEditorGUI::getTypeOfArea (   $a_nr)

Get Type of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 927 of file class.ilImageMapEditorGUI.php.

928 {
929 $st_item = $this->media_object->getMediaItem("Standard");
930 $area = $st_item->getMapArea($a_nr);
931 return $area->getType();
932 }

Referenced by setLink().

+ Here is the caller graph for this function:

◆ handleMapParameters()

ilImageMapEditorGUI::handleMapParameters ( )

handle parameter during map area editing (storing to session)

Definition at line 165 of file class.ilImageMapEditorGUI.php.

166 {
167 if($_GET["ref_id"] != "")
168 {
169 $_SESSION["il_map_edit_ref_id"] = $_GET["ref_id"];
170 }
171
172 if($_GET["obj_id"] != "")
173 {
174 $_SESSION["il_map_edit_obj_id"] = $_GET["obj_id"];
175 }
176
177 if($_GET["hier_id"] != "")
178 {
179 $_SESSION["il_map_edit_hier_id"] = $_GET["hier_id"];
180 }
181
182 if($_GET["pc_id"] != "")
183 {
184 $_SESSION["il_map_edit_pc_id"] = $_GET["pc_id"];
185 }
186 }

References $_GET, and $_SESSION.

Referenced by addArea(), editMapAreas(), setLink(), and setShape().

+ Here is the caller graph for this function:

◆ initAreaEditingForm()

ilImageMapEditorGUI::initAreaEditingForm (   $a_edit_property)

Init area editing form.

Parameters
int$a_modeEdit Mode

Reimplemented in ilPCIIMTriggerEditorGUI.

Definition at line 473 of file class.ilImageMapEditorGUI.php.

474 {
475 global $lng, $ilCtrl;
476
477 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
478 $form = new ilPropertyFormGUI();
479 $form->setOpenTag(false);
480 $form->setCloseTag(false);
481
482 // link
483 if ($a_edit_property != "shape")
484 {
485 //
486 $radg = new ilRadioGroupInputGUI($lng->txt("cont_link"), "area_link_type");
487 if ($_SESSION["il_map_il_ltype"] != "int")
488 {
489 if ($_SESSION["il_map_el_href"] == "")
490 {
491 $radg->setValue("no");
492 }
493 else
494 {
495 $radg->setValue("ext");
496 }
497 }
498 else
499 {
500 $radg->setValue("int");
501 }
502
503 // external link
504 $ext = new ilRadioOption($lng->txt("cont_link_ext"), "ext");
505 $radg->addOption($ext);
506
507 $ti = new ilTextInputGUI("", "area_link_ext");
508 $ti->setMaxLength(200);
509 $ti->setSize(50);
510 if ($_SESSION["il_map_el_href"] != "")
511 {
512 $ti->setValue($_SESSION["il_map_el_href"]);
513 }
514 else
515 {
516 $ti->setValue("http://");
517 }
518 $ext->addSubItem($ti);
519
520 // internal link
521 $int = new ilRadioOption($lng->txt("cont_link_int"), "int");
522 $radg->addOption($int);
523
524 $ne = new ilNonEditableValueGUI("", "", true);
525 $link_str = "";
526 if($_SESSION["il_map_il_target"] != "")
527 {
528 $link_str = $this->getMapAreaLinkString($_SESSION["il_map_il_target"],
529 $_SESSION["il_map_il_type"], $_SESSION["il_map_il_targetframe"]);
530 }
531 $ne->setValue($link_str.
532 '&nbsp;<a id="iosEditInternalLinkTrigger" href="#">'.
533 "[".$lng->txt("cont_get_link")."]".
534 '</a>'
535 );
536 $int->addSubItem($ne);
537
538 // no link
539 $no = new ilRadioOption($lng->txt("cont_link_no"), "no");
540 $radg->addOption($no);
541
542 $form->addItem($radg);
543 }
544
545
546 // name
547 if ($a_edit_property != "link" && $a_edit_property != "shape")
548 {
549 $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
550 $ti->setMaxLength(200);
551 $ti->setSize(20);
552 $form->addItem($ti);
553 }
554
555 // save and cancel commands
556 if ($a_edit_property == "")
557 {
558 $form->setTitle($lng->txt("cont_new_area"));
559 $form->addCommandButton("saveArea", $lng->txt("save"));
560 }
561 else
562 {
563 $form->setTitle($lng->txt("cont_new_area"));
564 $form->addCommandButton("saveArea", $lng->txt("save"));
565 }
566
567// $form->setFormAction($ilCtrl->getFormAction($this));
568
569 return $form;
570 }
getMapAreaLinkString($a_target, $a_type, $a_frame)
Get text name of internal link.
This class represents a non editable value in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.

References $_SESSION, $ilCtrl, $lng, and getMapAreaLinkString().

Referenced by editMapArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ linkWholePicture()

ilImageMapEditorGUI::linkWholePicture ( )

Link the whole picture.

Definition at line 237 of file class.ilImageMapEditorGUI.php.

238 {
239 $this->clearSessionVars();
240 $_SESSION["il_map_edit_area_type"] = "WholePicture";
241
242 return $this->editMapArea(false, false, true);
243 }

References $_SESSION, clearSessionVars(), and editMapArea().

Referenced by addNewArea().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeMapWorkCopy()

ilImageMapEditorGUI::makeMapWorkCopy (   $a_edit_property = "",
  $a_area_nr = 0,
  $a_output_new_area = false,
  $a_area_type = "",
  $a_coords = "" 
)

Make work file for editing.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 575 of file class.ilImageMapEditorGUI.php.

577 {
578 // create/update imagemap work copy
579 $st_item = $this->media_object->getMediaItem("Standard");
580
581 if ($a_edit_property == "shape")
582 {
583 $st_item->makeMapWorkCopy($a_area_nr, true); // exclude area currently being edited
584 }
585 else
586 {
587 $st_item->makeMapWorkCopy($a_area_nr, false);
588 }
589
590 if ($a_output_new_area)
591 {
592 $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
593 }
594 }

Referenced by editMapArea(), and editMapAreas().

+ Here is the caller graph for this function:

◆ outputPostProcessing()

ilImageMapEditorGUI::outputPostProcessing (   $a_output)

Output post processing.

Parameters

return

Reimplemented in ilPCIIMTriggerEditorGUI.

Definition at line 654 of file class.ilImageMapEditorGUI.php.

655 {
656 return $a_output;
657 }

Referenced by getImageMapOutput().

+ Here is the caller graph for this function:

◆ saveArea()

ilImageMapEditorGUI::saveArea ( )

Save new or updated map area.

Reimplemented in ilPCIIMTriggerEditorGUI, and ilPCImageMapEditorGUI.

Definition at line 756 of file class.ilImageMapEditorGUI.php.

757 {
758 global $lng, $ilCtrl;
759
760 switch ($_SESSION["il_map_edit_mode"])
761 {
762 // save edited link
763 case "edit_link":
764 $st_item = $this->media_object->getMediaItem("Standard");
765 $max = ilMapArea::_getMaxNr($st_item->getId());
766 $area = new ilMapArea($st_item->getId(), $_SESSION["il_map_area_nr"]);
767
768 if ($_POST["area_link_type"] == IL_INT_LINK)
769 {
770 $area->setLinkType(IL_INT_LINK);
771 $area->setType($_SESSION["il_map_il_type"]);
772 $area->setTarget($_SESSION["il_map_il_target"]);
773 $area->setTargetFrame($_SESSION["il_map_il_targetframe"]);
774 }
775 else
776 {
777 $area->setLinkType(IL_EXT_LINK);
778 if ($_POST["area_link_type"] != IL_NO_LINK)
779 {
780 $area->setHref(ilUtil::stripSlashes($_POST["area_link_ext"]));
781 }
782 else
783 {
784 $area->setHref("");
785 }
786 }
787 $area->update();
788 break;
789
790 // save edited shape
791 case "edit_shape":
792 $st_item = $this->media_object->getMediaItem("Standard");
793 $max = ilMapArea::_getMaxNr($st_item->getId());
794 $area =& new ilMapArea($st_item->getId(), $_SESSION["il_map_area_nr"]);
795
796 $area->setShape($_SESSION["il_map_edit_area_type"]);
797 $area->setCoords($_SESSION["il_map_edit_coords"]);
798 $area->update();
799 break;
800
801 // save new area
802 default:
803 $area_type = $_SESSION["il_map_edit_area_type"];
804 $coords = $_SESSION["il_map_edit_coords"];
805
806 $st_item = $this->media_object->getMediaItem("Standard");
807 $max = ilMapArea::_getMaxNr($st_item->getId());
808
809 // make new area object
810 $area = new ilMapArea();
811 $area->setItemId($st_item->getId());
812 $area->setShape($area_type);
813 $area->setCoords($coords);
814 $area->setNr($max + 1);
815 $area->setTitle(ilUtil::stripSlashes($_POST["area_name"]));
816 switch($_POST["area_link_type"])
817 {
818 case "ext":
819 $area->setLinkType(IL_EXT_LINK);
820 $area->setHref($_POST["area_link_ext"]);
821 break;
822
823 case "int":
824 $area->setLinkType(IL_INT_LINK);
825 $area->setType($_SESSION["il_map_il_type"]);
826 $area->setTarget($_SESSION["il_map_il_target"]);
827 $area->setTargetFrame($_SESSION["il_map_il_targetframe"]);
828 break;
829 }
830
831 // put area into item and update media object
832 $st_item->addMapArea($area);
833 $this->media_object->update();
834 break;
835 }
836
837 //$this->initMapParameters();
838 ilUtil::sendSuccess($lng->txt("cont_saved_map_area"), true);
839 $ilCtrl->redirect($this, "editMapAreas");
840 }
const IL_INT_LINK
const IL_EXT_LINK
const IL_NO_LINK
Class ilMapArea.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, $_SESSION, $coords, $ilCtrl, $lng, ilMapArea\_getMaxNr(), IL_EXT_LINK, IL_INT_LINK, IL_NO_LINK, ilUtil\sendSuccess(), and ilUtil\stripSlashes().

Referenced by setShape().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHighlight()

ilImageMapEditorGUI::setHighlight ( )

Set highlight settings.

Parameters

return

Definition at line 1160 of file class.ilImageMapEditorGUI.php.

1161 {
1162 global $ilCtrl, $lng;
1163
1164 $st_item = $this->media_object->getMediaItem("Standard");
1165 $st_item->setHighlightMode(ilUtil::stripSlashes($_POST["highlight_mode"]));
1166 $st_item->setHighlightClass(ilUtil::stripSlashes($_POST["highlight_class"]));
1167 $st_item->update();
1168
1169 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1170 $ilCtrl->redirect($this, "editMapAreas");
1171 }

References $_POST, $ilCtrl, $lng, ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ setInternalLink()

ilImageMapEditorGUI::setInternalLink ( )

Set internal link.

Definition at line 845 of file class.ilImageMapEditorGUI.php.

846 {
847 $_SESSION["il_map_il_type"] = $_GET["linktype"];
848 $_SESSION["il_map_il_ltype"] = "int";
849
850 $_SESSION["il_map_il_target"] = $_GET["linktarget"];
851 $_SESSION["il_map_il_targetframe"] = $_GET["linktargetframe"];
852 switch ($_SESSION["il_map_edit_mode"])
853 {
854 case "edit_link":
855 return $this->setLink();
856 break;
857
858 default:
859 return $this->addArea();
860 break;
861 }
862 }

References $_GET, $_SESSION, addArea(), and setLink().

+ Here is the call graph for this function:

◆ setLink()

ilImageMapEditorGUI::setLink (   $a_handle = true)

Set link.

Definition at line 867 of file class.ilImageMapEditorGUI.php.

868 {
869 global $lng, $ilCtrl;
870
871 if($a_handle)
872 {
873 $this->handleMapParameters();
874 }
875 if ($_SESSION["il_map_area_nr"] != "")
876 {
877 $_POST["area"][0] = $_SESSION["il_map_area_nr"];
878 }
879 if (!isset($_POST["area"]))
880 {
881 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
882 $ilCtrl->redirect($this, "editMapAreas");
883 }
884
885 if (count($_POST["area"]) > 1)
886 {
887 //$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
888 ilUtil::sendFailure($lng->txt("cont_select_max_one_item"), true);
889 $ilCtrl->redirect($this, "editMapAreas");
890 }
891
892
893 if ($_SESSION["il_map_edit_mode"] != "edit_link")
894 {
895 $_SESSION["il_map_area_nr"] = $_POST["area"][0];
896 $_SESSION["il_map_il_ltype"] = $this->getLinkTypeOfArea($_POST["area"][0]);
897 $_SESSION["il_map_edit_mode"] = "edit_link";
898 $_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "setLink");
899 if ($_SESSION["il_map_il_ltype"] == IL_INT_LINK)
900 {
901 $_SESSION["il_map_il_type"] = $this->getTypeOfArea($_POST["area"][0]);
902 $_SESSION["il_map_il_target"] = $this->getTargetOfArea($_POST["area"][0]);
903 $_SESSION["il_map_il_targetframe"] = $this->getTargetFrameOfArea($_POST["area"][0]);
904 }
905 else
906 {
907 $_SESSION["il_map_el_href"] = $this->getHrefOfArea($_POST["area"][0]);
908 }
909 }
910
911 return $this->editMapArea(false, false, true, "link", $_POST["area"][0]);
912 }
getTargetOfArea($a_nr)
Get Target of Area (only internal link)
getTypeOfArea($a_nr)
Get Type of Area (only internal link)
getTargetFrameOfArea($a_nr)
Get TargetFrame of Area (only internal link)
getHrefOfArea($a_nr)
Get Href of Area (only external link)
getLinkTypeOfArea($a_nr)
Get Link Type of Area.

References $_POST, $_SESSION, $ilCtrl, $lng, editMapArea(), getHrefOfArea(), getLinkTypeOfArea(), getTargetFrameOfArea(), getTargetOfArea(), getTypeOfArea(), handleMapParameters(), IL_INT_LINK, and ilUtil\sendFailure().

Referenced by editLink(), and setInternalLink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShape()

ilImageMapEditorGUI::setShape (   $a_handle = true)

edit shape of existing map area

Definition at line 1056 of file class.ilImageMapEditorGUI.php.

1057 {
1058 global $lng, $ilCtrl;
1059
1060 if($a_handle)
1061 {
1062 $this->handleMapParameters();
1063 }
1064 if($_POST["areatype2"] != "")
1065 {
1066 $_SESSION["il_map_edit_area_type"] = $_POST["areatype2"];
1067 }
1068 if ($_SESSION["il_map_area_nr"] != "")
1069 {
1070 $_POST["area"][0] = $_SESSION["il_map_area_nr"];
1071 }
1072 if (!isset($_POST["area"]))
1073 {
1074 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
1075 $ilCtrl->redirect($this, "editMapAreas");
1076 }
1077
1078 if (count($_POST["area"]) > 1)
1079 {
1080 ilUtil::sendFailure($lng->txt("cont_select_max_one_item"), true);
1081 $ilCtrl->redirect($this, "editMapAreas");
1082 }
1083
1084 if ($_SESSION["il_map_edit_mode"] != "edit_shape")
1085 {
1086 $_SESSION["il_map_area_nr"] = $_POST["area"][0];
1087 $_SESSION["il_map_edit_mode"] = "edit_shape";
1088 $_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "setShape", "", false, false);
1089 }
1090
1091
1092 $area_type = $_SESSION["il_map_edit_area_type"];
1093 $coords = $_SESSION["il_map_edit_coords"];
1094 $cnt_coords = ilMapArea::countCoords($coords);
1095
1096 // decide what to do next
1097 switch ($area_type)
1098 {
1099 // Rectangle
1100 case "Rect" :
1101 if ($cnt_coords < 2)
1102 {
1103 return $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
1104 }
1105 else if ($cnt_coords == 2)
1106 {
1107 return $this->saveArea();
1108 }
1109 break;
1110
1111 // Circle
1112 case "Circle":
1113 if ($cnt_coords <= 1)
1114 {
1115 return $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
1116 }
1117 else
1118 {
1119 if ($cnt_coords == 2)
1120 {
1121 $c = explode(",",$coords);
1122 $coords = $c[0].",".$c[1].","; // determine radius
1123 $coords .= round(sqrt(pow(abs($c[3]-$c[1]),2)+pow(abs($c[2]-$c[0]),2)));
1124 }
1125 $_SESSION["il_map_edit_coords"] = $coords;
1126
1127 return $this->saveArea();
1128 }
1129 break;
1130
1131 // Polygon
1132 case "Poly":
1133 if ($cnt_coords < 1)
1134 {
1135 return $this->editMapArea(true, false, false, "shape", $_POST["area"][0]);
1136 }
1137 else if ($cnt_coords < 3)
1138 {
1139 return $this->editMapArea(true, true, false, "shape", $_POST["area"][0]);
1140 }
1141 else
1142 {
1143 return $this->editMapArea(true, true, true, "shape", $_POST["area"][0]);
1144 }
1145 break;
1146
1147 // Whole Picture
1148 case "WholePicture":
1149 return $this->saveArea();
1150 }
1151
1152 }
saveArea()
Save new or updated map area.

References $_POST, $_SESSION, $coords, $ilCtrl, $lng, ilMapArea\countCoords(), editMapArea(), handleMapParameters(), saveArea(), and ilUtil\sendFailure().

Referenced by editShapeCircle(), editShapePolygon(), editShapeRectangle(), and editShapeWholePicture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showImageMap()

ilImageMapEditorGUI::showImageMap ( )

show image map

Definition at line 191 of file class.ilImageMapEditorGUI.php.

192 {
193 $item =& new ilMediaItem($_GET["item_id"]);
194 $item->outputMapWorkCopy();
195 }
Class ilMediaItem.

References $_GET.

◆ updateAreas()

ilImageMapEditorGUI::updateAreas ( )

Update map areas.

Reimplemented in ilPCImageMapEditorGUI.

Definition at line 200 of file class.ilImageMapEditorGUI.php.

201 {
202 global $lng, $ilCtrl;
203
204 $st_item =& $this->media_object->getMediaItem("Standard");
205 $max = ilMapArea::_getMaxNr($st_item->getId());
206 for ($i=1; $i<=$max; $i++)
207 {
208 $area =& new ilMapArea($st_item->getId(), $i);
209 $area->setTitle(ilUtil::stripSlashes($_POST["name_".$i]));
210 $area->setHighlightMode(ilUtil::stripSlashes($_POST["hl_mode_".$i]));
211 $area->setHighlightClass(ilUtil::stripSlashes($_POST["hl_class_".$i]));
212 $area->update();
213 }
214
215 ilUtil::sendSuccess($lng->txt("cont_saved_map_data"), true);
216 $ilCtrl->redirect($this, "editMapAreas");
217 }

References $_POST, $ilCtrl, $lng, ilMapArea\_getMaxNr(), ilUtil\sendSuccess(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: