-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmap.php
More file actions
117 lines (103 loc) · 3.46 KB
/
map.php
File metadata and controls
117 lines (103 loc) · 3.46 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">!
<!--
//============================================================+
// File name : map.php
//
// Description : Outputs Google map on the screen
//
// Author: Aditya Mathur
//
// (c) Copyright:
// Aditya Mathur
// eztasker.com
//
// License:
// Copyright (C) 2014 Aditya Mathur - eztasker.com
//============================================================+
-->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Map</title>
<script src="http://maps.google.com/maps?file=api&v=2&key="" type="text/javascript"></script>
<link href="./css/geometry.css" rel="stylesheet" />
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
geocoder = new GClientGeocoder();
// Here enter your url of ashx/php file
GDownloadUrl("./xml.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++)
{
//gather data from php file xml.php
var tid = markers[i].getAttribute("tid");
var title = markers[i].getAttribute("title");
var description = markers[i].getAttribute("description");
var deadline = markers[i].getAttribute("deadline");
var name = markers[i].getAttribute("name");
var payment = markers[i].getAttribute("payment");
var address = markers[i].getAttribute("address");
//call to function showAddress with paramerters to show on the map
showAddress(tid,title,description,deadline,payment,address,name);
}
});
}
}
function showAddress(tid,title,description,deadline,payment,address,name) {
if (geocoder) {
geocoder.getLatLng(name+","+address,function(point) {
if (!point) {
//alert(address + " not found");
}
else {
map.setCenter(point, 12); //set Zoom level
var marker = createMarker(point,tid,title,description,deadline,payment,address,name);
map.addOverlay(marker);
}
});
}
}
function createMarker(point,tid,title,description,deadline,payment,address,name) {
var marker = new GMarker(point);
var html =
'<table class="popinfo">' +
'<tr>'+
'<td><h2>' + title +'</h2>' +
'<p>'+ description + '<a href=job_apply1.php?t='+tid+' target=1>...Read more</a>'+ '</p>'+
'<b>Deadline: </b>' + deadline + '<br/>'+
'<b>Location: </b>' + name + '<br/>'+
'<b>Address: </b>' + address + '<br/>'+
'</td>'+
'<td bgcolor="lightyellow" align="center"><h2>' + payment + '</h2>' +
'<a href=job_apply1.php?t='+tid+' target=1 class="but_pink">Make offer</a>' +
'</td>'+
'</tr>'+
'<tr>'+
'<td colspan=2 style="border-top: 1px solid @e5e5e5">' + 'Share this task ' +
'<a href=job_apply1.php?t='+tid+' target=1><img src=images/facebook-icon.png></a> ' +
'<a href=job_apply1.php?t='+tid+' target=1><img src=images/twittericon.png></a> '+
'<a href=job_apply1.php?t='+tid+' target=1><img src=images/mailicon.png></a>' +
'</td>'+
'</tr>'+
'</table>';
GEvent.addListener(marker, 'click', function() {
//open info window on marker click event
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>
<body onload="load()" onunload="GUnload()">
<div>
<div id="map" style="width: 100%; height:743px"></div>
</div>
</body>
</html>