ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilOpenLayersMapGUI Class Reference

User interface class for OpenLayers maps. More...

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

Public Member Functions

 __construct ()
 
 getTileServers ()
 
 setTileServers (string $tile)
 
 getGeolocationServer ()
 
 setGeolocationServer (?string $geolocation)
 
 getHtml ()
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 
- Public Member Functions inherited from ilMapGUI
 __construct ()
 
 setMapId (string $map_id)
 
 getMapId ()
 
 setWidth (string $width)
 
 getWidth ()
 
 setHeight (string $height)
 
 getHeight ()
 
 setLatitude (string $latitude)
 
 getLatitude ()
 
 setLongitude (string $longitude)
 
 getLongitude ()
 
 setZoom (?int $zoom)
 
 getZoom ()
 
 setEnableTypeControl (bool $enable_type_control)
 
 getEnableTypeControl ()
 
 setEnableNavigationControl (bool $enable_navigation_control)
 
 getEnableNavigationControl ()
 
 setEnableUpdateListener (bool $enable_update_listener)
 
 getEnableUpdateListener ()
 
 setEnableLargeMapControl (bool $large_map_control)
 
 getEnableLargeMapControl ()
 
 setEnableCentralMarker (bool $central_marker)
 
 getEnableCentralMarker ()
 
 addUserMarker (int $user_id)
 
 getHtml ()
 
 getUserListHtml ()
 Get User List HTML (to be displayed besides the map) More...
 

Protected Attributes

string $css_row
 
string $tile_server
 
string $geolocation_server
 
- Protected Attributes inherited from ilMapGUI
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
string $map_id
 
string $width
 
string $height
 
string $latitude
 
string $longitude
 
int $zoom
 
bool $enable_type_control
 
bool $enable_update_listener
 
bool $enable_navigation_control
 
array $user_marker
 
bool $large_map_control
 
bool $central_marker
 

Detailed Description

User interface class for OpenLayers maps.

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

Constructor & Destructor Documentation

◆ __construct()

ilOpenLayersMapGUI::__construct ( )

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

References ILIAS\GlobalScreen\Provider\__construct().

31  {
33 
34  $this->css_row = "";
35  $this->tile_server = "";
36  $this->geolocation_server = "";
37  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getGeolocationServer()

ilOpenLayersMapGUI::getGeolocationServer ( )

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

References $geolocation_server.

Referenced by getHtml().

50  : ?string
51  {
53  }
+ Here is the caller graph for this function:

◆ getHtml()

ilOpenLayersMapGUI::getHtml ( )

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

References ilMapGUI\$central_marker, $user_id, ilObject\_exists(), ilMapGUI\getEnableCentralMarker(), ilMapGUI\getEnableNavigationControl(), ilMapGUI\getEnableUpdateListener(), getGeolocationServer(), ilMapGUI\getHeight(), ilMapGUI\getLatitude(), ilMapGUI\getLongitude(), ilMapGUI\getMapId(), getTileServers(), ilMapGUI\getWidth(), ilMapGUI\getZoom(), and ILIAS\Repository\lng().

61  : string
62  {
63  $html_tpl = new ilTemplate(
64  "tpl.openlayers_map.html",
65  true,
66  true,
67  "components/ILIAS/Maps"
68  );
69 
70  $js_tpl = new ilTemplate(
71  "tpl.openlayers_map.js",
72  true,
73  true,
74  "components/ILIAS/Maps"
75  );
76 
77  $this->lng->loadLanguageModule("maps");
78  $this->tpl->addCss("components/ILIAS/Maps/css/service_openlayers.css");
79  $this->tpl->addJavaScript("assets/js/ServiceOpenLayers.js");
80 
81  // add user markers
82  $cnt = 0;
83  foreach ($this->user_marker as $user_id) {
84  if (ilObject::_exists($user_id)) {
85  $user = new ilObjUser($user_id);
86  if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
87  $user->getPref("public_location") == "y") {
88  $js_tpl->setCurrentBlock("user_marker");
89  $js_tpl->setVariable(
90  "UMAP_ID",
91  $this->getMapId()
92  );
93  $js_tpl->setVariable("CNT", $cnt);
94 
95  $js_tpl->setVariable("ULAT", htmlspecialchars($user->getLatitude()));
96  $js_tpl->setVariable("ULONG", htmlspecialchars($user->getLongitude()));
97  $info = htmlspecialchars($user->getFirstName() . " " . $user->getLastName());
98  $delim = "<br />";
99  if ($user->getPref("public_institution") == "y") {
100  $info .= $delim . htmlspecialchars($user->getInstitution());
101  $delim = ", ";
102  }
103  if ($user->getPref("public_department") == "y") {
104  $info .= $delim . htmlspecialchars($user->getDepartment());
105  }
106  $delim = "<br />";
107  if ($user->getPref("public_street") == "y") {
108  $info .= $delim . htmlspecialchars($user->getStreet());
109  }
110  if ($user->getPref("public_zip") == "y") {
111  $info .= $delim . htmlspecialchars($user->getZipcode());
112  $delim = " ";
113  }
114  if ($user->getPref("public_city") == "y") {
115  $info .= $delim . htmlspecialchars($user->getCity());
116  }
117  $delim = "<br />";
118  if ($user->getPref("public_country") == "y") {
119  $info .= $delim . htmlspecialchars($user->getCountry());
120  }
121  $js_tpl->setVariable(
122  "USER_INFO",
123  $info
124  );
125  $js_tpl->setVariable(
126  "IMG_USER",
127  $user->getPersonalPicturePath("xsmall")
128  );
129  $js_tpl->parseCurrentBlock();
130  $cnt++;
131  }
132  }
133  }
134 
135  $html_tpl->setVariable("MAP_ID", $this->getMapId());
136  $html_tpl->setVariable("WIDTH", $this->getWidth());
137  $html_tpl->setVariable("HEIGHT", $this->getHeight());
138 
139  $js_tpl->setVariable("MAP_ID", $this->getMapId());
140  $js_tpl->setVariable("LAT", $this->getLatitude());
141  $js_tpl->setVariable("LONG", $this->getLongitude());
142  $js_tpl->setVariable("ZOOM", (int) $this->getZoom());
143 
144  $nav_control = $this->getEnableNavigationControl()
145  ? "true"
146  : "false";
147  $js_tpl->setVariable("NAV_CONTROL", $nav_control);
149  ? "true"
150  : "false";
151  $js_tpl->setVariable("CENTRAL_MARKER", $central_marker);
152  $replace_marker = $this->getEnableUpdateListener()
153  ? "true"
154  : "false";
155  $js_tpl->setVariable("REPLACE_MARKER", $replace_marker);
156 
157  $tile_servers = $this->getTileServers();
158  $tile_servers = explode(" ", $tile_servers);
159  array_walk($tile_servers, function (&$string) {
160  $string = '"' . $string . '"';
161  });
162  $tile_servers = '[' . implode(', ', $tile_servers) . ']';
163 
164  $js_tpl->setVariable("TILES", $tile_servers);
165  $js_tpl->setVariable("GEOLOCATION", $this->getGeolocationServer());
166  $js_tpl->setVariable("INVALID_ADDRESS_STRING", $this->lng->txt("invalid_address"));
167 
168  $this->tpl->addOnLoadCode($js_tpl->get());
169 
170  return $html_tpl->get();
171  }
bool $central_marker
getEnableCentralMarker()
getEnableUpdateListener()
getEnableNavigationControl()
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
+ Here is the call graph for this function:

◆ getTileServers()

ilOpenLayersMapGUI::getTileServers ( )

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

References $tile_server.

Referenced by getHtml().

39  : string
40  {
41  return $this->tile_server;
42  }
+ Here is the caller graph for this function:

◆ getUserListHtml()

ilOpenLayersMapGUI::getUserListHtml ( )

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

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

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

176  : string
177  {
178  $list_tpl = new ilTemplate(
179  "tpl.openlayers_map_user_list.html",
180  true,
181  true,
182  "components/ILIAS/Maps"
183  );
184 
185  $cnt = 0;
186  foreach ($this->user_marker as $user_id) {
187  if (ilObject::_exists($user_id)) {
188  $user = new ilObjUser($user_id);
189  $this->css_row = ($this->css_row != "tblrow1_mo")
190  ? "tblrow1_mo"
191  : "tblrow2_mo";
192  if ($user->getLatitude() != 0 && $user->getLongitude() != 0
193  && $user->getPref("public_location") == "y") {
194  $list_tpl->setCurrentBlock("item");
195  $list_tpl->setVariable("MARKER_CNT", $cnt);
196  $list_tpl->setVariable("MAP_ID", $this->getMapId());
197  $cnt++;
198  } else {
199  $list_tpl->setCurrentBlock("item_no_link");
200  }
201  $list_tpl->setVariable("CSS_ROW", $this->css_row);
202  $list_tpl->setVariable("TXT_USER", $user->getLogin());
203  $list_tpl->setVariable(
204  "IMG_USER",
205  $user->getPersonalPicturePath("xxsmall")
206  );
207  $list_tpl->parseCurrentBlock();
208  $list_tpl->touchBlock("row");
209  }
210  }
211 
212  return $list_tpl->get();
213  }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
+ Here is the call graph for this function:

◆ setGeolocationServer()

ilOpenLayersMapGUI::setGeolocationServer ( ?string  $geolocation)

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

56  {
57  $this->geolocation_server = $geolocation;
58  return $this;
59  }
User interface class for OpenLayers maps.

◆ setTileServers()

ilOpenLayersMapGUI::setTileServers ( string  $tile)

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

45  {
46  $this->tile_server = $tile;
47  return $this;
48  }
User interface class for OpenLayers maps.

Field Documentation

◆ $css_row

string ilOpenLayersMapGUI::$css_row
protected

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

◆ $geolocation_server

string ilOpenLayersMapGUI::$geolocation_server
protected

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

Referenced by getGeolocationServer().

◆ $tile_server

string ilOpenLayersMapGUI::$tile_server
protected

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

Referenced by getTileServers().


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