ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
42 parent::__construct();
43
44 }

Member Function Documentation

◆ getGeolocationServer()

ilOpenLayersMapGUI::getGeolocationServer ( )

Definition at line 58 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 69 of file class.ilOpenLayersMapGUI.php.

70 {
71 global $DIC;
72 $tpl = $DIC['tpl'];
73 $lng = $DIC['lng'];
74 $https = $DIC['https'];
75
76 $this->tpl = new ilTemplate("tpl.openlayers_map.html",
77 true, true, "Services/Maps");
78
79
80 $lng->loadLanguageModule("maps");
81 $tpl->addJavaScript("Services/Maps/js/OpenLayers.js");
82 $tpl->addJavaScript("Services/Maps/js/ServiceOpenLayers.js");
83
84 // add user markers
85 $cnt = 0;
86 foreach($this->user_marker as $user_id)
87 {
88 if (ilObject::_exists($user_id))
89 {
90 $user = new ilObjUser($user_id);
91 if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
92 $user->getPref("public_location") == "y")
93 {
94 $this->tpl->setCurrentBlock("user_marker");
95 $this->tpl->setVariable("UMAP_ID",
96 $this->getMapId());
97 $this->tpl->setVariable("CNT", $cnt);
98
99 $this->tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
100 $this->tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
101 $info = htmlspecialchars($user->getFirstName()." ".$user->getLastName());
102 $delim = "<br \/>";
103 if ($user->getPref("public_institution") == "y")
104 {
105 $info.= $delim.htmlspecialchars($user->getInstitution());
106 $delim = ", ";
107 }
108 if ($user->getPref("public_department") == "y")
109 {
110 $info.= $delim.htmlspecialchars($user->getDepartment());
111 }
112 $delim = "<br \/>";
113 if ($user->getPref("public_street") == "y")
114 {
115 $info.= $delim.htmlspecialchars($user->getStreet());
116 }
117 if ($user->getPref("public_zip") == "y")
118 {
119 $info.= $delim.htmlspecialchars($user->getZipcode());
120 $delim = " ";
121 }
122 if ($user->getPref("public_city") == "y")
123 {
124 $info.= $delim.htmlspecialchars($user->getCity());
125 }
126 $delim = "<br \/>";
127 if ($user->getPref("public_country") == "y")
128 {
129 $info.= $delim.htmlspecialchars($user->getCountry());
130 }
131 $this->tpl->setVariable("USER_INFO",
132 $info);
133 $this->tpl->setVariable("IMG_USER",
134 $user->getPersonalPicturePath("xsmall"));
135 $this->tpl->parseCurrentBlock();
136 $cnt++;
137 }
138 }
139 }
140
141 $this->tpl->setVariable("MAP_ID", $this->getMapId());
142 $this->tpl->setVariable("WIDTH", $this->getWidth());
143 $this->tpl->setVariable("HEIGHT", $this->getHeight());
144 $this->tpl->setVariable("LAT", $this->getLatitude());
145 $this->tpl->setVariable("LONG", $this->getLongitude());
146 $this->tpl->setVariable("ZOOM", (int) $this->getZoom());
147
148
149 $nav_control = $this->getEnableNavigationControl()
150 ? "true"
151 : "false";
152 $this->tpl->setVariable("NAV_CONTROL", $nav_control);
153 $central_marker = $this->getEnableCentralMarker()
154 ? "true"
155 : "false";
156 $this->tpl->setVariable("CENTRAL_MARKER", $central_marker);
157 $replace_marker = $this->getEnableUpdateListener()
158 ? "true"
159 : "false";
160 $this->tpl->setVariable("REPLACE_MARKER", $replace_marker);
161
162 $tile_servers = $this->getTileServers();
163 $tile_servers = explode(" ", $tile_servers);
164 array_walk($tile_servers, function(&$string) { $string = '"'.$string.'"';});
165 $tile_servers = '['.implode(', ', $tile_servers).']';
166
167 $this->tpl->setVariable("TILES", $tile_servers);
168 $this->tpl->setVariable("GEOLOCATION", $this->getGeolocationServer());
169 $this->tpl->setVariable("INVALID_ADDRESS_STRING", $lng->txt("invalid_address"));
170
171 return $this->tpl->get();
172 }
global $tpl
Definition: ilias.php:8
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
$info
Definition: example_052.php:80
global $lng
Definition: privfeed.php:17
global $DIC
$https
Definition: imgupload.php:19

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

+ Here is the call graph for this function:

◆ getTileServers()

ilOpenLayersMapGUI::getTileServers ( )

Get HTML.

Definition at line 49 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 177 of file class.ilOpenLayersMapGUI.php.

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

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

+ Here is the call graph for this function:

◆ setGeolocationServer()

ilOpenLayersMapGUI::setGeolocationServer (   $a_geolocation)

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

62 {
63 $this->geolocation_server = $a_geolocation;
64 return $this;
65 }

◆ setTileServers()

ilOpenLayersMapGUI::setTileServers (   $a_tile)

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

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

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: