Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/ILIAS/Maps/classes/class.ilGoogleMapGUI.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

/**
* User interface class for Google Maps
*
Expand Down
36 changes: 22 additions & 14 deletions components/ILIAS/Maps/templates/default/tpl.google_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,35 @@
* https://github.com/ILIAS-eLearning
*/

ilMapData = Array();
ilMap = Array();
ilMapOptions = [];
ilCM = Array();
ilMapUserMarker = Array();
window.ilMapData = window.ilMapData || [];
window.ilMap = window.ilMap || [];
window.ilMapOptions = window.ilMapOptions || [];
window.ilCM = window.ilCM || [];
window.ilMapUserMarker = window.ilMapUserMarker || [];
ilMapData["{MAP_ID}"] = new Array({LAT},{LONG},{ZOOM},{TYPE_CONTROL},{NAV_CONTROL},{UPDATE_LISTENER},{LARGE_CONTROL},{CENTRAL_MARKER});
ilMapUserMarker["{MAP_ID}"] = Array();
<!-- BEGIN user_marker -->
ilMapUserMarker["{UMAP_ID}"][{CNT}] = new Array({ULAT},{ULONG}, "<div style='width:220px;'><img style='float:right; margin-right:10px;' className='ilUserXXSmall' src='{IMG_USER}'\/><span className='small'>{USER_INFO}<\/span><\/div>");
<!-- END user_marker -->

if (google.maps)
var ilMarkerImage = null;
if (typeof google !== "undefined" && google.maps)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

{
var ilMarkerImage = new google.maps.MarkerImage(
"./assets/images/standard/icon_mapm.svg",
new google.maps.Size(12, 20),
new google.maps.Point(0,0),
new google.maps.Point(6, 20));
// Google Maps still supports legacy `google.maps.Marker`, but `google.maps.MarkerImage`
// is an older wrapper API for marker icons. Using the icon as a plain object with
// `url`, `scaledSize`, `origin`, and `anchor` passes the same marker configuration in
// the format the current marker API expects. This keeps the existing legacy marker
// behavior and custom SVG icon, while avoiding the deprecated `MarkerImage` wrapper
// that no longer rendered reliably here.
ilMarkerImage = {
url: "./assets/images/standard/icon_mapm.svg",
scaledSize: new google.maps.Size(12, 20),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(6, 20)
};
}

if (google.maps)
if (typeof google !== "undefined" && google.maps)
{
ilInitMaps();
}
Expand All @@ -52,7 +60,7 @@ function ilInitMaps()
for (var i=0;i<obj.length;i++)
{
// if it has a class of helpLink
if(/ilGoogleMap/.test(obj[i].className))
if(/ilGoogleMap/.test(obj[i].className) && ilMapData[obj[i].id] && !ilMap[obj[i].id])
{
ilInitMap(obj[i].id, ilMapData[obj[i].id][0], ilMapData[obj[i].id][1],
ilMapData[obj[i].id][2], ilMapData[obj[i].id][3], ilMapData[obj[i].id][4],
Expand All @@ -76,7 +84,7 @@ function ilInitMap(id, latitude, longitude, zoom, type_control,
mapTypeControl: type_control,
scaleControl: true,
panControl: (nav_control || large_map_control)
}
};
var map = new google.maps.Map(document.getElementById(id), mapOptions);

ilGetUserMarkers(id, map);
Expand Down
Loading