if (!DBfetch(DBselect('SELECT g.graphid FROM graphs g WHERE g.graphid=' . $_REQUEST['graphid']))) {
    show_error_message(_('No graphs defined.'));
}
$db_data = API::Graph()->get(array('graphids' => $_REQUEST['graphid'], 'selectHosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND));
if (empty($db_data)) {
    access_deny();
} else {
    $db_data = reset($db_data);
}
$host = reset($db_data['hosts']);
/*
 * Display
 */
$timeline = CScreenBase::calculateTime(array('profileIdx' => get_request('profileIdx', 'web.screens'), 'profileIdx2' => get_request('profileIdx2'), 'updateProfile' => get_request('updateProfile', true), 'period' => get_request('period'), 'stime' => get_request('stime')));
$graph = new CPie($db_data['graphtype']);
$graph->setPeriod($timeline['period']);
$graph->setSTime($timeline['stime']);
if (isset($_REQUEST['border'])) {
    $graph->setBorder(0);
}
$width = get_request('width', 0);
if ($width <= 0) {
    $width = $db_data['width'];
}
$height = get_request('height', 0);
if ($height <= 0) {
    $height = $db_data['height'];
}
$graph->setWidth($width);
$graph->setHeight($height);
$graph->setHeader($host['host'] . ': ' . $db_data['name']);
示例#2
0
check_fields($fields);
if (!DBfetch(DBselect('select graphid from graphs where graphid=' . $_REQUEST['graphid']))) {
    show_error_message(S_NO_GRAPH_DEFINED);
}
$options = array('graphids' => $_REQUEST['graphid'], 'select_hosts' => 1, 'extendoutput' => 1);
$db_data = CGraph::get($options);
if (empty($db_data)) {
    access_deny();
} else {
    $db_data = reset($db_data);
}
$host = reset($db_data['hosts']);
$effectiveperiod = navigation_bar_calc();
$graph = new CPie($db_data['graphtype']);
if (isset($_REQUEST['period'])) {
    $graph->setPeriod($_REQUEST['period']);
}
if (isset($_REQUEST['stime'])) {
    $graph->setSTime($_REQUEST['stime']);
}
if (isset($_REQUEST['border'])) {
    $graph->setBorder(0);
}
$width = get_request('width', 0);
if ($width <= 0) {
    $width = $db_data['width'];
}
$height = get_request('height', 0);
if ($height <= 0) {
    $height = $db_data['height'];
}