ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilImageMapEditorGUI Class Reference

User interface class for map editor. More...

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

Public Member Functions

 __construct (ilObjMediaObject $a_media_object)
 
 executeCommand ()
 
 editMapAreas ()
 
 getToolbar ()
 
 getEditorTitle ()
 
 getImageMapTableHTML ()
 
 handleMapParameters ()
 
 showImageMap ()
 
 updateAreas ()
 
 addNewArea ()
 
 linkWholePicture ()
 
 addRectangle ()
 
 addCircle ()
 
 addPolygon ()
 
 clearSessionVars ()
 
 addArea (bool $a_handle=true)
 
 editMapArea (bool $a_get_next_coordinate=false, bool $a_output_new_area=false, bool $a_save_form=false, string $a_edit_property="", int $a_area_nr=0)
 Edit a single map area. More...
 
 initAreaEditingForm (string $a_edit_property)
 
 makeMapWorkCopy (string $a_edit_property="", int $a_area_nr=0, bool $a_output_new_area=false, string $a_area_type="", string $a_coords="")
 Make work file for editing. More...
 
 getImageMapOutput (string $a_map_edit_mode="")
 Render the image map. More...
 
 getAdditionalPageXML ()
 Get additional page xml (to be overwritten) More...
 
 outputPostProcessing (string $a_output)
 
 getAliasXML ()
 
 getMapAreaLinkString (string $a_target, string $a_type, string $a_frame)
 Get text name of internal link. More...
 
 editImagemapForward ()
 Get image map coordinates. More...
 
 saveArea ()
 Save new or updated map area. More...
 
 setInternalLink ()
 
 setLink (bool $a_handle=true)
 
 getLinkTypeOfArea (int $a_nr)
 
 getTypeOfArea (int $a_nr)
 Get Type of Area (only internal link) More...
 
 getTargetOfArea (int $a_nr)
 Get Target of Area (only internal link) More...
 
 getTargetFrameOfArea (int $a_nr)
 Get TargetFrame of Area (only internal link) More...
 
 getHrefOfArea (int $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 (bool $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

ILIAS COPage Xsl XslManager $xsl
 
ilObjMediaObject $media_object
 
ImageMapGUIRequest $request
 
ImageMapManager $map
 
ilTemplate $tpl
 
ilGlobalTemplateInterface $main_tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilToolbarGUI $toolbar
 

Detailed Description

User interface class for map editor.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilImageMapEditorGUI: ilInternalLinkGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilImageMapEditorGUI::__construct ( ilObjMediaObject  $a_media_object)

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

41  {
42  global $DIC;
43 
44  $this->ctrl = $DIC->ctrl();
45  $this->main_tpl = $DIC->ui()->mainTemplate();
46  $this->lng = $DIC->language();
47  $this->toolbar = $DIC->toolbar();
48  $this->media_object = $a_media_object;
49 
50  $this->map = $DIC->mediaObjects()
51  ->internal()
52  ->domain()
53  ->imageMap();
54 
55  $this->request = $DIC->mediaObjects()
56  ->internal()
57  ->gui()
58  ->imageMap()
59  ->request();
60  $this->xsl = $DIC->copage()->internal()->domain()->xsl();
61  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ _recoverParameters()

static ilImageMapEditorGUI::_recoverParameters ( )
static

Recover parameters from session variables (static)

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

References $DIC.

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

679  : void
680  {
681  global $DIC;
682 
683  $map = $DIC->mediaObjects()->internal()->domain()->imageMap();
684  /*
685  $_GET["ref_id"] = $map->getRefId();
686  $_GET["obj_id"] = $map->getObjId();
687  $_GET["hier_id"] = $map->getHierId();
688  $_GET["pc_id"] = $map->getPCId();*/
689  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ addArea()

ilImageMapEditorGUI::addArea ( bool  $a_handle = true)

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

References Vendor\Package\$c, ilMapArea\countCoords(), editMapArea(), and handleMapParameters().

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

263  : string {
264  // handle map parameters
265  if ($a_handle) {
266  $this->handleMapParameters();
267  }
268 
269  $area_type = $this->map->getAreaType();
270  $coords = $this->map->getCoords();
271  $cnt_coords = ilMapArea::countCoords($coords);
272 
273  // decide what to do next
274  switch ($area_type) {
275  // Rectangle
276  case "Rect":
277  if ($cnt_coords < 2) {
278  $html = $this->editMapArea(true, false, false);
279  return $html;
280  } elseif ($cnt_coords == 2) {
281  return $this->editMapArea(false, true, true);
282  }
283  break;
284 
285  // Circle
286  case "Circle":
287  if ($cnt_coords <= 1) {
288  return $this->editMapArea(true, false, false);
289  } else {
290  if ($cnt_coords == 2) {
291  $c = explode(",", $coords);
292  $coords = $c[0] . "," . $c[1] . ","; // determine radius
293  $coords .= round(sqrt(pow(abs($c[3] - $c[1]), 2) + pow(abs($c[2] - $c[0]), 2)));
294  }
295  $this->map->setCoords($coords);
296 
297  return $this->editMapArea(false, true, true);
298  }
299 
300  // Polygon
301  // no break
302  case "Poly":
303  if ($cnt_coords < 1) {
304  return $this->editMapArea(true, false, false);
305  } elseif ($cnt_coords < 3) {
306  return $this->editMapArea(true, true, false);
307  } else {
308  return $this->editMapArea(true, true, true);
309  }
310 
311  // Whole picture
312  // no break
313  case "WholePicture":
314  return $this->editMapArea(false, false, true);
315  }
316  return "";
317  }
static countCoords(string $c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
editMapArea(bool $a_get_next_coordinate=false, bool $a_output_new_area=false, bool $a_save_form=false, string $a_edit_property="", int $a_area_nr=0)
Edit a single map area.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCircle()

ilImageMapEditorGUI::addCircle ( )

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

References addArea(), and clearSessionVars().

Referenced by addNewArea().

242  : string
243  {
244  $this->clearSessionVars();
245  $this->map->setAreaType("Circle");
246  return $this->addArea(false);
247  }
addArea(bool $a_handle=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addNewArea()

ilImageMapEditorGUI::addNewArea ( )

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

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

216  : string
217  {
218  switch ($this->request->getAreaShape()) {
219  case "WholePicture": return $this->linkWholePicture();
220  case "Rect": return $this->addRectangle();
221  case "Circle": return $this->addCircle();
222  case "Poly": return $this->addPolygon();
223  }
224  return "";
225  }
+ Here is the call graph for this function:

◆ addPolygon()

ilImageMapEditorGUI::addPolygon ( )

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

References addArea(), and clearSessionVars().

Referenced by addNewArea().

249  : string
250  {
251  $this->clearSessionVars();
252  $this->map->setAreaType("Poly");
253  return $this->addArea(false);
254  }
addArea(bool $a_handle=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRectangle()

ilImageMapEditorGUI::addRectangle ( )

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

References addArea(), and clearSessionVars().

Referenced by addNewArea().

235  : string
236  {
237  $this->clearSessionVars();
238  $this->map->setAreaType("Rect");
239  return $this->addArea(false);
240  }
addArea(bool $a_handle=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clearSessionVars()

ilImageMapEditorGUI::clearSessionVars ( )

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

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

256  : void
257  {
258  $this->map->clear();
259  }
+ Here is the caller graph for this function:

◆ deleteAreas()

ilImageMapEditorGUI::deleteAreas ( )

Delete map areas.

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

References $ctrl, $lng, ilMapArea\_getMaxNr(), and ilLanguage\txt().

901  : void
902  {
903  $ilCtrl = $this->ctrl;
904  $lng = $this->lng;
905 
906  $area = $this->request->getArea();
907  if (count($area) == 0) {
908  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
909  $ilCtrl->redirect($this, "editMapAreas");
910  }
911 
912  $st_item = $this->media_object->getMediaItem("Standard");
913  $max = ilMapArea::_getMaxNr($st_item->getId());
914 
915  if (count($area) > 0) {
916  $i = 0;
917 
918  foreach ($area as $area_nr) {
919  $st_item->deleteMapArea($area_nr - $i);
920  $i++;
921  }
922 
923  $this->media_object->update();
924  $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_areas_deleted"), true);
925  }
926 
927  $ilCtrl->redirect($this, "editMapAreas");
928  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)
+ Here is the call graph for this function:

◆ editImagemapForward()

ilImageMapEditorGUI::editImagemapForward ( )

Get image map coordinates.

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

References _recoverParameters(), and ilUtil\redirect().

660  : void
661  {
663 
664  $coords = $this->map->getCoords();
665  if ($coords != "") {
666  $coords .= ",";
667  }
668 
669  $this->map->setCoords($coords . $this->request->getX() . "," .
670  $this->request->getY());
671 
672  // call editing script
673  ilUtil::redirect($this->map->getTargetScript());
674  }
static redirect(string $a_script)
static _recoverParameters()
Recover parameters from session variables (static)
+ Here is the call graph for this function:

◆ editLink()

ilImageMapEditorGUI::editLink ( )

Edit existing link.

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

References setLink().

933  : string
934  {
935  $this->map->clear();
936  return $this->setLink(false);
937  }
setLink(bool $a_handle=true)
+ Here is the call graph for this function:

◆ editMapArea()

ilImageMapEditorGUI::editMapArea ( bool  $a_get_next_coordinate = false,
bool  $a_output_new_area = false,
bool  $a_save_form = false,
string  $a_edit_property = "",
int  $a_area_nr = 0 
)

Edit a single map area.

Parameters
bool$a_get_next_coordinateenable next coordinate input
bool$a_output_new_areaoutput the new area
bool$a_save_formoutput save form
string$a_edit_property"" | "link" | "shape"
int$a_area_nr
Returns
string

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

References $ctrl, $lng, ilMapArea\countCoords(), getImageMapOutput(), ilInternalLinkGUI\getInitHTML(), initAreaEditingForm(), makeMapWorkCopy(), and ilLanguage\txt().

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

334  : string {
335  $ilCtrl = $this->ctrl;
336  $lng = $this->lng;
337 
338  $area_type = $this->map->getAreaType();
339  $coords = $this->map->getCoords();
340  $cnt_coords = ilMapArea::countCoords($coords);
341 
342  $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
343 
344  $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
345 
346  if ($a_edit_property != "link") {
347  switch ($area_type) {
348  // rectangle
349  case "Rect":
350  if ($cnt_coords == 0) {
351  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_tl_corner"));
352  }
353  if ($cnt_coords == 1) {
354  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_br_corner"));
355  }
356  break;
357 
358  // circle
359  case "Circle":
360  if ($cnt_coords == 0) {
361  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_center"));
362  }
363  if ($cnt_coords == 1) {
364  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_circle"));
365  }
366  break;
367 
368  // polygon
369  case "Poly":
370  if ($cnt_coords == 0) {
371  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_starting_point"));
372  } elseif ($cnt_coords < 3) {
373  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_next_point"));
374  } else {
375  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_next_or_save"));
376  }
377  break;
378  }
379  }
380 
381 
382  // map properties input fields (name and link)
383  if ($a_save_form) {
384  if ($a_edit_property != "shape") {
385  // prepare link gui
386  $ilCtrl->setParameter($this, "linkmode", "map");
387  $this->tpl->setCurrentBlock("int_link_prep");
388  $this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
389  $ilCtrl->getLinkTargetByClass(
390  "ilinternallinkgui",
391  "",
392  false,
393  true,
394  false
395  )
396  ));
397  $this->tpl->parseCurrentBlock();
398  }
399  $form = $this->initAreaEditingForm($a_edit_property);
400  $this->tpl->setVariable("FORM", $form->getHTML());
401  }
402 
403  $this->makeMapWorkCopy(
404  $a_edit_property,
405  $a_area_nr,
406  $a_output_new_area,
407  $area_type,
408  $coords
409  );
410 
411  $edit_mode = ($a_get_next_coordinate)
412  ? "get_coords"
413  : (($a_output_new_area)
414  ? "new_area"
415  : "");
416  $output = $this->getImageMapOutput($edit_mode);
417  $this->tpl->setVariable("IMAGE_MAP", $output);
418 
419  return $this->tpl->get();
420  }
makeMapWorkCopy(string $a_edit_property="", int $a_area_nr=0, bool $a_output_new_area=false, string $a_area_type="", string $a_coords="")
Make work file for editing.
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
getImageMapOutput(string $a_map_edit_mode="")
Render the image map.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
initAreaEditingForm(string $a_edit_property)
static countCoords(string $c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editMapAreas()

ilImageMapEditorGUI::editMapAreas ( )

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

References $ctrl, getImageMapOutput(), getImageMapTableHTML(), getToolbar(), handleMapParameters(), makeMapWorkCopy(), and ilCtrl\setTargetScript().

99  : string
100  {
101  $ilCtrl = $this->ctrl;
102 
103  $this->map->setTargetScript(
104  $ilCtrl->getLinkTarget(
105  $this,
106  "addArea",
107  "",
108  false,
109  false
110  )
111  );
112  $this->handleMapParameters();
113 
114  $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "Services/MediaObjects");
115  $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
116 
117  // create/update imagemap work copy
118  $this->makeMapWorkCopy();
119 
120  $output = $this->getImageMapOutput();
121  $this->tpl->setVariable("IMAGE_MAP", $output);
122 
123  $this->tpl->setVariable("TOOLBAR", $this->getToolbar()->getHTML());
124 
125  // table
126  $this->tpl->setVariable("MAP_AREA_TABLE", $this->getImageMapTableHTML());
127 
128  return $this->tpl->get();
129  }
makeMapWorkCopy(string $a_edit_property="", int $a_area_nr=0, bool $a_output_new_area=false, string $a_area_type="", string $a_coords="")
Make work file for editing.
getImageMapOutput(string $a_map_edit_mode="")
Render the image map.
setTargetScript(string $a_target_script)
+ Here is the call graph for this function:

◆ editShapeCircle()

ilImageMapEditorGUI::editShapeCircle ( )

Edit an existing shape (make it a circle)

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

References clearSessionVars(), and setShape().

962  : string
963  {
964  $this->clearSessionVars();
965  $this->map->setAreaType("Circle");
966  return $this->setShape(false);
967  }
setShape(bool $a_handle=true)
edit shape of existing map area
+ Here is the call graph for this function:

◆ editShapePolygon()

ilImageMapEditorGUI::editShapePolygon ( )

Edit an existing shape (make it a polygon)

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

References clearSessionVars(), and setShape().

972  : string
973  {
974  $this->clearSessionVars();
975  $this->map->setAreaType("Poly");
976  return $this->setShape(false);
977  }
setShape(bool $a_handle=true)
edit shape of existing map area
+ Here is the call graph for this function:

◆ editShapeRectangle()

ilImageMapEditorGUI::editShapeRectangle ( )

Edit an existing shape (make it a rectangle)

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

References clearSessionVars(), and setShape().

952  : string
953  {
954  $this->clearSessionVars();
955  $this->map->setAreaType("Rect");
956  return $this->setShape(false);
957  }
setShape(bool $a_handle=true)
edit shape of existing map area
+ Here is the call graph for this function:

◆ editShapeWholePicture()

ilImageMapEditorGUI::editShapeWholePicture ( )

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

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

References clearSessionVars(), and setShape().

942  : string
943  {
944  $this->clearSessionVars();
945  $this->map->setAreaType("WholePicture");
946  return $this->setShape(false);
947  }
setShape(bool $a_handle=true)
edit shape of existing map area
+ Here is the call graph for this function:

◆ executeCommand()

ilImageMapEditorGUI::executeCommand ( )
Returns
mixed
Exceptions
ilCtrlException

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

References $ctrl, ilCtrl\getNextClass(), and ilObjMediaObjectGUI\includePresentationJS().

68  {
69  $ilCtrl = $this->ctrl;
70 
71  $next_class = $ilCtrl->getNextClass($this);
72  $cmd = $ilCtrl->getCmd();
73 
74  switch ($next_class) {
75  case "ilinternallinkgui":
76  $link_gui = new ilInternalLinkGUI("Media_Media", 0);
77  $link_gui->setSetLinkTargetScript(
78  $ilCtrl->getLinkTarget(
79  $this,
80  "setInternalLink"
81  )
82  );
83  $link_gui->filterLinkType("File");
84  $ret = $ilCtrl->forwardCommand($link_gui);
85  break;
86 
87  default:
89  if ($this->request->getX() != "" &&
90  $this->request->getY() != "") {
91  $cmd = "editImagemapForward";
92  }
93  $ret = $this->$cmd();
94  break;
95  }
96  return $ret;
97  }
static includePresentationJS(ilGlobalTemplateInterface $a_tpl=null)
Include media object presentation JS.
Internal link selector.
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ getAdditionalPageXML()

ilImageMapEditorGUI::getAdditionalPageXML ( )

Get additional page xml (to be overwritten)

Returns
string additional page xml

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

Referenced by getImageMapOutput().

574  : string
575  {
576  return "";
577  }
+ Here is the caller graph for this function:

◆ getAliasXML()

ilImageMapEditorGUI::getAliasXML ( )

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

References IL_MODE_ALIAS.

Referenced by getImageMapOutput().

585  : string
586  {
587  return $this->media_object->getXML(IL_MODE_ALIAS);
588  }
const IL_MODE_ALIAS
+ Here is the caller graph for this function:

◆ getEditorTitle()

ilImageMapEditorGUI::getEditorTitle ( )

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

References $lng, and ilLanguage\txt().

153  : string
154  {
155  $lng = $this->lng;
156  return $lng->txt("cont_imagemap");
157  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ getHrefOfArea()

ilImageMapEditorGUI::getHrefOfArea ( int  $a_nr)

Get Href of Area (only external link)

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

Referenced by setLink().

892  : string {
893  $st_item = $this->media_object->getMediaItem("Standard");
894  $area = $st_item->getMapArea($a_nr);
895  return $area->getHref();
896  }
+ Here is the caller graph for this function:

◆ getImageMapOutput()

ilImageMapEditorGUI::getImageMapOutput ( string  $a_map_edit_mode = "")

Render the image map.

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

References $ctrl, $params, getAdditionalPageXML(), getAliasXML(), ilUtil\getImagePath(), ilFileUtils\getWebspaceDir(), IL_MODE_OUTPUT, and outputPostProcessing().

Referenced by editMapArea(), and editMapAreas().

535  : string {
536  $ilCtrl = $this->ctrl;
537 
538  $st_item = $this->media_object->getMediaItem("Standard");
539 
540  // output image map
541  $xml = "<dummy>";
542  $xml .= $this->getAliasXML();
543  $xml .= $this->media_object->getXML(IL_MODE_OUTPUT);
544  $xml .= $this->getAdditionalPageXML();
545  $xml .= "</dummy>";
546 
547  $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
548  $mode = "media";
549  //echo htmlentities($ilCtrl->getLinkTarget($this, "showImageMap"));
550 
551  $random = new \ilRandom();
552  $params = array('map_edit_mode' => $a_map_edit_mode,
553  'map_item' => $st_item->getId(),
554  'map_mob_id' => $this->media_object->getId(),
555  'mode' => $mode,
556  'media_mode' => 'enable',
557  'image_map_link' => $ilCtrl->getLinkTarget($this, "showImageMap", "", false, false),
558  'link_params' => "ref_id=" . $this->request->getRefId() . "&rand=" . $random->int(1, 999999),
559  'ref_id' => $this->request->getRefId(),
560  'pg_frame' => "",
561  'enlarge_path' => ilUtil::getImagePath("media/enlarge.svg"),
562  'webspace_path' => $wb_path);
563  $output = $this->xsl->process($xml, $params);
564 
565  $output = $this->outputPostProcessing($output);
566 
567  return $output;
568  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
outputPostProcessing(string $a_output)
getAdditionalPageXML()
Get additional page xml (to be overwritten)
const IL_MODE_OUTPUT
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageMapTableHTML()

ilImageMapEditorGUI::getImageMapTableHTML ( )

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

Referenced by editMapAreas().

160  : string
161  {
162  $image_map_table = new ilImageMapTableGUI($this, "editMapAreas", $this->media_object);
163  return $image_map_table->getHTML();
164  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getLinkTypeOfArea()

ilImageMapEditorGUI::getLinkTypeOfArea ( int  $a_nr)

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

Referenced by setLink().

848  : string {
849  $st_item = $this->media_object->getMediaItem("Standard");
850  $area = $st_item->getMapArea($a_nr);
851  return $area->getLinkType();
852  }
+ Here is the caller graph for this function:

◆ getMapAreaLinkString()

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

Get text name of internal link.

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

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

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

Referenced by initAreaEditingForm().

600  : string {
601  $lng = $this->lng;
602  $frame_str = "";
603  $link_str = "";
604  $t_arr = explode("_", $a_target);
605  if ($a_frame != "") {
606  $frame_str = " (" . $a_frame . " Frame)";
607  }
608  switch ($a_type) {
609  case "StructureObject":
610  $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
611  $link_str = $lng->txt("chapter") .
612  ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
613  break;
614 
615  case "PageObject":
616  $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
617  $link_str = $lng->txt("page") .
618  ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
619  break;
620 
621  case "GlossaryItem":
622  $term = new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
623  $link_str = $lng->txt("term") .
624  ": " . $term->getTerm() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
625  break;
626 
627  case "MediaObject":
628  $mob = new ilObjMediaObject($t_arr[count($t_arr) - 1]);
629  $link_str = $lng->txt("mob") .
630  ": " . $mob->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
631  break;
632 
633  case "RepositoryItem":
634  if (trim($a_target) !== "") {
635  $title = ilObject::_lookupTitle(
636  ilObject::_lookupObjId((int) $t_arr[count($t_arr) - 1])
637  );
638  $link_str = $lng->txt("obj_" . $t_arr[count($t_arr) - 2]) .
639  ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
640  } else {
641  $title = "";
642  $link_str = "";
643  }
644  break;
645 
646  case "WikiPage":
647  $wpg = new ilWikiPage($t_arr[count($t_arr) - 1]);
648  $link_str = $lng->txt("cont_wiki_page") .
649  ": " . $wpg->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
650  break;
651 
652  }
653 
654  return $link_str;
655  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static _lookupTitle(int $a_obj_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTargetFrameOfArea()

ilImageMapEditorGUI::getTargetFrameOfArea ( int  $a_nr)

Get TargetFrame of Area (only internal link)

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

Referenced by setLink().

881  : string {
882  $st_item = $this->media_object->getMediaItem("Standard");
883  $area = $st_item->getMapArea($a_nr);
884  return $area->getTargetFrame();
885  }
+ Here is the caller graph for this function:

◆ getTargetOfArea()

ilImageMapEditorGUI::getTargetOfArea ( int  $a_nr)

Get Target of Area (only internal link)

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

Referenced by setLink().

870  : string {
871  $st_item = $this->media_object->getMediaItem("Standard");
872  $area = $st_item->getMapArea($a_nr);
873  return $area->getTarget();
874  }
+ Here is the caller graph for this function:

◆ getToolbar()

ilImageMapEditorGUI::getToolbar ( )

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

References $ctrl, $lng, ilSelectInputGUI\setOptions(), and ilLanguage\txt().

Referenced by editMapAreas().

131  : ilToolbarGUI
132  {
133  $ilCtrl = $this->ctrl;
134  $lng = $this->lng;
135 
136  // toolbar
137  $tb = new ilToolbarGUI();
138  $tb->setFormAction($ilCtrl->getFormAction($this));
139  $options = array(
140  "WholePicture" => $lng->txt("cont_WholePicture"),
141  "Rect" => $lng->txt("cont_Rect"),
142  "Circle" => $lng->txt("cont_Circle"),
143  "Poly" => $lng->txt("cont_Poly"),
144  );
145  $si = new ilSelectInputGUI($lng->txt("cont_shape"), "shape");
146  $si->setOptions($options);
147  $tb->addInputItem($si, true);
148  $tb->addFormButton($lng->txt("cont_add_area"), "addNewArea");
149 
150  return $tb;
151  }
This class represents a selection list property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setOptions(array $a_options)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTypeOfArea()

ilImageMapEditorGUI::getTypeOfArea ( int  $a_nr)

Get Type of Area (only internal link)

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

Referenced by setLink().

859  : string {
860  $st_item = $this->media_object->getMediaItem("Standard");
861  $area = $st_item->getMapArea($a_nr);
862  return $area->getType();
863  }
+ Here is the caller graph for this function:

◆ handleMapParameters()

ilImageMapEditorGUI::handleMapParameters ( )

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

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

166  : void
167  {
168  if ($this->request->getRefId() > 0) {
169  $this->map->setRefId($this->request->getRefId());
170  }
171 
172  if ($this->request->getObjId() > 0) {
173  $this->map->setObjId($this->request->getObjId());
174  }
175 
176  if ($this->request->getHierId() != "") {
177  $this->map->setHierId($this->request->getHierId());
178  }
179 
180  if ($this->request->getPCId() != "") {
181  $this->map->setPCId($this->request->getPCId());
182  }
183  }
+ Here is the caller graph for this function:

◆ initAreaEditingForm()

ilImageMapEditorGUI::initAreaEditingForm ( string  $a_edit_property)

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

References $lng, getMapAreaLinkString(), ilRadioGroupInputGUI\setValue(), and ilLanguage\txt().

Referenced by editMapArea().

425  $lng = $this->lng;
426 
427  $form = new ilPropertyFormGUI();
428  $form->setOpenTag(false);
429  $form->setCloseTag(false);
430 
431  // link
432  if ($a_edit_property != "shape") {
433  //
434  $radg = new ilRadioGroupInputGUI($lng->txt("cont_link"), "area_link_type");
435  if ($this->map->getLinkType() != "int") {
436  if ($this->map->getExternalLink() == "") {
437  $radg->setValue("no");
438  } else {
439  $radg->setValue("ext");
440  }
441  } else {
442  $radg->setValue("int");
443  }
444 
445  // external link
446  $ext = new ilRadioOption($lng->txt("cont_link_ext"), "ext");
447  $radg->addOption($ext);
448 
449  $ti = new ilTextInputGUI("", "area_link_ext");
450  $ti->setMaxLength(800);
451  $ti->setSize(50);
452  if ($this->map->getExternalLink() != "") {
453  $ti->setValue($this->map->getExternalLink());
454  } else {
455  $ti->setValue("https://");
456  }
457  $ext->addSubItem($ti);
458 
459  // internal link
460  $int = new ilRadioOption($lng->txt("cont_link_int"), "int");
461  $radg->addOption($int);
462 
463  $ne = new ilNonEditableValueGUI("", "", true);
464  $link_str = "";
465  $int_link = $this->map->getInternalLink();
466  if ($int_link["target"] != "") {
467  $link_str = $this->getMapAreaLinkString(
468  $int_link["target"],
469  $int_link["type"],
470  $int_link["target_frame"]
471  );
472  }
473  $ne->setValue(
474  $link_str .
475  '&nbsp;<a id="iosEditInternalLinkTrigger" href="#">' .
476  "[" . $lng->txt("cont_get_link") . "]" .
477  '</a>'
478  );
479  $int->addSubItem($ne);
480 
481  // no link
482  $no = new ilRadioOption($lng->txt("cont_link_no"), "no");
483  $radg->addOption($no);
484 
485  $form->addItem($radg);
486  }
487 
488 
489  // name
490  if ($a_edit_property != "link" && $a_edit_property != "shape") {
491  $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
492  $ti->setMaxLength(200);
493  $ti->setSize(20);
494  $form->addItem($ti);
495  }
496 
497  // save and cancel commands
498  $form->setTitle($lng->txt("cont_new_area"));
499  $form->addCommandButton("saveArea", $lng->txt("save"));
500 
501  // $form->setFormAction($ilCtrl->getFormAction($this));
502 
503  return $form;
504  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getMapAreaLinkString(string $a_target, string $a_type, string $a_frame)
Get text name of internal link.
This class represents a property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ linkWholePicture()

ilImageMapEditorGUI::linkWholePicture ( )

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

References clearSessionVars(), and editMapArea().

Referenced by addNewArea().

227  : string
228  {
229  $this->clearSessionVars();
230  $this->map->setAreaType("WholePicture");
231 
232  return $this->editMapArea(false, false, true);
233  }
editMapArea(bool $a_get_next_coordinate=false, bool $a_output_new_area=false, bool $a_save_form=false, string $a_edit_property="", int $a_area_nr=0)
Edit a single map area.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeMapWorkCopy()

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

Make work file for editing.

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

Referenced by editMapArea(), and editMapAreas().

515  : void {
516  // create/update imagemap work copy
517  $st_item = $this->media_object->getMediaItem("Standard");
518 
519  if ($a_edit_property == "shape") {
520  $st_item->makeMapWorkCopy($a_area_nr, true); // exclude area currently being edited
521  } else {
522  $st_item->makeMapWorkCopy($a_area_nr, false);
523  }
524 
525  if ($a_output_new_area) {
526  $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
527  }
528  }
+ Here is the caller graph for this function:

◆ outputPostProcessing()

ilImageMapEditorGUI::outputPostProcessing ( string  $a_output)

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

Referenced by getImageMapOutput().

581  : string {
582  return $a_output;
583  }
+ Here is the caller graph for this function:

◆ saveArea()

ilImageMapEditorGUI::saveArea ( )

Save new or updated map area.

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

References $ctrl, $lng, ilMapArea\_getMaxNr(), IL_EXT_LINK, IL_INT_LINK, IL_NO_LINK, ilMapArea\setLinkType(), ilMapArea\setShape(), and ilLanguage\txt().

Referenced by setShape().

694  : string
695  {
696  $lng = $this->lng;
697  $ilCtrl = $this->ctrl;
698 
699  switch ($this->map->getMode()) {
700  // save edited link
701  case "edit_link":
702  $st_item = $this->media_object->getMediaItem("Standard");
703  $max = ilMapArea::_getMaxNr($st_item->getId());
704  $area = new ilMapArea($st_item->getId(), $this->map->getAreaNr());
705 
706  if ($this->request->getAreaLinkType() == IL_INT_LINK) {
707  $area->setLinkType(IL_INT_LINK);
708  $int_link = $this->map->getInternalLink();
709  $area->setType($int_link["type"] ?? "");
710  $area->setTarget($int_link["target"] ?? "");
711  $area->setTargetFrame($int_link["target_frame"] ?? "");
712  } else {
713  $area->setLinkType(IL_EXT_LINK);
714  if ($this->request->getAreaLinkType() != IL_NO_LINK) {
715  $area->setHref(
716  $this->request->getExternalLink()
717  );
718  } else {
719  $area->setHref("");
720  }
721  }
722  $area->update();
723  break;
724 
725  // save edited shape
726  case "edit_shape":
727  $st_item = $this->media_object->getMediaItem("Standard");
728  $max = ilMapArea::_getMaxNr($st_item->getId());
729  $area = new ilMapArea(
730  $st_item->getId(),
731  $this->map->getAreaNr()
732  );
733 
734  $area->setShape($this->map->getAreaType());
735  $area->setCoords($this->map->getCoords());
736  $area->update();
737  break;
738 
739  // save new area
740  default:
741  $area_type = $this->map->getAreaType();
742  $coords = $this->map->getCoords();
743 
744  $st_item = $this->media_object->getMediaItem("Standard");
745  $max = ilMapArea::_getMaxNr($st_item->getId());
746 
747  // make new area object
748  $area = new ilMapArea();
749  $area->setItemId($st_item->getId());
750  $area->setShape($area_type);
751  $area->setCoords($coords);
752  $area->setNr($max + 1);
753  $area->setTitle($this->request->getAreaName());
754  switch ($this->request->getAreaLinkType()) {
755  case "ext":
756  $area->setLinkType(IL_EXT_LINK);
757  $area->setHref($this->request->getExternalLink());
758  break;
759 
760  case "int":
761  $area->setLinkType(IL_INT_LINK);
762  $int_link = $this->map->getInternalLink();
763  $area->setType($int_link["type"] ?? "");
764  $area->setTarget($int_link["target"] ?? "");
765  $area->setTargetFrame($int_link["type_frame"] ?? "");
766  break;
767  }
768 
769  // put area into item and update media object
770  $st_item->addMapArea($area);
771  $this->media_object->update();
772  break;
773  }
774 
775  //$this->initMapParameters();
776  $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_area"), true);
777  $ilCtrl->redirect($this, "editMapAreas");
778  return "";
779  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)
setShape(string $a_shape)
set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE)
const IL_NO_LINK
const IL_INT_LINK
setLinkType(string $a_link_type)
set link type
const IL_EXT_LINK
Class ilMapArea.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHighlight()

ilImageMapEditorGUI::setHighlight ( )

Set highlight settings.

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

References $ctrl, $lng, and ilLanguage\txt().

1072  : void
1073  {
1074  $ilCtrl = $this->ctrl;
1075  $lng = $this->lng;
1076 
1077  $st_item = $this->media_object->getMediaItem("Standard");
1078  // seems to be obsolete, methods don't exist
1079  //$st_item->setHighlightMode($this->request->getHighlightMode());
1080  //$st_item->setHighlightClass($this->request->getHighlightClass());
1081  $st_item->update();
1082 
1083  $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1084  $ilCtrl->redirect($this, "editMapAreas");
1085  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ setInternalLink()

ilImageMapEditorGUI::setInternalLink ( )

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

References addArea(), and setLink().

781  : string
782  {
783  $this->map->setLinkType("int");
784  $this->map->setInternalLink(
785  $this->request->getLinkType(),
786  $this->request->getLinkTarget(),
787  $this->request->getLinkTargetFrame(),
788  $this->request->getLinkAnchor()
789  );
790 
791  switch ($this->map->getMode()) {
792  case "edit_link":
793  return $this->setLink();
794 
795  default:
796  return $this->addArea();
797  }
798  }
setLink(bool $a_handle=true)
addArea(bool $a_handle=true)
+ Here is the call graph for this function:

◆ setLink()

ilImageMapEditorGUI::setLink ( bool  $a_handle = true)

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

References $ctrl, $lng, editMapArea(), getHrefOfArea(), getLinkTypeOfArea(), getTargetFrameOfArea(), getTargetOfArea(), getTypeOfArea(), handleMapParameters(), IL_INT_LINK, ILIAS\Repository\int(), and ilLanguage\txt().

Referenced by editLink(), and setInternalLink().

802  : string {
803  $lng = $this->lng;
804  $ilCtrl = $this->ctrl;
805  $area = null;
806  if ($a_handle) {
807  $this->handleMapParameters();
808  }
809  if ($this->map->getAreaNr() > 0) {
810  $area_nr = $this->map->getAreaNr();
811  } else {
812  $area = $this->request->getArea();
813  $area_nr = (int) ($area[0] ?? 0);
814  }
815  if ($area_nr === 0) {
816  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
817  $ilCtrl->redirect($this, "editMapAreas");
818  }
819 
820  if (count($area ?? []) > 1) {
821  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("cont_select_max_one_item"), true);
822  $ilCtrl->redirect($this, "editMapAreas");
823  }
824 
825 
826  if ($this->map->getMode() != "edit_link") {
827  $this->map->setAreaNr($area_nr);
828  $this->map->setLinkType($this->getLinkTypeOfArea($area_nr));
829  $this->map->setMode("edit_link");
830  $this->map->setTargetScript($ilCtrl->getLinkTarget($this, "setLink"));
831  if ($this->map->getLinkType() == IL_INT_LINK) {
832  $this->map->setInternalLink(
833  $this->getTypeOfArea($area_nr),
834  $this->getTargetOfArea($area_nr),
835  $this->getTargetFrameOfArea($area_nr),
836  ""
837  );
838  } else {
839  $this->map->setExternalLink($this->getHrefOfArea($area_nr));
840  }
841  }
842 
843  return $this->editMapArea(false, false, true, "link", $area_nr);
844  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getTargetOfArea(int $a_nr)
Get Target of Area (only internal link)
getHrefOfArea(int $a_nr)
Get Href of Area (only external link)
getTargetFrameOfArea(int $a_nr)
Get TargetFrame of Area (only internal link)
const IL_INT_LINK
editMapArea(bool $a_get_next_coordinate=false, bool $a_output_new_area=false, bool $a_save_form=false, string $a_edit_property="", int $a_area_nr=0)
Edit a single map area.
getTypeOfArea(int $a_nr)
Get Type of Area (only internal link)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setShape()

ilImageMapEditorGUI::setShape ( bool  $a_handle = true)

edit shape of existing map area

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

References Vendor\Package\$c, $ctrl, $lng, ilMapArea\countCoords(), editMapArea(), handleMapParameters(), ILIAS\Repository\int(), saveArea(), and ilLanguage\txt().

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

984  : string {
985  $lng = $this->lng;
986  $ilCtrl = $this->ctrl;
987 
988  $area = [];
989  if ($a_handle) {
990  $this->handleMapParameters();
991  }
992  /* this seems to be obsolete
993  if ($_POST["areatype2"] != "") {
994  $this->map->setAreaType($_POST["areatype2"]);
995  }*/
996  if ($this->map->getAreaNr() > 0) {
997  $area_nr = $this->map->getAreaNr();
998  } else {
999  $area = $this->request->getArea();
1000  $area_nr = (int) ($area[0] ?? 0);
1001  }
1002  if ($area_nr === 0) {
1003  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1004  $ilCtrl->redirect($this, "editMapAreas");
1005  }
1006 
1007  if (count($area ?? []) > 1) {
1008  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("cont_select_max_one_item"), true);
1009  $ilCtrl->redirect($this, "editMapAreas");
1010  }
1011 
1012  if ($this->map->getMode() != "edit_shape") {
1013  $this->map->setAreaNr($area_nr);
1014  $this->map->setMode("edit_shape");
1015  $this->map->setTargetScript(
1016  $ilCtrl->getLinkTarget($this, "setShape", "", false, false)
1017  );
1018  }
1019 
1020 
1021  $area_type = $this->map->getAreaType();
1022  $coords = $this->map->getCoords();
1023  $cnt_coords = ilMapArea::countCoords($coords);
1024 
1025  // decide what to do next
1026  switch ($area_type) {
1027  // Rectangle
1028  case "Rect":
1029  if ($cnt_coords < 2) {
1030  return $this->editMapArea(true, false, false, "shape", $area_nr);
1031  } elseif ($cnt_coords == 2) {
1032  return $this->saveArea();
1033  }
1034  break;
1035 
1036  // Circle
1037  case "Circle":
1038  if ($cnt_coords <= 1) {
1039  return $this->editMapArea(true, false, false, "shape", $area_nr);
1040  } else {
1041  if ($cnt_coords == 2) {
1042  $c = explode(",", $coords);
1043  $coords = $c[0] . "," . $c[1] . ","; // determine radius
1044  $coords .= round(sqrt(pow(abs($c[3] - $c[1]), 2) + pow(abs($c[2] - $c[0]), 2)));
1045  }
1046  $this->map->setCoords($coords);
1047  return $this->saveArea();
1048  }
1049 
1050  // Polygon
1051  // no break
1052  case "Poly":
1053  if ($cnt_coords < 1) {
1054  return $this->editMapArea(true, false, false, "shape", $area_nr);
1055  } elseif ($cnt_coords < 3) {
1056  return $this->editMapArea(true, true, false, "shape", $area_nr);
1057  } else {
1058  return $this->editMapArea(true, true, true, "shape", $area_nr);
1059  }
1060 
1061  // Whole Picture
1062  // no break
1063  case "WholePicture":
1064  return $this->saveArea();
1065  }
1066  return "";
1067  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
saveArea()
Save new or updated map area.
static countCoords(string $c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...")
editMapArea(bool $a_get_next_coordinate=false, bool $a_output_new_area=false, bool $a_save_form=false, string $a_edit_property="", int $a_area_nr=0)
Edit a single map area.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showImageMap()

ilImageMapEditorGUI::showImageMap ( )

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

References ilMediaItem\outputMapWorkCopy().

185  : void
186  {
187  $item = new ilMediaItem($this->request->getItemId());
188  $item->outputMapWorkCopy();
189  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
outputMapWorkCopy()
output raw map work copy file
+ Here is the call graph for this function:

◆ updateAreas()

ilImageMapEditorGUI::updateAreas ( )

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

References $ctrl, $lng, ilMapArea\_getMaxNr(), ilMapArea\setTitle(), and ilLanguage\txt().

191  : void
192  {
193  $lng = $this->lng;
194  $ilCtrl = $this->ctrl;
195 
196  $st_item = $this->media_object->getMediaItem("Standard");
197  $max = ilMapArea::_getMaxNr($st_item->getId());
198  for ($i = 1; $i <= $max; $i++) {
199  $area = new ilMapArea($st_item->getId(), $i);
200  $area->setTitle(
201  $this->request->getAreaTitle($i)
202  );
203  $area->setHighlightMode(
204  $this->request->getAreaHighlightMode($i)
205  );
206  $area->setHighlightClass(
207  $this->request->getAreaHighlightClass($i)
208  );
209  $area->update();
210  }
211 
212  $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_data"), true);
213  $ilCtrl->redirect($this, "editMapAreas");
214  }
setTitle(string $a_title)
set (tooltip)title of area
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)
Class ilMapArea.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

◆ $lng

◆ $main_tpl

ilGlobalTemplateInterface ilImageMapEditorGUI::$main_tpl
protected

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

◆ $map

ImageMapManager ilImageMapEditorGUI::$map
protected

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

◆ $media_object

ilObjMediaObject ilImageMapEditorGUI::$media_object
protected

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

Referenced by ilPCImageMapEditorGUI\makeMapWorkCopy().

◆ $request

ImageMapGUIRequest ilImageMapEditorGUI::$request
protected

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

Referenced by ilPCImageMapEditorGUI\__construct().

◆ $toolbar

ilToolbarGUI ilImageMapEditorGUI::$toolbar
protected

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

◆ $tpl

ilTemplate ilImageMapEditorGUI::$tpl
protected

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

◆ $xsl

ILIAS COPage Xsl XslManager ilImageMapEditorGUI::$xsl
protected

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


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