X-Git-Url: https://git.rvb.name/weathermon.git/blobdiff_plain/065f212afe549f1dfc2fee1e42349b725d8e40c5..4177ee347c6a063ac3e115d5419edfc2ae5d67fe:/web/index.php?ds=inline diff --git a/web/index.php b/web/index.php index dfc7450..37251e6 100644 --- a/web/index.php +++ b/web/index.php @@ -2,6 +2,7 @@ + WeatherMon (Последние 24 часа) @@ -9,12 +10,20 @@ a:visited { text-decoration: none; color:darkblue; } a:link { text-decoration: none; color:blue; } a:hover { text-decoration: none; color:navy; } + .header { font-size: 16; float: left; margin: 10px;} + .timestamp { font-size: 16; margin: 10px;} + .value { font-size: 60; margin: 10px; } + .block { float: left; margin: 20px; } + .container { clear: both; } + .footer { clear: both; margin: 20px; font-size: 20; } - + +
false)))) { die($err); @@ -38,16 +47,57 @@ $q -> execute(); while ($row = $q -> fetch(PDO::FETCH_ASSOC)) { - echo '

'.$row['s_description'].'/'.$row['st_description'].'

'; + echo '
'; + echo '
'.$row['s_description'].'/'.$row['st_description'].'
'; + +$ql = $db -> prepare( + ' + SELECT unix_timestamp(timestamp) timestamp,DATE_FORMAT(timestamp,"%H:%i") printable,value + FROM + meteo.sensor_values + WHERE + sensor_id='.$row['sensor_id'].' and parameter_id='.$row['param_id'].' and timestamp>addtime(now(), -3600) + ORDER BY + timestamp desc + ' + ); + +$ql -> execute(); + +$printable_ts = "?"; +$value = "?"; + +if ($rowl = $ql -> fetch(PDO::FETCH_ASSOC)) { + + $timestamp = $rowl['timestamp']; + $printable_ts = $rowl['printable']; + $value = $rowl['value']; + + $units = get_unit($db,$row['param_id']); + $from_unit = $units['from']; + $to_unit = $units['to']; + $param_unit = $units['name']; + + $val = convert_unit($db,$value,$from_unit,$to_unit); + +} + +echo '
'.$printable_ts.'
'; +echo '
'.$val.' '.$param_unit.'
'; ?> -
+
"; + } ?> +
+ \ No newline at end of file