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/ReportProjectTime.class.php';
29 require_once $gfcommon.'reporting/report_utils.php';
31 session_require_global_perm ('forge_stats', 'read') ;
33 $g_id = getIntFromRequest('g_id');
34 $type = getStringFromRequest('type');
35 $start = getIntFromRequest('start');
36 $end = getIntFromRequest('end');
41 $report=new ReportProjectTime($g_id,$type,$start,$end);
44 // Check for error, such as license key problem
46 if ($report->isError()) {
47 exit_error($report->getErrorMessage());
50 // XXX ogi: Isn't it $type?
51 if (!isset($datatype)) {
56 $start=mktime(0,0,0,date('m'),1,date('Y'));;
64 // Create the graph. These two calls are always required
65 $graph = new PieGraph(640, 480,"auto");
66 $graph->SetMargin(50,10,35,80);
68 $arr['tasks']='By Task';
69 $arr['category']='By Category';
70 $arr['subproject']='By Subproject';
71 $arr['user']='By User';
73 $graph->title->Set("Time Report ".$arr[$type]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
74 $graph->subtitle->Set(forge_get_config ('forge_name'));
76 report_pie_arr($report->labels,$report->getData());
78 $p1 = new PiePlot3D( $pie_vals );
79 $p1->ExplodeSlice (0);
80 $p1->SetLegends( $pie_labels );