/*
 * 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']);
if ($db_data['show_3d']) {
    $graph->switchPie3D();
}
$graph->showLegend($db_data['show_legend']);
$result = DBselect('SELECT gi.*' . ' FROM graphs_items gi' . ' WHERE gi.graphid=' . $db_data['graphid'] . ' ORDER BY gi.sortorder,gi.itemid DESC');
while ($db_data = DBfetch($result)) {
    $graph->addItem($db_data['itemid'], $db_data['calc_fnc'], $db_data['color'], $db_data['type']);
}
$graph->draw();
require_once dirname(__FILE__) . '/include/page_footer.php';
Example #2
0
$db_data = CItem::get($options);
$db_data = zbx_toHash($db_data, 'itemid');
foreach ($items as $id => $gitem) {
    if (!isset($db_data[$gitem['itemid']])) {
        access_deny();
    }
}
$effectiveperiod = navigation_bar_calc();
$graph = new CPie(get_request('graphtype', GRAPH_TYPE_NORMAL));
$graph->setHeader(get_request('name', ''));
$graph3d = get_request('graph3d', 0);
$legend = get_request('legend', 0);
if ($graph3d == 1) {
    $graph->switchPie3D();
}
$graph->showLegend($legend);
unset($host);
if (isset($_REQUEST['period'])) {
    $graph->SetPeriod($_REQUEST['period']);
}
if (isset($_REQUEST['from'])) {
    $graph->SetFrom($_REQUEST['from']);
}
if (isset($_REQUEST['stime'])) {
    $graph->SetSTime($_REQUEST['stime']);
}
if (isset($_REQUEST['border'])) {
    $graph->SetBorder(0);
}
$graph->SetWidth(get_request('width', 400));
$graph->SetHeight(get_request('height', 300));
            show_error_message(_('Warning. Cannot display more than one item with type "Graph sum".'));
            break;
        }
    }
}
/*
 * Display
 */
if ($isDataValid) {
    navigation_bar_calc();
    $graph = new CPie(get_request('graphtype', GRAPH_TYPE_NORMAL));
    $graph->setHeader(get_request('name', ''));
    if (!empty($_REQUEST['graph3d'])) {
        $graph->switchPie3D();
    }
    $graph->showLegend(get_request('legend', 0));
    unset($host);
    if (isset($_REQUEST['period'])) {
        $graph->setPeriod($_REQUEST['period']);
    }
    if (isset($_REQUEST['from'])) {
        $graph->setFrom($_REQUEST['from']);
    }
    if (isset($_REQUEST['stime'])) {
        $graph->setSTime($_REQUEST['stime']);
    }
    if (isset($_REQUEST['border'])) {
        $graph->setBorder(0);
    }
    $graph->setWidth(get_request('width', 400));
    $graph->setHeight(get_request('height', 300));