-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.php
80 lines (68 loc) · 2.17 KB
/
js.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
<?php
/**
* @subpackage : Wordpress
* @author : Jonathon Byrd
* @copyright : All Rights Reserved, Byrd Inc. 2009
* @link : http://www.jonathonbyrd.com
*
* Jonathon Byrd is a freelance developer for hire. Jonathon has owned many companies and
* understands the importance of website credibility. Contact Jonathon Today.
*
*/
// Check to ensure this file is within the rest of the framework
defined('_EXEC') or die();
?>
<script src="http://maps.google.com/maps?file=api&v=2.x&key=<?php echo $this->api_key; ?>" type="text/javascript"></script>
<script type="text/javascript">
var reinkes = "<?php echo $this->to_address; ?>";
var map = null;
var geocoder = null;
window.addEvent('unload', function() {
GUnload();
});
window.addEvent('load', function() {
initialize();
showAddress(reinkes);
$('gmapbutton').addEvent('click', function(evt){
getDirections();
});
});
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
<?php if( !$this->G_HYBRID_MAP ) echo 'map.removeMapType(G_HYBRID_MAP);'; ?>
<?php if( !$this->G_SATELLITE_MAP ) echo 'map.removeMapType(G_SATELLITE_MAP);'; ?>
<?php if( !$this->G_NORMAL_MAP ) echo 'map.removeMapType(G_NORMAL_MAP);'; ?>
map.addControl(new <?php echo $this->sizecontrol; ?>());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 8);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
var marker = new GMarker(point);
map.addOverlay(marker);
map.setCenter(point, 13);
marker.openInfoWindowHtml(address);
}
}
);
}
}
function getDirections(address){
dir = new GDirections(map, document.getElementById("directions"));
dir.load(address);
setDirections(document.getElementById('map_address').value, reinkes, 'en');
return false;
}
function setDirections(fromAddress, toAddress, locale) {
dir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
}
</script>