mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
second attempt at device graphs setup
git-svn-id: http://www.observium.org/svn/observer/trunk@1564 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,45 +1,61 @@
|
||||
<?php
|
||||
|
||||
### Sections are printed in the order they exist in $config['graph_sections']
|
||||
### Graphs are printed in the order they exist in $config['graph_types']
|
||||
|
||||
$bg="#ffffff";
|
||||
|
||||
echo('<div style="clear: both;">');
|
||||
|
||||
|
||||
print_optionbar_start('', '');
|
||||
|
||||
$sep = "";
|
||||
$query = mysql_query("SELECT graph_section FROM device_graphs AS D, graph_types AS G WHERE D.device_id = '".$device['device_id']."' AND G.graph_subtype = D.graph AND G.graph_type = 'device' GROUP BY G.graph_section ORDER BY graph_section");
|
||||
while($section = mysql_fetch_assoc($query))
|
||||
$query = mysql_query("SELECT * FROM device_graphs WHERE device_id = '".$device['device_id']."'");
|
||||
while($graph = mysql_fetch_assoc($query))
|
||||
{
|
||||
$type = strtolower($section['graph_section']);
|
||||
if(!$_GET['opta']) { $_GET['opta'] = $type; }
|
||||
echo($sep);
|
||||
if ($_GET['opta'] == $type)
|
||||
$section = $config['graph_types']['device'][$graph['graph']]['section'];
|
||||
$graph_enable[$section][$graph['graph']] = $graph['graph'];
|
||||
}
|
||||
|
||||
foreach($config['graph_sections'] as $section)
|
||||
{
|
||||
if(is_array($graph_enable[$section]))
|
||||
{
|
||||
echo("<strong>");
|
||||
echo('<img src="images/icons/'.$type.'.png" class="optionicon" />');
|
||||
$type = strtolower($section);
|
||||
if(!$_GET['opta']) { $_GET['opta'] = $type; }
|
||||
echo($sep);
|
||||
if ($_GET['opta'] == $type)
|
||||
{
|
||||
echo("<strong>");
|
||||
echo('<img src="images/icons/'.$type.'.png" class="optionicon" />');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />');
|
||||
}
|
||||
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type ."</a>\n");
|
||||
if ($_GET['opta'] == $type) { echo("</strong>"); }
|
||||
$sep = " | ";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />');
|
||||
}
|
||||
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type ."</a>\n");
|
||||
if ($_GET['opta'] == $type) { echo("</strong>"); }
|
||||
$sep = " | ";
|
||||
}
|
||||
unset ($sep);
|
||||
print_optionbar_end();
|
||||
|
||||
$sql = "SELECT * FROM device_graphs AS D, graph_types AS G WHERE D.device_id = '".$device['device_id']."'";
|
||||
$sql .=" AND G.graph_subtype = D.graph AND G.graph_type = 'device' AND G.graph_section = '".mres($_GET['opta'])."' ORDER BY graph_order, graph_subtype";
|
||||
$query = mysql_query($sql);
|
||||
while($graph = mysql_fetch_assoc($query))
|
||||
#echo("<pre>");
|
||||
#print_r($_GET['opta']);
|
||||
#print_r($graph_enable);
|
||||
#echo("</pre>");
|
||||
|
||||
$graph_enable = $graph_enable[$_GET['opta']];
|
||||
|
||||
foreach($config['graph_types']['device'] as $graph => $entry)
|
||||
{
|
||||
|
||||
$graph_title = $graph['graph_descr'];
|
||||
$graph_type = "device_" . $graph['graph_subtype'];
|
||||
include ("includes/print-device-graph.php");
|
||||
|
||||
if($graph_enable[$graph])
|
||||
{
|
||||
$graph_title = $config['graph_types']['device'][$graph]['descr'];
|
||||
$graph_type = "device_" . $graph;
|
||||
include ("includes/print-device-graph.php");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user