5 * Copyright 2004 (c) GForge LLC
7 * @author Tim Perdue tim@gforge.org
10 * This file is part of GForge.
12 * GForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * GForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with GForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../env.inc.php');
28 require_once $gfwww.'include/pre.php';
29 require_once($sys_path_to_jpgraph.'/jpgraph.php');
30 require_once($sys_path_to_jpgraph.'/jpgraph_pie.php');
31 require_once($sys_path_to_jpgraph.'/jpgraph_pie3d.php');
32 require_once $gfcommon.'reporting/Report.class.php';
33 require_once $gfcommon.'reporting/report_utils.php';
34 require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
36 session_require( array('group'=>$sys_stats_group) );
44 // Check for error, such as license key problem
46 if ($report->isError()) {
47 echo $report->getErrorMessage();
51 $area = getStringFromRequest('area');
52 $start = getStringFromRequest('start');
53 $end = getStringFromRequest('end');
60 $start=mktime(0,0,0,date('m'),1,date('Y'));;
69 if ($area == 'category') {
71 $sql="SELECT ac.category_name,count(*)
72 FROM artifact a, artifact_category ac
73 WHERE a.group_artifact_id='$atid'
74 AND a.category_id=ac.id
75 AND a.open_date BETWEEN '$start' AND '$end'
76 GROUP BY category_name";
78 } elseif ($area == 'group') {
80 $sql="SELECT ag.group_name,count(*)
81 FROM artifact a, artifact_group ag
82 WHERE a.group_artifact_id='$atid'
83 AND a.artifact_group_id=ag.id
84 AND a.open_date BETWEEN '$start' AND '$end'
87 } elseif ($area == 'resolution') {
89 $sql="SELECT ar.resolution_name,count(*)
90 FROM artifact a, artifact_resolution ar
91 WHERE a.group_artifact_id='$atid'
92 AND a.resolution_id=ar.id
93 AND a.open_date BETWEEN '$start' AND '$end'
94 GROUP BY resolution_name";
100 $sql="SELECT u.realname,count(*)
101 FROM artifact a, users u
102 WHERE a.group_artifact_id='$atid'
103 AND a.assigned_to=u.user_id
104 AND a.open_date BETWEEN '$start' AND '$end'
115 exit_error('Error',db_error());
118 // Create the graph. These two calls are always required
119 $graph = new PieGraph(640, 480,"auto");
120 //$graph->SetMargin(50,10,35,50);
123 $arr['category']='By Category';
124 $arr['group']='By Group';
125 $arr['resolution']='By Resolution';
126 $arr['assignee']='By Assignee';
127 $graph->title->Set($arr[$area]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
128 $graph->subtitle->Set($sys_name);
130 // Create the tracker open plot
131 report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1));
133 $p1 = new PiePlot3D($pie_vals);
134 $p1->ExplodeSlice (0);
135 $p1->SetLegends($pie_labels);