29     protected \ILIAS\COPage\Xsl\XslManager 
$xsl;
    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;
    50         $this->map = $DIC->mediaObjects()
    55         $this->request = $DIC->mediaObjects()
    60         $this->xsl = $DIC->copage()->internal()->domain()->xsl();
    72         $cmd = $ilCtrl->getCmd();
    74         switch ($next_class) {
    75             case "ilinternallinkgui":
    77                 $link_gui->setSetLinkTargetScript(
    78                     $ilCtrl->getLinkTarget(
    83                 $link_gui->filterLinkType(
"File");
    84                 $ret = $ilCtrl->forwardCommand($link_gui);
    89                 if ($this->request->getX() != 
"" &&
    90                     $this->request->getY() != 
"") {
    91                     $cmd = 
"editImagemapForward";
   104             $ilCtrl->getLinkTarget(
   114         $this->tpl = 
new ilTemplate(
"tpl.map_edit.html", 
true, 
true, 
"components/ILIAS/MediaObjects");
   115         $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
   121         $this->tpl->setVariable(
"IMAGE_MAP", $output);
   123         $this->tpl->setVariable(
"TOOLBAR", $this->
getToolbar()->getHTML());
   128         return $this->tpl->get();
   138         $tb->setFormAction($ilCtrl->getFormAction($this));
   140             "WholePicture" => $lng->
txt(
"cont_WholePicture"),
   141             "Rect" => $lng->
txt(
"cont_Rect"),
   142             "Circle" => $lng->
txt(
"cont_Circle"),
   143             "Poly" => $lng->
txt(
"cont_Poly"),
   147         $tb->addInputItem($si, 
true);
   148         $tb->addFormButton($lng->
txt(
"cont_add_area"), 
"addNewArea");
   156         return $lng->
txt(
"cont_imagemap");
   162         $image_map_table = 
new ilImageMapTableGUI($this, 
"editMapAreas", $this->media_object);
   163         return $image_map_table->getHTML();
   168         if ($this->request->getRefId() > 0) {
   169             $this->map->setRefId($this->request->getRefId());
   172         if ($this->request->getObjId() > 0) {
   173             $this->map->setObjId($this->request->getObjId());
   176         if ($this->request->getHierId() != 
"") {
   177             $this->map->setHierId($this->request->getHierId());
   180         if ($this->request->getPCId() != 
"") {
   181             $this->map->setPCId($this->request->getPCId());
   188             $this->request->getOutEditProperty(),
   189             $this->request->getOutAreaNr(),
   190             $this->request->getOutOutputNewArea(),
   191             $this->request->getOutAreaType(),
   192             $this->request->getOutCoords()
   196         $item->outputMapWorkCopy();
   204         $st_item = $this->media_object->getMediaItem(
"Standard");
   206         for ($i = 1; $i <= $max; $i++) {
   207             $area = 
new ilMapArea($st_item->getId(), $i);
   209                 $this->request->getAreaTitle($i)
   211             $area->setHighlightMode(
   212                 $this->request->getAreaHighlightMode($i)
   214             $area->setHighlightClass(
   215                 $this->request->getAreaHighlightClass($i)
   220         $this->main_tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_saved_map_data"), 
true);
   221         $ilCtrl->redirect($this, 
"editMapAreas");
   226         switch ($this->request->getAreaShape()) {
   229             case "Circle": 
return $this->
addCircle();
   238         $this->map->setAreaType(
"WholePicture");
   246         $this->map->setAreaType(
"Rect");
   253         $this->map->setAreaType(
"Circle");
   260         $this->map->setAreaType(
"Poly");
   270         bool $a_handle = 
true   277         $area_type = $this->map->getAreaType();
   278         $coords = $this->map->getCoords();
   282         switch ($area_type) {
   285                 if ($cnt_coords < 2) {
   288                 } elseif ($cnt_coords == 2) {
   295                 if ($cnt_coords <= 1) {
   298                     if ($cnt_coords == 2) {
   299                         $c = explode(
",", $coords);
   300                         $coords = 
$c[0] . 
"," . 
$c[1] . 
",";    
   301                         $coords .= round(sqrt(pow(abs(
$c[3] - 
$c[1]), 2) + pow(abs(
$c[2] - 
$c[0]), 2)));
   303                     $this->map->setCoords($coords);
   311                 if ($cnt_coords < 1) {
   313                 } elseif ($cnt_coords < 3) {
   337         bool $a_get_next_coordinate = 
false,
   338         bool $a_output_new_area = 
false,
   339         bool $a_save_form = 
false,
   340         string $a_edit_property = 
"",
   346         $area_type = $this->map->getAreaType();
   347         $coords = $this->map->getCoords();
   350         $this->tpl = 
new ilTemplate(
"tpl.map_edit.html", 
true, 
true, 
"components/ILIAS/MediaObjects");
   352         $this->tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this));
   354         if ($a_edit_property != 
"link") {
   355             switch ($area_type) {
   358                     if ($cnt_coords == 0) {
   359                         $this->main_tpl->setOnScreenMessage(
'info', $lng->
txt(
"cont_click_tl_corner"));
   361                     if ($cnt_coords == 1) {
   362                         $this->main_tpl->setOnScreenMessage(
'info', $lng->
txt(
"cont_click_br_corner"));
   368                     if ($cnt_coords == 0) {
   369                         $this->main_tpl->setOnScreenMessage(
'info', $lng->
txt(
"cont_click_center"));
   371                     if ($cnt_coords == 1) {
   372                         $this->main_tpl->setOnScreenMessage(
'info', $lng->
txt(
"cont_click_circle"));
   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"));
   383                         $this->main_tpl->setOnScreenMessage(
'info', $lng->
txt(
"cont_click_next_or_save"));
   392             if ($a_edit_property != 
"shape") {
   394                 $ilCtrl->setParameter($this, 
"linkmode", 
"map");
   395                 $this->tpl->setCurrentBlock(
"int_link_prep");
   397                     $ilCtrl->getLinkTargetByClass(
   405                 $this->tpl->parseCurrentBlock();
   408             $this->tpl->setVariable(
"FORM", $form->getHTML());
   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);
   417         $edit_mode = ($a_get_next_coordinate)
   419             : (($a_output_new_area)
   424         $this->tpl->setVariable(
"IMAGE_MAP", $output);
   426         return $this->tpl->get();
   430         string $a_edit_property
   435         $form->setOpenTag(
false);
   436         $form->setCloseTag(
false);
   439         if ($a_edit_property != 
"shape") {
   442             if ($this->map->getLinkType() != 
"int") {
   443                 if ($this->map->getExternalLink() == 
"") {
   446                     $radg->setValue(
"ext");
   449                 $radg->setValue(
"int");
   454             $radg->addOption($ext);
   457             $ti->setMaxLength(800);
   459             if ($this->map->getExternalLink() != 
"") {
   460                 $ti->setValue($this->map->getExternalLink());
   462                 $ti->setValue(
"https://");
   464             $ext->addSubItem($ti);
   468             $radg->addOption($int);
   472             $int_link = $this->map->getInternalLink();
   473             if ($int_link[
"target"] != 
"") {
   477                     $int_link[
"target_frame"]
   482                     ' <a id="iosEditInternalLinkTrigger" href="#">' .
   483                     "[" . $lng->
txt(
"cont_get_link") . 
"]" .
   486             $int->addSubItem($ne);
   490             $radg->addOption($no);
   492             $form->addItem($radg);
   497         if ($a_edit_property != 
"link" && $a_edit_property != 
"shape") {
   499             $ti->setMaxLength(200);
   505         $form->setTitle($lng->
txt(
"cont_new_area"));
   506         $form->addCommandButton(
"saveArea", $lng->
txt(
"save"));
   517         string $a_edit_property = 
"",
   519         bool $a_output_new_area = 
false,
   520         string $a_area_type = 
"",
   521         string $a_coords = 
""   524         $st_item = $this->media_object->getMediaItem(
"Standard");
   526         if ($a_edit_property == 
"shape") {
   529             $st_item->makeMapWorkCopy($a_area_nr, 
false);
   532         if ($a_output_new_area) {
   533             $st_item->addAreaToMapWorkCopy($a_area_type, $a_coords);
   543         string $a_map_edit_mode = 
""   547         $st_item = $this->media_object->getMediaItem(
"Standard");
   560         $random = new \ilRandom();
   561         $params = array(
'map_edit_mode' => $a_map_edit_mode,
   562             'map_item' => $st_item->getId(),
   563             'map_mob_id' => $this->media_object->getId(),
   565             'media_mode' => 
'enable',
   566             'image_map_link' => $ilCtrl->getLinkTarget($this, 
"showImageMap", 
"", 
false, 
false),
   567             'link_params' => 
"ref_id=" . $this->request->getRefId() . 
"&rand=" . $random->int(1, 999999),
   568             'ref_id' => $this->request->getRefId(),
   571             'webspace_path' => $wb_path);
   572         $output = $this->xsl->process($xml, 
$params);
   613         $t_arr = explode(
"_", $a_target);
   614         if ($a_frame != 
"") {
   615             $frame_str = 
" (" . $a_frame . 
" Frame)";
   618             case "StructureObject":
   620                 $link_str = $lng->
txt(
"chapter") .
   621                     ": " . $title . 
" [" . $t_arr[count($t_arr) - 1] . 
"]" . $frame_str;
   626                 $link_str = $lng->
txt(
"page") .
   627                     ": " . $title . 
" [" . $t_arr[count($t_arr) - 1] . 
"]" . $frame_str;
   632                 $link_str = $lng->
txt(
"term") .
   633                     ": " . $term->getTerm() . 
" [" . $t_arr[count($t_arr) - 1] . 
"]" . $frame_str;
   638                 $link_str = $lng->
txt(
"mob") .
   639                     ": " . $mob->getTitle() . 
" [" . $t_arr[count($t_arr) - 1] . 
"]" . $frame_str;
   642             case "RepositoryItem":
   643                 if (trim($a_target) !== 
"") {
   647                     $link_str = $lng->
txt(
"obj_" . $t_arr[count($t_arr) - 2]) .
   648                         ": " . $title . 
" [" . $t_arr[count($t_arr) - 1] . 
"]" . $frame_str;
   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;
   673         $coords = $this->map->getCoords();
   678         $this->map->setCoords($coords . $this->request->getX() . 
"," .
   679             $this->request->getY());
   692         $map = $DIC->mediaObjects()->internal()->domain()->imageMap();
   708         switch ($this->map->getMode()) {
   711                 $st_item = $this->media_object->getMediaItem(
"Standard");
   713                 $area = 
new ilMapArea($st_item->getId(), $this->map->getAreaNr());
   715                 if ($this->request->getAreaLinkType() == 
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"] ?? 
"");
   723                     if ($this->request->getAreaLinkType() != 
IL_NO_LINK) {
   725                             $this->request->getExternalLink()
   736                 $st_item = $this->media_object->getMediaItem(
"Standard");
   740                     $this->map->getAreaNr()
   743                 $area->
setShape($this->map->getAreaType());
   744                 $area->setCoords($this->map->getCoords());
   750                 $area_type = $this->map->getAreaType();
   751                 $coords = $this->map->getCoords();
   753                 $st_item = $this->media_object->getMediaItem(
"Standard");
   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()) {
   766                         $area->setHref($this->request->getExternalLink());
   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"] ?? 
"");
   779                 $st_item->addMapArea($area);
   780                 $this->media_object->update();
   785         $this->main_tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_saved_map_area"), 
true);
   786         $ilCtrl->redirect($this, 
"editMapAreas");
   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()
   800         switch ($this->map->getMode()) {
   810         bool $a_handle = 
true   818         if ($this->map->getAreaNr() > 0) {
   819             $area_nr = $this->map->getAreaNr();
   821             $area = $this->request->getArea();
   822             $area_nr = (
int) ($area[0] ?? 0);
   824         if ($area_nr === 0) {
   825             $this->main_tpl->setOnScreenMessage(
'failure', $lng->
txt(
"no_checkbox"), 
true);
   826             $ilCtrl->redirect($this, 
"editMapAreas");
   829         if (count($area ?? []) > 1) {
   830             $this->main_tpl->setOnScreenMessage(
'failure', $lng->
txt(
"cont_select_max_one_item"), 
true);
   831             $ilCtrl->redirect($this, 
"editMapAreas");
   835         if ($this->map->getMode() != 
"edit_link") {
   836             $this->map->setAreaNr($area_nr);
   838             $this->map->setMode(
"edit_link");
   839             $this->map->setTargetScript($ilCtrl->getLinkTarget($this, 
"setLink"));
   841                 $this->map->setInternalLink(
   852         return $this->
editMapArea(
false, 
false, 
true, 
"link", $area_nr);
   858         $st_item = $this->media_object->getMediaItem(
"Standard");
   859         $area = $st_item->getMapArea($a_nr);
   860         return $area->getLinkType();
   869         $st_item = $this->media_object->getMediaItem(
"Standard");
   870         $area = $st_item->getMapArea($a_nr);
   871         return $area->getType();
   880         $st_item = $this->media_object->getMediaItem(
"Standard");
   881         $area = $st_item->getMapArea($a_nr);
   882         return $area->getTarget();
   891         $st_item = $this->media_object->getMediaItem(
"Standard");
   892         $area = $st_item->getMapArea($a_nr);
   893         return $area->getTargetFrame();
   902         $st_item = $this->media_object->getMediaItem(
"Standard");
   903         $area = $st_item->getMapArea($a_nr);
   904         return $area->getHref();
   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");
   921         $st_item = $this->media_object->getMediaItem(
"Standard");
   924         if (count($area) > 0) {
   927             foreach ($area as $area_nr) {
   928                 $st_item->deleteMapArea($area_nr - $i);
   932             $this->media_object->update();
   933             $this->main_tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_areas_deleted"), 
true);
   936         $ilCtrl->redirect($this, 
"editMapAreas");
   954         $this->map->setAreaType(
"WholePicture");
   964         $this->map->setAreaType(
"Rect");
   974         $this->map->setAreaType(
"Circle");
   984         $this->map->setAreaType(
"Poly");
   992         bool $a_handle = 
true  1001         if ($this->map->getAreaNr() > 0) {
  1002             $area_nr = $this->map->getAreaNr();
  1004             $area = $this->request->getArea();
  1005             $area_nr = (
int) ($area[0] ?? 0);
  1007         if ($area_nr === 0) {
  1008             $this->main_tpl->setOnScreenMessage(
'failure', $lng->
txt(
"no_checkbox"), 
true);
  1009             $ilCtrl->redirect($this, 
"editMapAreas");
  1012         if (count($area ?? []) > 1) {
  1013             $this->main_tpl->setOnScreenMessage(
'failure', $lng->
txt(
"cont_select_max_one_item"), 
true);
  1014             $ilCtrl->redirect($this, 
"editMapAreas");
  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)
  1026         $area_type = $this->map->getAreaType();
  1027         $coords = $this->map->getCoords();
  1031         switch ($area_type) {
  1034                 if ($cnt_coords < 2) {
  1035                     return $this->
editMapArea(
true, 
false, 
false, 
"shape", $area_nr);
  1036                 } elseif ($cnt_coords == 2) {
  1043                 if ($cnt_coords <= 1) {
  1044                     return $this->
editMapArea(
true, 
false, 
false, 
"shape", $area_nr);
  1046                     if ($cnt_coords == 2) {
  1047                         $c = explode(
",", $coords);
  1048                         $coords = 
$c[0] . 
"," . 
$c[1] . 
",";    
  1049                         $coords .= round(sqrt(pow(abs(
$c[3] - 
$c[1]), 2) + pow(abs(
$c[2] - 
$c[0]), 2)));
  1051                     $this->map->setCoords($coords);
  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);
  1063                     return $this->
editMapArea(
true, 
true, 
true, 
"shape", $area_nr);
  1068             case "WholePicture":
  1082         $st_item = $this->media_object->getMediaItem(
"Standard");
  1088         $this->main_tpl->setOnScreenMessage(
'success', $lng->
txt(
"msg_obj_modified"), 
true);
  1089         $ilCtrl->redirect($this, 
"editMapAreas");
 
static getWebspaceDir(string $mode="filesystem")
get webspace directory 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
makeMapWorkCopy(string $a_edit_property="", int $a_area_nr=0, bool $a_output_new_area=false, string $a_area_type="", string $a_coords="")
Make work file for editing. 
 
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing. 
 
getImageMapOutput(string $a_map_edit_mode="")
Render the image map. 
 
ImageMapGUIRequest $request
 
setTitle(string $a_title)
set (tooltip)title of area 
 
editShapeWholePicture()
Edit an existing shape (make it a whole picture link) 
 
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...
 
setLink(bool $a_handle=true)
 
saveArea()
Save new or updated map area. 
 
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
__construct(ilObjMediaObject $a_media_object)
 
getTargetOfArea(int $a_nr)
Get Target of Area (only internal link) 
 
getLinkTypeOfArea(int $a_nr)
 
static _getMaxNr(int $a_item_id)
get maximum nr of media item (static) 
 
getMapAreaLinkString(string $a_target, string $a_type, string $a_frame)
Get text name of internal link. 
 
ILIAS COPage Xsl XslManager $xsl
 
setShape(string $a_shape)
set shape (IL_AREA_RECT, IL_AREA_CIRCLE, IL_AREA_POLY, IL_AREA_WHOLE_PICTURE) 
 
initAreaEditingForm(string $a_edit_property)
 
getHrefOfArea(int $a_nr)
Get Href of Area (only external link) 
 
static _lookupObjId(int $ref_id)
 
static _lookupTitle(int $a_obj_id)
 
getTargetFrameOfArea(int $a_nr)
Get TargetFrame of Area (only internal link) 
 
editShapeCircle()
Edit an existing shape (make it a circle) 
 
setHighlight()
Set highlight settings. 
 
getNextClass($a_gui_class=null)
 
static _lookupTitle(int $obj_id)
 
outputPostProcessing(string $a_output)
 
static countCoords(string $c)
count the number of coordinates (x,y) in a coordinate string (format: "x1,y1,x2,y2,x3,y3,...") 
 
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
setLinkType(string $a_link_type)
set link type 
 
editLink()
Edit existing link. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
deleteAreas()
Delete map areas. 
 
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. 
 
ilObjMediaObject $media_object
 
static redirect(string $a_script)
 
User interface class for map editor. 
 
setShape(bool $a_handle=true)
edit shape of existing map area 
 
static _recoverParameters()
Recover parameters from session variables (static) 
 
editShapePolygon()
Edit an existing shape (make it a polygon) 
 
editImagemapForward()
Get image map coordinates. 
 
setTargetScript(string $a_target_script)
 
getTypeOfArea(int $a_nr)
Get Type of Area (only internal link) 
 
getAdditionalPageXML()
Get additional page xml (to be overwritten) 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
addArea(bool $a_handle=true)
 
ilGlobalTemplateInterface $main_tpl
 
editShapeRectangle()
Edit an existing shape (make it a rectangle)