ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 
 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...
 

Static Public Member Functions

static _recoverParameters ()
 Recover parameters from session variables (static) More...
 

Protected Attributes

 $ctrl
 
 $tpl
 
 $lng
 
 $toolbar
 

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 39 of file class.ilImageMapEditorGUI.php.

40 {
41 global $DIC;
42
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;
48 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ _recoverParameters()

static ilImageMapEditorGUI::_recoverParameters ( )
static

Recover parameters from session variables (static)

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

756 {
757 $_GET["ref_id"] = $_SESSION["il_map_edit_ref_id"];
758 $_GET["obj_id"] = $_SESSION["il_map_edit_obj_id"];
759 $_GET["hier_id"] = $_SESSION["il_map_edit_hier_id"];
760 $_GET["pc_id"] = $_SESSION["il_map_edit_pc_id"];
761 }
$_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 324 of file class.ilImageMapEditorGUI.php.

325 {
326
327 // handle map parameters
328 if ($a_handle) {
329 $this->handleMapParameters();
330 }
331
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");
335 $cnt_coords = ilMapArea::countCoords($coords);
336
337 // decide what to do next
338 switch ($area_type) {
339 // Rectangle
340 case "Rect":
341 if ($cnt_coords < 2) {
342 $html = $this->editMapArea(true, false, false);
343 return $html;
344 } elseif ($cnt_coords == 2) {
345 return $this->editMapArea(false, true, true);
346 }
347 break;
348
349 // Circle
350 case "Circle":
351 if ($cnt_coords <= 1) {
352 return $this->editMapArea(true, false, false);
353 } else {
354 if ($cnt_coords == 2) {
355 $c = explode(",", $coords);
356 $coords = $c[0] . "," . $c[1] . ","; // determine radius
357 $coords .= round(sqrt(pow(abs($c[3]-$c[1]), 2)+pow(abs($c[2]-$c[0]), 2)));
358 }
359 $_SESSION["il_map_edit_coords"] = $coords;
360
361 return $this->editMapArea(false, true, true);
362 }
363 break;
364
365 // Polygon
366 case "Poly":
367 if ($cnt_coords < 1) {
368 return $this->editMapArea(true, false, false);
369 } elseif ($cnt_coords < 3) {
370 return $this->editMapArea(true, true, false);
371 } else {
372 return $this->editMapArea(true, true, true);
373 }
374 break;
375
376 // Whole picture
377 case "WholePicture":
378 return $this->editMapArea(false, false, true);
379 break;
380 }
381 }
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.
handleMapParameters()
handle parameter during map area editing (storing to session)
static 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 288 of file class.ilImageMapEditorGUI.php.

289 {
290 $this->clearSessionVars();
291 $_SESSION["il_map_edit_area_type"] = "Circle";
292 return $this->addArea(false);
293 }
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 253 of file class.ilImageMapEditorGUI.php.

254 {
255 switch ($_POST["shape"]) {
256 case "WholePicture": return $this->linkWholePicture();
257 case "Rect": return $this->addRectangle();
258 case "Circle": return $this->addCircle();
259 case "Poly": return $this->addPolygon();
260 }
261 }
$_POST["username"]
linkWholePicture()
Link the whole picture.
addPolygon()
Add a new polygon.
addRectangle()
Add a new rectangle.

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 298 of file class.ilImageMapEditorGUI.php.

299 {
300 $this->clearSessionVars();
301 $_SESSION["il_map_edit_area_type"] = "Poly";
302 return $this->addArea(false);
303 }

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 278 of file class.ilImageMapEditorGUI.php.

279 {
280 $this->clearSessionVars();
281 $_SESSION["il_map_edit_area_type"] = "Rect";
282 return $this->addArea(false);
283 }

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 308 of file class.ilImageMapEditorGUI.php.

309 {
310 $_SESSION["il_map_area_nr"] = "";
311 $_SESSION["il_map_edit_coords"] = "";
312 $_SESSION["il_map_edit_mode"] = "";
313 $_SESSION["il_map_el_href"] = "";
314 $_SESSION["il_map_il_type"] = "";
315 $_SESSION["il_map_il_ltype"] = "";
316 $_SESSION["il_map_il_target"] = "";
317 $_SESSION["il_map_il_targetframe"] = "";
318 $_SESSION["il_map_edit_area_type"] = "";
319 }

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 963 of file class.ilImageMapEditorGUI.php.

964 {
967
968 if (!isset($_POST["area"])) {
969 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
970 $ilCtrl->redirect($this, "editMapAreas");
971 }
972
973 $st_item = $this->media_object->getMediaItem("Standard");
974 $max = ilMapArea::_getMaxNr($st_item->getId());
975
976 if (count($_POST["area"]) > 0) {
977 $i = 0;
978
979 foreach ($_POST["area"] as $area_nr) {
980 $st_item->deleteMapArea($area_nr - $i);
981 $i++;
982 }
983
984 $this->media_object->update();
985 ilUtil::sendSuccess($lng->txt("cont_areas_deleted"), true);
986 }
987
988 $ilCtrl->redirect($this, "editMapAreas");
989 }
static _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.
$i
Definition: disco.tpl.php:19
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ctrl, $i, $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 737 of file class.ilImageMapEditorGUI.php.

738 {
740
741 if ($_SESSION["il_map_edit_coords"] != "") {
742 $_SESSION["il_map_edit_coords"] .= ",";
743 }
744
745 $_SESSION["il_map_edit_coords"] .= $_POST["editImagemapForward_x"] . "," .
746 $_POST["editImagemapForward_y"];
747
748 // call editing script
749 ilUtil::redirect($_SESSION["il_map_edit_target_script"]);
750 }
static _recoverParameters()
Recover parameters from session variables (static)
static redirect($a_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 994 of file class.ilImageMapEditorGUI.php.

995 {
996 $_SESSION["il_map_edit_coords"] = "";
997 $_SESSION["il_map_edit_mode"] = "";
998 $_SESSION["il_map_el_href"] = "";
999 $_SESSION["il_map_il_type"] = "";
1000 $_SESSION["il_map_il_ltype"] = "";
1001 $_SESSION["il_map_il_target"] = "";
1002 $_SESSION["il_map_il_targetframe"] = "";
1003 $_SESSION["il_map_area_nr"] = "";
1004 return $this->setLink(false);
1005 }
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 391 of file class.ilImageMapEditorGUI.php.

397 {
401
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");
405 $cnt_coords = ilMapArea::countCoords($coords);
406
407 $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
408
409 $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
410
411 if ($a_edit_property != "link") {
412 switch ($area_type) {
413 // rectangle
414 case "Rect":
415 if ($cnt_coords == 0) {
416 ilUtil::sendInfo($lng->txt("cont_click_tl_corner"));
417 }
418 if ($cnt_coords == 1) {
419 ilUtil::sendInfo($lng->txt("cont_click_br_corner"));
420 }
421 break;
422
423 // circle
424 case "Circle":
425 if ($cnt_coords == 0) {
426 ilUtil::sendInfo($lng->txt("cont_click_center"));
427 }
428 if ($cnt_coords == 1) {
429 ilUtil::sendInfo($lng->txt("cont_click_circle"));
430 }
431 break;
432
433 // polygon
434 case "Poly":
435 if ($cnt_coords == 0) {
436 ilUtil::sendInfo($lng->txt("cont_click_starting_point"));
437 } elseif ($cnt_coords < 3) {
438 ilUtil::sendInfo($lng->txt("cont_click_next_point"));
439 } else {
440 ilUtil::sendInfo($lng->txt("cont_click_next_or_save"));
441 }
442 break;
443 }
444 }
445
446
447 // map properties input fields (name and link)
448 if ($a_save_form) {
449 if ($a_edit_property != "shape") {
450 // prepare link gui
451 $ilCtrl->setParameter($this, "linkmode", "map");
452 include_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
453 $this->tpl->setCurrentBlock("int_link_prep");
454 $this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
455 $ilCtrl->getLinkTargetByClass(
456 "ilinternallinkgui",
457 "",
458 false,
459 true,
460 false
461 )
462 ));
463 $this->tpl->parseCurrentBlock();
464 }
465 $form = $this->initAreaEditingForm($a_edit_property);
466 $this->tpl->setVariable("FORM", $form->getHTML());
467 }
468
469 $this->makeMapWorkCopy(
470 $a_edit_property,
471 $a_area_nr,
472 $a_output_new_area,
473 $area_type,
474 $coords
475 );
476
477 $edit_mode = ($a_get_next_coordinate)
478 ? "get_coords"
479 : (($a_output_new_area)
480 ? "new_area"
481 :"");
482 $output = $this->getImageMapOutput($edit_mode);
483 $this->tpl->setVariable("IMAGE_MAP", $output);
484
485 return $this->tpl->get();
486 }
makeMapWorkCopy( $a_edit_property="", $a_area_nr=0, $a_output_new_area=false, $a_area_type="", $a_coords="")
Make work file for editing.
getImageMapOutput($a_map_edit_mode="")
Render the image map.
initAreaEditingForm($a_edit_property)
Init area editing form.
static getInitHTML($a_url)
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.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
if(isset($_POST['submit'])) $form

References $_SESSION, $coords, $ctrl, $form, $ilCtrl, $lng, $output, $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 93 of file class.ilImageMapEditorGUI.php.

94 {
97 $ilToolbar = $this->toolbar;
98
99 $_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget(
100 $this,
101 "addArea",
102 "",
103 false,
104 false
105 );
106 $this->handleMapParameters();
107
108 $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
109 $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
110
111 // create/update imagemap work copy
112 $this->makeMapWorkCopy();
113
114 $output = $this->getImageMapOutput();
115 $this->tpl->setVariable("IMAGE_MAP", $output);
116
117 $this->tpl->setVariable("TOOLBAR", $this->getToolbar()->getHTML());
118
119 // table
120 $this->tpl->setVariable("MAP_AREA_TABLE", $this->getImageMapTableHTML());
121
122 return $this->tpl->get();
123 }
getImageMapTableHTML()
Get table HTML.

References $_SESSION, $ctrl, $ilCtrl, $lng, $output, $toolbar, 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 1030 of file class.ilImageMapEditorGUI.php.

1031 {
1032 $this->clearSessionVars();
1033 $_SESSION["il_map_edit_area_type"] = "Circle";
1034 return $this->setShape(false);
1035 }
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 1040 of file class.ilImageMapEditorGUI.php.

1041 {
1042 $this->clearSessionVars();
1043 $_SESSION["il_map_edit_area_type"] = "Poly";
1044 return $this->setShape(false);
1045 }

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 1020 of file class.ilImageMapEditorGUI.php.

1021 {
1022 $this->clearSessionVars();
1023 $_SESSION["il_map_edit_area_type"] = "Rect";
1024 return $this->setShape(false);
1025 }

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 1010 of file class.ilImageMapEditorGUI.php.

1011 {
1012 $this->clearSessionVars();
1013 $_SESSION["il_map_edit_area_type"] = "WholePicture";
1014 return $this->setShape(false);
1015 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilImageMapEditorGUI::executeCommand ( )

Execute current command.

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

54 {
57
58 $next_class = $ilCtrl->getNextClass($this);
59 $cmd = $ilCtrl->getCmd();
60
61 switch ($next_class) {
62 case "ilinternallinkgui":
63 require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
64 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
65 $link_gui->setSetLinkTargetScript(
66 $ilCtrl->getLinkTarget(
67 $this,
68 "setInternalLink"
69 )
70 );
71 $link_gui->filterLinkType("File");
72 $ret = $ilCtrl->forwardCommand($link_gui);
73 break;
74
75 default:
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";
82 }
83 $ret = $this->$cmd();
84 break;
85 }
86
87 return $ret;
88 }
Class ilInternalLinkGUI.
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
$ret
Definition: parser.php:6

References $_POST, $ctrl, $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 655 of file class.ilImageMapEditorGUI.php.

656 {
657 return "";
658 }

Referenced by getImageMapOutput().

+ Here is the caller graph for this function:

◆ getAliasXML()

ilImageMapEditorGUI::getAliasXML ( )

Reimplemented in ilPCImageMapEditorGUI.

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

672 {
673 return $this->media_object->getXML(IL_MODE_ALIAS);
674 }
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 179 of file class.ilImageMapEditorGUI.php.

180 {
182
183 return $lng->txt("cont_imagemap");
184 }

References $lng.

◆ getHrefOfArea()

ilImageMapEditorGUI::getHrefOfArea (   $a_nr)

Get Href of Area (only external link)

Reimplemented in ilPCImageMapEditorGUI.

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

954 {
955 $st_item = $this->media_object->getMediaItem("Standard");
956 $area = $st_item->getMapArea($a_nr);
957 return $area->getHref();
958 }

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 609 of file class.ilImageMapEditorGUI.php.

610 {
612
613 $st_item = $this->media_object->getMediaItem("Standard");
614
615 // output image map
616 $xml = "<dummy>";
617 $xml.= $this->getAliasXML();
618 $xml.= $this->media_object->getXML(IL_MODE_OUTPUT);
619 $xml.= $this->getAdditionalPageXML();
620 $xml.="</dummy>";
621 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
622 //echo htmlentities($xml); exit;
623 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
624 $xh = xslt_create();
625 $wb_path = ilUtil::getWebspaceDir("output") . "/";
626 $mode = "media";
627 //echo htmlentities($ilCtrl->getLinkTarget($this, "showImageMap"));
628
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(),
633 'mode' => $mode,
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"],
638 'pg_frame' => "",
639 'enlarge_path' => ilUtil::getImagePath("enlarge.svg"),
640 'webspace_path' => $wb_path);
641 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
642 echo xslt_error($xh);
643 xslt_free($xh);
644
646
647 return $output;
648 }
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)
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
$xml
Definition: metadata.php:240
$params
Definition: disable.php:11

References $_GET, $ctrl, $ilCtrl, $output, $params, $xml, 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 190 of file class.ilImageMapEditorGUI.php.

191 {
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();
195 }
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 913 of file class.ilImageMapEditorGUI.php.

914 {
915 $st_item = $this->media_object->getMediaItem("Standard");
916 $area = $st_item->getMapArea($a_nr);
917 return $area->getLinkType();
918 }

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 685 of file class.ilImageMapEditorGUI.php.

686 {
688
689 $t_arr = explode("_", $a_target);
690 if ($a_frame != "") {
691 $frame_str = " (" . $a_frame . " Frame)";
692 }
693 switch ($a_type) {
694 case "StructureObject":
695 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
696 $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
697 $link_str = $lng->txt("chapter") .
698 ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
699 break;
700
701 case "PageObject":
702 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
703 $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
704 $link_str = $lng->txt("page") .
705 ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
706 break;
707
708 case "GlossaryItem":
709 require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
710 $term = new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
711 $link_str = $lng->txt("term") .
712 ": " . $term->getTerm() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
713 break;
714
715 case "MediaObject":
716 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
717 $mob = new ilObjMediaObject($t_arr[count($t_arr) - 1]);
718 $link_str = $lng->txt("mob") .
719 ": " . $mob->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
720 break;
721
722 case "RepositoryItem":
724 ilObject::_lookupObjId($t_arr[count($t_arr) - 1])
725 );
726 $link_str = $lng->txt("obj_" . $t_arr[count($t_arr) - 2]) .
727 ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
728 break;
729 }
730
731 return $link_str;
732 }
Class ilGlossaryTerm.
static _lookupTitle($a_obj_id)
Lookup title.
Class ilObjMediaObject.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
$a_type
Definition: workflow.php:92

References $a_type, $lng, $title, 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 943 of file class.ilImageMapEditorGUI.php.

944 {
945 $st_item = $this->media_object->getMediaItem("Standard");
946 $area = $st_item->getMapArea($a_nr);
947 return $area->getTargetFrame();
948 }

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 933 of file class.ilImageMapEditorGUI.php.

934 {
935 $st_item = $this->media_object->getMediaItem("Standard");
936 $area = $st_item->getMapArea($a_nr);
937 return $area->getTarget();
938 }

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 130 of file class.ilImageMapEditorGUI.php.

131 {
135
136 // toolbar
137 $tb = new ilToolbarGUI();
138 $tb->setFormAction($ilCtrl->getFormAction($this));
139 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
140 $options = array(
141 "WholePicture" => $lng->txt("cont_WholePicture"),
142 "Rect" => $lng->txt("cont_Rect"),
143 "Circle" => $lng->txt("cont_Circle"),
144 "Poly" => $lng->txt("cont_Poly"),
145 );
146 $si = new ilSelectInputGUI($lng->txt("cont_shape"), "shape");
147 $si->setOptions($options);
148 $tb->addInputItem($si, true);
149 $tb->addFormButton($lng->txt("cont_add_area"), "addNewArea");
150
151
152 // highlight mode
153 /* if (strtolower(get_class($this)) == "ilimagemapeditorgui")
154 {
155 $st_item = $this->media_object->getMediaItem("Standard");
156 $tb->addSeparator();
157 $options = ilMapArea::getAllHighlightModes();
158 $hl = new ilSelectInputGUI($lng->txt("cont_highlight_mode"), "highlight_mode");
159 $hl->setOptions($options);
160 // $hl->setValue($st_item->getHighlightMode());
161 $tb->addInputItem($hl, true);
162 $options = ilMapArea::getAllHighlightClasses();
163 $hc = new ilSelectInputGUI($lng->txt("cont_highlight_class"), "highlight_class");
164 $hc->setOptions($options);
165 // $hc->setValue($st_item->getHighlightClass());
166 $tb->addInputItem($hc, false);
167 $tb->addFormButton($lng->txt("cont_set"), "setHighlight");
168 }*/
169
170 return $tb;
171 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
This class represents a selection list property in a property form.

References $ctrl, $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 923 of file class.ilImageMapEditorGUI.php.

924 {
925 $st_item = $this->media_object->getMediaItem("Standard");
926 $area = $st_item->getMapArea($a_nr);
927 return $area->getType();
928 }

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 200 of file class.ilImageMapEditorGUI.php.

201 {
202 if ($_GET["ref_id"] != "") {
203 $_SESSION["il_map_edit_ref_id"] = $_GET["ref_id"];
204 }
205
206 if ($_GET["obj_id"] != "") {
207 $_SESSION["il_map_edit_obj_id"] = $_GET["obj_id"];
208 }
209
210 if ($_GET["hier_id"] != "") {
211 $_SESSION["il_map_edit_hier_id"] = $_GET["hier_id"];
212 }
213
214 if ($_GET["pc_id"] != "") {
215 $_SESSION["il_map_edit_pc_id"] = $_GET["pc_id"];
216 }
217 }

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 493 of file class.ilImageMapEditorGUI.php.

494 {
497
498 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
499 $form = new ilPropertyFormGUI();
500 $form->setOpenTag(false);
501 $form->setCloseTag(false);
502
503 // link
504 if ($a_edit_property != "shape") {
505 //
506 $radg = new ilRadioGroupInputGUI($lng->txt("cont_link"), "area_link_type");
507 if ($_SESSION["il_map_il_ltype"] != "int") {
508 if ($_SESSION["il_map_el_href"] == "") {
509 $radg->setValue("no");
510 } else {
511 $radg->setValue("ext");
512 }
513 } else {
514 $radg->setValue("int");
515 }
516
517 // external link
518 $ext = new ilRadioOption($lng->txt("cont_link_ext"), "ext");
519 $radg->addOption($ext);
520
521 $ti = new ilTextInputGUI("", "area_link_ext");
522 $ti->setMaxLength(800);
523 $ti->setSize(50);
524 if ($_SESSION["il_map_el_href"] != "") {
525 $ti->setValue($_SESSION["il_map_el_href"]);
526 } else {
527 $ti->setValue("http://");
528 }
529 $ext->addSubItem($ti);
530
531 // internal link
532 $int = new ilRadioOption($lng->txt("cont_link_int"), "int");
533 $radg->addOption($int);
534
535 $ne = new ilNonEditableValueGUI("", "", true);
536 $link_str = "";
537 if ($_SESSION["il_map_il_target"] != "") {
538 $link_str = $this->getMapAreaLinkString(
539 $_SESSION["il_map_il_target"],
540 $_SESSION["il_map_il_type"],
541 $_SESSION["il_map_il_targetframe"]
542 );
543 }
544 $ne->setValue(
545 $link_str .
546 '&nbsp;<a id="iosEditInternalLinkTrigger" href="#">' .
547 "[" . $lng->txt("cont_get_link") . "]" .
548 '</a>'
549 );
550 $int->addSubItem($ne);
551
552 // no link
553 $no = new ilRadioOption($lng->txt("cont_link_no"), "no");
554 $radg->addOption($no);
555
556 $form->addItem($radg);
557 }
558
559
560 // name
561 if ($a_edit_property != "link" && $a_edit_property != "shape") {
562 $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
563 $ti->setMaxLength(200);
564 $ti->setSize(20);
565 $form->addItem($ti);
566 }
567
568 // save and cancel commands
569 if ($a_edit_property == "") {
570 $form->setTitle($lng->txt("cont_new_area"));
571 $form->addCommandButton("saveArea", $lng->txt("save"));
572 } else {
573 $form->setTitle($lng->txt("cont_new_area"));
574 $form->addCommandButton("saveArea", $lng->txt("save"));
575 }
576
577 // $form->setFormAction($ilCtrl->getFormAction($this));
578
579 return $form;
580 }
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, $ctrl, $form, $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 267 of file class.ilImageMapEditorGUI.php.

268 {
269 $this->clearSessionVars();
270 $_SESSION["il_map_edit_area_type"] = "WholePicture";
271
272 return $this->editMapArea(false, false, true);
273 }

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 585 of file class.ilImageMapEditorGUI.php.

591 {
592 // create/update imagemap work copy
593 $st_item = $this->media_object->getMediaItem("Standard");
594
595 if ($a_edit_property == "shape") {
596 $st_item->makeMapWorkCopy($a_area_nr, true); // exclude area currently being edited
597 } else {
598 $st_item->makeMapWorkCopy($a_area_nr, false);
599 }
600
601 if ($a_output_new_area) {
602 $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
603 }
604 }

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 666 of file class.ilImageMapEditorGUI.php.

667 {
668 return $a_output;
669 }

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 766 of file class.ilImageMapEditorGUI.php.

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

1136 {
1138 $lng = $this->lng;
1139
1140 $st_item = $this->media_object->getMediaItem("Standard");
1141 $st_item->setHighlightMode(ilUtil::stripSlashes($_POST["highlight_mode"]));
1142 $st_item->setHighlightClass(ilUtil::stripSlashes($_POST["highlight_class"]));
1143 $st_item->update();
1144
1145 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1146 $ilCtrl->redirect($this, "editMapAreas");
1147 }

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

+ Here is the call graph for this function:

◆ setInternalLink()

ilImageMapEditorGUI::setInternalLink ( )

Set internal link.

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

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

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 870 of file class.ilImageMapEditorGUI.php.

871 {
874
875 if ($a_handle) {
876 $this->handleMapParameters();
877 }
878 if ($_SESSION["il_map_area_nr"] != "") {
879 $_POST["area"][0] = $_SESSION["il_map_area_nr"];
880 }
881 if (!isset($_POST["area"])) {
882 ilUtil::sendFailure($lng->txt("no_checkbox"), true);
883 $ilCtrl->redirect($this, "editMapAreas");
884 }
885
886 if (count($_POST["area"]) > 1) {
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 $_SESSION["il_map_area_nr"] = $_POST["area"][0];
895 $_SESSION["il_map_il_ltype"] = $this->getLinkTypeOfArea($_POST["area"][0]);
896 $_SESSION["il_map_edit_mode"] = "edit_link";
897 $_SESSION["il_map_edit_target_script"] = $ilCtrl->getLinkTarget($this, "setLink");
898 if ($_SESSION["il_map_il_ltype"] == IL_INT_LINK) {
899 $_SESSION["il_map_il_type"] = $this->getTypeOfArea($_POST["area"][0]);
900 $_SESSION["il_map_il_target"] = $this->getTargetOfArea($_POST["area"][0]);
901 $_SESSION["il_map_il_targetframe"] = $this->getTargetFrameOfArea($_POST["area"][0]);
902 } else {
903 $_SESSION["il_map_el_href"] = $this->getHrefOfArea($_POST["area"][0]);
904 }
905 }
906
907 return $this->editMapArea(false, false, true, "link", $_POST["area"][0]);
908 }
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, $ctrl, $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 1050 of file class.ilImageMapEditorGUI.php.

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

References $_POST, $_SESSION, $coords, $ctrl, $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 222 of file class.ilImageMapEditorGUI.php.

223 {
224 $item = new ilMediaItem($_GET["item_id"]);
225 $item->outputMapWorkCopy();
226 }
Class ilMediaItem.

References $_GET.

◆ updateAreas()

ilImageMapEditorGUI::updateAreas ( )

Update map areas.

Reimplemented in ilPCImageMapEditorGUI.

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

232 {
235
236 $st_item = $this->media_object->getMediaItem("Standard");
237 $max = ilMapArea::_getMaxNr($st_item->getId());
238 for ($i=1; $i<=$max; $i++) {
239 $area = new ilMapArea($st_item->getId(), $i);
240 $area->setTitle(ilUtil::stripSlashes($_POST["name_" . $i]));
241 $area->setHighlightMode(ilUtil::stripSlashes($_POST["hl_mode_" . $i]));
242 $area->setHighlightClass(ilUtil::stripSlashes($_POST["hl_class_" . $i]));
243 $area->update();
244 }
245
246 ilUtil::sendSuccess($lng->txt("cont_saved_map_data"), true);
247 $ilCtrl->redirect($this, "editMapAreas");
248 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

◆ $lng

◆ $toolbar

ilImageMapEditorGUI::$toolbar
protected

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

Referenced by editMapAreas().

◆ $tpl

ilImageMapEditorGUI::$tpl
protected

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

Referenced by editMapArea(), executeCommand(), and getToolbar().


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