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/Report.class');
34 require_once('common/reporting/report_utils.php');
35 require_once('www/tracker/include/ArtifactTypeHtml.class');
37 session_require( array('group'=>$sys_stats_group) );
45 // Check for error, such as license key problem
47 if ($report->isError()) {
48 echo $report->getErrorMessage();
52 $area = getStringFromRequest('area');
53 $start = getStringFromRequest('start');
54 $end = getStringFromRequest('end');
61 $start=mktime(0,0,0,date('m'),1,date('Y'));;
70 if ($area == 'category') {
72 $sql="SELECT ac.category_name,count(*)
73 FROM artifact a, artifact_category ac
74 WHERE a.group_artifact_id='$atid'
75 AND a.category_id=ac.id
76 AND a.open_date BETWEEN '$start' AND '$end'
77 GROUP BY category_name";
79 } elseif ($area == 'group') {
81 $sql="SELECT ag.group_name,count(*)
82 FROM artifact a, artifact_group ag
83 WHERE a.group_artifact_id='$atid'
84 AND a.artifact_group_id=ag.id
85 AND a.open_date BETWEEN '$start' AND '$end'
88 } elseif ($area == 'resolution') {
90 $sql="SELECT ar.resolution_name,count(*)
91 FROM artifact a, artifact_resolution ar
92 WHERE a.group_artifact_id='$atid'
93 AND a.resolution_id=ar.id
94 AND a.open_date BETWEEN '$start' AND '$end'
95 GROUP BY resolution_name";
101 $sql="SELECT u.realname,count(*)
102 FROM artifact a, users u
103 WHERE a.group_artifact_id='$atid'
104 AND a.assigned_to=u.user_id
105 AND a.open_date BETWEEN '$start' AND '$end'
116 exit_error('Error',db_error());
119 // Create the graph. These two calls are always required
120 $graph = new PieGraph(640, 480,"auto");
121 //$graph->SetMargin(50,10,35,50);
124 $arr['category']='By Category';
125 $arr['group']='By Group';
126 $arr['resolution']='By Resolution';
127 $arr['assignee']='By Assignee';
128 $graph->title->Set($arr[$area]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
129 $graph->subtitle->Set($sys_name);
131 // Create the tracker open plot
132 report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1));
134 $p1 = new PiePlot3D($pie_vals);
135 $p1->ExplodeSlice (0);
136 $p1->SetLegends($pie_labels);