remotes/angel/1.11.x
parent
c5986d080e
commit
b662ece7f8
@ -1,4 +1,5 @@ |
||||
<?php |
||||
|
||||
$strings['plugin_title'] = "Google Maps"; |
||||
$strings['plugin_comment'] = "Active la fonctionnalité pour afficher Google Maps"; |
||||
$strings['plugin_comment'] = "Enable the functionality to show google maps"; |
||||
$strings['extra_field_name_help'] = "Ingrese aquí el nombre del campo extra de usuario del cual quiere obtener las localizaciones"; |
@ -1,4 +1,5 @@ |
||||
<?php |
||||
|
||||
$strings['plugin_title'] = "Google Maps"; |
||||
$strings['plugin_comment'] = "Active la fonctionnalité pour afficher Google Maps"; |
||||
$strings['plugin_comment'] = "Active la fonctionnalité pour afficher Google Maps"; |
||||
$strings['extra_field_name_help'] = "Ingrese aquí el nombre del campo extra de usuario del cual quiere obtener las localizaciones"; |
@ -0,0 +1,46 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* Show the map coordinates of all users geo extra field |
||||
* @author José Loguercio Silva <jose.loguercio@beeznest.com> |
||||
* @package chamilo.plugin.google_maps |
||||
*/ |
||||
|
||||
|
||||
$cidReset = true; |
||||
|
||||
require_once __DIR__.'/../../../main/inc/global.inc.php'; |
||||
|
||||
api_protect_admin_script(); |
||||
|
||||
$plugin = GoogleMapsPlugin::create(); |
||||
|
||||
$apiIsEnable = $plugin->get('enable_api') === 'true'; |
||||
$extraFieldName = $plugin->get('extra_field_name'); |
||||
|
||||
if ($apiIsEnable) { |
||||
$gmapsApiKey = $plugin->get('api_key'); |
||||
$htmlHeadXtra[] = '<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key='. $gmapsApiKey . '" ></script>'; |
||||
} |
||||
|
||||
$em = Database::getManager(); |
||||
|
||||
$extraField = $em->getRepository('ChamiloCoreBundle:ExtraField'); |
||||
$extraField = $extraField->findOneBy(['variable' => $extraFieldName]); |
||||
|
||||
$extraFieldValues = $em->getRepository('ChamiloCoreBundle:ExtraFieldValues'); |
||||
$extraFieldValues = $extraFieldValues->findBy(['field' => $extraField->getId()]); |
||||
|
||||
$templateName = get_lang('UsersCoordinatesMap'); |
||||
|
||||
$tpl = new Template($templateName); |
||||
|
||||
$tpl->assign('extra_field_values', $extraFieldValues); |
||||
|
||||
$content = $tpl->fetch('google_maps/view/map_coordinates.tpl'); |
||||
|
||||
$tpl->assign('header', $templateName); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
||||
|
@ -0,0 +1,50 @@ |
||||
<div id="map" style="width:100%; height:400px;"> |
||||
|
||||
</div> |
||||
<script> |
||||
$(document).ready(function() { |
||||
initMap(); |
||||
}); |
||||
|
||||
function initMap() { |
||||
var center = new google.maps.LatLng(-3.480523, 7.866211); |
||||
|
||||
var bounds = new google.maps.LatLngBounds(); |
||||
var infoWindow = new google.maps.InfoWindow(); |
||||
|
||||
var map = new google.maps.Map(document.getElementById("map"), { |
||||
zoom: 2, |
||||
center: center, |
||||
mapTypeControl: true, |
||||
mapTypeControlOptions: { |
||||
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU |
||||
}, |
||||
navigationControl: true, |
||||
mapTypeId: google.maps.MapTypeId.ROADMAP |
||||
}); |
||||
|
||||
{% for field in extra_field_values %} |
||||
|
||||
var latLng = '{{ field.value }}'; |
||||
latLng = latLng.split(','); |
||||
|
||||
var lat = latLng[0]; |
||||
var lng = latLng[1]; |
||||
|
||||
var location = new google.maps.LatLng(lat, lng); |
||||
|
||||
{% set userInfo = field.itemId | user_info %} |
||||
|
||||
var marker = new google.maps.Marker({ |
||||
map: map, |
||||
position: location, |
||||
label: "{{ userInfo.complete_name }}" |
||||
}); |
||||
|
||||
bounds.extend(marker.position); |
||||
map.fitBounds(bounds); |
||||
|
||||
{% endfor %} |
||||
|
||||
} |
||||
</script> |
Loading…
Reference in new issue