ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilOpenLayersMapGUI Class Reference

User interface class for OpenLayers maps. More...

+ Inheritance diagram for ilOpenLayersMapGUI:
+ Collaboration diagram for ilOpenLayersMapGUI:

Public Member Functions

 __construct ()
 
 getTileServers ()
 Get HTML. More...
 
 setTileServers ($a_tile)
 
 getGeolocationServer ()
 
 setGeolocationServer ($a_geolocation)
 
 getHtml ()
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 
- Public Member Functions inherited from ilMapGUI
 __construct ()
 
 setMapId ($a_mapid)
 Set Map ID. More...
 
 getMapId ()
 Get Map ID. More...
 
 setWidth ($a_width)
 Set Width. More...
 
 getWidth ()
 Get Width. More...
 
 setHeight ($a_height)
 Set Height. More...
 
 getHeight ()
 Get Height. More...
 
 setLatitude ($a_latitude)
 Set Latitude. More...
 
 getLatitude ()
 Get Latitude. More...
 
 setLongitude ($a_longitude)
 Set Longitude. More...
 
 getLongitude ()
 Get Longitude. More...
 
 setZoom ($a_zoom)
 Set Zoom. More...
 
 getZoom ()
 Get Zoom. More...
 
 setEnableTypeControl ($a_enabletypecontrol)
 Set Use Map Type Control. More...
 
 getEnableTypeControl ()
 Get Use Map Type Control. More...
 
 setEnableNavigationControl ($a_enablenavigationcontrol)
 Set Use Navigation Control. More...
 
 getEnableNavigationControl ()
 Get Use Navigation Control. More...
 
 setEnableUpdateListener ($a_enableupdatelistener)
 Set Activate Update Listener. More...
 
 getEnableUpdateListener ()
 Get Activate Update Listener. More...
 
 setEnableLargeMapControl ($a_largemapcontrol)
 Set Large Map Control. More...
 
 getEnableLargeMapControl ()
 Get Large Map Control. More...
 
 setEnableCentralMarker ($a_centralmarker)
 Enable Central Marker. More...
 
 getEnableCentralMarker ()
 Get Enable Central Marker. More...
 
 addUserMarker ($a_user_id)
 Add user marker. More...
 
 getHtml ()
 Get HTML. More...
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 

Protected Attributes

 $tile_server
 
 $geolocation_server
 
- Protected Attributes inherited from ilMapGUI
 $mapid
 
 $width = "500px"
 
 $height = "300px"
 
 $latitude
 
 $longitude
 
 $zoom
 
 $enabletypecontrol = false
 
 $enableupdatelistener = false
 
 $enablenavigationcontrol = false
 
 $enablelargemapcontrol = false
 
 $user_marker = array()
 

Detailed Description

User interface class for OpenLayers maps.

Author
Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilOpenLayersMapGUI::__construct ( )

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

41  {
42  parent::__construct();
43  }

Member Function Documentation

◆ getGeolocationServer()

ilOpenLayersMapGUI::getGeolocationServer ( )

Definition at line 59 of file class.ilOpenLayersMapGUI.php.

References $geolocation_server.

Referenced by getHtml().

+ Here is the caller graph for this function:

◆ getHtml()

ilOpenLayersMapGUI::getHtml ( )

Definition at line 72 of file class.ilOpenLayersMapGUI.php.

References $DIC, $https, $info, $lng, $tpl, ilObject\_exists(), ilMapGUI\getEnableCentralMarker(), ilMapGUI\getEnableNavigationControl(), ilMapGUI\getEnableUpdateListener(), getGeolocationServer(), ilMapGUI\getHeight(), ilMapGUI\getLatitude(), ilMapGUI\getLongitude(), ilMapGUI\getMapId(), getTileServers(), ilMapGUI\getWidth(), and ilMapGUI\getZoom().

73  {
74  global $DIC;
75  $tpl = $DIC['tpl'];
76  $lng = $DIC['lng'];
77  $https = $DIC['https'];
78 
79  $this->tpl = new ilTemplate(
80  "tpl.openlayers_map.html",
81  true,
82  true,
83  "Services/Maps"
84  );
85 
86 
87  $lng->loadLanguageModule("maps");
88  $tpl->addCss("libs/bower/bower_components/OpenLayers/ol.css");
89  $tpl->addJavaScript("libs/bower/bower_components/OpenLayers/ol.js");
90  $tpl->addCss("Services/Maps/css/service_openlayers.css");
91  $tpl->addJavaScript("Services/Maps/js/ServiceOpenLayers.js");
92 
93  // add user markers
94  $cnt = 0;
95  foreach ($this->user_marker as $user_id) {
96  if (ilObject::_exists($user_id)) {
97  $user = new ilObjUser($user_id);
98  if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
99  $user->getPref("public_location") == "y") {
100  $this->tpl->setCurrentBlock("user_marker");
101  $this->tpl->setVariable(
102  "UMAP_ID",
103  $this->getMapId()
104  );
105  $this->tpl->setVariable("CNT", $cnt);
106 
107  $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
108  $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
109  $info = htmlspecialchars($user->getFirstName() . " " . $user->getLastName());
110  $delim = "<br \/>";
111  if ($user->getPref("public_institution") == "y") {
112  $info.= $delim . htmlspecialchars($user->getInstitution());
113  $delim = ", ";
114  }
115  if ($user->getPref("public_department") == "y") {
116  $info.= $delim . htmlspecialchars($user->getDepartment());
117  }
118  $delim = "<br \/>";
119  if ($user->getPref("public_street") == "y") {
120  $info.= $delim . htmlspecialchars($user->getStreet());
121  }
122  if ($user->getPref("public_zip") == "y") {
123  $info.= $delim . htmlspecialchars($user->getZipcode());
124  $delim = " ";
125  }
126  if ($user->getPref("public_city") == "y") {
127  $info.= $delim . htmlspecialchars($user->getCity());
128  }
129  $delim = "<br \/>";
130  if ($user->getPref("public_country") == "y") {
131  $info.= $delim . htmlspecialchars($user->getCountry());
132  }
133  $this->tpl->setVariable(
134  "USER_INFO",
135  $info
136  );
137  $this->tpl->setVariable(
138  "IMG_USER",
139  $user->getPersonalPicturePath("xsmall")
140  );
141  $this->tpl->parseCurrentBlock();
142  $cnt++;
143  }
144  }
145  }
146 
147  $this->tpl->setVariable("MAP_ID", $this->getMapId());
148  $this->tpl->setVariable("WIDTH", $this->getWidth());
149  $this->tpl->setVariable("HEIGHT", $this->getHeight());
150  $this->tpl->setVariable("LAT", $this->getLatitude());
151  $this->tpl->setVariable("LONG", $this->getLongitude());
152  $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
153 
154 
155  $nav_control = $this->getEnableNavigationControl()
156  ? "true"
157  : "false";
158  $this->tpl->setVariable("NAV_CONTROL", $nav_control);
159  $central_marker = $this->getEnableCentralMarker()
160  ? "true"
161  : "false";
162  $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
163  $replace_marker = $this->getEnableUpdateListener()
164  ? "true"
165  : "false";
166  $this->tpl->setVariable("REPLACE_MARKER", $replace_marker);
167 
168  $tile_servers = $this->getTileServers();
169  $tile_servers = explode(" ", $tile_servers);
170  array_walk($tile_servers, function (&$string) {
171  $string = '"' . $string . '"';
172  });
173  $tile_servers = '[' . implode(', ', $tile_servers) . ']';
174 
175  $this->tpl->setVariable("TILES", $tile_servers);
176  $this->tpl->setVariable("GEOLOCATION", $this->getGeolocationServer());
177  $this->tpl->setVariable("INVALID_ADDRESS_STRING", $lng->txt("invalid_address"));
178 
179  return $this->tpl->get();
180  }
getLatitude()
Get Latitude.
getZoom()
Get Zoom.
global $DIC
Definition: saml.php:7
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
$tpl
Definition: ilias.php:10
getMapId()
Get Map ID.
getEnableCentralMarker()
Get Enable Central Marker.
getEnableUpdateListener()
Get Activate Update Listener.
getWidth()
Get Width.
getEnableNavigationControl()
Get Use Navigation Control.
special template class to simplify handling of ITX/PEAR
$https
Definition: imgupload.php:19
getHeight()
Get Height.
getLongitude()
Get Longitude.
global $lng
Definition: privfeed.php:17
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ getTileServers()

ilOpenLayersMapGUI::getTileServers ( )

Get HTML.

Definition at line 48 of file class.ilOpenLayersMapGUI.php.

References $tile_server.

Referenced by getHtml().

+ Here is the caller graph for this function:

◆ getUserListHtml()

ilOpenLayersMapGUI::getUserListHtml ( )

Get User List HTML (to be displayed besides the map)

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

References ilObject\_exists(), and ilMapGUI\getMapId().

186  {
187  $list_tpl = new ilTemplate(
188  "tpl.openlayers_map_user_list.html",
189  true,
190  true,
191  "Services/Maps"
192  );
193 
194  $cnt = 0;
195  foreach ($this->user_marker as $user_id) {
196  if (ilObject::_exists($user_id)) {
197  $user = new ilObjUser($user_id);
198  $this->css_row = ($this->css_row != "tblrow1_mo")
199  ? "tblrow1_mo"
200  : "tblrow2_mo";
201  if ($user->getLatitude() != 0 && $user->getLongitude() != 0
202  && $user->getPref("public_location") == "y") {
203  $list_tpl->setCurrentBlock("item");
204  $list_tpl->setVariable("MARKER_CNT", $cnt);
205  $list_tpl->setVariable("MAP_ID", $this->getMapId());
206  $cnt++;
207  } else {
208  $list_tpl->setCurrentBlock("item_no_link");
209  }
210  $list_tpl->setVariable("CSS_ROW", $this->css_row);
211  $list_tpl->setVariable("TXT_USER", $user->getLogin());
212  $list_tpl->setVariable(
213  "IMG_USER",
214  $user->getPersonalPicturePath("xxsmall")
215  );
216  $list_tpl->parseCurrentBlock();
217  $list_tpl->touchBlock("row");
218  }
219  }
220 
221  return $list_tpl->get();
222  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getMapId()
Get Map ID.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:

◆ setGeolocationServer()

ilOpenLayersMapGUI::setGeolocationServer (   $a_geolocation)

Definition at line 64 of file class.ilOpenLayersMapGUI.php.

65  {
66  $this->geolocation_server = $a_geolocation;
67  return $this;
68  }

◆ setTileServers()

ilOpenLayersMapGUI::setTileServers (   $a_tile)

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

54  {
55  $this->tile_server = $a_tile;
56  return $this;
57  }

Field Documentation

◆ $geolocation_server

ilOpenLayersMapGUI::$geolocation_server
protected

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

Referenced by getGeolocationServer().

◆ $tile_server

ilOpenLayersMapGUI::$tile_server
protected

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

Referenced by getTileServers().


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