= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ''; } } // FIXME - make this "four graphs in popup" a function/include and "small graph" a function. // FIXME - So now we need to clean this up and move it into a function. Isn't it just "print-graphrow"? // FIXME - DUPLICATED IN device/overview/sensors $graph_colour = str_replace('#', '', $row_colour); $graph_array = array(); $graph_array['height'] = '100'; $graph_array['width'] = '210'; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $sensor['sensor_id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = 'no'; $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link_graph = generate_url($link_array); $link = generate_url(array('page' => 'device', 'device' => $sensor['device_id'], 'tab' => 'health', 'metric' => $sensor['sensor_class'])); $overlib_content = '

'.$sensor['hostname'].' - '.$sensor['sensor_descr'].'

'; foreach (array('day', 'week', 'month', 'year') as $period) { $graph_array['from'] = $config['time'][$period]; $overlib_content .= str_replace('"', "\'", generate_graph_tag($graph_array)); } $overlib_content .= '
'; $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; // the 00 at the end makes the area transparent. $graph_array['from'] = $config['time']['day']; $sensor_minigraph = generate_lazy_graph_tag($graph_array); $sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, ''); $response[] = array( 'hostname' => generate_device_link($sensor), 'sensor_descr' => overlib_link($link, $sensor['sensor_descr'], $overlib_content, null), 'graph' => overlib_link($link_graph, $sensor_minigraph, $overlib_content, null), 'alert' => $alert, 'sensor_current' => $sensor['sensor_current'].$unit, 'sensor_range' => round($sensor['sensor_limit_low'], 2).$unit.' - '.round($sensor['sensor_limit'], 2).$unit, ); if ($_POST['view'] == 'graphs') { $daily_graph = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=211&height=100'; $daily_url = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['day'].'&to='.$config['time']['now'].'&width=400&height=150'; $weekly_graph = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['week'].'&to='.$config['time']['now'].'&width=211&height=100'; $weekly_url = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['week'].'&to='.$config['time']['now'].'&width=400&height=150'; $monthly_graph = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now'].'&width=211&height=100'; $monthly_url = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['month'].'&to='.$config['time']['now'].'&width=400&height=150'; $yearly_graph = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['year'].'&to='.$config['time']['now'].'&width=211&height=100'; $yearly_url = 'graph.php?id='.$sensor['sensor_id'].'&type='.$graph_type.'&from='.$config['time']['year'].'&to='.$config['time']['now'].'&width=400&height=150'; $response[] = array( 'hostname' => "', LEFT);\" onmouseout=\"return nd();\"> ", 'sensor_descr' => "', LEFT);\" onmouseout=\"return nd();\"> ", 'graph' => "', LEFT);\" onmouseout=\"return nd();\"> ", 'alert' => '', 'sensor_current' => "', LEFT);\" onmouseout=\"return nd();\"> ", 'sensor_range' => '', ); } //end if }//end foreach $output = array( 'current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $count, ); echo _json_encode($output);