-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
414 lines (332 loc) · 13.8 KB
/
home.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
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html>
<?php
include 'db.php';
session_start();
if(isset($_SESSION['user'])) {
$user = $_SESSION['user'];
$pass = $_SESSION['pass'];
$qs = mysqli_query($conn, "SELECT * FROM accounts where email='$user' and pass='$pass'");
$count1=mysqli_num_rows($qs);
if($count1 > 0) {
while($acc = mysqli_fetch_array($qs)){
$fname = $acc['fname'];
$lname = $acc['lname'];
$pno = $acc['pno'];
$role = $acc['role'];
}
} else {
header('Location: index.php');
exit();
}
} else {
header('Location: index.php');
exit();
}
$dump_query = mysqli_query($conn, "SELECT * FROM dumps");
$garbage_dumps = mysqli_num_rows($dump_query);
if ($garbage_dumps > 0) {
$i = 0;
while($row = mysqli_fetch_assoc($dump_query)) {
$dumpsId[$i] = $row["id"];
$dumpsLat[$i] = $row["lat"];
$dumpsLong[$i] = $row["longi"];
$dumpsHeight[$i] = $row["height"];
$dumpsCap[$i] = $row["capacity"];
$i++;
}
}
if(isset($_POST['sel_sub'])) {
$as = "INSERT INTO settings (vol,history,pred,direc) VALUES ('0','0','0','0')";
mysqli_query($conn, $as);
foreach ($_POST['sel'] as $selectedOption) {
$as = "UPDATE settings SET $selectedOption='1' ORDER BY id DESC LIMIT 1";
if(mysqli_query($conn, $as)) {
//$status = 1;
} else {
//$status = -1;
}
}
}
$settings_query = mysqli_query($conn, "SELECT * FROM settings ORDER BY id DESC LIMIT 1");
$settings_row = mysqli_fetch_assoc($settings_query);
$direc = $settings_row["direc"];
if(isset($_POST['logout'])) {
session_destroy();
header('Location:index.php');
}
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Analysis and Management of Waste</title>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="css/mdb.min.css">
<!-- Your custom styles (optional) -->
<style>
.card.card-cascade .view.gradient-card-header {
padding: 1.2rem 1rem;
}
.map-container{
overflow:hidden;
padding-bottom:56.25%;
position:relative;
height:0;
}
.map-container iframe{
left:0;
top:0;
height:100%;
width:100%;
position:absolute;
}
</style>
</head>
<body class="fixed-sn white-skin">
<!--Main Navigation-->
<header>
<!-- Sidebar navigation -->
<div id="slide-out" class="side-nav sn-bg-4 fixed">
<ul class="custom-scrollbar">
<!-- Logo -->
<li class="collapsible-header waves-effect pb-5 pt-2">
<div class="text-center">
<a href="#" class="pl-0"><img src="img/slogo.png" class="img" height="100px" width="130px"></a>
</div>
</li>
<!--/. Logo -->
<li>
<ul class="collapsible collapsible-accordion">
<li><a href="home.php" class="collapsible-header waves-effect active"><i class="fas fa-home"></i> Home</a></li>
<?php for($d = 1; $d <= $garbage_dumps; $d++) {?>
<li><a href="gd.php?id=<?php echo $d;?>" class="collapsible-header waves-effect"><i class="fas fa-bolt"></i> Garbage Dump <?php echo $d;?></a></li>
<?php } if($direc == 1 || !($role == 'user')) {?>
<li><a href="direc.php" class="collapsible-header waves-effect active"><i class="fab fa-google"></i> Directions </a></li>
<?php } ?>
<?php if($role == "auth") {?>
<li><a class="collapsible-header waves-effect" data-toggle="modal" href="#set" ><i class="fas fa-cogs"></i> Settings</a></li>
<?php } ?>
</ul>
</li>
<!--/. Side navigation links -->
</ul>
<div class="sidenav-bg mask-strong"></div>
</div>
<!--/. Sidebar navigation -->
<!-- Navbar -->
<nav class="navbar fixed-top navbar-expand-lg scrolling-navbar double-nav">
<!-- SideNav slide-out button -->
<div class="float-left">
<a href="#" data-activates="slide-out" class="button-collapse black-text"><i class="fa fa-bars"></i></a>
</div>
<!-- Collapse -->
<!-- Breadcrumb-->
<div class="breadcrumb-dn mr-auto ml-2">
<p> Dashboard - Analysis and Management of Waste
<a class="btn btn-md btn-outline-primary btn-rounded waves-effect"><span class=""><?php echo $garbage_dumps;?> Garbage Dumps</span></a>
</p>
</div>
<!--Navbar links-->
<ul class="nav navbar-nav nav-flex-icons ml-auto">
<!-- Dropdown -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle waves-effect" href="#" id="userDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-user"></i> <span class="clearfix d-none d-sm-inline-block">Welcome, <strong><?php echo $fname;?></strong></span></a>
</a>
<form method="post">
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<button class="dropdown-item" href="#" name="logout" type="submit">Log Out</button>
<!--<a class="dropdown-item" href="#">My account</a>-->
</div></form>
</li>
</ul>
<!--/Navbar links-->
</nav>
<!-- /.Navbar -->
<!-- Fixed button
<div class="fixed-action-btn clearfix d-none d-xl-block" style="bottom: 45px; right: 24px;">
<a class="btn-floating btn-lg red">
<i class="fa fa-pencil"></i>
</a>
<ul class="list-unstyled">
<li><a class="btn-floating red"><i class="fa fa-star"></i></a></li>
<li><a class="btn-floating yellow darken-1"><i class="fa fa-user"></i></a></li>
<li><a class="btn-floating green"><i class="fa fa-envelope"></i></a></li>
<li><a class="btn-floating blue"><i class="fa fa-shopping-cart"></i></a></li>
</ul>
</div>-->
<!-- Fixed button -->
</header>
<!--Main Navigation-->
<!--Main layout-->
<!--Main layout-->
<main>
<div class="container-fluid">
<?php
for($a = 1; $a<=$garbage_dumps;$a++) {
$sq = mysqli_query($conn, "SELECT * FROM gd$a ORDER BY id DESC LIMIT 1;");
$dn = mysqli_num_rows($sq);
if ($dn > 0) {
while($row = mysqli_fetch_assoc($sq)) {
$u1 = $row["y1"];
$u2 = $row["y2"];
$u3 = $row["y3"];
$u4 = $row["y4"];
$time = $row["time"];
}
}
?>
<section>
<!--Section: Analytical panel-->
<section class="mb-5">
<!--Card-->
<div class="card card-cascade narrower">
<!--Section: Chart-->
<!--Grid row-->
<div class="row">
<!--Grid column-->
<div class="col-xl-5 col-md-12 mr-0">
<!--Card image-->
<div class="view view-cascade gradient-card-header primary-color">
<h4 class="h4-responsive mb-0 font-weight-bold">Garbage Dump <?php echo $a;?></h4>
</div>
<!--/Card image-->
<!--Card content-->
<div class="card-body card-body-cascade pb-0">
<!--Panel data-->
<div class="row card-body pt-3">
<!--First column-->
<div class="col-md-12">
<div class="progress mb-1 mt-1">
<div class="progress-bar warning-color" role="progressbar" style="width: <?php echo $u1;?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<!--Text-->
<p class="grey-text mb-4">Dry Waste : <?php echo $u1;?>%</p>
<div class="progress mb-1">
<div class="progress-bar red accent-2" role="progressbar" style="width: <?php echo $u2;?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<!--Text-->
<p class="grey-text mb-4">Wet Waste : <?php echo $u2;?>%</p>
<div class="progress mb-1">
<div class="progress-bar primary-color" role="progressbar" style="width: <?php echo $u3;?>%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<!--Text-->
<p class="grey-text mb-4">Mixed Waste : <?php echo $u3;?>%</p>
<div class="progress mb-1">
<div class="progress-bar light-blue lighten-1" role="progressbar" style="width: <?php echo $u4;?>%" aria-valuenow="25" aria-valuemin="0"
aria-valuemax="100"></div>
</div>
<!--Text-->
<p class="grey-text mb-2">Medi Waste : <?php echo $u4;?>%</p>
<p class="h6 font">Last Updated: <?php echo $time; ?></p>
<a href="gd.php?id=<?php echo $a;?>" class="btn peach-gradient float-right">See More</a>
</div>
<!--/First column-->
</div>
<!--/Panel data-->
</div>
<!--/.Card content-->
</div>
<!--Grid column-->
<!--Grid column-->
<div class="col-xl-7 col-md-12 mb-4">
<!--Card image-->
<div class="view view-cascade gradient-card-header primary-color">
<div id="map-container-google-1" class="z-depth-1-half map-container" style="height: 300px">
<iframe src="https://maps.google.com/maps?q=<?php echo $dumpsLat[$a-1]; ?>,<?php echo $dumpsLong[$a-1]; ?>&t=&z=10&ie=UTF8&iwloc=&output=embed" frameborder="0" style="border:0" allowfullscreen=""></iframe>
</div>
</div>
<!--/Card image-->
</div>
<!--Grid column-->
</div>
<!--Grid row-->
</section>
<!--Section: Chart-->
</div>
<!--/.Card-->
</section>
<?php
}
?>
</div>
</main>
<!--Main layout-->
<!--Footer
<footer class="page-footer pt-0 mt-5 rgba-stylish-light">
<div class="footer-copyright py-3 text-center">
<div class="container-fluid">
© 2018 Copyright: <a href="https://mdbootstrap.com/bootstrap-tutorial/" target="_blank"> MDBootstrap.com </a>
</div>
</div>
</footer>
/.Footer-->
<!-- Central Modal Small --><form method="post">
<div class="modal fade" id="set" tabindex="-1" role="dialog" aria-labelledby="set"
aria-hidden="true">
<!-- Change class .modal-sm to change the size of the modal -->
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title w-100" id="myModalLabel">Settings</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<select class="mdb-select md-form colorful-select dropdown-danger" name="sel[]" multiple>
<option value="" disabled selected>Choose your options</option>
<option value="vol">Volume and Capacity</option>
<option value="history">History</option>
<option value="pred">Predictions</option>
<option value="direc">Directions</option>
</select>
<label><h6>Select which information users can see</h6></label>
<button class="btn-save btn btn-danger btn-sm" type="button">Save</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
<button type="submit" name="sel_sub" class="btn btn-primary btn-sm">Save changes</button>
</div>
</div>
</div>
</div></form>
<!-- Central Modal Small -->
<!-- SCRIPTS -->
<!-- JQuery -->
<script src="js/jquery-3.3.1.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="js/bootstrap.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="js/mdb.min.js"></script>
<!--Initializations-->
<script>
// SideNav Initialization
$(".button-collapse").sideNav();
var container = document.querySelector('.custom-scrollbar');
Ps.initialize(container, {
wheelSpeed: 2,
wheelPropagation: true,
minScrollbarLength: 20
});
// Data Picker Initialization
$('.datepicker').pickadate();
// Material Select Initialization
$(document).ready(function () {
$('.mdb-select').material_select();
});
// Tooltips Initialization
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<!-- Charts -->
</body>
</html>