Exemple #1
0
foreach ($items as $item) {
    if ($item['type'] == GRAPH_ITEM_SUM) {
        if (!in_array($item['type'], $types)) {
            array_push($types, $item['type']);
        } else {
            show_error_message(_('Cannot display more than one item with type "Graph sum".'));
            break;
        }
    }
}
/*
 * Display
 */
if ($isDataValid) {
    navigation_bar_calc();
    $graph = new CPieGraphDraw(getRequest('graphtype', GRAPH_TYPE_NORMAL));
    $graph->setHeader(getRequest('name', ''));
    if (!empty($_REQUEST['graph3d'])) {
        $graph->switchPie3D();
    }
    $graph->showLegend(getRequest('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']);
    }
Exemple #2
0
check_fields($fields);
/*
 * Permissions
 */
$dbGraph = API::Graph()->get(array('graphids' => $_REQUEST['graphid'], 'selectHosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND));
if (!$dbGraph) {
    access_deny();
} else {
    $dbGraph = reset($dbGraph);
}
$host = reset($dbGraph['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 CPieGraphDraw($dbGraph['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 = $dbGraph['width'];
}
$height = get_request('height', 0);
if ($height <= 0) {
    $height = $dbGraph['height'];
}
$graph->setWidth($width);
$graph->setHeight($height);