forked from oliviermichaud1/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
geo_displaymap_suppliers.php
executable file
·93 lines (79 loc) · 3.3 KB
/
geo_displaymap_suppliers.php
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/* $Id: geo_displaymap_suppliers.php 5784 2012-12-29 04:00:43Z daintree $*/
$Title = _('Geocoded Supplier Report');
include ('includes/session.inc');
include ('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
$sql="SELECT * FROM geocode_param WHERE 1";
$ErrMsg = _('An error occurred in retrieving the currency information');;
$result = DB_query($sql, $db, $ErrMsg);
$myrow = DB_fetch_array($result);
$Api_Key = $myrow['geocode_key'];
$Center_Long = $myrow['center_long'];
$Center_Lat = $myrow['center_lat'];
$Map_Height = $myrow['map_height'];
$Map_Width = $myrow['map_width'];
$Map_Host = $myrow['map_host'];
echo '<script src="http://' . $Map_Host . '/maps?file=api&v=2&key=' . $Api_Key . '"';
echo ' type="text/javascript"></script>';
echo ' <script type="text/javascript">';
echo " //<![CDATA[ "; ?>
var iconBlue = new GIcon();
iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconBlue.iconSize = new GSize(12, 20);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);
var iconRed = new GIcon();
iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);
var customIcons = [];
customIcons["commercial"] = iconBlue;
customIcons["domestic"] = iconRed;
function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
<? echo 'map.setCenter(new GLatLng(' . $Center_Lat . ', ' . $Center_Long . '), 10);'; ?>
GDownloadUrl("geocode_genxml_suppliers.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, name, address, type);
map.addOverlay(marker);
}
});
}
}
function createMarker(point, name, address, type) {
var marker = new GMarker(point, customIcons[type]);
var html = "<b>" + name + "</b> <br/>" + address;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<p>
<? echo '<div class="centre" id="map" style="width: ' . $Map_Width . 'px; height: ' . $Map_Height . 'px"></div>'; ?>
</p>
</body>
<?
echo '<div class="centre"><a href="' . $RootPath . '/GeocodeSetup.php">' . _('Go to Geocode Setup') . '</a></div></p>';
include ('includes/footer.inc');
?>
</html>