ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 ()
 
 editTitle (int $area_nr)
 
 saveTitle ()
 
 editHighlightMode (int $area_nr)
 
 saveHighlightMode ()
 
 editHighlightClass (int $area_nr)
 
 saveHighlightClass ()
 
 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 (int $area_nr=0)
 Delete map areas. More...
 
 editLink (int $area_nr=0)
 Edit existing link. More...
 
 editShapeWholePicture (int $area_nr=0)
 Edit an existing shape (make it a whole picture link) More...
 
 editShapeRectangle (int $area_nr=0)
 Edit an existing shape (make it a rectangle) More...
 
 editShapeCircle (int $area_nr=0)
 Edit an existing shape (make it a circle) More...
 
 editShapePolygon (int $area_nr=0)
 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 Member Functions

 getImageMapTable ()
 
 getMapArea (int $area_nr)
 
 getAreaTitleForm (int $area_nr, string $cmd="saveTitle")
 
 getAreaHighlightForm (int $area_nr, string $field, string $label, string $cmd, array $options, string $value)
 

Protected Attributes

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

Detailed Description

User interface class for map editor.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilImageMapEditorGUI::__construct ( ilObjMediaObject  $a_media_object)

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

45 {
46 global $DIC;
47
48 $this->ctrl = $DIC->ctrl();
49 $this->main_tpl = $DIC->ui()->mainTemplate();
50 $this->lng = $DIC->language();
51 $this->obj_definition = $DIC["objDefinition"];
52 $this->toolbar = $DIC->toolbar();
53 $this->media_gui = $DIC->mediaObjects()->internal()->gui();
54 $this->media_object = $a_media_object;
55
56 $this->map = $DIC->mediaObjects()
57 ->internal()
58 ->domain()
59 ->imageMap();
60
61 $this->request = $DIC->mediaObjects()
62 ->internal()
63 ->gui()
64 ->imageMap()
65 ->request();
66 $this->xsl = $DIC->copage()->internal()->domain()->xsl();
67 }
global $DIC
Definition: shib_login.php:26

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

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

868 : void
869 {
870 global $DIC;
871
872 $map = $DIC->mediaObjects()->internal()->domain()->imageMap();
873 /*
874 $_GET["ref_id"] = $map->getRefId();
875 $_GET["obj_id"] = $map->getObjId();
876 $_GET["hier_id"] = $map->getHierId();
877 $_GET["pc_id"] = $map->getPCId();*/
878 }

References $DIC.

Referenced by editImagemapForward().

+ Here is the caller graph for this function:

◆ addArea()

ilImageMapEditorGUI::addArea ( bool  $a_handle = true)

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

428 : string {
429 // handle map parameters
430 if ($a_handle) {
431 $this->handleMapParameters();
432 }
433
434 $area_type = $this->map->getAreaType();
435 $coords = $this->map->getCoords();
436 $cnt_coords = ilMapArea::countCoords($coords);
437
438 // decide what to do next
439 switch ($area_type) {
440 // Rectangle
441 case "Rect":
442 if ($cnt_coords < 2) {
443 $html = $this->editMapArea(true, false, false);
444 return $html;
445 } elseif ($cnt_coords == 2) {
446 return $this->editMapArea(false, true, true);
447 }
448 break;
449
450 // Circle
451 case "Circle":
452 if ($cnt_coords <= 1) {
453 return $this->editMapArea(true, false, false);
454 } else {
455 if ($cnt_coords == 2) {
456 $c = explode(",", $coords);
457 $coords = $c[0] . "," . $c[1] . ","; // determine radius
458 $coords .= round(sqrt(pow(abs($c[3] - $c[1]), 2) + pow(abs($c[2] - $c[0]), 2)));
459 }
460 $this->map->setCoords($coords);
461
462 return $this->editMapArea(false, true, true);
463 }
464
465 // Polygon
466 // no break
467 case "Poly":
468 if ($cnt_coords < 1) {
469 return $this->editMapArea(true, false, false);
470 } elseif ($cnt_coords < 3) {
471 return $this->editMapArea(true, true, false);
472 } else {
473 return $this->editMapArea(true, true, true);
474 }
475
476 // Whole picture
477 // no break
478 case "WholePicture":
479 return $this->editMapArea(false, false, true);
480 }
481 return "";
482 }
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.
static countCoords(string $c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,...

◆ addCircle()

ilImageMapEditorGUI::addCircle ( )

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

407 : string
408 {
409 $this->clearSessionVars();
410 $this->map->setAreaType("Circle");
411 return $this->addArea(false);
412 }
addArea(bool $a_handle=true)

◆ addNewArea()

ilImageMapEditorGUI::addNewArea ( )

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

381 : string
382 {
383 switch ($this->request->getAreaShape()) {
384 case "WholePicture": return $this->linkWholePicture();
385 case "Rect": return $this->addRectangle();
386 case "Circle": return $this->addCircle();
387 case "Poly": return $this->addPolygon();
388 }
389 return "";
390 }

◆ addPolygon()

ilImageMapEditorGUI::addPolygon ( )

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

414 : string
415 {
416 $this->clearSessionVars();
417 $this->map->setAreaType("Poly");
418 return $this->addArea(false);
419 }

◆ addRectangle()

ilImageMapEditorGUI::addRectangle ( )

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

400 : string
401 {
402 $this->clearSessionVars();
403 $this->map->setAreaType("Rect");
404 return $this->addArea(false);
405 }

◆ clearSessionVars()

ilImageMapEditorGUI::clearSessionVars ( )

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

421 : void
422 {
423 $this->map->clear();
424 }

◆ deleteAreas()

ilImageMapEditorGUI::deleteAreas ( int  $area_nr = 0)

Delete map areas.

Reimplemented in ilPCImageMapEditorGUI.

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

1090 : void
1091 {
1092 $ilCtrl = $this->ctrl;
1093 $lng = $this->lng;
1094
1095 if ($area_nr === 0) {
1096 $area_nr = $this->request->getAreaNr();
1097 }
1098
1099 if ($area_nr === 0) {
1100 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1101 $ilCtrl->redirect($this, "editMapAreas");
1102 }
1103
1104 $st_item = $this->media_object->getMediaItem("Standard");
1105 $st_item->deleteMapArea($area_nr);
1106 $this->media_object->update();
1107 $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_areas_deleted"), true);
1108
1109 $ilCtrl->redirect($this, "editMapAreas");
1110 }
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...

References $lng.

◆ editHighlightClass()

ilImageMapEditorGUI::editHighlightClass ( int  $area_nr)

Reimplemented in ilPCImageMapEditorGUI.

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

283 : void
284 {
285 $area = $this->getMapArea($area_nr);
286 $this->media_gui->clearAsnyOnloadCode();
287 $modal = $this->media_gui
288 ->modal($this->lng->txt("cont_highlight_class"))
289 ->form($this->getAreaHighlightForm(
290 $area_nr,
291 "highlight_class",
292 "cont_highlight_class",
293 "saveHighlightClass",
295 $area->getHighlightClass()
296 ));
297 $modal->send();
298 }
getAreaHighlightForm(int $area_nr, string $field, string $label, string $cmd, array $options, string $value)
static getAllHighlightClasses()

References ilMapArea\getAllHighlightClasses(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ editHighlightMode()

ilImageMapEditorGUI::editHighlightMode ( int  $area_nr)

Reimplemented in ilPCImageMapEditorGUI.

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

246 : void
247 {
248 $area = $this->getMapArea($area_nr);
249 $this->media_gui->clearAsnyOnloadCode();
250 $modal = $this->media_gui
251 ->modal($this->lng->txt("cont_highlight_mode"))
252 ->form($this->getAreaHighlightForm(
253 $area_nr,
254 "highlight_mode",
255 "cont_highlight_mode",
256 "saveHighlightMode",
258 $area->getHighlightMode()
259 ));
260 $modal->send();
261 }
static getAllHighlightModes()

References ilMapArea\getAllHighlightModes(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ editImagemapForward()

ilImageMapEditorGUI::editImagemapForward ( )

Get image map coordinates.

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

849 : void
850 {
852
853 $coords = $this->map->getCoords();
854 if ($coords != "") {
855 $coords .= ",";
856 }
857
858 $this->map->setCoords($coords . $this->request->getX() . "," .
859 $this->request->getY());
860
861 // call editing script
862 ilUtil::redirect($this->map->getTargetScript());
863 }
static _recoverParameters()
Recover parameters from session variables (static)
static redirect(string $a_script)

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

+ Here is the call graph for this function:

◆ editLink()

ilImageMapEditorGUI::editLink ( int  $area_nr = 0)

Edit existing link.

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

1115 : string
1116 {
1117 $this->map->clear();
1118 if ($area_nr === 0) {
1119 $area_nr = $this->request->getAreaNr();
1120 }
1121 $this->map->setAreaNr($area_nr);
1122 return $this->setLink(false);
1123 }
setLink(bool $a_handle=true)

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

499 : string {
500 $ilCtrl = $this->ctrl;
502
503 $area_type = $this->map->getAreaType();
504 $coords = $this->map->getCoords();
505 $cnt_coords = ilMapArea::countCoords($coords);
506
507 $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "components/ILIAS/MediaObjects");
508
509 $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
510
511 if ($a_edit_property != "link") {
512 switch ($area_type) {
513 // rectangle
514 case "Rect":
515 if ($cnt_coords == 0) {
516 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_tl_corner"));
517 }
518 if ($cnt_coords == 1) {
519 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_br_corner"));
520 }
521 break;
522
523 // circle
524 case "Circle":
525 if ($cnt_coords == 0) {
526 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_center"));
527 }
528 if ($cnt_coords == 1) {
529 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_circle"));
530 }
531 break;
532
533 // polygon
534 case "Poly":
535 if ($cnt_coords == 0) {
536 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_starting_point"));
537 } elseif ($cnt_coords < 3) {
538 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_next_point"));
539 } else {
540 $this->main_tpl->setOnScreenMessage('info', $lng->txt("cont_click_next_or_save"));
541 }
542 break;
543 }
544 }
545
546
547 // map properties input fields (name and link)
548 if ($a_save_form) {
549 if ($a_edit_property != "shape") {
550 // prepare link gui
551 $ilCtrl->setParameter($this, "linkmode", "map");
552 $this->tpl->setCurrentBlock("int_link_prep");
553 $this->tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML(
554 $ilCtrl->getLinkTargetByClass(
555 "ilinternallinkgui",
556 "",
557 false,
558 true,
559 false
560 )
561 ));
562 $this->tpl->parseCurrentBlock();
563 }
564 $form = $this->initAreaEditingForm($a_edit_property);
565 $this->tpl->setVariable("FORM", $form->getHTML());
566 }
567
568 $ilCtrl->setParameter($this, "out_edit_property", $a_edit_property);
569 $ilCtrl->setParameter($this, "out_area_nr", $a_area_nr);
570 $ilCtrl->setParameter($this, "out_output_new_area", (int) $a_output_new_area);
571 $ilCtrl->setParameter($this, "out_area_type", $area_type);
572 $ilCtrl->setParameter($this, "out_coords", $coords);
573
574 $edit_mode = ($a_get_next_coordinate)
575 ? "get_coords"
576 : (($a_output_new_area)
577 ? "new_area"
578 : "");
579
580 $output = $this->getImageMapOutput($edit_mode);
581 $this->tpl->setVariable("IMAGE_MAP", $output);
582
583 return $this->tpl->get();
584 }
initAreaEditingForm(string $a_edit_property)
getImageMapOutput(string $a_map_edit_mode="")
Render the image map.
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
special template class to simplify handling of ITX/PEAR

◆ editMapAreas()

ilImageMapEditorGUI::editMapAreas ( )

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

106 : string
107 {
108 $ilCtrl = $this->ctrl;
109 $table_html = $this->getImageMapTableHTML();
110 if ($table_html === "") {
111 return "";
112 }
113
114 $this->map->setTargetScript(
115 $ilCtrl->getLinkTarget(
116 $this,
117 "addArea",
118 "",
119 false,
120 false
121 )
122 );
123 $this->handleMapParameters();
124
125 $this->tpl = new ilTemplate("tpl.map_edit.html", true, true, "components/ILIAS/MediaObjects");
126 $this->tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this));
127
128 // create/update imagemap work copy
129 $this->makeMapWorkCopy();
130
131 $output = $this->getImageMapOutput();
132 $this->tpl->setVariable("IMAGE_MAP", $output);
133
134 $this->tpl->setVariable("TOOLBAR", $this->getToolbar()->getHTML());
135
136 // table
137 $this->tpl->setVariable("MAP_AREA_TABLE", $table_html);
138
139 return $this->tpl->get();
140 }
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.

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

+ Here is the call graph for this function:

◆ editShapeCircle()

ilImageMapEditorGUI::editShapeCircle ( int  $area_nr = 0)

Edit an existing shape (make it a circle)

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

1156 : string
1157 {
1158 $this->clearSessionVars();
1159 if ($area_nr === 0) {
1160 $area_nr = $this->request->getAreaNr();
1161 }
1162 $this->map->setAreaNr($area_nr);
1163 $this->map->setAreaType("Circle");
1164 return $this->setShape(false);
1165 }
setShape(bool $a_handle=true)
edit shape of existing map area

◆ editShapePolygon()

ilImageMapEditorGUI::editShapePolygon ( int  $area_nr = 0)

Edit an existing shape (make it a polygon)

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

1170 : string
1171 {
1172 $this->clearSessionVars();
1173 if ($area_nr === 0) {
1174 $area_nr = $this->request->getAreaNr();
1175 }
1176 $this->map->setAreaNr($area_nr);
1177 $this->map->setAreaType("Poly");
1178 return $this->setShape(false);
1179 }

◆ editShapeRectangle()

ilImageMapEditorGUI::editShapeRectangle ( int  $area_nr = 0)

Edit an existing shape (make it a rectangle)

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

1142 : string
1143 {
1144 $this->clearSessionVars();
1145 if ($area_nr === 0) {
1146 $area_nr = $this->request->getAreaNr();
1147 }
1148 $this->map->setAreaNr($area_nr);
1149 $this->map->setAreaType("Rect");
1150 return $this->setShape(false);
1151 }

◆ editShapeWholePicture()

ilImageMapEditorGUI::editShapeWholePicture ( int  $area_nr = 0)

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

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

1128 : string
1129 {
1130 $this->clearSessionVars();
1131 if ($area_nr === 0) {
1132 $area_nr = $this->request->getAreaNr();
1133 }
1134 $this->map->setAreaNr($area_nr);
1135 $this->map->setAreaType("WholePicture");
1136 return $this->setShape(false);
1137 }

◆ editTitle()

ilImageMapEditorGUI::editTitle ( int  $area_nr)

Reimplemented in ilPCImageMapEditorGUI.

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

209 : void
210 {
211 $this->media_gui->clearAsnyOnloadCode();
212 $modal = $this->media_gui
213 ->modal($this->lng->txt("cont_name"))
214 ->form($this->getAreaTitleForm($area_nr));
215 $modal->send();
216 }
getAreaTitleForm(int $area_nr, string $cmd="saveTitle")

References getAreaTitleForm(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilImageMapEditorGUI::executeCommand ( )
Returns
mixed
Exceptions
ilCtrlException

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

73 : mixed
74 {
75 $ilCtrl = $this->ctrl;
76
77 $next_class = $ilCtrl->getNextClass($this);
78 $cmd = $ilCtrl->getCmd();
79
80 switch ($next_class) {
81 case "ilinternallinkgui":
82 $link_gui = new ilInternalLinkGUI("Media_Media", 0);
83 $link_gui->setSetLinkTargetScript(
84 $ilCtrl->getLinkTarget(
85 $this,
86 "setInternalLink"
87 )
88 );
89 $link_gui->filterLinkType("File");
90 $link_gui->filterLinkType("User");
91 $ret = $ilCtrl->forwardCommand($link_gui);
92 break;
93
94 default:
96 if ($this->request->getX() != "" &&
97 $this->request->getY() != "") {
98 $cmd = "editImagemapForward";
99 }
100 $ret = $this->$cmd();
101 break;
102 }
103 return $ret;
104 }
getNextClass($a_gui_class=null)
@inheritDoc
static includePresentationJS(?ilGlobalTemplateInterface $a_tpl=null)
Include media object presentation JS.

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

+ Here is the call graph for this function:

◆ getAdditionalPageXML()

ilImageMapEditorGUI::getAdditionalPageXML ( )

Get additional page xml (to be overwritten)

Returns
string additional page xml

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

740 : string
741 {
742 return "";
743 }

◆ getAliasXML()

ilImageMapEditorGUI::getAliasXML ( )

Reimplemented in ilPCImageMapEditorGUI.

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

751 : string
752 {
753 return $this->media_object->getXML(IL_MODE_ALIAS);
754 }
const IL_MODE_ALIAS

References IL_MODE_ALIAS.

◆ getAreaHighlightForm()

ilImageMapEditorGUI::getAreaHighlightForm ( int  $area_nr,
string  $field,
string  $label,
string  $cmd,
array  $options,
string  $value 
)
protected

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

240 $this->ctrl->setParameterByClass(self::class, "area_nr", $area_nr);
241 return $this->media_gui
242 ->form([self::class], $cmd)
243 ->select($field, $this->lng->txt($label), $options, "", $value);
244 }

◆ getAreaTitleForm()

ilImageMapEditorGUI::getAreaTitleForm ( int  $area_nr,
string  $cmd = "saveTitle" 
)
protected

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

196 {
197 $this->ctrl->setParameterByClass(self::class, "area_nr", $area_nr);
198 return $this->media_gui
199 ->form([self::class], $cmd)
200 ->text(
201 "title",
202 $this->lng->txt("cont_name"),
203 "",
204 $this->getMapArea($area_nr)->getTitle(),
205 200
206 );
207 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by editTitle(), and saveTitle().

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

◆ getEditorTitle()

ilImageMapEditorGUI::getEditorTitle ( )

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

164 : string
165 {
167 return $lng->txt("cont_imagemap");
168 }

References $lng, and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getHrefOfArea()

ilImageMapEditorGUI::getHrefOfArea ( int  $a_nr)

Get Href of Area (only external link)

Reimplemented in ilPCImageMapEditorGUI.

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

1081 : string {
1082 $st_item = $this->media_object->getMediaItem("Standard");
1083 $area = $st_item->getMapArea($a_nr);
1084 return $area->getHref();
1085 }

◆ getImageMapOutput()

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

Render the image map.

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

701 : string {
702 $ilCtrl = $this->ctrl;
703
704 $st_item = $this->media_object->getMediaItem("Standard");
705
706 // output image map
707 $xml = "<dummy>";
708 $xml .= $this->getAliasXML();
709 $xml .= $this->media_object->getXML(IL_MODE_OUTPUT);
710 $xml .= $this->getAdditionalPageXML();
711 $xml .= "</dummy>";
712
713 $wb_path = ilFileUtils::getWebspaceDir("output") . "/";
714 $mode = "media";
715 //echo htmlentities($ilCtrl->getLinkTarget($this, "showImageMap"));
716
717 $random = new \Random\Randomizer();
718 $params = array('map_edit_mode' => $a_map_edit_mode,
719 'map_item' => $st_item->getId(),
720 'map_mob_id' => $this->media_object->getId(),
721 'mode' => $mode,
722 'media_mode' => 'enable',
723 'image_map_link' => $ilCtrl->getLinkTarget($this, "showImageMap", "", false, false),
724 'link_params' => "ref_id=" . $this->request->getRefId() . "&rand=" . $random->getInt(1, 999999),
725 'ref_id' => $this->request->getRefId(),
726 'pg_frame' => "",
727 'enlarge_path' => ilUtil::getImagePath("media/enlarge.svg"),
728 'webspace_path' => $wb_path);
729 $output = $this->xsl->process($xml, $params);
730
731 $output = $this->outputPostProcessing($output);
732
733 return $output;
734 }
const IL_MODE_OUTPUT
static getWebspaceDir(string $mode="filesystem")
get webspace directory
getAdditionalPageXML()
Get additional page xml (to be overwritten)
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)

Referenced by editMapAreas().

+ Here is the caller graph for this function:

◆ getImageMapTable()

ilImageMapEditorGUI::getImageMapTable ( )
protected

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

172 {
173 return $this->media_gui->imageMap()->imageMapTableBuilder(
174 $this->media_object,
175 $this,
176 "editMapAreas"
177 )->getTable();
178 }

References ILIAS\Repository\Table\TableAdapterGUI\getTable().

Referenced by getImageMapTableHTML().

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

◆ getImageMapTableHTML()

ilImageMapEditorGUI::getImageMapTableHTML ( )

Reimplemented in ilPCImageMapEditorGUI.

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

180 : string
181 {
182 $table = $this->getImageMapTable();
183 if ($table->handleCommand()) {
184 return "";
185 }
186 return $table->render();
187 }

References getImageMapTable().

Referenced by editMapAreas().

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

◆ getLinkTypeOfArea()

ilImageMapEditorGUI::getLinkTypeOfArea ( int  $a_nr)

Reimplemented in ilPCImageMapEditorGUI.

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

1037 : string {
1038 $st_item = $this->media_object->getMediaItem("Standard");
1039 $area = $st_item->getMapArea($a_nr);
1040 return $area->getLinkType();
1041 }

◆ getMapArea()

ilImageMapEditorGUI::getMapArea ( int  $area_nr)
protected

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

189 : ilMapArea
190 {
191 $item = $this->media_object->getMediaItem("Standard");
192 return new ilMapArea($item->getId(), $area_nr);
193 }
Class ilMapArea.

Referenced by saveTitle().

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

766 : string {
768 $frame_str = "";
769 $link_str = "";
770 $t_arr = explode("_", $a_target);
771 if ($a_frame != "") {
772 $frame_str = " (" . $a_frame . " Frame)";
773 }
774 switch ($a_type) {
775 case "StructureObject":
776 $id = (int) $t_arr[count($t_arr) - 1];
779 $link_str = $lng->txt("chapter") .
780 ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
781 }
782 break;
783
784 case "PageObject":
785 $id = (int) $t_arr[count($t_arr) - 1];
788 $link_str = $lng->txt("page") .
789 ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
790 }
791 break;
792
793 case "GlossaryItem":
794 $id = (int) $t_arr[count($t_arr) - 1];
796 $term = new ilGlossaryTerm($id);
797 $link_str = $lng->txt("term") .
798 ": " . $term->getTerm() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
799 }
800 break;
801
802 case "MediaObject":
803 $id = (int) $t_arr[count($t_arr) - 1];
805 $mob = new ilObjMediaObject($id);
806 $link_str = $lng->txt("mob") .
807 ": " . $mob->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
808 }
809 break;
810
811 case "RepositoryItem":
812 if (trim($a_target) !== "") {
813 $id = (int) $t_arr[count($t_arr) - 1];
814 $obj_id = ilObject::_lookupObjId($id);
815 if (ilObject::_exists($obj_id)) {
816 $title = ilObject::_lookupTitle(
817 $obj_id
818 );
819 $type = $t_arr[count($t_arr) - 2];
820 $type_title = $this->obj_definition->isPlugin($type)
821 ? ilObjectPlugin::lookupTxtById($type, "obj_" . $type)
822 : $lng->txt("obj_" . $type);
823 $link_str = $type_title .
824 ": " . $title . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
825 }
826 } else {
827 $title = "";
828 $link_str = "";
829 }
830 break;
831
832 case "WikiPage":
833 $id = (int) $t_arr[count($t_arr) - 1];
834 if (ilWikiPage::_exists("wpg", $id)) {
835 $wpg = new ilWikiPage($id);
836 $link_str = $lng->txt("cont_wiki_page") .
837 ": " . $wpg->getTitle() . " [" . $t_arr[count($t_arr) - 1] . "]" . $frame_str;
838 }
839 break;
840
841 }
842
843 return $link_str;
844 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(int $a_id)
checks whether a glossary term with specified id exists or not
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
static _lookupTitle(int $a_obj_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static lookupTxtById(string $plugin_id, string $lang_var)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getTargetFrameOfArea()

ilImageMapEditorGUI::getTargetFrameOfArea ( int  $a_nr)

Get TargetFrame of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

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

1070 : string {
1071 $st_item = $this->media_object->getMediaItem("Standard");
1072 $area = $st_item->getMapArea($a_nr);
1073 return $area->getTargetFrame();
1074 }

◆ getTargetOfArea()

ilImageMapEditorGUI::getTargetOfArea ( int  $a_nr)

Get Target of Area (only internal link)

Reimplemented in ilPCImageMapEditorGUI.

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

1059 : string {
1060 $st_item = $this->media_object->getMediaItem("Standard");
1061 $area = $st_item->getMapArea($a_nr);
1062 return $area->getTarget();
1063 }

◆ getToolbar()

ilImageMapEditorGUI::getToolbar ( )

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

143 {
144 $ilCtrl = $this->ctrl;
146
147 // toolbar
148 $tb = new ilToolbarGUI();
149 $tb->setFormAction($ilCtrl->getFormAction($this));
150 $options = array(
151 "WholePicture" => $lng->txt("cont_WholePicture"),
152 "Rect" => $lng->txt("cont_Rect"),
153 "Circle" => $lng->txt("cont_Circle"),
154 "Poly" => $lng->txt("cont_Poly"),
155 );
156 $si = new ilSelectInputGUI($lng->txt("cont_shape"), "shape");
157 $si->setOptions($options);
158 $tb->addInputItem($si, true);
159 $tb->addFormButton($lng->txt("cont_add_area"), "addNewArea");
160
161 return $tb;
162 }
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $ctrl, $lng, ILIAS\UI\Implementation\Component\Input\Field\$options, and ilLanguage\txt().

Referenced by editMapAreas().

+ 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)

Reimplemented in ilPCImageMapEditorGUI.

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

1048 : string {
1049 $st_item = $this->media_object->getMediaItem("Standard");
1050 $area = $st_item->getMapArea($a_nr);
1051 return $area->getType();
1052 }

◆ handleMapParameters()

ilImageMapEditorGUI::handleMapParameters ( )

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

320 : void
321 {
322 if ($this->request->getRefId() > 0) {
323 $this->map->setRefId($this->request->getRefId());
324 }
325
326 if ($this->request->getObjId() > 0) {
327 $this->map->setObjId($this->request->getObjId());
328 }
329
330 if ($this->request->getHierId() != "") {
331 $this->map->setHierId($this->request->getHierId());
332 }
333
334 if ($this->request->getPCId() != "") {
335 $this->map->setPCId($this->request->getPCId());
336 }
337 }

Referenced by editMapAreas().

+ Here is the caller graph for this function:

◆ initAreaEditingForm()

ilImageMapEditorGUI::initAreaEditingForm ( string  $a_edit_property)

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

590
591 $form = new ilPropertyFormGUI();
592 $form->setOpenTag(false);
593 $form->setCloseTag(false);
594
595 // link
596 if ($a_edit_property != "shape") {
597 //
598 $radg = new ilRadioGroupInputGUI($lng->txt("cont_link"), "area_link_type");
599 if ($this->map->getLinkType() != "int") {
600 if ($this->map->getExternalLink() == "") {
601 $radg->setValue("no");
602 } else {
603 $radg->setValue("ext");
604 }
605 } else {
606 $radg->setValue("int");
607 }
608
609 // external link
610 $ext = new ilRadioOption($lng->txt("cont_link_ext"), "ext");
611 $radg->addOption($ext);
612
613 $ti = new ilTextInputGUI("", "area_link_ext");
614 $ti->setMaxLength(800);
615 $ti->setSize(50);
616 if ($this->map->getExternalLink() != "") {
617 $ti->setValue($this->map->getExternalLink());
618 } else {
619 $ti->setValue("https://");
620 }
621 $ext->addSubItem($ti);
622
623 // internal link
624 $int = new ilRadioOption($lng->txt("cont_link_int"), "int");
625 $radg->addOption($int);
626
627 $ne = new ilNonEditableValueGUI("", "", true);
628 $link_str = "";
629 $int_link = $this->map->getInternalLink();
630 if ($int_link["target"] != "") {
631 $link_str = $this->getMapAreaLinkString(
632 $int_link["target"],
633 $int_link["type"],
634 $int_link["target_frame"]
635 );
636 }
637 $ne->setValue(
638 $link_str .
639 '&nbsp;<a id="iosEditInternalLinkTrigger" href="#">' .
640 "[" . $lng->txt("cont_get_link") . "]" .
641 '</a>'
642 );
643 $int->addSubItem($ne);
644
645 // no link
646 $no = new ilRadioOption($lng->txt("cont_link_no"), "no");
647 $radg->addOption($no);
648
649 $form->addItem($radg);
650 }
651
652
653 // name
654 if ($a_edit_property != "link" && $a_edit_property != "shape") {
655 $ti = new ilTextInputGUI($lng->txt("cont_name"), "area_name");
656 $ti->setMaxLength(200);
657 $ti->setSize(20);
658 $form->addItem($ti);
659 }
660
661 // save and cancel commands
662 $form->setTitle($lng->txt("cont_new_area"));
663 $form->addCommandButton("saveArea", $lng->txt("save"));
664
665 // $form->setFormAction($ilCtrl->getFormAction($this));
666
667 return $form;
668 }
getMapAreaLinkString(string $a_target, string $a_type, string $a_frame)
Get text name of internal link.
This class represents a non editable value in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.

◆ linkWholePicture()

ilImageMapEditorGUI::linkWholePicture ( )

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

392 : string
393 {
394 $this->clearSessionVars();
395 $this->map->setAreaType("WholePicture");
396
397 return $this->editMapArea(false, false, true);
398 }

◆ 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.

Reimplemented in ilPCImageMapEditorGUI.

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

679 : ilMediaItem {
680 // create/update imagemap work copy
681 $st_item = $this->media_object->getMediaItem("Standard");
682
683 if ($a_edit_property == "shape") {
684 $st_item->makeMapWorkCopy($a_area_nr, true); // exclude area currently being edited
685 } else {
686 $st_item->makeMapWorkCopy($a_area_nr, false);
687 }
688
689 if ($a_output_new_area) {
690 $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
691 }
692
693 return $st_item;
694 }
Class ilMediaItem Media Item, component of a media object (file or reference)
makeMapWorkCopy(int $a_area_nr=0, bool $a_exclude=false)
make map work copy of image

References ilMediaItem\makeMapWorkCopy().

Referenced by editMapAreas().

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

747 : string {
748 return $a_output;
749 }

◆ saveArea()

ilImageMapEditorGUI::saveArea ( )

Save new or updated map area.

Reimplemented in ilPCImageMapEditorGUI.

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

883 : string
884 {
886 $ilCtrl = $this->ctrl;
887
888 switch ($this->map->getMode()) {
889 // save edited link
890 case "edit_link":
891 $st_item = $this->media_object->getMediaItem("Standard");
892 $max = ilMapArea::_getMaxNr($st_item->getId());
893 $area = new ilMapArea($st_item->getId(), $this->map->getAreaNr());
894
895 if ($this->request->getAreaLinkType() == IL_INT_LINK) {
896 $area->setLinkType(IL_INT_LINK);
897 $int_link = $this->map->getInternalLink();
898 $area->setType($int_link["type"] ?? "");
899 $area->setTarget($int_link["target"] ?? "");
900 $area->setTargetFrame($int_link["target_frame"] ?? "");
901 } else {
902 $area->setLinkType(IL_EXT_LINK);
903 if ($this->request->getAreaLinkType() != IL_NO_LINK) {
904 $area->setHref(
905 $this->request->getExternalLink()
906 );
907 } else {
908 $area->setHref("");
909 }
910 }
911 $area->update();
912 break;
913
914 // save edited shape
915 case "edit_shape":
916 $st_item = $this->media_object->getMediaItem("Standard");
917 $max = ilMapArea::_getMaxNr($st_item->getId());
918 $area = new ilMapArea(
919 $st_item->getId(),
920 $this->map->getAreaNr()
921 );
922
923 $area->setShape($this->map->getAreaType());
924 $area->setCoords($this->map->getCoords());
925 $area->update();
926 break;
927
928 // save new area
929 default:
930 $area_type = $this->map->getAreaType();
931 $coords = $this->map->getCoords();
932
933 $st_item = $this->media_object->getMediaItem("Standard");
934 $max = ilMapArea::_getMaxNr($st_item->getId());
935
936 // make new area object
937 $area = new ilMapArea();
938 $area->setItemId($st_item->getId());
939 $area->setShape($area_type);
940 $area->setCoords($coords);
941 $area->setNr($max + 1);
942 $area->setTitle($this->request->getAreaName());
943 switch ($this->request->getAreaLinkType()) {
944 case "ext":
945 $area->setLinkType(IL_EXT_LINK);
946 $area->setHref($this->request->getExternalLink());
947 break;
948
949 case "int":
950 $area->setLinkType(IL_INT_LINK);
951 $int_link = $this->map->getInternalLink();
952 $area->setType($int_link["type"] ?? "");
953 $area->setTarget($int_link["target"] ?? "");
954 $area->setTargetFrame($int_link["type_frame"] ?? "");
955 break;
956 }
957
958 // put area into item and update media object
959 $st_item->addMapArea($area);
960 $this->media_object->update();
961 break;
962 }
963
964 //$this->initMapParameters();
965 $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_area"), true);
966 $ilCtrl->redirect($this, "editMapAreas");
967 return "";
968 }
const IL_INT_LINK
const IL_EXT_LINK
const IL_NO_LINK
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static)

References $lng, ilMapArea\_getMaxNr(), IL_EXT_LINK, IL_INT_LINK, and IL_NO_LINK.

+ Here is the call graph for this function:

◆ saveHighlightClass()

ilImageMapEditorGUI::saveHighlightClass ( )

Reimplemented in ilPCImageMapEditorGUI.

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

300 : void
301 {
302 $area_nr = $this->request->getAreaNr();
303 $form = $this->getAreaHighlightForm(
304 $area_nr,
305 "highlight_class",
306 "cont_highlight_class",
307 "saveHighlightClass",
309 $this->getMapArea($area_nr)->getHighlightClass()
310 );
311 if ($form->isValid()) {
312 $area = $this->getMapArea($area_nr);
313 $area->setHighlightClass((string) $form->getData("highlight_class"));
314 $area->update();
315 }
316 $this->main_tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
317 $this->ctrl->redirect($this, "editMapAreas");
318 }

References ILIAS\Repository\ctrl(), ilMapArea\getAllHighlightClasses(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveHighlightMode()

ilImageMapEditorGUI::saveHighlightMode ( )

Reimplemented in ilPCImageMapEditorGUI.

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

263 : void
264 {
265 $area_nr = $this->request->getAreaNr();
266 $form = $this->getAreaHighlightForm(
267 $area_nr,
268 "highlight_mode",
269 "cont_highlight_mode",
270 "saveHighlightMode",
272 $this->getMapArea($area_nr)->getHighlightMode()
273 );
274 if ($form->isValid()) {
275 $area = $this->getMapArea($area_nr);
276 $area->setHighlightMode((string) $form->getData("highlight_mode"));
277 $area->update();
278 }
279 $this->main_tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
280 $this->ctrl->redirect($this, "editMapAreas");
281 }

References ILIAS\Repository\ctrl(), ilMapArea\getAllHighlightModes(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveTitle()

ilImageMapEditorGUI::saveTitle ( )

Reimplemented in ilPCImageMapEditorGUI.

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

218 : void
219 {
220 $area_nr = $this->request->getAreaNr();
221 $form = $this->getAreaTitleForm($area_nr);
222 if ($form->isValid()) {
223 $title = $form->getData("title");
224 $area = $this->getMapArea($area_nr);
225 $area->setTitle($title === "" ? " " : $title);
226 $area->update();
227 }
228 $this->main_tpl->setOnScreenMessage("success", $this->lng->txt("msg_obj_modified"), true);
229 $this->ctrl->redirect($this, "editMapAreas");
230 }

References ILIAS\Repository\ctrl(), getAreaTitleForm(), getMapArea(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setHighlight()

ilImageMapEditorGUI::setHighlight ( )

Set highlight settings.

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

1270 : void
1271 {
1272 $ilCtrl = $this->ctrl;
1273 $lng = $this->lng;
1274
1275 $st_item = $this->media_object->getMediaItem("Standard");
1276 // seems to be obsolete, methods don't exist
1277 //$st_item->setHighlightMode($this->request->getHighlightMode());
1278 //$st_item->setHighlightClass($this->request->getHighlightClass());
1279 $st_item->update();
1280
1281 $this->main_tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1282 $ilCtrl->redirect($this, "editMapAreas");
1283 }

References $lng.

◆ setInternalLink()

ilImageMapEditorGUI::setInternalLink ( )

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

970 : string
971 {
972 $this->map->setLinkType("int");
973 $this->map->setInternalLink(
974 $this->request->getLinkType(),
975 $this->request->getLinkTarget(),
976 $this->request->getLinkTargetFrame(),
977 $this->request->getLinkAnchor()
978 );
979
980 switch ($this->map->getMode()) {
981 case "edit_link":
982 return $this->setLink();
983
984 default:
985 return $this->addArea();
986 }
987 }

◆ setLink()

ilImageMapEditorGUI::setLink ( bool  $a_handle = true)

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

991 : string {
993 $ilCtrl = $this->ctrl;
994 $area = null;
995 if ($a_handle) {
996 $this->handleMapParameters();
997 }
998 if ($this->map->getAreaNr() > 0) {
999 $area_nr = $this->map->getAreaNr();
1000 } else {
1001 $area = $this->request->getArea();
1002 $area_nr = (int) ($area[0] ?? 0);
1003 }
1004 if ($area_nr === 0) {
1005 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1006 $ilCtrl->redirect($this, "editMapAreas");
1007 }
1008
1009 if (count($area ?? []) > 1) {
1010 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("cont_select_max_one_item"), true);
1011 $ilCtrl->redirect($this, "editMapAreas");
1012 }
1013
1014
1015 if ($this->map->getMode() != "edit_link") {
1016 $this->map->setAreaNr($area_nr);
1017 $this->map->setLinkType($this->getLinkTypeOfArea($area_nr));
1018 $this->map->setMode("edit_link");
1019 $this->map->setTargetScript($ilCtrl->getLinkTarget($this, "setLink"));
1020 if ($this->map->getLinkType() == IL_INT_LINK) {
1021 $this->map->setInternalLink(
1022 $this->getTypeOfArea($area_nr),
1023 $this->getTargetOfArea($area_nr),
1024 $this->getTargetFrameOfArea($area_nr),
1025 ""
1026 );
1027 } else {
1028 $this->map->setExternalLink($this->getHrefOfArea($area_nr));
1029 }
1030 }
1031
1032 return $this->editMapArea(false, false, true, "link", $area_nr);
1033 }
getHrefOfArea(int $a_nr)
Get Href of Area (only external link)
getTargetFrameOfArea(int $a_nr)
Get TargetFrame of Area (only internal link)
getTargetOfArea(int $a_nr)
Get Target of Area (only internal link)
getTypeOfArea(int $a_nr)
Get Type of Area (only internal link)

◆ setShape()

ilImageMapEditorGUI::setShape ( bool  $a_handle = true)

edit shape of existing map area

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

1186 : string {
1187 $lng = $this->lng;
1188 $ilCtrl = $this->ctrl;
1189
1190 $area = [];
1191 if ($a_handle) {
1192 $this->handleMapParameters();
1193 }
1194 if ($this->map->getAreaNr() > 0) {
1195 $area_nr = $this->map->getAreaNr();
1196 } else {
1197 $area = $this->request->getArea();
1198 $area_nr = (int) ($area[0] ?? 0);
1199 }
1200 if ($area_nr === 0) {
1201 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("no_checkbox"), true);
1202 $ilCtrl->redirect($this, "editMapAreas");
1203 }
1204
1205 if (count($area ?? []) > 1) {
1206 $this->main_tpl->setOnScreenMessage('failure', $lng->txt("cont_select_max_one_item"), true);
1207 $ilCtrl->redirect($this, "editMapAreas");
1208 }
1209
1210 if ($this->map->getMode() != "edit_shape") {
1211 $this->map->setAreaNr($area_nr);
1212 $this->map->setMode("edit_shape");
1213 $this->map->setTargetScript(
1214 $ilCtrl->getLinkTarget($this, "setShape", "", false, false)
1215 );
1216 }
1217
1218
1219 $area_type = $this->map->getAreaType();
1220 $coords = $this->map->getCoords();
1221 $cnt_coords = ilMapArea::countCoords($coords);
1222
1223 // decide what to do next
1224 switch ($area_type) {
1225 // Rectangle
1226 case "Rect":
1227 if ($cnt_coords < 2) {
1228 return $this->editMapArea(true, false, false, "shape", $area_nr);
1229 } elseif ($cnt_coords == 2) {
1230 return $this->saveArea();
1231 }
1232 break;
1233
1234 // Circle
1235 case "Circle":
1236 if ($cnt_coords <= 1) {
1237 return $this->editMapArea(true, false, false, "shape", $area_nr);
1238 } else {
1239 if ($cnt_coords == 2) {
1240 $c = explode(",", $coords);
1241 $coords = $c[0] . "," . $c[1] . ","; // determine radius
1242 $coords .= round(sqrt(pow(abs($c[3] - $c[1]), 2) + pow(abs($c[2] - $c[0]), 2)));
1243 }
1244 $this->map->setCoords($coords);
1245 return $this->saveArea();
1246 }
1247
1248 // Polygon
1249 // no break
1250 case "Poly":
1251 if ($cnt_coords < 1) {
1252 return $this->editMapArea(true, false, false, "shape", $area_nr);
1253 } elseif ($cnt_coords < 3) {
1254 return $this->editMapArea(true, true, false, "shape", $area_nr);
1255 } else {
1256 return $this->editMapArea(true, true, true, "shape", $area_nr);
1257 }
1258
1259 // Whole Picture
1260 // no break
1261 case "WholePicture":
1262 return $this->saveArea();
1263 }
1264 return "";
1265 }
saveArea()
Save new or updated map area.

◆ showImageMap()

ilImageMapEditorGUI::showImageMap ( )

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

339 : void
340 {
341 $item = $this->makeMapWorkCopy(
342 $this->request->getOutEditProperty(),
343 $this->request->getOutAreaNr(),
344 $this->request->getOutOutputNewArea(),
345 $this->request->getOutAreaType(),
346 $this->request->getOutCoords()
347 );
348
349 //$item = new ilMediaItem($this->request->getItemId());
350 $item->outputMapWorkCopy();
351 }

◆ updateAreas()

ilImageMapEditorGUI::updateAreas ( )

Reimplemented in ilPCImageMapEditorGUI.

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

353 : void
354 {
356 $ilCtrl = $this->ctrl;
357
358 $st_item = $this->media_object->getMediaItem("Standard");
359 $max = ilMapArea::_getMaxNr($st_item->getId());
360 for ($i = 1; $i <= $max; $i++) {
361 if (!$this->request->hasRow($i)) {
362 continue;
363 }
364 $area = new ilMapArea($st_item->getId(), $i);
365 $area->setTitle(
366 $this->request->getAreaTitle($i)
367 );
368 $area->setHighlightMode(
369 $this->request->getAreaHighlightMode($i)
370 );
371 $area->setHighlightClass(
372 $this->request->getAreaHighlightClass($i)
373 );
374 $area->update();
375 }
376
377 $this->main_tpl->setOnScreenMessage('success', $lng->txt("cont_saved_map_data"), true);
378 $ilCtrl->redirect($this, "editMapAreas");
379 }

References $lng, and ilMapArea\_getMaxNr().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilImageMapEditorGUI::$ctrl
protected

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

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

◆ $lng

ilLanguage ilImageMapEditorGUI::$lng
protected

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

Referenced by getEditorTitle(), and getToolbar().

◆ $main_tpl

ilGlobalTemplateInterface ilImageMapEditorGUI::$main_tpl
protected

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

◆ $map

ImageMapManager ilImageMapEditorGUI::$map
protected

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

◆ $media_gui

ILIAS MediaObjects InternalGUIService ilImageMapEditorGUI::$media_gui
protected

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

◆ $media_object

ilObjMediaObject ilImageMapEditorGUI::$media_object
protected

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

◆ $obj_definition

ilObjectDefinition ilImageMapEditorGUI::$obj_definition
protected

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

◆ $request

ImageMapGUIRequest ilImageMapEditorGUI::$request
protected

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

Referenced by ilPCImageMapEditorGUI\__construct().

◆ $toolbar

ilToolbarGUI ilImageMapEditorGUI::$toolbar
protected

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

◆ $tpl

ilTemplate ilImageMapEditorGUI::$tpl
protected

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

◆ $xsl

ILIAS COPage Xsl XslManager ilImageMapEditorGUI::$xsl
protected

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


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