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/Report.class.php';
29 require_once $gfcommon.'reporting/report_utils.php';
31 session_require_global_perm ('forge_stats', 'read') ;
39 // Check for error, such as license key problem
41 if ($report->isError()) {
42 exit_error($report->getErrorMessage());
45 $datatype = getIntFromRequest('datatype');
46 $start = getIntFromRequest('start');
47 $end = getIntFromRequest('end');
49 if (!isset($datatype)) {
54 $start=mktime(0,0,0,date('m'),1,date('Y'));;
64 $res = db_query_params ('SELECT g.group_name,count(*) AS count
65 FROM groups g, artifact_group_list agl, artifact a
66 WHERE g.group_id=agl.group_id
67 AND agl.group_artifact_id=a.group_artifact_id
68 AND a.open_date BETWEEN $1 AND $2
75 } elseif ($datatype == 5) {
76 $res = db_query_params ('SELECT g.group_name,count(*) AS count
77 FROM groups g, forum_group_list fgl, forum f
78 WHERE g.group_id=fgl.group_id
79 AND fgl.group_forum_id=f.group_forum_id
80 AND f.post_date BETWEEN $1 AND $2
85 } elseif ($datatype == 6) {
86 $res = db_query_params ('SELECT g.group_name,count(*) AS count
87 FROM groups g, project_group_list pgl, project_task pt
88 WHERE g.group_id=pgl.group_id
89 AND pgl.group_project_id=pt.group_project_id
90 AND pt.start_date BETWEEN $1 AND $2
96 $res = db_query_params ('SELECT g.group_name,count(*) AS count
97 FROM groups g, frs_package fp, frs_release fr, frs_file ff, frs_dlstats_file fdf
98 WHERE g.group_id=fp.group_id
99 AND fp.package_id=fr.package_id
100 AND fr.release_id=ff.release_id
101 AND ff.file_id=fdf.file_id
102 AND (((fdf.month > $1) OR (fdf.month = $1 AND fdf.day >= $2))
103 AND ((fdf.month < $3) OR (fdf.month = $3 AND fdf.day < $4)))
105 ORDER BY count DESC',
106 array (date('Ym',$start),
117 exit_error(db_error());
120 // Create the graph. These two calls are always required
121 $graph = new PieGraph(640, 480,"auto");
122 $graph->SetMargin(50,10,35,80);
125 $arr[2]='Support Requests';
127 $arr[4]='Feature Requests';
128 $arr[0]='Other Trackers';
129 $arr[5]='Forum Messages';
132 $graph->title->Set($arr[$datatype]." By Project (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
133 $graph->subtitle->Set(forge_get_config ('forge_name'));
135 // Create the tracker open plot
136 report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1));
138 $p1 = new PiePlot3D($pie_vals);
139 $p1->ExplodeSlice (0);
140 $p1->SetLegends($pie_labels);
148 // c-file-style: "bsd"