forked from Simon90/Semvis-Air
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateTable.html
More file actions
275 lines (233 loc) · 10.9 KB
/
createTable.html
File metadata and controls
275 lines (233 loc) · 10.9 KB
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
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Air Quality Egg Münster</title>
<link rel="shortcut icon" href="bilder/egg1.png" type="image/x-icon" />
<meta name="description" content="Luftqualitätsdaten Muenster">
<meta name="keywords" content="Air Quality Egg">
<meta name="viewport" content="target-densitydpi=480px, width=1000px, user-scalable=yes">
<meta http-equiv="X-UA-Compatible" content="IE=edge"><!--Order IE to use the best available compatibility-Microsoft Standard-->
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="libraries_diagram/jquery-1.9.1.js" type="text/javascript">
</script>
</head>
<body>
<div id="main">
<div id="header">
<div id="banner">
<div id="Willkommen">
<h1>Semvis Air</h1>
<h6>System zur Erfassung,Modellierung und Visualisierung von Luftqualitätsdaten</h6>
</div><!--close welcome-->
</div><!--close banner-->
</div><!--close header-->
<div id="menubar">
<ul id="menu">
<li class="current">
<a href="createTable.html">Tabelle</a>
</li>
<li>
<a href="Karte.php">Zurück zur Kartenansicht</a>
</li>
<li>
<a href="Hilfe.html">Hilfe</a>
</li>
</ul>
</div><!--close menubar-->
<div id="site_content">
<div class="sidebar_container">
<div class="sidebar">
<div class="sidebar_item">
<h2>Tabelle</h2>
<form name='selectpara' id="selectpara">
<input type="radio" name="Parameter" onclick="(chooseTemperature())" checked="checked"> Temperatur<br>
<input type="radio" name="Parameter" onclick="(chooseO3())"> Ozon<br>
<input type="radio" name="Parameter" onclick="(chooseCO())"> Kohlenstoffmonoxid<br>
<input type="radio" name="Parameter" onclick="(chooseNO2())"> Stickstoffdioxid<br>
<input type="radio" name="Parameter" onclick="(chooseHumidity())"> Luftfeuchtigkeit<br>
</form>
<br>
<p id='parameter'>Maßeinheit</p><span style="margin-left: 225px"><a class="tooltip">?<span class="classic">Um eine
Messung in der Tabelle anzuzeigen, wählen und markieren Sie bitte den jeweiligen Kreis</span></a></span>
</div><!--Close-item-->
<div class="sidebar_item">
<p id='time'></p>
<h2>Tag</h2>
<form name='selectday' id="selectday">
<input type="radio" name="Parameter" onclick="(chooseDay(6))"> <span id="day6"></span><br>
<input type="radio" name="Parameter" onclick="(chooseDay(5))"> <span id="day5"></span><br>
<input type="radio" name="Parameter" onclick="(chooseDay(4))"> <span id="day4"></span><br>
<input type="radio" name="Parameter" onclick="(chooseDay(3))"> <span id="day3"></span><br>
<input type="radio" name="Parameter" onclick="(chooseDay(2))"> <span id="day2"></span><br>
<input type="radio" name="Parameter" onclick="(chooseDay(1))"> <span id="day1"></span><br>
<input type="radio" name="Parameter" onclick="(chooseDay(0))" checked="checked"> <span id="day0"></span> (heute)
</form><span style="margin-left: 225px"><a class="tooltip">?<span class="classic">Wenn Sie die Werte vergangener Tage
einsehen möchten, wählen und markieren Sie bitte den zum jeweiligen Datum dazugehörigen Kreis</span></a></span>
</div><!--Close-item-->
<div class="sidebar_item">
<h2>Rohdaten XML</h2>
<div id="rawdata" onclick="(getXML1())">AQE 1</div>
<div id="rawdata" onclick="(getXML2())">AQE 2</div>
<div id="rawdata" onclick="(getXML3())">AQE 3</div>
</div><!--Close-item-->
</div><!--Close-sidebar-->
</div><!--Close-sidebar_container-->
<div id="table">
<canvas id="canvas1" width="200" height="720">[No canvas support]</canvas>
</div>
<script>
function getXML1(){
xmlPath1 = 'http://giv-geosoft2c.uni-muenster.de:8080/XML/rest/XML/' + sensorId1 + '/' + selectedPara + '/' + year + '-' + month + '-' + date + '%200:0:0/' + year + '-' + month + '-' + date + '%2023:59:59';
window.open(xmlPath1);
}
function getXML2(){
xmlPath2 = 'http://giv-geosoft2c.uni-muenster.de:8080/XML/rest/XML/' + sensorId2 + '/' + selectedPara + '/' + year + '-' + month + '-' + date + '%200:0:0/' + year + '-' + month + '-' + date + '%2023:59:59';
window.open(xmlPath2);
}
function getXML3(){
xmlPath3 = 'http://giv-geosoft2c.uni-muenster.de:8080/XML/rest/XML/' + sensorId3 + '/' + selectedPara + '/' + year + '-' + month + '-' + date + '%200:0:0/' + year + '-' + month + '-' + date + '%2023:59:59';
window.open(xmlPath3);
}
</script>
<script>
var sensorId1 = 0;
var sensorId2 = 0;
var sensorId3 = 0;
selectedPara = 'temperature';
table = [];
path = location.href;
pathPara = path.split('?');
if (pathPara.length > 0){ //at least one egg selected
pathPara = pathPara[1];
eggId = pathPara.split('&');
getId1 = eggId.slice(0,1);
getId1 = getId1.toString();
sensorId1 = getId1.slice(4);
if (eggId.length > 1){ //more than one egg selected
getId2 = eggId.slice(1,2);
getId2 = getId2.toString();
sensorId2 = getId2.slice(4);
if (eggId.length > 2){ //more than two eggs selected
getId3 = eggId.slice(2,3);
getId3 = getId3.toString();
sensorId3 = getId3.slice(4);
}
}
}
//get Names for the legend
phpLocation2 = 'http://giv-geosoft2c.uni-muenster.de/getEggNames.php?id1=' + sensorId1 + '&id2=' + sensorId2 + '&id3=' + sensorId3;
$.ajax({
type: "GET",
url: phpLocation2,
dataType: "script",
success: function(){}
});
//choose the day of the displayed measurements
function chooseDay(n)
{
time = writeCorrectDates(n);
timeArray = time.split(".");
date = timeArray[0];
month = timeArray[1];
year = timeArray[2];
callPHP();
switch(selectedPara)
{
case 'temperature':
chooseTemperature();
break;
case 'ozon':
chooseO3();
break;
case 'co':
chooseCO();
break;
case 'no2':
chooseNO2();
break;
case 'humidity':
chooseHumidity();
break;
}
}
chooseDay(1);
//Date of the radio buttons: Instead of "yesterday", "day before yesterday" etc.
for (var x = 0; x < 7; x++) document.getElementById('day' + x).innerHTML = writeCorrectDates(x);
function testLeapYear(x){
if (x%400 == 0) return true;
if (x%4 == 0 && x%100 != 0) return true;
else return false;
}
function writeCorrectDates(n)
{
var d = new Date();
var currentDay = d.getDate();
var currentMonth = d.getMonth() + 1;
var currentYear = d.getFullYear();
var correctDay = (currentDay-n + '.' + (currentMonth) + '.' + currentYear);
//Preventing negative days and months
if (currentDay-n < 1){
var minusDays = n - currentDay;
var previousMonth = currentMonth-1;
if (previousMonth < 1) previousMonth = 12;
var previousMonthLength;
if (previousMonth == 1 || previousMonth == 3 || previousMonth == 5 || previousMonth == 7 || previousMonth == 8 || previousMonth == 10 || previousMonth == 12)
previousMonthLength = 31;
else if (previousMonth == 4 || previousMonth == 6 || previousMonth == 9 || previousMonth == 11)
previousMonthLength = 30;
else if (testLeapYear(currentYear) == true)
previousMonthLength = 29;
else previousMonthLength = 28;
correctDay = (previousMonthLength-minusDays + '.' + (previousMonth) + '.' + currentYear);
}
return correctDay;
}
//Choose parameter
function chooseTemperature()
{
selectedPara = 'temperature';
callPHP();
document.getElementById('parameter').innerHTML='Temperatur in °C';
}
function chooseO3()
{
selectedPara = 'ozon';
callPHP();
document.getElementById('parameter').innerHTML='Ozon in Parts per Million';
}
function chooseCO()
{
selectedPara = 'co';
callPHP();
document.getElementById('parameter').innerHTML='Kohlenstoffmonoxid in Parts per Million';
}
function chooseNO2()
{
selectedPara = 'no2';
callPHP();
document.getElementById('parameter').innerHTML='Stickstoffdioxid in Parts per Million';
}
function chooseHumidity()
{
selectedPara = 'humidity';
callPHP();
document.getElementById('parameter').innerHTML='Luftfeuchtigkeit in Prozent';
}
//function for requesting data from the database with PHP and drawing the table
function callPHP(){
phpLocation = 'http://giv-geosoft2c.uni-muenster.de/createTable.php?date=' + date + '&month=' + month + '&year=' + year + '&selectedPara=' + selectedPara + '&id1=' + sensorId1 + '&id2=' + sensorId2 + '&id3=' + sensorId3;
$.ajax({
type: "GET",
url: phpLocation,
dataType: "script",
success: function(){
document.getElementById('table').innerHTML=table[0]+table[1];
}
});
}
</script>
</div><!--Close-side_content-->
</div><!--Close_Main=-->
</body>
</html>