This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/htdocs/image.backupevents.php

58 lines
1.7 KiB
PHP
Raw Normal View History

2011-01-13 14:45:19 +00:00
<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/image.backupevents.php,v 1.6 2009/04/19 03:53:40 wurley Exp $
# Required Libraries
require './common.php';
initJPGraph(true);
if (! isset($_SESSION['graph']['backupevent']))
exit;
# Make sure all our keys for each sched are the same.
foreach ($_SESSION['graph']['backupevent']['data'] as $sched => $details) {
foreach ($_SESSION['graph']['backupevent']['legend'] as $key => $count) {
@$_SESSION['graph']['backupevent']['data'][$sched][$key] += 0;
}
ksort($_SESSION['graph']['backupevent']['data'][$sched]);
}
$graph_row = 2;
$xcounter = 1;
$ycounter = 1;
$numrows = round(count($_SESSION['graph']['backupevent']['data'])/$graph_row);
$graph = new PieGraph(500,30+180*$numrows,'auto');
foreach ($_SESSION['graph']['backupevent']['data'] as $sched => $details) {
ksort($details);
$newsched = preg_replace('/-/','_',$sched);
$$newsched = new PiePlot(array_values($details));
$$newsched->SetCenter(120+(($xcounter%$graph_row)*160),120+(($ycounter-1)*180));
$$newsched->SetGuideLines(false,false);
$$newsched->SetGuideLinesAdjust(1.0);
$$newsched->SetSize(60);
$$newsched->SetTheme('sand');
$$newsched->value->SetFormat('%2.1f%%');
$$newsched->title->Set($sched);
$$newsched->title->SetMargin(10);
if ($xcounter == 1)
$$newsched->SetLegends(array_keys($details));
$graph->Add($$newsched);
if (! ($xcounter%$graph_row))
$ycounter++;
$xcounter++;
}
$graph->legend->SetFillColor('azure');
$graph->SetMarginColor('azure2');
$graph->title->Set(sprintf('Schedule Backup Status for %s',$app['server']->GetStatusDetail('SERVER_NAME')));
# Display the chart
unset($_SESSION['graph']['backupevent']);
$graph->Stroke();
?>