-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotokoll.php
297 lines (261 loc) · 12.3 KB
/
protokoll.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
<!DOCTYPE html>
<html lang="de">
<!-- Site: 'Protokoll' -->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title id="title" ></title>
<!-- homescreen icon -->
<link rel="icon" type="image/ico" id="IconStart">
<!-- css stylesheets -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/tooplate.css">
<link rel="stylesheet" href="css/time.css">
<!-- css datatables -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css">
</head>
<body id="reportsPage">
<div class="" id="home">
<div class="container">
<div class="row">
<div class="col-12">
<!-- navigationbar with dropdown menu -->
<nav class="navbar navbar-expand-xl navbar-light bg-light">
<a class="navbar-brand" href="#">
<!-- navigationbar icon -->
<img id="homeIcon" >
<h1 class="tm-site-title mb-0" id="header"></h1>
</a>
<button class="navbar-toggler ml-auto mr-0" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto">
<!-- pages in navigationbar -->
<li class="nav-item">
<a class="nav-link" href="index.php">Menü</a>
</li>
<li class="nav-item">
<a class="nav-link" href="temperature.php">Temperatur</a>
</li>
<li class="nav-item">
<a class="nav-link" href="feuchtigkeit.php">Feuchtigkeit</a>
</li>
<li class="nav-item">
<a class="nav-link" href="protokoll.php">Protokoll</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<!-- 1. white block, includes Datatable 'Protokoll'-->
<div class="row tm-content-row tm-mt-big">
<div class="tm-col tm-col-big">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Protokoll</h2>
<!-- Datatable 'Protokoll' -->
<table id="tableProtokoll">
<thead>
<tr>
<th>Zeit</th>
<th>Eintrag</th>
</tr>
</thead>
<tbody>
<tr>
<th>Zeit</th>
<th>Eintrag</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tm-col tm-col-big" id="lichtChart" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Licht Zustand</h2>
<!-- LineChart 'Licht' -->
<canvas id="lineChartLicht" height="300" ></canvas>
</div>
</div>
<div class="tm-col tm-col-big" id="heizungChart" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Heizung Zustand</h2>
<!-- LineChart 'Heizung' -->
<canvas id="lineChartHeizung" height="300" ></canvas>
</div>
</div>
<div class="tm-col tm-col-big" id="kuehlungChart" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Kühlung Zustand</h2>
<!-- LineChart 'Kühlung' -->
<canvas id="lineChartKuehlung" height="300" ></canvas>
</div>
</div>
<div class="tm-col tm-col-big" id="foggerChart" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Fogger Zustand</h2>
<!-- LineChart 'Fogger' -->
<canvas id="lineChartFogger" height="300" ></canvas>
</div>
</div>
<div class="tm-col tm-col-big" id="lueftungChart" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Lüftung Zustand</h2>
<!-- LineChart 'Lüftung' -->
<canvas id="lineChartLueftung" height="300" ></canvas>
</div>
</div>
<div class="tm-col tm-col-big" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Steuerungsauswahl</h2>
<label for="appt1" method>Terrarium/Fungarium</label>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" id="TerraFunga" name="TerraFunga" <?php echo terraFunga("terraFunga");?>>
<span class="slider round"></span>
</label>
</div>
</div>
<!-- 5. white block, includes 'Vorhandene Komponenten'-->
<div class="tm-col tm-col-big" id="komponenten" style="display:none;">
<div class="bg-white tm-block h-100">
<h2 class="tm-block-title">Vorhandene Komponenten</h2>
<label for="appt1" method>Licht:</label>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" id="licht" name="licht" <?php echo komponenten("licht");?>>
<span class="slider round"></span>
</label>
<label for="appt1" method>Heizung:</label>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" id="heizung" name="heizung" <?php echo komponenten("heizung");?>>
<span class="slider round"></span>
</label>
<label for="appt1" method>Kühlung:</label>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" id="kuehlung" name="kuehlung" <?php echo komponenten("kuehlung");?>>
<span class="slider round"></span>
</label>
<label for="appt1" method>Fogger:</label>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" id="fogger" name="fogger" <?php echo komponenten("fogger");?>>
<span class="slider round"></span>
</label>
<label for="appt1" method>Lüftung:</label>
<!-- Rounded switch -->
<label class="switch">
<input type="checkbox" id="lueftung" name="lueftung" <?php echo komponenten("lueftung");?>>
<span class="slider round"></span>
</label>
</div>
</div>
</div>
</div>
<?php
function terraFunga(String $Bezeichnung)
{
// Database Login
include "databaseLogin.php";
// create table "einstellungen" when the data is submitted for the first time
$sql = "CREATE TABLE IF NOT EXISTS voreinstellungen (
ID INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Bezeichnung VARCHAR(30) NOT NULL,
Wert VARCHAR(4) NOT NULL,
Zugriff TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
$db->exec($sql);
// execute query
$result = $db->query("SELECT * FROM voreinstellungen WHERE Bezeichnung='$Bezeichnung'");
foreach ($result as $row)
$einstellungen = $row["Wert"];
if ($einstellungen) {
$returnWert = 'checked';
}
else {
$returnWert = 'unchecked';
}
return $returnWert;
}
function komponenten(String $Bezeichnung)
{
// Database Login
include "databaseLogin.php";
// create table "einstellungen" when the data is submitted for the first time
$sql = "CREATE TABLE IF NOT EXISTS voreinstellungen (
ID INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
Bezeichnung VARCHAR(30) NOT NULL,
Wert VARCHAR(4) NOT NULL,
Zugriff TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
$db->exec($sql);
// execute query
$result = $db->query("SELECT * FROM voreinstellungen WHERE Bezeichnung='$Bezeichnung'");
foreach ($result as $row)
$einstellungen = $row["Wert"];
if ($einstellungen) {
$returnWert = 'checked';
}
else {
$returnWert = 'unchecked';
}
return $returnWert;
}
?>
<!-- datatable and jquery module -->
<script src="js/cdn_jsdelivr.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/cdn_datatables.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/tooplate-scripts.js"></script>
<script src="js/moment.min.js"></script>
<!-- chartjs adapter and plugins -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<!-- Changes title and Icon of the Navigationbar, depends on 'Terrarium/Fungarium' switch on 'Menü' -->
<script src="js/actionTerraFungaTitle.js"></script>
<!-- Draws the Charts using the module chart.js -->
<script src="js/ProtokollChart/lichtChart.js"></script>
<script src="js/ProtokollChart/heizungChart.js"></script>
<script src="js/ProtokollChart/kuehlungChart.js"></script>
<script src="js/ProtokollChart/foggerChart.js"></script>
<script src="js/ProtokollChart/lueftungChart.js"></script>
<!-- Shows or Hides the Chart when the component is selected in the settings 'Vorhandene Komponenten' on 'Menü' -->
<script src="js/ProtokollChart/ShowHide/actionLichtChartData.js"></script>
<script src="js/ProtokollChart/ShowHide/actionHeizungChartData.js"></script>
<script src="js/ProtokollChart/ShowHide/actionKuehlungChartData.js"></script>
<script src="js/ProtokollChart/ShowHide/actionFoggerChartData.js"></script>
<script src="js/ProtokollChart/ShowHide/actionLueftungChartData.js"></script>
<!-- js to draw DataTable 'Protokoll' -->
<script>
$('#tableProtokoll').DataTable( {
"searching": true,
"pageLength": 20,
"scrollY": "300px",
"scrollCollapse": true,
"lengthChange": false,
"order": [[ 0, "desc"]],
"language": {
"url": "js/dataTables.german.json"
},
ajax: {
url: "data_protokoll.php",
dataSrc: ''
},
columns: [
{ data: "Zugriff" },
{ data: "Eintrag" }
]
} );
</script>
</body>
</html>