2010-07-25 14:21:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
unset($vars['page']);
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
### Setup here
|
|
|
|
|
|
|
|
|
|
if($_SESSION['widescreen'])
|
|
|
|
|
{
|
|
|
|
|
$graph_width=1700;
|
|
|
|
|
$thumb_width=180;
|
2011-09-20 09:55:11 +00:00
|
|
|
} else {
|
2011-09-17 19:14:44 +00:00
|
|
|
$graph_width=1075;
|
|
|
|
|
$thumb_width=113;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-19 15:27:43 +00:00
|
|
|
if (!is_numeric($vars['from'])) { $vars['from'] = $config['time']['day']; }
|
|
|
|
|
if (!is_numeric($vars['to'])) { $vars['to'] = $config['time']['now']; }
|
2011-09-17 19:14:44 +00:00
|
|
|
|
|
|
|
|
preg_match('/^(?P<type>[A-Za-z0-9]+)_(?P<subtype>.+)/', mres($vars['type']), $graphtype);
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
$type = $graphtype['type'];
|
|
|
|
|
$subtype = $graphtype['subtype'];
|
2011-09-17 19:14:44 +00:00
|
|
|
$id = $vars['id'];
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if (is_file("includes/graphs/".$type."/auth.inc.php"))
|
|
|
|
|
{
|
|
|
|
|
include("includes/graphs/".$type."/auth.inc.php");
|
|
|
|
|
}
|
2010-08-01 14:17:06 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if (!$auth)
|
|
|
|
|
{
|
|
|
|
|
include("includes/error-no-perm.inc.php");
|
|
|
|
|
} else {
|
2011-09-26 12:16:05 +00:00
|
|
|
if (isset($config['graph_types'][$type][$subtype]['descr']))
|
|
|
|
|
{
|
|
|
|
|
$title .= " :: ".$config['graph_types'][$type][$subtype]['descr'];
|
|
|
|
|
} else {
|
|
|
|
|
$title .= " :: ".ucfirst($subtype);
|
|
|
|
|
}
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-25 22:10:03 +00:00
|
|
|
$graph_array = $vars;
|
2010-07-25 14:21:05 +00:00
|
|
|
$graph_array['height'] = "60";
|
2011-09-17 19:14:44 +00:00
|
|
|
$graph_array['width'] = $thumb_width;
|
2011-09-25 22:37:26 +00:00
|
|
|
$graph_array['legend'] = "no";
|
2010-07-25 14:21:05 +00:00
|
|
|
$graph_array['to'] = $now;
|
|
|
|
|
|
|
|
|
|
print_optionbar_start();
|
|
|
|
|
echo($title);
|
|
|
|
|
print_optionbar_end();
|
|
|
|
|
|
2011-09-25 22:37:26 +00:00
|
|
|
print_optionbar_start();
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-19 15:27:43 +00:00
|
|
|
$thumb_array = array('sixhour' => '6 Hours', 'day' => '24 Hours', 'twoday' => '48 Hours', 'week' => 'One Week', 'twoweek' => 'Two Weeks',
|
2011-09-17 19:14:44 +00:00
|
|
|
'month' => 'One Month', 'twomonth' => 'Two Months','year' => 'One Year', 'twoyear' => 'Two Years');
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-25 22:37:26 +00:00
|
|
|
echo('<table width=100%><tr>');
|
|
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
foreach ($thumb_array as $period => $text)
|
|
|
|
|
{
|
|
|
|
|
$graph_array['from'] = $config['time'][$period];
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
$link_array = $vars;
|
|
|
|
|
$link_array['from'] = $graph_array['from'];
|
|
|
|
|
$link_array['to'] = $graph_array['to'];
|
|
|
|
|
$link_array['page'] = "graphs";
|
|
|
|
|
$link = generate_url($link_array);
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-25 22:37:26 +00:00
|
|
|
echo('<td align=center>');
|
|
|
|
|
echo('<span class="device-head">'.$text.'</span><br />');
|
|
|
|
|
echo('<a href="'.$link.'">');
|
2011-09-17 19:14:44 +00:00
|
|
|
echo(generate_graph_tag($graph_array));
|
2011-09-25 22:37:26 +00:00
|
|
|
echo('</a>');
|
|
|
|
|
echo('</td>');
|
|
|
|
|
|
2011-09-17 19:14:44 +00:00
|
|
|
}
|
2010-07-25 14:21:05 +00:00
|
|
|
|
2011-09-25 22:37:26 +00:00
|
|
|
echo('</tr></table>');
|
2011-09-17 19:14:44 +00:00
|
|
|
|
2011-09-25 22:37:26 +00:00
|
|
|
$graph_array = $vars;
|
2010-07-25 14:21:05 +00:00
|
|
|
$graph_array['height'] = "300";
|
2011-09-17 19:14:44 +00:00
|
|
|
$graph_array['width'] = $graph_width;
|
2011-09-20 09:55:11 +00:00
|
|
|
|
2011-09-25 22:37:26 +00:00
|
|
|
echo("<hr />");
|
|
|
|
|
|
2011-09-26 16:06:18 +00:00
|
|
|
if ($vars['legend'] == "no")
|
2011-09-25 22:37:26 +00:00
|
|
|
{
|
|
|
|
|
echo(generate_link("Show Legend",$vars, array('page' => "graphs", 'legend' => NULL)));
|
|
|
|
|
} else {
|
|
|
|
|
echo(generate_link("Hide Legend",$vars, array('page' => "graphs", 'legend' => "no")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print_optionbar_end();
|
|
|
|
|
|
2011-06-14 14:04:56 +00:00
|
|
|
echo generate_graph_js_state($graph_array);
|
|
|
|
|
|
2011-09-20 15:41:59 +00:00
|
|
|
echo('<div style="width: '.$graph_array['width'].'; margin: auto;">');
|
2010-07-25 14:21:05 +00:00
|
|
|
echo(generate_graph_tag($graph_array));
|
|
|
|
|
echo("</div>");
|
2010-08-01 14:17:06 +00:00
|
|
|
}
|
|
|
|
|
|
2011-04-22 14:59:10 +00:00
|
|
|
?>
|