ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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: shib_login.php:22
+ 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 688 of file class.ilImageMapEditorGUI.php.

References $DIC.

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

688  : void
689  {
690  global $DIC;
691 
692  $map = $DIC->mediaObjects()->internal()->domain()->imageMap();
693  /*
694  $_GET["ref_id"] = $map->getRefId();
695  $_GET["obj_id"] = $map->getObjId();
696  $_GET["hier_id"] = $map->getHierId();
697  $_GET["pc_id"] = $map->getPCId();*/
698  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ addArea()

ilImageMapEditorGUI::addArea ( bool  $a_handle = true)

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

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

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

271  : string {
272  // handle map parameters
273  if ($a_handle) {
274  $this->handleMapParameters();
275  }
276 
277  $area_type = $this->map->getAreaType();
278  $coords = $this->map->getCoords();
279  $cnt_coords = ilMapArea::countCoords($coords);
280 
281  // decide what to do next
282  switch ($area_type) {
283  // Rectangle
284  case "Rect":
285  if ($cnt_coords < 2) {
286  $html = $this->editMapArea(true, false, false);
287  return $html;
288  } elseif ($cnt_coords == 2) {
289  return $this->editMapArea(false, true, true);
290  }
291  break;
292 
293  // Circle
294  case "Circle":
295  if ($cnt_coords <= 1) {
296  return $this->editMapArea(true, false, false);
297  } else {
298  if ($cnt_coords == 2) {
299  $c = explode(",", $coords);
300  $coords = $c[0] . "," . $c[1] . ","; // determine radius
301  $coords .= round(sqrt(pow(abs($c[3] - $c[1]), 2) + pow(abs($c[2] - $c[0]), 2)));
302  }
303  $this->map->setCoords($coords);
304 
305  return $this->editMapArea(false, true, true);
306  }
307 
308  // Polygon
309  // no break
310  case "Poly":
311  if ($cnt_coords < 1) {
312  return $this->editMapArea(true, false, false);
313  } elseif ($cnt_coords < 3) {
314  return $this->editMapArea(true, true, false);
315  } else {
316  return $this->editMapArea(true, true, true);
317  }
318 
319  // Whole picture
320  // no break
321  case "WholePicture":
322  return $this->editMapArea(false, false, true);
323  }
324  return "";
325  }
$c
Definition: deliver.php:25
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 250 of file class.ilImageMapEditorGUI.php.

References addArea(), and clearSessionVars().

Referenced by addNewArea().

250  : string
251  {
252  $this->clearSessionVars();
253  $this->map->setAreaType("Circle");
254  return $this->addArea(false);
255  }
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 224 of file class.ilImageMapEditorGUI.php.

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

224  : string
225  {
226  switch ($this->request->getAreaShape()) {
227  case "WholePicture": return $this->linkWholePicture();
228  case "Rect": return $this->addRectangle();
229  case "Circle": return $this->addCircle();
230  case "Poly": return $this->addPolygon();
231  }
232  return "";
233  }
+ Here is the call graph for this function:

◆ addPolygon()

ilImageMapEditorGUI::addPolygon ( )

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

References addArea(), and clearSessionVars().

Referenced by addNewArea().

257  : string
258  {
259  $this->clearSessionVars();
260  $this->map->setAreaType("Poly");
261  return $this->addArea(false);
262  }
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 243 of file class.ilImageMapEditorGUI.php.

References addArea(), and clearSessionVars().

Referenced by addNewArea().

243  : string
244  {
245  $this->clearSessionVars();
246  $this->map->setAreaType("Rect");
247  return $this->addArea(false);
248  }
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 264 of file class.ilImageMapEditorGUI.php.

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

264  : void
265  {
266  $this->map->clear();
267  }
+ Here is the caller graph for this function:

◆ deleteAreas()

ilImageMapEditorGUI::deleteAreas ( )

Delete map areas.

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

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

910  : void
911  {
912  $ilCtrl = $this->ctrl;
913  $lng = $this->lng;
914 
915  $area = $this->request->getArea();
916  if (count($area) == 0) {
917  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
918  $ilCtrl->redirect($this, "editMapAreas");
919  }
920 
921  $st_item = $this->media_object->getMediaItem("Standard");
922  $max = ilMapArea::_getMaxNr($st_item->getId());
923 
924  if (count($area) > 0) {
925  $i = 0;
926 
927  foreach ($area as $area_nr) {
928  $st_item->deleteMapArea($area_nr - $i);
929  $i++;
930  }
931 
932  $this->media_object->update();
933  $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_areas_deleted"), true);
934  }
935 
936  $ilCtrl->redirect($this, "editMapAreas");
937  }
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 669 of file class.ilImageMapEditorGUI.php.

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

669  : void
670  {
672 
673  $coords = $this->map->getCoords();
674  if ($coords != "") {
675  $coords .= ",";
676  }
677 
678  $this->map->setCoords($coords . $this->request->getX() . "," .
679  $this->request->getY());
680 
681  // call editing script
682  ilUtil::redirect($this->map->getTargetScript());
683  }
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 942 of file class.ilImageMapEditorGUI.php.

References setLink().

942  : string
943  {
944  $this->map->clear();
945  return $this->setLink(false);
946  }
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 336 of file class.ilImageMapEditorGUI.php.

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

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

342  : string {
343  $ilCtrl = $this->ctrl;
344  $lng = $this->lng;
345 
346  $area_type = $this->map->getAreaType();
347  $coords = $this->map->getCoords();
348  $cnt_coords = ilMapArea::countCoords($coords);
349 
350  $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "components/ILIAS/MediaObjects");
351 
352  $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
353 
354  if ($a_edit_property != "link") {
355  switch ($area_type) {
356  // rectangle
357  case "Rect":
358  if ($cnt_coords == 0) {
359  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_tl_corner"));
360  }
361  if ($cnt_coords == 1) {
362  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_br_corner"));
363  }
364  break;
365 
366  // circle
367  case "Circle":
368  if ($cnt_coords == 0) {
369  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_center"));
370  }
371  if ($cnt_coords == 1) {
372  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_circle"));
373  }
374  break;
375 
376  // polygon
377  case "Poly":
378  if ($cnt_coords == 0) {
379  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_starting_point"));
380  } elseif ($cnt_coords < 3) {
381  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_next_point"));
382  } else {
383  $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_next_or_save"));
384  }
385  break;
386  }
387  }
388 
389 
390  // map properties input fields (name and link)
391  if ($a_save_form) {
392  if ($a_edit_property != "shape") {
393  // prepare link gui
394  $ilCtrl->setParameter($this, "linkmode", "map");
395  $this->tpl->setCurrentBlock("int_link_prep");
396  $this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
397  $ilCtrl->getLinkTargetByClass(
398  "ilinternallinkgui",
399  "",
400  false,
401  true,
402  false
403  )
404  ));
405  $this->tpl->parseCurrentBlock();
406  }
407  $form = $this->initAreaEditingForm($a_edit_property);
408  $this->tpl->setVariable("FORM", $form->getHTML());
409  }
410 
411  $ilCtrl->setParameter($this, "out_edit_property", $a_edit_property);
412  $ilCtrl->setParameter($this, "out_area_nr", $a_area_nr);
413  $ilCtrl->setParameter($this, "out_output_new_area", (int) $a_output_new_area);
414  $ilCtrl->setParameter($this, "out_area_type", $area_type);
415  $ilCtrl->setParameter($this, "out_coords", $coords);
416 
417  $edit_mode = ($a_get_next_coordinate)
418  ? "get_coords"
419  : (($a_output_new_area)
420  ? "new_area"
421  : "");
422 
423  $output = $this->getImageMapOutput($edit_mode);
424  $this->tpl->setVariable("IMAGE_MAP", $output);
425 
426  return $this->tpl->get();
427  }
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, "components/ILIAS/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 971 of file class.ilImageMapEditorGUI.php.

References clearSessionVars(), and setShape().

971  : string
972  {
973  $this->clearSessionVars();
974  $this->map->setAreaType("Circle");
975  return $this->setShape(false);
976  }
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 981 of file class.ilImageMapEditorGUI.php.

References clearSessionVars(), and setShape().

981  : string
982  {
983  $this->clearSessionVars();
984  $this->map->setAreaType("Poly");
985  return $this->setShape(false);
986  }
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 961 of file class.ilImageMapEditorGUI.php.

References clearSessionVars(), and setShape().

961  : string
962  {
963  $this->clearSessionVars();
964  $this->map->setAreaType("Rect");
965  return $this->setShape(false);
966  }
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 951 of file class.ilImageMapEditorGUI.php.

References clearSessionVars(), and setShape().

951  : string
952  {
953  $this->clearSessionVars();
954  $this->map->setAreaType("WholePicture");
955  return $this->setShape(false);
956  }
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  }
Internal link selector.
static includePresentationJS(?ilGlobalTemplateInterface $a_tpl=null)
Include media object presentation JS.
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 583 of file class.ilImageMapEditorGUI.php.

Referenced by getImageMapOutput().

583  : string
584  {
585  return "";
586  }
+ Here is the caller graph for this function:

◆ getAliasXML()

ilImageMapEditorGUI::getAliasXML ( )

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

References IL_MODE_ALIAS.

Referenced by getImageMapOutput().

594  : string
595  {
596  return $this->media_object->getXML(IL_MODE_ALIAS);
597  }
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 899 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

901  : string {
902  $st_item = $this->media_object->getMediaItem("Standard");
903  $area = $st_item->getMapArea($a_nr);
904  return $area->getHref();
905  }
+ Here is the caller graph for this function:

◆ getImageMapOutput()

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

Render the image map.

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

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

Referenced by editMapArea(), and editMapAreas().

544  : string {
545  $ilCtrl = $this->ctrl;
546 
547  $st_item = $this->media_object->getMediaItem("Standard");
548 
549  // output image map
550  $xml = "<dummy>";
551  $xml .= $this->getAliasXML();
552  $xml .= $this->media_object->getXML(IL_MODE_OUTPUT);
553  $xml .= $this->getAdditionalPageXML();
554  $xml .= "</dummy>";
555 
556  $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
557  $mode = "media";
558  //echo htmlentities($ilCtrl->getLinkTarget($this, "showImageMap"));
559 
560  $random = new \Random\Randomizer();
561  $params = array('map_edit_mode' => $a_map_edit_mode,
562  'map_item' => $st_item->getId(),
563  'map_mob_id' => $this->media_object->getId(),
564  'mode' => $mode,
565  'media_mode' => 'enable',
566  'image_map_link' => $ilCtrl->getLinkTarget($this, "showImageMap", "", false, false),
567  'link_params' => "ref_id=" . $this->request->getRefId() . "&rand=" . $random->getInt(1, 999999),
568  'ref_id' => $this->request->getRefId(),
569  'pg_frame' => "",
570  'enlarge_path' => ilUtil::getImagePath("media/enlarge.svg"),
571  'webspace_path' => $wb_path);
572  $output = $this->xsl->process($xml, $params);
573 
574  $output = $this->outputPostProcessing($output);
575 
576  return $output;
577  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
outputPostProcessing(string $a_output)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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 855 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

857  : string {
858  $st_item = $this->media_object->getMediaItem("Standard");
859  $area = $st_item->getMapArea($a_nr);
860  return $area->getLinkType();
861  }
+ 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 605 of file class.ilImageMapEditorGUI.php.

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

Referenced by initAreaEditingForm().

609  : string {
610  $lng = $this->lng;
611  $frame_str = "";
612  $link_str = "";
613  $t_arr = explode("_", $a_target);
614  if ($a_frame != "") {
615  $frame_str = " (" . $a_frame . " Frame)";
616  }
617  switch ($a_type) {
618  case "StructureObject":
619  $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
620  $link_str = $lng->txt("chapter") .
621  ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
622  break;
623 
624  case "PageObject":
625  $title = ilLMObject::_lookupTitle($t_arr[count($t_arr) - 1]);
626  $link_str = $lng->txt("page") .
627  ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
628  break;
629 
630  case "GlossaryItem":
631  $term = new ilGlossaryTerm($t_arr[count($t_arr) - 1]);
632  $link_str = $lng->txt("term") .
633  ": " . $term->getTerm() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
634  break;
635 
636  case "MediaObject":
637  $mob = new ilObjMediaObject($t_arr[count($t_arr) - 1]);
638  $link_str = $lng->txt("mob") .
639  ": " . $mob->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
640  break;
641 
642  case "RepositoryItem":
643  if (trim($a_target) !== "") {
644  $title = ilObject::_lookupTitle(
645  ilObject::_lookupObjId((int) $t_arr[count($t_arr) - 1])
646  );
647  $link_str = $lng->txt("obj_" . $t_arr[count($t_arr) - 2]) .
648  ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
649  } else {
650  $title = "";
651  $link_str = "";
652  }
653  break;
654 
655  case "WikiPage":
656  $wpg = new ilWikiPage($t_arr[count($t_arr) - 1]);
657  $link_str = $lng->txt("cont_wiki_page") .
658  ": " . $wpg->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
659  break;
660 
661  }
662 
663  return $link_str;
664  }
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 888 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

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

◆ getTargetOfArea()

ilImageMapEditorGUI::getTargetOfArea ( int  $a_nr)

Get Target of Area (only internal link)

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

Referenced by setLink().

879  : string {
880  $st_item = $this->media_object->getMediaItem("Standard");
881  $area = $st_item->getMapArea($a_nr);
882  return $area->getTarget();
883  }
+ 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 866 of file class.ilImageMapEditorGUI.php.

Referenced by setLink().

868  : string {
869  $st_item = $this->media_object->getMediaItem("Standard");
870  $area = $st_item->getMapArea($a_nr);
871  return $area->getType();
872  }
+ 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 429 of file class.ilImageMapEditorGUI.php.

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

Referenced by editMapArea().

432  $lng = $this->lng;
433 
434  $form = new ilPropertyFormGUI();
435  $form->setOpenTag(false);
436  $form->setCloseTag(false);
437 
438  // link
439  if ($a_edit_property != "shape") {
440  //
441  $radg = new ilRadioGroupInputGUI($lng->txt("cont_link"), "area_link_type");
442  if ($this->map->getLinkType() != "int") {
443  if ($this->map->getExternalLink() == "") {
444  $radg->setValue("no");
445  } else {
446  $radg->setValue("ext");
447  }
448  } else {
449  $radg->setValue("int");
450  }
451 
452  // external link
453  $ext = new ilRadioOption($lng->txt("cont_link_ext"), "ext");
454  $radg->addOption($ext);
455 
456  $ti = new ilTextInputGUI("", "area_link_ext");
457  $ti->setMaxLength(800);
458  $ti->setSize(50);
459  if ($this->map->getExternalLink() != "") {
460  $ti->setValue($this->map->getExternalLink());
461  } else {
462  $ti->setValue("https://");
463  }
464  $ext->addSubItem($ti);
465 
466  // internal link
467  $int = new ilRadioOption($lng->txt("cont_link_int"), "int");
468  $radg->addOption($int);
469 
470  $ne = new ilNonEditableValueGUI("", "", true);
471  $link_str = "";
472  $int_link = $this->map->getInternalLink();
473  if ($int_link["target"] != "") {
474  $link_str = $this->getMapAreaLinkString(
475  $int_link["target"],
476  $int_link["type"],
477  $int_link["target_frame"]
478  );
479  }
480  $ne->setValue(
481  $link_str .
482  '&nbsp;<a id="iosEditInternalLinkTrigger" href="#">' .
483  "[" . $lng->txt("cont_get_link") . "]" .
484  '</a>'
485  );
486  $int->addSubItem($ne);
487 
488  // no link
489  $no = new ilRadioOption($lng->txt("cont_link_no"), "no");
490  $radg->addOption($no);
491 
492  $form->addItem($radg);
493  }
494 
495 
496  // name
497  if ($a_edit_property != "link" && $a_edit_property != "shape") {
498  $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
499  $ti->setMaxLength(200);
500  $ti->setSize(20);
501  $form->addItem($ti);
502  }
503 
504  // save and cancel commands
505  $form->setTitle($lng->txt("cont_new_area"));
506  $form->addCommandButton("saveArea", $lng->txt("save"));
507 
508  // $form->setFormAction($ilCtrl->getFormAction($this));
509 
510  return $form;
511  }
This class represents an option in a radio group.
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 235 of file class.ilImageMapEditorGUI.php.

References clearSessionVars(), and editMapArea().

Referenced by addNewArea().

235  : string
236  {
237  $this->clearSessionVars();
238  $this->map->setAreaType("WholePicture");
239 
240  return $this->editMapArea(false, false, true);
241  }
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 516 of file class.ilImageMapEditorGUI.php.

References ilMediaItem\makeMapWorkCopy().

Referenced by editMapAreas(), and showImageMap().

522  : ilMediaItem {
523  // create/update imagemap work copy
524  $st_item = $this->media_object->getMediaItem("Standard");
525 
526  if ($a_edit_property == "shape") {
527  $st_item->makeMapWorkCopy($a_area_nr, true); // exclude area currently being edited
528  } else {
529  $st_item->makeMapWorkCopy($a_area_nr, false);
530  }
531 
532  if ($a_output_new_area) {
533  $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
534  }
535 
536  return $st_item;
537  }
makeMapWorkCopy(int $a_area_nr=0, bool $a_exclude=false)
make map work copy of image
Class ilMediaItem Media Item, component of a media object (file or reference)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outputPostProcessing()

ilImageMapEditorGUI::outputPostProcessing ( string  $a_output)

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

Referenced by getImageMapOutput().

590  : string {
591  return $a_output;
592  }
+ Here is the caller graph for this function:

◆ saveArea()

ilImageMapEditorGUI::saveArea ( )

Save new or updated map area.

Definition at line 703 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().

703  : string
704  {
705  $lng = $this->lng;
706  $ilCtrl = $this->ctrl;
707 
708  switch ($this->map->getMode()) {
709  // save edited link
710  case "edit_link":
711  $st_item = $this->media_object->getMediaItem("Standard");
712  $max = ilMapArea::_getMaxNr($st_item->getId());
713  $area = new ilMapArea($st_item->getId(), $this->map->getAreaNr());
714 
715  if ($this->request->getAreaLinkType() == IL_INT_LINK) {
716  $area->setLinkType(IL_INT_LINK);
717  $int_link = $this->map->getInternalLink();
718  $area->setType($int_link["type"] ?? "");
719  $area->setTarget($int_link["target"] ?? "");
720  $area->setTargetFrame($int_link["target_frame"] ?? "");
721  } else {
722  $area->setLinkType(IL_EXT_LINK);
723  if ($this->request->getAreaLinkType() != IL_NO_LINK) {
724  $area->setHref(
725  $this->request->getExternalLink()
726  );
727  } else {
728  $area->setHref("");
729  }
730  }
731  $area->update();
732  break;
733 
734  // save edited shape
735  case "edit_shape":
736  $st_item = $this->media_object->getMediaItem("Standard");
737  $max = ilMapArea::_getMaxNr($st_item->getId());
738  $area = new ilMapArea(
739  $st_item->getId(),
740  $this->map->getAreaNr()
741  );
742 
743  $area->setShape($this->map->getAreaType());
744  $area->setCoords($this->map->getCoords());
745  $area->update();
746  break;
747 
748  // save new area
749  default:
750  $area_type = $this->map->getAreaType();
751  $coords = $this->map->getCoords();
752 
753  $st_item = $this->media_object->getMediaItem("Standard");
754  $max = ilMapArea::_getMaxNr($st_item->getId());
755 
756  // make new area object
757  $area = new ilMapArea();
758  $area->setItemId($st_item->getId());
759  $area->setShape($area_type);
760  $area->setCoords($coords);
761  $area->setNr($max + 1);
762  $area->setTitle($this->request->getAreaName());
763  switch ($this->request->getAreaLinkType()) {
764  case "ext":
765  $area->setLinkType(IL_EXT_LINK);
766  $area->setHref($this->request->getExternalLink());
767  break;
768 
769  case "int":
770  $area->setLinkType(IL_INT_LINK);
771  $int_link = $this->map->getInternalLink();
772  $area->setType($int_link["type"] ?? "");
773  $area->setTarget($int_link["target"] ?? "");
774  $area->setTargetFrame($int_link["type_frame"] ?? "");
775  break;
776  }
777 
778  // put area into item and update media object
779  $st_item->addMapArea($area);
780  $this->media_object->update();
781  break;
782  }
783 
784  //$this->initMapParameters();
785  $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_area"), true);
786  $ilCtrl->redirect($this, "editMapAreas");
787  return "";
788  }
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 1077 of file class.ilImageMapEditorGUI.php.

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

1077  : void
1078  {
1079  $ilCtrl = $this->ctrl;
1080  $lng = $this->lng;
1081 
1082  $st_item = $this->media_object->getMediaItem("Standard");
1083  // seems to be obsolete, methods don't exist
1084  //$st_item->setHighlightMode($this->request->getHighlightMode());
1085  //$st_item->setHighlightClass($this->request->getHighlightClass());
1086  $st_item->update();
1087 
1088  $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1089  $ilCtrl->redirect($this, "editMapAreas");
1090  }
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 790 of file class.ilImageMapEditorGUI.php.

References addArea(), and setLink().

790  : string
791  {
792  $this->map->setLinkType("int");
793  $this->map->setInternalLink(
794  $this->request->getLinkType(),
795  $this->request->getLinkTarget(),
796  $this->request->getLinkTargetFrame(),
797  $this->request->getLinkAnchor()
798  );
799 
800  switch ($this->map->getMode()) {
801  case "edit_link":
802  return $this->setLink();
803 
804  default:
805  return $this->addArea();
806  }
807  }
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 809 of file class.ilImageMapEditorGUI.php.

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

Referenced by editLink(), and setInternalLink().

811  : string {
812  $lng = $this->lng;
813  $ilCtrl = $this->ctrl;
814  $area = null;
815  if ($a_handle) {
816  $this->handleMapParameters();
817  }
818  if ($this->map->getAreaNr() > 0) {
819  $area_nr = $this->map->getAreaNr();
820  } else {
821  $area = $this->request->getArea();
822  $area_nr = (int) ($area[0] ?? 0);
823  }
824  if ($area_nr === 0) {
825  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
826  $ilCtrl->redirect($this, "editMapAreas");
827  }
828 
829  if (count($area ?? []) > 1) {
830  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("cont_select_max_one_item"), true);
831  $ilCtrl->redirect($this, "editMapAreas");
832  }
833 
834 
835  if ($this->map->getMode() != "edit_link") {
836  $this->map->setAreaNr($area_nr);
837  $this->map->setLinkType($this->getLinkTypeOfArea($area_nr));
838  $this->map->setMode("edit_link");
839  $this->map->setTargetScript($ilCtrl->getLinkTarget($this, "setLink"));
840  if ($this->map->getLinkType() == IL_INT_LINK) {
841  $this->map->setInternalLink(
842  $this->getTypeOfArea($area_nr),
843  $this->getTargetOfArea($area_nr),
844  $this->getTargetFrameOfArea($area_nr),
845  ""
846  );
847  } else {
848  $this->map->setExternalLink($this->getHrefOfArea($area_nr));
849  }
850  }
851 
852  return $this->editMapArea(false, false, true, "link", $area_nr);
853  }
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 991 of file class.ilImageMapEditorGUI.php.

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

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

993  : string {
994  $lng = $this->lng;
995  $ilCtrl = $this->ctrl;
996 
997  $area = [];
998  if ($a_handle) {
999  $this->handleMapParameters();
1000  }
1001  if ($this->map->getAreaNr() > 0) {
1002  $area_nr = $this->map->getAreaNr();
1003  } else {
1004  $area = $this->request->getArea();
1005  $area_nr = (int) ($area[0] ?? 0);
1006  }
1007  if ($area_nr === 0) {
1008  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1009  $ilCtrl->redirect($this, "editMapAreas");
1010  }
1011 
1012  if (count($area ?? []) > 1) {
1013  $this->main_tpl->setOnScreenMessage('failure', $lng->txt("cont_select_max_one_item"), true);
1014  $ilCtrl->redirect($this, "editMapAreas");
1015  }
1016 
1017  if ($this->map->getMode() != "edit_shape") {
1018  $this->map->setAreaNr($area_nr);
1019  $this->map->setMode("edit_shape");
1020  $this->map->setTargetScript(
1021  $ilCtrl->getLinkTarget($this, "setShape", "", false, false)
1022  );
1023  }
1024 
1025 
1026  $area_type = $this->map->getAreaType();
1027  $coords = $this->map->getCoords();
1028  $cnt_coords = ilMapArea::countCoords($coords);
1029 
1030  // decide what to do next
1031  switch ($area_type) {
1032  // Rectangle
1033  case "Rect":
1034  if ($cnt_coords < 2) {
1035  return $this->editMapArea(true, false, false, "shape", $area_nr);
1036  } elseif ($cnt_coords == 2) {
1037  return $this->saveArea();
1038  }
1039  break;
1040 
1041  // Circle
1042  case "Circle":
1043  if ($cnt_coords <= 1) {
1044  return $this->editMapArea(true, false, false, "shape", $area_nr);
1045  } else {
1046  if ($cnt_coords == 2) {
1047  $c = explode(",", $coords);
1048  $coords = $c[0] . "," . $c[1] . ","; // determine radius
1049  $coords .= round(sqrt(pow(abs($c[3] - $c[1]), 2) + pow(abs($c[2] - $c[0]), 2)));
1050  }
1051  $this->map->setCoords($coords);
1052  return $this->saveArea();
1053  }
1054 
1055  // Polygon
1056  // no break
1057  case "Poly":
1058  if ($cnt_coords < 1) {
1059  return $this->editMapArea(true, false, false, "shape", $area_nr);
1060  } elseif ($cnt_coords < 3) {
1061  return $this->editMapArea(true, true, false, "shape", $area_nr);
1062  } else {
1063  return $this->editMapArea(true, true, true, "shape", $area_nr);
1064  }
1065 
1066  // Whole Picture
1067  // no break
1068  case "WholePicture":
1069  return $this->saveArea();
1070  }
1071  return "";
1072  }
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.
$c
Definition: deliver.php:25
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 makeMapWorkCopy().

185  : void
186  {
187  $item = $this->makeMapWorkCopy(
188  $this->request->getOutEditProperty(),
189  $this->request->getOutAreaNr(),
190  $this->request->getOutOutputNewArea(),
191  $this->request->getOutAreaType(),
192  $this->request->getOutCoords()
193  );
194 
195  //$item = new ilMediaItem($this->request->getItemId());
196  $item->outputMapWorkCopy();
197  }
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.
+ Here is the call graph for this function:

◆ updateAreas()

ilImageMapEditorGUI::updateAreas ( )

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

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

199  : void
200  {
201  $lng = $this->lng;
202  $ilCtrl = $this->ctrl;
203 
204  $st_item = $this->media_object->getMediaItem("Standard");
205  $max = ilMapArea::_getMaxNr($st_item->getId());
206  for ($i = 1; $i <= $max; $i++) {
207  $area = new ilMapArea($st_item->getId(), $i);
208  $area->setTitle(
209  $this->request->getAreaTitle($i)
210  );
211  $area->setHighlightMode(
212  $this->request->getAreaHighlightMode($i)
213  );
214  $area->setHighlightClass(
215  $this->request->getAreaHighlightClass($i)
216  );
217  $area->update();
218  }
219 
220  $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_data"), true);
221  $ilCtrl->redirect($this, "editMapAreas");
222  }
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: