= '5') {
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.device_id = D.device_id ORDER BY D.hostname, T.temp_descr";
} else {
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D, devices_perms as P WHERE T.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, T.temp_descr";
}
$query = mysql_query($sql);
echo('
');
echo('
Device |
Sensor |
|
|
Current |
Alert |
Notes |
');
$row = 1;
while($temp = mysql_fetch_array($query))
{
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$weekly_temp = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=500&height=150";
$temp_popup = "', LEFT);\" onmouseout=\"return nd();\">
" . $temp['temp_descr'] . "";
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
if($temp['temp_current'] >= $temp['temp_limit']) { $alert = '
'; } else { $alert = ""; }
$temp_day = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$day&to=$now&width=300&height=100";
$temp_week = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$week&to=$now&width=300&height=100";
$temp_month = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$month&to=$now&width=300&height=100";
$temp_year = "graph.php?id=" . $temp['temp_id'] . "&type=temperature&from=$year&to=$now&width=300&height=100";
$temp_minigraph = "
".$temp['hostname']." - ".$temp['temp_descr'];
$temp_minigraph .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
echo("
" . generatedevicelink($temp) . " |
$temp_popup |
$temp_minigraph |
$alert |
" . $temp['temp_current'] . " °C |
" . $temp['temp_limit'] . " °C |
" . (isset($temp['temp_notes']) ? $temp['temp_notes'] : '') . " |
\n");
$row++;
}
echo("
");
?>