20 declare(strict_types=1);
36 $this->tile_server =
"";
37 $this->geolocation_server =
"";
47 $this->tile_server = $tile;
58 $this->geolocation_server = $geolocation;
65 "tpl.openlayers_map.html",
68 "components/ILIAS/Maps" 72 "tpl.openlayers_map.js",
75 "components/ILIAS/Maps" 78 $this->
lng->loadLanguageModule(
"maps");
79 $this->tpl->addCss(
"components/ILIAS/Maps/css/service_openlayers.css");
80 $this->tpl->addJavaScript(
"assets/js/ServiceOpenLayers.js");
84 foreach ($this->user_marker as
$user_id) {
87 if ($user->getLatitude() != 0 && $user->getLongitude() != 0 &&
88 $user->getPref(
"public_location") ==
"y") {
89 $js_tpl->setCurrentBlock(
"user_marker");
94 $js_tpl->setVariable(
"CNT", $cnt);
96 $js_tpl->setVariable(
"ULAT", htmlspecialchars($user->getLatitude()));
97 $js_tpl->setVariable(
"ULONG", htmlspecialchars($user->getLongitude()));
98 $info = htmlspecialchars($user->getFirstName() .
" " . $user->getLastName());
100 if ($user->getPref(
"public_institution") ==
"y") {
101 $info .= $delim . htmlspecialchars($user->getInstitution());
104 if ($user->getPref(
"public_department") ==
"y") {
105 $info .= $delim . htmlspecialchars($user->getDepartment());
108 if ($user->getPref(
"public_street") ==
"y") {
109 $info .= $delim . htmlspecialchars($user->getStreet());
111 if ($user->getPref(
"public_zip") ==
"y") {
112 $info .= $delim . htmlspecialchars($user->getZipcode());
115 if ($user->getPref(
"public_city") ==
"y") {
116 $info .= $delim . htmlspecialchars($user->getCity());
119 if ($user->getPref(
"public_country") ==
"y") {
120 $info .= $delim . htmlspecialchars($user->getCountry());
122 $js_tpl->setVariable(
126 $js_tpl->setVariable(
128 $user->getPersonalPicturePath(
"xsmall")
130 $js_tpl->parseCurrentBlock();
136 $html_tpl->setVariable(
"MAP_ID", $this->
getMapId());
137 $html_tpl->setVariable(
"WIDTH", $this->
getWidth());
138 $html_tpl->setVariable(
"HEIGHT", $this->
getHeight());
140 $js_tpl->setVariable(
"MAP_ID", $this->
getMapId());
143 $js_tpl->setVariable(
"ZOOM", (
int) $this->
getZoom());
148 $js_tpl->setVariable(
"NAV_CONTROL", $nav_control);
156 $js_tpl->setVariable(
"REPLACE_MARKER", $replace_marker);
159 $tile_servers = explode(
" ", $tile_servers);
160 array_walk($tile_servers,
function (&$string) {
161 $string =
'"' . $string .
'"';
163 $tile_servers =
'[' . implode(
', ', $tile_servers) .
']';
165 $js_tpl->setVariable(
"TILES", $tile_servers);
167 $js_tpl->setVariable(
"INVALID_ADDRESS_STRING", $this->
lng->txt(
"invalid_address"));
169 $this->tpl->addOnLoadCode($js_tpl->get());
171 return $html_tpl->get();
180 "tpl.openlayers_map_user_list.html",
183 "components/ILIAS/Maps" 187 foreach ($this->user_marker as
$user_id) {
190 $this->css_row = ($this->css_row !=
"tblrow1_mo")
193 if ($user->getLatitude() != 0 && $user->getLongitude() != 0
194 && $user->getPref(
"public_location") ==
"y") {
195 $list_tpl->setCurrentBlock(
"item");
196 $list_tpl->setVariable(
"MARKER_CNT", $cnt);
197 $list_tpl->setVariable(
"MAP_ID", $this->
getMapId());
200 $list_tpl->setCurrentBlock(
"item_no_link");
202 $list_tpl->setVariable(
"CSS_ROW", $this->css_row);
203 $list_tpl->setVariable(
"TXT_USER", $user->getLogin());
204 $list_tpl->setVariable(
206 $user->getPersonalPicturePath(
"xxsmall")
208 $list_tpl->parseCurrentBlock();
209 $list_tpl->touchBlock(
"row");
213 return $list_tpl->get();
getUserListHtml()
Get User List HTML (to be displayed besides the map)
getEnableUpdateListener()
getEnableNavigationControl()
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
string $geolocation_server
setTileServers(string $tile)
__construct(Container $dic, ilPlugin $plugin)
User interface class for maps.
User interface class for OpenLayers maps.
setGeolocationServer(?string $geolocation)