This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·91 lines (90 loc) · 3.78 KB
/
index.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
<?php
include('lib/sql.php');
$sqlquery = new doSQL();
$sqlquery->doSQLStuff("SELECT * FROM `Systems`");
$names = $sqlquery->get_names();
$gpios = $sqlquery->get_gpios();
$id = $sqlquery->get_id();
?>
<!doctype html>
<html>
<head>
<base href="<?php echo $_SERVER['HTTP_HOST']; ?>"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SQLSprinkler</title>
<link href="css/w3.css" type="text/css" rel="stylesheet"/>
<link href="css/w3-flat.css" type="text/css" rel="stylesheet"/>
<link href="css/style.css" type="text/css" rel="stylesheet"/>
<script src="https://kit.fontawesome.com/e00a151875.js" crossorigin="anonymous"></script>
<script src="js/jquery.js"></script>
<script src="js/sprinkler.js"></script>
</head>
<body onload="getSprinklers();" style="display:none;">
<div>
<!-- Begin systems, repeat this <?php echo sizeof($id); ?> times -->
<!-- TODO: Make this out of pure html and js. -->
<br>
<table class="w3-table w3-table-all sprinkler-table w3-threequarter w3-display-topmiddle">
<div id="notification" style="display: none;font-size: .75em;padding:16px;" class="w3-card-4">
<span id="notification-text"></span>
<span class="w3-button dismiss w3-red" style="float:right;"><i class="fas fa-times"></i></span>
</div>
<tr>
<td>
<div class="w3-rest" style="float:left;">
<p style="font-weight: bold">System Schedule</p>
<p>Status: <span id="schedule"></span></p>
</div>
</td>
<td>
<button id="schedule-btn " onclick="systemToggle();return false;"
class="w3-button programoff w3-round-xxlarge w3-centered mybutton sprinkler-button">Turn <span
id="schedule-btn-txt">Off</span></button>
</td>
</tr>
<?php
for ($i = 0; $i < sizeof($id); $i++) {
?>
<tr>
<td>
<div class="sprinkler-info">
<p class="sprinkler-name">
<?php echo 'Zone ' . ($i + 1) ?>
</p>
<p>
<?php echo $names[$i]; ?>
</p>
<p>
Status: <span id="status-<?php echo $i; ?>">Off</p>
</div>
</td>
<td>
<div class="sprinkler-button">
<button id="<?php echo $gpios[$i]; ?>" name="toggle"
onclick="getData(<?php echo $i; ?>);return false;"
class="w3-button systemoff w3-round-xxlarge w3-center mybutton">Turn On
</button>
</div>
</td>
</tr>
<?php
}
?>
<!-- End systems-->
</table>
</div>
<div class="w3-display-bottomleft w3-center w3-flat-silver w3-dropdown-hover " style="position:fixed;">
<a href="javascript:void(0);" id="menuopen" class="w3-button fix-bars"> <i style="z-index: 5;"
class="fa fa-bars w3-display-middle"></i>
</a>
<div style="display: none;" id="menunav">
<a id="menuclose" class="w3-button "> <i style="z-index: 5;" class="fa fa-times"></i></a>
<a href="/" class="w3-button"><i style="z-index: 5;" class="fa fa-home"></i></a>
<a href="settings" class="w3-button"><i style="z-index: 5;" class="fa fa-gears"></i></a>
<a id="update" class="w3-button"><i style="z-index: 5;" class="fas fa-download"></i></a>
</div>
</div>
</div>
</body>
</html>