-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaps.php
More file actions
249 lines (203 loc) · 7.26 KB
/
Copy pathmaps.php
File metadata and controls
249 lines (203 loc) · 7.26 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<?php
session_start();
include('dbconnect.php');
$xdata=$_SESSION["data"];
$username = $_SESSION["UserName"];
$sql = "SELECT * FROM Location
WHERE UserName = '$username' ";
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false)
{
echo "Error in query preparation/execution.\n";
die( print_r( sqlsrv_errors(), true));
}
while($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
{
$Latitude= $row['Latitude'];
$Longitude= $row['Longitude'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Sanguine-Donor Tracking</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.css" />
<link rel="stylesheet" type="text/css" href="css/styles.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
<title>Sanguine</title>
<link href="css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation" width="100%">
<div class="container" style="margin-left:0;">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</div>
</div>
<div align="Left" width="60%" style="Padding-left:30px; float: left; color:#FFFFFF">
<h2>Sanguine</h2><br>
</div>
<div align="right" width="100%" style="float: right;padding-right:50px;color:#FFFFFF">
Welcome <b> <?php echo $_SESSION["DisplayName"]; ?></b><br>
<a href="signout.php?logout">
Sign Out
</a>
</div>
</div>
<br/><br/>
</div>
<div style="padding-top:50px;" class="btn-group btn-group-justified">
<a class="btn btn-default" href="gpsdata.php">Send Blood Request</a>
<a class="btn btn-default" href="search_layout.php">Search</a>
<a class="btn btn-default" href="user_infoedit.php">Update Profile</a>
<a class="btn btn-default" href="DonationHistory.php">Donation History</a>
</div>
<div style="padding-left:50px; ">
<div style="color:#FFFFFF; width:5000px; padding-top:10px;width:1200px">
<form class="form-horizontal" action="sendNotification.php" method="post" >
Filter By Blood Type
<select id="cmbBloodType" onchange="markerFilter()" name="BloodType" style="color:#000000">
<option value="All">All</option>
<option value="A+">A+</option>
<option value="A-">A-</option>
<option value="B+">B+</option>
<option value="B-">B-</option>
<option value="AB+">AB+</option>
<option value="AB-">AB-</option>
<option value="O+">O+</option>
<option value="O-">O-</option>
</select>
<p style="padding-left:50px; display:inline">
Filter By Radius
<select id="cmbZoom" onchange="changeZoom()" style="color:#000000">
<option value="50">50</option>
<option value="25">25</option>
<option value="15">15</option>
<option value="10">10</option>
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
</select> Miles
</p>
<div style="float: right;">
<input type="hidden" name="NotificationType" value="true">
<input type="submit" class="btn btn-success" style="margin-left:2em" value="Send Group Notification">
</form>
</div>
</div>
<br/>
<div id="map" style="width:1200px; height: 800px"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7.5/leaflet.js"></script>
<script src="https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/leaflet.markercluster.js"></script>
<script>
var lat = <?php echo ($Latitude); ?>;
var longt = <?php echo ($Longitude); ?>;
var greenIcon = L.icon({
iconUrl: 'http://localhost/Sanguine-Web/homeicon.png',
iconSize: [30, 40], // size of the icon
shadowSize: [50, 64], // size of the shadow
iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
shadowAnchor: [4, 62], // the same for the shadow
popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
});
var map = L.map('map').setView([lat, longt], 13);
var donorMarkers = new L.markerClusterGroup();
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6IjZjNmRjNzk3ZmE2MTcwOTEwMGY0MzU3YjUzOWFmNWZhIn0.Y8bhBaUMqFiPrDRW9hieoQ', {
maxZoom: 18,attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(map);
L.marker([lat, longt], {icon: greenIcon} ).addTo(donorMarkers);
dropMarkers('All');
function markerFilter() {
var x = document.getElementById("cmbBloodType").value;
donorMarkers.clearLayers();
dropMarkers(x);
}
//L.marker([lat, long], {icon: greenIcon}).addTo(map);
function changeZoom() {
var x = document.getElementById("cmbZoom").value;
switch(x) {
case "50":
map.setZoom(9);
break;
case "25":
map.setZoom(10);
break;
case "15":
map.setZoom(11);
break;
case "10":
map.setZoom(12);
break;
case "5":
map.setZoom(13);
break;
case "4":
map.setZoom(14);
break;
case "3":
map.setZoom(15);
break;
case "2":
map.setZoom(16);
break;
case "1":
map.setZoom(17);
break;
default:
map.setZoom(18);
}
}
function dropMarkers(filter) {
var xdata = <?php echo json_encode($xdata); ?>;
var jsonData = JSON.parse(xdata);
//Parse JSON Data and create markers based on JSOn Data
for (var i = 0; i < jsonData.length; i++) {
var donors = jsonData[i];
if (filter !='All')
{
if (donors.Type != filter)
continue;
}
var bloodTpe=donors.Type;
bloodTpe = bloodTpe.replace('p','+');
bloodTpe = bloodTpe.replace('n','-');
var verified="Yes"
if (donors.IsValidated == 0)
verified="No"
var tmpType=donors.Type;
tmpType = bloodTpe.replace('+','p');
tmpType = bloodTpe.replace('-','n');
L.marker([donors.Latitude, donors.Longitude]).bindPopup("<b>" + donors.Name + "</b><br />Blood Type: " + bloodTpe +" <br />Verified:"+ verified +
"<br/> <a href='sendNotification.php?DeviceId=" + donors.DeviceID + "&BloodType=" + tmpType +"'>Send Notification </a>"
).addTo(donorMarkers);
//L.marker([donors.Latitude, donors.Longitude]).bindPopup("Test").addTo(donorMarkers);
}
donorMarkers.addTo(map);
}
/* map.on('click', onMapClick);
function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(map);
}
*/
</script>
</div>
</body>
</html>