5 * Copyright 2003-2004 (c) GForge LLC
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once '../env.inc.php';
24 require_once $gfcommon.'include/pre.php';
25 require_once(forge_get_config('jpgraph_path').'/jpgraph.php');
26 require_once(forge_get_config('jpgraph_path').'/jpgraph_pie.php');
27 require_once(forge_get_config('jpgraph_path').'/jpgraph_pie3d.php');
28 require_once $gfcommon.'reporting/ReportSiteTime.class.php';
29 require_once $gfcommon.'reporting/report_utils.php';
31 session_require_global_perm ('forge_stats', 'read') ;
33 $start = getIntFromRequest('start');
34 $end = getIntFromRequest('end');
35 $type = getStringFromRequest('type');
40 $report=new ReportSiteTime($type,$start,$end);
43 // Check for error, such as license key problem
45 if ($report->isError()) {
46 exit_error($report->getErrorMessage());
49 // XXX ogi: Isn't it $type?
50 if (!isset($datatype)) {
55 $start=mktime(0,0,0,date('m'),1,date('Y'));;
63 // Create the graph. These two calls are always required
64 $graph = new PieGraph(640, 480,"auto");
65 $graph->SetMargin(50,10,35,80);
67 $arr['tasks']='By Task';
68 $arr['category']='By Category';
69 $arr['subproject']='By Subproject';
70 $arr['user']='By User';
72 $graph->title->Set("Time Report ".$arr[$type]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
73 $graph->subtitle->Set(forge_get_config ('forge_name'));
75 report_pie_arr($report->labels,$report->getData());
77 $p1 = new PiePlot3D( $pie_vals );
78 $p1->ExplodeSlice (0);
79 $p1->SetLegends( $pie_labels );