Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

remotes/angel/1.11.x
jmontoyaa 8 years ago
commit bfce9ec4ce
  1. 43
      plugin/google_maps/view/map_coordinates.tpl

@ -6,11 +6,41 @@
initMap(); initMap();
}); });
function addMaker(lat, lng, map, bounds, userInfo) {
var location = new google.maps.LatLng(lat, lng);
var infoWindow = new google.maps.InfoWindow();
var geocoder = geocoder = new google.maps.Geocoder();
var marker = new google.maps.Marker({
map: map,
position: location,
label: userInfo.complete_name
});
var address = "";
geocoder.geocode({ 'latLng': location }, function (results) {
address = results[1].formatted_address;
var infoWinContent = "<b>" + userInfo.complete_name + "</b> - " + address;
marker.addListener('click', function() {
infoWindow.setContent(infoWinContent);
infoWindow.open(map, marker);
});
});
bounds.extend(marker.position);
map.fitBounds(bounds);
}
function initMap() { function initMap() {
var center = new google.maps.LatLng(-3.480523, 7.866211); var center = new google.maps.LatLng(-3.480523, 7.866211);
var bounds = new google.maps.LatLngBounds(); var bounds = new google.maps.LatLngBounds();
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("map"), { var map = new google.maps.Map(document.getElementById("map"), {
zoom: 2, zoom: 2,
@ -31,18 +61,9 @@
var lat = latLng[0]; var lat = latLng[0];
var lng = latLng[1]; var lng = latLng[1];
var location = new google.maps.LatLng(lat, lng);
{% set userInfo = field.itemId | user_info %} {% set userInfo = field.itemId | user_info %}
var marker = new google.maps.Marker({ addMaker(lat, lng, map, bounds, {{ userInfo|json_encode }});
map: map,
position: location,
label: "{{ userInfo.complete_name }}"
});
bounds.extend(marker.position);
map.fitBounds(bounds);
{% endfor %} {% endfor %}

Loading…
Cancel
Save