@@ -20,10 +20,12 @@ function SG($plato)
20
20
if ($ show != '' )
21
21
{
22
22
$ id = intval ($ show );
23
+ $ sh = "&show= $ id " ;
23
24
$ sql = "SELECT pk_id, name, timestamp, plato FROM batch WHERE pk_id = ' $ id' " ; // selected
24
25
}
25
26
else
26
27
{
28
+ $ sh = "" ;
27
29
$ sql = "SELECT pk_id, name, timestamp, plato FROM batch ORDER BY timestamp DESC " ; // last
28
30
}
29
31
@@ -37,6 +39,17 @@ function SG($plato)
37
39
$ show = $ row ['pk_id ' ];
38
40
}
39
41
42
+ // webcam - jpg
43
+ $ webcam = '' ;
44
+ $ webdir = date ('YmdHis ' , strtotime ($ time_start ));
45
+ $ files = array_diff (scandir ("/var/www/html/webcam/ $ webdir " , SCANDIR_SORT_DESCENDING ), array ('.. ' , '. ' ));
46
+ $ numFiles = count ($ files );
47
+ for ($ i = 0 ; $ i < $ numFiles ; $ i ++)
48
+ {
49
+ $ file = $ files [$ i ];
50
+ $ webcam .= "<img class= \"mySlides \" src= \"black.png \" data-src= \"webcam/ $ webdir/ $ file \" title= \"$ file \" width= \"640 \" height= \"480 \" /> " ;
51
+ }
52
+
40
53
// find time_end if exists
41
54
$ sql = "SELECT timestamp FROM batch WHERE timestamp > ' $ time_start' ORDER BY timestamp ASC " ;
42
55
$ result = $ conn ->query ($ sql );
@@ -51,9 +64,9 @@ function SG($plato)
51
64
while ($ row = $ result ->fetch_assoc ())
52
65
{
53
66
$ timestamp = $ row ["timestamp " ];
67
+ $ temp = $ row ["temperature " ];
54
68
$ plato = $ row ["gravity " ];
55
69
if ($ plato > $ plato_max ) $ plato_max = $ plato ;
56
- $ temp = $ row ["temperature " ];
57
70
$ battery = $ row ["battery " ];
58
71
$ angle = $ row ["angle " ];
59
72
$ line_chart .= "[new Date(' $ timestamp'), $ plato, $ temp], " ;
@@ -74,6 +87,8 @@ function SG($plato)
74
87
75
88
<html>
76
89
<head>
90
+ <title>Pivo - kvašení</title>
91
+ <meta name="robots" content="noindex">
77
92
<style>
78
93
table.data {
79
94
border-collapse: collapse;
@@ -95,6 +110,19 @@ function SG($plato)
95
110
table.data th.r {
96
111
background: #B6D7A8;
97
112
}
113
+ .w3-display-left{position:absolute;top:50%;left:0%;transform:translate(0%,-50%);-ms-transform:translate(-0%,-50%)}
114
+ .w3-display-right{position:absolute;top:50%;right:0%;transform:translate(0%,-50%);-ms-transform:translate(0%,-50%)}
115
+ .w3-button{border:none;display:inline-block;padding:8px 8px;vertical-align:middle;overflow:hidden;text-decoration:none;color:inherit;background-color:inherit;text-align:center;cursor:pointer;white-space:nowrap;margin-bottom: 15px;margin-top:15px;width:60px;font-weight:bold}
116
+ .w3-button:hover{color:#000!important;background-color:#B6D7A8!important}
117
+ .w3-button:disabled{cursor:not-allowed;opacity:0.3}
118
+ .w3-black,.w3-hover-black:hover{color:#000!important;background-color:#A4C2F4!important}
119
+ body, p, table {
120
+ font: 10pt Verdana, Arial, sans-serif;
121
+ }
122
+ h1 {
123
+ font-size: 16pt;
124
+ font-weight: bold;
125
+ }
98
126
</style>
99
127
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
100
128
<script type="text/javascript">
@@ -120,8 +148,11 @@ function drawChart()
120
148
format: '#.##'
121
149
},
122
150
colors: ['red', 'blue'],
123
- width: 1400,
124
- height: 520
151
+ width: 1250,
152
+ height: 520,
153
+ legend: {
154
+ position: 'none'
155
+ }
125
156
};
126
157
var chart = new google.charts.Line(document.getElementById('plato_temp_chart_div'));
127
158
chart.draw(data, google.charts.Line.convertOptions(options));
@@ -147,28 +178,92 @@ function drawChart()
147
178
</head>
148
179
<body>
149
180
<h1><?php echo $ beer_name ; ?> </h1>
181
+
182
+ <div style="float: right; position:relative; margin-left: 20px; margin-bottom: 20px; width: 640px; height: 480px;">
183
+ <?php echo $ webcam ; ?>
184
+ <div class="w3-display-left">
185
+ <button id="minus15" class="w3-button w3-black" onclick="plusDivs(1)">-15 min</button><br />
186
+ <button id="minus60" class="w3-button w3-black" onclick="plusDivs(4)">-1 hod</button><br />
187
+ <button id="start" class="w3-button w3-black" onclick="showDiv(<?php echo $ numFiles - 1 ; ?> )">Start</button><br />
188
+ </div>
189
+ <div class="w3-display-right">
190
+ <button id="plus15" class="w3-button w3-black" onclick="plusDivs(-1)">+15 min</button><br />
191
+ <button id="plus60" class="w3-button w3-black" onclick="plusDivs(-4)">+1 hod</button><br />
192
+ <button id="end" class="w3-button w3-black" onclick="showDiv(0)">Konec</button>
193
+ </div>
194
+ </div>
195
+ <script type="text/javascript">
196
+ var slideIndex = 0;
197
+ showDivs(slideIndex);
198
+
199
+ function plusDivs(n)
200
+ {
201
+ showDivs(slideIndex += n);
202
+ }
203
+ function showDiv(n)
204
+ {
205
+ showDivs(slideIndex = n);
206
+ }
207
+
208
+ function showDivs(n)
209
+ {
210
+ var i;
211
+ var x = document.getElementsByClassName("mySlides");
212
+ var maxIndex = x.length - 1;
213
+ if (n >= maxIndex) slideIndex = maxIndex;
214
+ if (n < 0) slideIndex = 0;
215
+
216
+ document.getElementById("minus15").disabled = slideIndex == maxIndex;
217
+ document.getElementById("minus60").disabled = slideIndex > maxIndex - 4;
218
+ document.getElementById("start").disabled = slideIndex == maxIndex;
219
+
220
+ document.getElementById("plus15").disabled = slideIndex == 0;
221
+ document.getElementById("plus60").disabled = slideIndex < 4;
222
+ document.getElementById("end").disabled = slideIndex == 0;
223
+
224
+ for (i = 0; i < x.length; i++)
225
+ {
226
+ x[i].style.display = "none";
227
+ }
228
+ // preload images
229
+ for(i = slideIndex - 4; i <= slideIndex + 4; i++)
230
+ {
231
+ if(i >= 0 && i <= maxIndex)
232
+ {
233
+ if(x[i].getAttribute("data-src"))
234
+ {
235
+ x[i].src = x[i].getAttribute("data-src");
236
+ x[i].removeAttribute("data-src");
237
+ }
238
+ }
239
+ }
240
+
241
+ x[slideIndex].style.display = "block";
242
+ }
243
+ </script>
244
+
150
245
<table class="data">
151
246
<tr>
152
247
<th width="170">Čas posledního bodu</th>
153
248
<td width="170"><?php echo $ timestamp ; ?> </td>
154
- <td width="50 " class="noborder"></td>
249
+ <td width="30 " class="noborder"></td>
155
250
<th width="170" class="r">Počáteční síla</th>
156
251
<td width="170"><?php echo (sprintf ('%.2f ' , $ plato_start )); ?> °P (<?php echo (sprintf ('%.3f ' , $ SG_start )); ?> )</td>
157
- <td width="50 " class="noborder"></td>
252
+ <td width="30 " class="noborder"></td>
158
253
<td class="noborder"><a href="settings.php"><strong>Nastavení</strong></a></td>
159
254
</tr>
160
255
<tr>
161
256
<th>Plato</th>
162
257
<td><?php echo (sprintf ('%.2f ' , $ plato )); ?> °P (<?php echo (sprintf ('%.3f ' , $ SG )); ?> )</td>
163
258
<td class="noborder"></td>
164
- <th class="r">Zdálivé prokvašení</th>
259
+ <th class="r">Zdánlivé prokvašení</th>
165
260
<td><?php echo (sprintf ('%.1f ' , 100 * $ Az )); ?> %</td>
166
261
</tr>
167
262
<tr>
168
263
<th>Teplota</th>
169
264
<td><?php echo (sprintf ('%.2f ' , $ temp )); ?> °C</td>
170
265
<td class="noborder"></td>
171
- <th class="r">ABV </th>
266
+ <th class="r">Alkohol </th>
172
267
<td><?php echo (sprintf ('%.1f ' , $ ABV )); ?> %</td>
173
268
<td class="noborder"></td>
174
269
<td class="noborder"><a href="values.php?show=<?php echo $ show ; ?> "><strong>Hodnoty</strong></a></td>
@@ -193,6 +288,7 @@ function drawChart()
193
288
<td><div id="plato_chart_div"></div></td>
194
289
<td><div id="temp_chart_div"></div></td>
195
290
<td><div id="battery_chart_div"></div></td>
291
+ <td style="vertical-align: bottom; text-align: right" width="100%"><img src="legend.png" width="124" height="77" /></td>
196
292
</tr>
197
293
</table>
198
294
<div id="plato_temp_chart_div"></div>
0 commit comments