";
}
$rras = get_associated_rras($_REQUEST['local_graph_id']);
switch ($_REQUEST['action']) {
case 'view':
api_plugin_hook_function('page_buttons',
array('lgid' => $_REQUEST['local_graph_id'],
'leafid' => '',//$leaf_id,
'mode' => 'mrtg',
'rraid' => $_REQUEST['rra_id'])
);
?>
0) {
$graph_end = time();
foreach ($rras as $rra) {
$graph_start = $graph_end - db_fetch_cell_prepared('SELECT timespan FROM rra WHERE id = ?', array($rra['id']));
$aggregate_url = aggregate_build_children_url($_REQUEST['local_graph_id'], $graph_start, $graph_end, $rra['id']);
?>
0) {
foreach ($rras as $rra) {
if ($rra['steps'] * $rra['rows'] * $rra['rrd_step'] > $max_timespan) {
$max_timespan = $rra['steps'] * $rra['rows'] * $rra['rrd_step'];
}
}
}
/* fetch information for the current RRA */
if (isset($_REQUEST['rra_id']) && $_REQUEST['rra_id'] > 0) {
$rra = db_fetch_row_prepared('SELECT id, timespan, steps, name FROM rra WHERE id = ?', array($_REQUEST['rra_id']));
}else{
$rra = db_fetch_row_prepared('SELECT id, timespan, steps, name FROM rra WHERE id = ?', array($rras[0]['id']));
}
/* define the time span, which decides which rra to use */
$timespan = -($rra['timespan']);
/* find the step and how often this graph is updated with new data */
$ds_step = db_fetch_cell_prepared('SELECT
data_template_data.rrd_step
FROM (data_template_data, data_template_rrd, graph_templates_item)
WHERE graph_templates_item.task_item_id = data_template_rrd.id
AND data_template_rrd.local_data_id = data_template_data.local_data_id
AND graph_templates_item.local_graph_id = ?
LIMIT 0,1', array(get_request_var_request('local_graph_id')));
$ds_step = empty($ds_step) ? 300 : $ds_step;
$seconds_between_graph_updates = ($ds_step * $rra['steps']);
$now = time();
if (isset($_REQUEST['graph_end']) && ($_REQUEST['graph_end'] <= $now - $seconds_between_graph_updates)) {
$graph_end = $_REQUEST['graph_end'];
}else{
$graph_end = $now - $seconds_between_graph_updates;
}
if (isset($_REQUEST['graph_start'])) {
if (($graph_end - $_REQUEST['graph_start'])>$max_timespan) {
$graph_start = $now - $max_timespan;
}else {
$graph_start = $_REQUEST['graph_start'];
}
}else{
$graph_start = $now + $timespan;
}
/* required for zoom out function */
if ($graph_start == $graph_end) {
$graph_start--;
}
$graph = db_fetch_row_prepared('SELECT * FROM graph_templates_graph WHERE local_graph_id = ?', array(get_request_var_request('local_graph_id')));
$graph_height = $graph['height'];
$graph_width = $graph['width'];
if (read_graph_config_option('custom_fonts') == 'on' & read_graph_config_option('title_size') != '') {
$title_font_size = read_graph_config_option('title_size');
}elseif (read_config_option('title_size') != '') {
$title_font_size = read_config_option('title_size');
}else {
$title_font_size = 10;
}
?>
' graph_width='' graph_height='' title_font_size='' style="min-height: ;">
" . htmlspecialchars($graph["title_cache"]) . " " : "");?>
_properties' class='hyperLink properties'>
_csv' class='hyperLink properties'>
'zoom', 'local_graph_id' => $_REQUEST['local_graph_id'], 'rra' => $_REQUEST['rra_id'], 'view_type' => $_REQUEST['view_type'])); ?>
\n";
print "\n";
print "\n";
print "\n";
print trim(@rrdtool_function_graph(get_request_var_request('local_graph_id'), get_request_var_request('rra_id'), $graph_data_array));
print " \n";
print "
\n";
exit;
break;
}
print '';
bottom_footer();