5 * Copyright 2004 (c) GForge LLC
8 * @author Tim Perdue tim@gforge.org
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 require_once('../env.inc.php');
29 require_once('pre.php');
30 require_once($sys_path_to_jpgraph.'/jpgraph.php');
31 require_once($sys_path_to_jpgraph.'/jpgraph_pie.php');
32 require_once($sys_path_to_jpgraph.'/jpgraph_pie3d.php');
33 require_once('common/reporting/ReportSiteTime.class.php');
34 require_once('common/reporting/report_utils.php');
36 session_require( array('group'=>$sys_stats_group) );
38 $start = getStringFromRequest('start');
39 $end = getStringFromRequest('end');
40 $type = getStringFromRequest('type');
45 $report=new ReportSiteTime($type,$start,$end);
48 // Check for error, such as license key problem
50 if ($report->isError()) {
51 echo $report->getErrorMessage();
55 // XXX ogi: Isn't it $type?
56 if (!isset($datatype)) {
61 $start=mktime(0,0,0,date('m'),1,date('Y'));;
69 // Create the graph. These two calls are always required
70 $graph = new PieGraph(640, 480,"auto");
71 //$graph->SetMargin(50,10,35,50);
73 $arr['tasks']='By Task';
74 $arr['category']='By Category';
75 $arr['subproject']='By Subproject';
76 $arr['user']='By User';
78 $graph->title->Set("Time Report ".$arr[$type]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
79 $graph->subtitle->Set($sys_name);
81 report_pie_arr($report->labels,$report->getData());
83 $p1 = new PiePlot3D( $pie_vals );
84 $p1->ExplodeSlice (0);
85 $p1->SetLegends( $pie_labels );