-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstripchart.php
49 lines (42 loc) · 1.47 KB
/
stripchart.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
<?php
include('connect_db.php');
require 'smarty3/Smarty.class.php';
$smarty = new Smarty;
$smarty->assign('pagetitle','Homelog - stripchart');
$fromvalue=$_GET['from'];
// Must parse the values to make sure they are valid dates
$tst=date_parse($fromvalue);
if($tst['error_count']){$fromvalue='';}
$smarty->assign('fromvalue',$fromvalue);
$tovalue=$_GET['to'];
$tst=date_parse($tovalue);
if($tst['error_count']){$tovalue='';}
$smarty->assign('tovalue',$tovalue);
$selected=$_GET['selected']?$_GET['selected']:2;
$smarty->assign('selected',$selected);
$selid=$_GET['selid']?$_GET['selid']:0;
$smarty->assign('selid',$selid);
$where=" where active = true ";
$showalllink="allsensors=true";
$showalltext="All";
if($_GET['allsensors'] == "true") {
$where = "";
$showalllink="";
$showalltext="Active";}
$smarty->assign('showalllink',$showalllink);
$smarty->assign('showalltext',$showalltext);
$sql="select concat,id from sensorlist $where order by stationname,priority";
$qry=$dbh->prepare($sql);
$qry->execute();
$sensorset=$qry->fetchAll(PDO::FETCH_ASSOC);
// print_r($sensorset);
foreach($sensorset as $s){
$params[$s['id']]=$s['concat'];}
//print_r($params);
$smarty->assign("sensors",$params);
$location="http://www.yr.no/sted/Norge/Akershus/Frogn/Karlsrud";
$smarty->assign("weatherdata","$location/time_for_time_detaljert.html");
$smarty->assign("meteogram", "$location/avansert_meteogram.png");
$smarty->assign('vlevel',voltagelevel());
$smarty->display('stripchart.tpl');
?>