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

References $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 174 of file class.ilOpenLayersMapGUI.php.

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

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: