forked from timleland/rfoutlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
130 lines (116 loc) · 3.41 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RF Outlets</title>
<link rel="stylesheet" href="Mirror/bootstrap.min.css">
<style>
body {
padding-top: 70px
}
</style>
</head>
<?php
include 'setup.php'; // setup variables reading ./outletCodes.json
?>
<body>
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href=".">RF Outlets on Rasp02</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
<div class="container">
<?php
// foreach ($outletsExists as $light => $value) { // code exists but not working correct yet.
foreach ($codeBook as $light => $value) {
if (file_exists($onStateDir . $light)) {
$onState = 'style="background-color:salmon;"';
$offState = '';
} else {
$onState = '';
$offState = 'style="background-color:lightBlue;"';
}
echo <<< EOM
<label> {$light} </label>: {$value['loc']}
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<div class="btn-group" role="group">
<button type="button" data-outletId="{$light}"
data-outletStatus="on" class="btn btn-default toggleOutlet" {$onState}>On</button>
</div>
<div class="btn-group" role="group">
<button type="button" data-outletId="{$light}"
data-outletStatus="off" class="btn btn-default toggleOutlet" {$offState}>Off</button>
</div>
</div>
EOM;
}
?>
</br>
<div class="container">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<label> current time: </label>
<?php
print date("Y M j \(D\) G:i:s T");
echo <<< EOM
</div>
<form method="post" action="timer.php">
EOM;
if (file_exists($onStateDir . 'Once')) {
$once = 'checked';
} else {
$redun = 'checked';
}
echo <<< EOM
Timer Mode:
<input type="radio" name="timer_mode" value="once" {$once}> <label> once </label>
<input type="radio" name="timer_mode" value="redun" {$redun}> <label> redun </label>
<p>
EOM;
foreach ($timerSetup as $mode => $value) {
if (file_exists($onStateDir . $mode)) {
$status = 'checked';
} else {
$status = '';
}
echo <<< EOM
<input type="radio" name="timer" value="{$mode}" {$status}>
<label> {$mode} </label>
<div class="btn-group btn-group-justified" role="group">
<pre>
EOM;
foreach ($value as $time => $rule) {
print $time . '[ ';
foreach ($rule as $switch => $light) {
print $switch . ':' . $light . ', ';
}
print '], ';
}
echo <<< EOM
</pre>
</div>
EOM;
}
// printf("<p><pre>\n Current mode in shuffle: %s\n</pre></p>", implode(" ", scandir($shuffleModeDir)));
$modes = implode(" ", scandir($shuffleModeDir));
echo <<< EOM
<p> <pre>Current mode in shuffle: { $modes }</pre> </p>
<p><input type="submit" value="Submit"></p>
</form">
EOM;
?>
<img src="CAM0.jpg">
</body>
<script src="Mirror/jquery-2.2.0.min.js"></script>
<script src="Mirror/bootstrap.min.js"></script>
<script src="script.js"></script>
</html>