ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 Get HTML. More...
 
 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 ( )

Reimplemented from ilMapGUI.

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

41 {
43 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

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

Get HTML.

Reimplemented from ilMapGUI.

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

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

References $DIC, $https, $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().

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

Reimplemented from ilMapGUI.

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

185 {
186 $list_tpl = new ilTemplate(
187 "tpl.openlayers_map_user_list.html",
188 true,
189 true,
190 "Services/Maps"
191 );
192
193 $cnt = 0;
194 foreach ($this->user_marker as $user_id) {
195 if (ilObject::_exists($user_id)) {
196 $user = new ilObjUser($user_id);
197 $this->css_row = ($this->css_row != "tblrow1_mo")
198 ? "tblrow1_mo"
199 : "tblrow2_mo";
200 if ($user->getLatitude() != 0 && $user->getLongitude() != 0
201 && $user->getPref("public_location") == "y") {
202 $list_tpl->setCurrentBlock("item");
203 $list_tpl->setVariable("MARKER_CNT", $cnt);
204 $list_tpl->setVariable("MAP_ID", $this->getMapId());
205 $cnt++;
206 } else {
207 $list_tpl->setCurrentBlock("item_no_link");
208 }
209 $list_tpl->setVariable("CSS_ROW", $this->css_row);
210 $list_tpl->setVariable("TXT_USER", $user->getLogin());
211 $list_tpl->setVariable(
212 "IMG_USER",
213 $user->getPersonalPicturePath("xxsmall")
214 );
215 $list_tpl->parseCurrentBlock();
216 $list_tpl->touchBlock("row");
217 }
218 }
219
220 return $list_tpl->get();
221 }

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

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