codice:
<?phprequire_once 'inc'. DIRECTORY_SEPARATOR . 'global.inc.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>DomusHouse</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-control" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="apple-touch-icon" sizes="57x57" href="../icon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="../icon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="../icon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="../icon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="../icon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="../icon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="../icon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="../icon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="../icon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="../icon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="../icon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="../icon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="../icon/favicon-16x16.png">
<link rel="manifest" href="../icon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="../icon/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<?php
if ( file_exists( 'css/style.user.css' ) ) {
echo '<link rel="stylesheet" type="text/css" href="css/style.user.css">';
}
?>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>My Title</h1>
</div><!-- /header -->
<div data-role="content"data-theme="b">
<center>
<div id="container"class="ui-responsive">
<?php
$when = sprintf( __('%1$s %2$s %3$s %4$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ) ),
strftime( '%e' ),
mb_ucfirst( strftime( '%B' ) ),
strftime( '%Y' ),
strftime( '%H' ),
strftime( '%M' )
);
$mm_display_when = ( (int) @$_GET['mm'] == 1 ) ? true : false;
if ( is_array( $result ) ) {
$scales = $result['scales'];
unset( $result['scales'] );
if ( count( $result ) > 0 ) {
foreach ($result as $macid => $data) {
$name = $data['station'];
$blocks = 1 + count($data['m']);
if ( isset( $_GET['n'] ) )
if ( strtolower( $name ) != strtolower( $_GET['n'] ) )
continue;
$tempc = (float) $data['results']['Temperature'];
$when = sprintf( __('measured %1$s %2$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ,$data['time'] ) ),
strftime( '%e' ,$data['time'] ),
mb_ucfirst( strftime( '%B' ,$data['time'] ) ),
strftime( '%Y' ,$data['time'] ),
strftime( '%H' ,$data['time'] ),
strftime( '%M' ,$data['time'] )
);
echo '<table class="' . htmlentities( $name . ' m' . sanitize_mac_id( $macid ) ) . '">';
echo '<tr class="stationname"><td colspan="' . $blocks . '" id="title" align="center">' . $name . '</td></tr>';
echo '<tr class="stationdata">';
echo ' <td id="inside" valign="top" align="left">';
echo ' <table>';
echo ' <tr><th align="left" class="insideimage"></th>';
echo ' <td class="te" style="color:' . get_color( (int) $tempc ) . '">';
if ( $unitmetric == 0 )
echo sprintf( __('%s°C') , round( $tempc , 1 ) );
else
echo sprintf( __('%s°F') , round ( ( 9 / 5 ) * $tempc + 32 , 1) );
echo ' </td>';
echo ' </tr>';
$device_order = ( isset( $_GET['do'] ) ) ? $_GET['do'] : NETATMO_DEVICE_DEFAULT_VALUES;
$device_disp = 0;
foreach ( explode( ',' , $device_order ) as $t) {
$t = trim($t);
switch ($t) {
case 'Humidity':
if ( (int) $data['results']['Humidity'] < 40 )
$humiditycolor = get_color( (int) $data['results']['Humidity'] , 20 , 40 , 255 , 0 , 0 , 0 , 255 , 0 );
else if ( (int) $data['results']['Humidity']>50 )
$humiditycolor = get_color( (int) $data['results']['Humidity'] , 50 , 80 , 0 , 255 , 0 , 255 , 0 , 0 );
else
$humiditycolor = 'rgb( 0,255,0 )';
echo '<tr><th>' . __('Humidity') . '</th>';
echo ' <td style="color:' . $humiditycolor.'">' . sprintf( __('%s%%') , $data['results']['Humidity'] ) . '</td>';
echo '</tr>';
$device_disp++;
break;
case 'CO2':
echo '<tr><th>' . __('CO2') . '</th>';
echo ' <td style="color:' . get_color( (int) $data['results']['Co2'],0,3000,0,255,0,255,0,0 ).'">' . sprintf( __('%sppm') , $data['results']['Co2'] ) . '</td>';
echo '</tr>';
$device_disp++;
break;
case 'Noise':
echo '<tr><th>' . __('Noise') . '</th>';
echo ' <td style="color:' . get_color( (int) $data['results']['Noise'],30,90,0,255,0,255,0,0 ).'">' . sprintf( __('%sdB') , $data['results']['Noise'] ) . '</td>';
echo '</tr>';
$device_disp++;
break;
case 'Pressure':
echo '<tr><th>' . __('Pressure') . '</th>';
echo ' <td>';
if ( $unitpressure == 0 )
echo sprintf( __('%smbar') , round( (int) $data['results']['Pressure'] ) );
else if ( $unitpressure == 1 )
echo sprintf( __('%sinHg') , round( (int) $data['results']['Pressure'] / 33.8638815 , 2 ) );
else
echo sprintf( __('%smmHg') , round( (int) $data['results']['Pressure'] * 0.750061 ) );
echo ' </td>';
echo '</tr>';
$device_disp++;
break;
case 'TemperatureMin' :
echo '<tr><th valign="top">' . __('Temp Min') . '</th><td valign="top" class="mm">';
if ( $unitmetric == 0 )
echo sprintf( __('%s°C') , round( (float) $data['misc']['min_temp'] , 1 ) );
else
echo sprintf( __('%s°F') , round ( ( 9 / 5 ) * (int) $data['misc']['min_temp'] + 32 , 1) );
echo '</td></tr>';
$device_disp++;
if ($mm_display_when) {
echo '<tr><td class="mmd" colspan="2">';
echo sprintf(
__('on %1$s %2$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ,$data['misc']['date_min_temp'] ) ),
strftime( '%e' ,$data['misc']['date_min_temp'] ),
mb_ucfirst( strftime( '%B' ,$data['misc']['date_min_temp'] ) ),
strftime( '%Y' ,$data['misc']['date_min_temp'] ),
strftime( '%H' ,$data['misc']['date_min_temp'] ),
strftime( '%M' ,$data['misc']['date_min_temp'] )
);
echo '</td></tr>';
$device_disp++;
}
break;
case 'TemperatureMax' :
echo '<tr><th valign="top">' . __('Temp Max') . '</th><td valign="top" class="mm">';
if ( $unitmetric == 0 )
echo sprintf( __('%s°C') , round( (float) $data['misc']['max_temp'] , 1 ) );
else
echo sprintf( __('%s°F') , round ( ( 9 / 5 ) * (int) $data['misc']['max_temp'] + 32 , 1) );
echo '</td></tr>';
$device_disp++;
if ($mm_display_when) {
echo '<tr><td class="mmd" colspan="2">';
echo sprintf( __('on %1$s %2$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ,$data['misc']['date_max_temp'] ) ),
strftime( '%e' ,$data['misc']['date_max_temp'] ),
mb_ucfirst( strftime( '%B' ,$data['misc']['date_max_temp'] ) ),
strftime( '%Y' ,$data['misc']['date_max_temp'] ),
strftime( '%H' ,$data['misc']['date_max_temp'] ),
strftime( '%M' ,$data['misc']['date_max_temp'] )
);
echo '</td></tr>';
$device_disp++;
}
break;
case 'HumidityMin' :
echo '<tr><th valign="top">' . __('Humidity Min') . '</th><td valign="top" class="mm">';
echo sprintf( __('%s%%') , (int) $data['misc']['min_hum'] );
echo '</td></tr>';
$device_disp++;
if ($mm_display_when) {
echo '<tr><td class="mmd" colspan="2">';
echo sprintf( __('on %1$s %2$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ,$data['misc']['date_min_hum'] ) ),
strftime( '%e' ,$data['misc']['date_min_hum'] ),
mb_ucfirst( strftime( '%B' ,$data['misc']['date_min_hum'] ) ),
strftime( '%Y' ,$data['misc']['date_min_hum'] ),
strftime( '%H' ,$data['misc']['date_min_hum'] ),
strftime( '%M' ,$data['misc']['date_min_hum'] )
);
echo '</td></tr>';
$device_disp++;
}
break;
case 'HumidityMax' :
echo '<tr><th valign="top">' . __('Humidity Max') . '</th><td valign="top" class="mm">';
echo sprintf( __('%s%%') , (int) $data['misc']['max_hum'] );
echo '</td></tr>';
$device_disp++;
if ($mm_display_when) {
echo '<tr><td class="mmd" colspan="2">';
echo sprintf( __('on %1$s %2$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ,$data['misc']['date_max_hum'] ) ),
strftime( '%e' ,$data['misc']['date_max_hum'] ),
mb_ucfirst( strftime( '%B' ,$data['misc']['date_max_hum'] ) ),
strftime( '%Y' ,$data['misc']['date_max_hum'] ),
strftime( '%H' ,$data['misc']['date_max_hum'] ),
strftime( '%M' ,$data['misc']['date_max_hum'] )
);
echo '</td></tr>';
$device_disp++;
}
break;
case 'PressureMin' :
echo '<tr><th valign="top">' . __('Pressure Min') . '</th><td valign="top" class="mm">';
if ( $unitpressure == 0 )
echo sprintf( __('%smbar') , round( (int) $data['misc']['min_pressure'] ) );
else if ( $unitpressure == 1 )
echo sprintf( __('%sinHg') , round( (int) $data['misc']['min_pressure'] / 33.8638815 , 2 ) );
else
echo sprintf( __('%smmHg') , round( (int) $data['misc']['min_pressure'] * 0.750061 ) );
echo '</td></tr>';
$device_disp++;
if ($mm_display_when) {
echo '<tr><td class="mmd" colspan="2">';
echo sprintf( __('on %1$s %2$s at %5$s:%6$s'),
mb_ucfirst( strftime( '%A' ,$data['misc']['date_min_pressure'] ) ),
strftime( '%e' ,$data['misc']['date_min_pressure'] ),
mb_ucfirst( strftime( '%B' ,$data['misc']['date_min_pressure'] ) ),
strftime( '%Y' ,$data['misc']['date_min_pressure'] ),
strftime( '%H' ,$data['misc']['date_min_pressure'] ),
strftime( '%M' ,$data['misc']['date_min_pressure'] )
);
echo '</td></tr>';
$device_disp++;
}
break;