= '5') { $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='temperature' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_index, S.sensor_descr"; } else { $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='temperature' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_index, S.sensor_descr"; } $graph_type = "sensor_temperature"; $query = mysql_query($sql); echo(''); echo(''); $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['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $temp_popup = "', LEFT);\" onmouseout=\"return nd();\"> " . $temp['sensor_descr'] . ""; $temp['sensor_current'] = round($temp['sensor_current'],1); $temp_perc = $temp['sensor_current'] / $temp['sensor_limit'] * 100; $temp_colour = percent_colour($temp_perc); if($temp['sensor_current'] >= $temp['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } $temp_day = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $temp_week = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $temp_month = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; $temp_year = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=300&height=100"; $temp_minigraph = "".$temp['hostname']." - ".$temp['sensor_descr']; $temp_minigraph .= "
', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >"; echo("\n"); if($_GET['optb'] == "graphs") { ## If graphs echo(""); } # endif graphs $row++; } echo("
Device Sensor Current Alert Notes
" . generate_device_link($temp) . " $temp_popup $temp_minigraph $alert " . $temp['sensor_current'] . " °C " . $temp['sensor_limit'] . " °C " . (isset($temp['sensor_notes']) ? $temp['sensor_notes'] : '') . "
"); $daily_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; $daily_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; $weekly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; $weekly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; $monthly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; $monthly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; $yearly_graph = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; $yearly_url = "graph.php?id=" . $temp['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; echo("', LEFT);\" onmouseout=\"return nd();\"> "); echo("', LEFT);\" onmouseout=\"return nd();\"> "); echo("', LEFT);\" onmouseout=\"return nd();\"> "); echo("', LEFT);\" onmouseout=\"return nd();\"> "); echo("
"); ?>