summaryrefslogtreecommitdiff
path: root/views/mods/mod_statistics/customermap/all.phtml
blob: fc58cb407656c69a550b5a9b9c7c8f524ea98cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php

	/**
	 * Template f�r die Anzeige der Kundenkarte innerhalb des Statistikmoduls
	 * @version 4.6.1
	 */
 
?> 
<script type="text/javascript">/* <![CDATA[ */
	
	function wpsg_mod_statistics_initialize() 
	{
		
    	var mapOptions = {
      		center: new google.maps.LatLng(-34.397, 150.644),
      		zoom: 5,
      		mapTypeId: google.maps.MapTypeId.ROADMAP
    	};

    	var map = new google.maps.Map(document.getElementById("wpsg_mod_statistics_map"), mapOptions);
    	var bounds = new google.maps.LatLngBounds();
    	var markers = [];
    	
    	<?php $i = 1; foreach ($this->view['wpsg_mod_statistics']['marker'] as $m) { 
            
            if (floatval($m['lat']) === 0.0 || floatval($m['long']) === 0.0) continue;
            
            ?>
    	var marker<?php echo $i; ?> = new google.maps.Marker({
			position: new google.maps.LatLng(<?php echo $m['lat']; ?>, <?php echo $m['long']; ?>),
			map: map
    	} );    	
    	markers.push(marker<?php echo $i; ?>);

    	google.maps.event.addListener(marker<?php echo $i; ?>, 'click', function() {
			location.href = '<?php
			
				echo wpsg_admin_url('Customer', 'edit', ['edit_id' => $m['customer']['id']], [], true);
				
			?>';
    	} );    	  
    	bounds.extend(marker<?php echo $i; ?>.getPosition());  	
    	<?php $i ++; } ?>

    	map.fitBounds(bounds);
    	map.setZoom(15);

        var markerCluster = new MarkerClusterer(map, markers,
                {imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
        	
    	
  	} // function wpsg_mod_statistics_initialize() 

	google.maps.event.addDomListener(window, 'load', wpsg_mod_statistics_initialize);
 
/* ]]> */</script>

<div style="" id="wpsg_mod_customermap_layer">
	<div class="postbox" id="wpsg_modcustomermap">
		<div style="height:500px; width:500px;">
			<div style="width:100%; height:100%" id="wpsg_mod_statistics_map"></div>	
		</div>
	</div>
</div>