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';
41 // Check for error, such as license key problem
43 if ($report->isError()) {
44 echo $report->getErrorMessage();
48 $group_id = getIntFromRequest('group_id');
49 $g =& group_get_object($group_id);
50 if (!$g || !is_object($g)) {
51 echo 'Permission Denied';
55 $days = getIntFromRequest('days');
56 if (!$days || $days < 1) {
60 $start = getIntFromRequest('start');
62 $start=time() - ($days * 60 * 60 * 24);
63 $formattedmonth = date('Ym',$start);
66 $end = getIntFromRequest('end');
73 $res = db_query_params ('SELECT u.realname,sum(commits) AS count
74 FROM stats_cvs_user scu, users u
75 WHERE u.user_id = scu.user_id
78 GROUP BY realname ORDER BY count DESC',
79 array ($formattedmonth,
83 exit_error('Error',db_error());
86 // Create the graph. These two calls are always required
87 $graph = new PieGraph(640, 480,"auto");
88 //$graph->SetMargin(50,10,35,50);
90 //$graph->title->Set("Commits By User (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
91 $graph->title->Set(utf8_decode(_("Commits By User")." (".strftime('%x',$start) ." - ". strftime('%x',$end) .")"));
92 $graph->subtitle->Set(forge_get_config ('forge_name'));
94 // Create the tracker open plot
95 report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1), 0);
97 $p1 = new PiePlot3D($pie_vals);
98 $p1->SetLegends($pie_labels);