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 $gfwww.'include/pre.php';
30 require_once($sys_path_to_jpgraph.'/jpgraph.php');
31 require_once($sys_path_to_jpgraph.'/jpgraph_bar.php');
32 require_once $gfcommon.'reporting/Report.class.php';
34 session_require( array('group'=>$sys_stats_group) );
42 // Check for error, such as license key problem
44 if ($report->isError()) {
45 echo $report->getErrorMessage();
49 $start = getStringFromRequest('start');
50 $end = getStringFromRequest('end');
53 $start=mktime(0,0,0,date('m'),1,date('Y'));;
61 $res=db_query("SELECT week,sum(hours)
62 FROM rep_time_tracking
64 BETWEEN '$start' AND '$end' GROUP BY week");
66 $report->setDates($res,0);
67 $report->setData($res,1);
70 // Create the graph. These two calls are always required
71 $graph = new Graph(640,480,"auto");
72 $graph->SetScale("textlin");
73 $graph->yaxis->scale->SetGrace(20);
76 //$graph->SetShadow();
78 // Adjust the margin a bit to make more room for titles
79 $graph->img->SetMargin(40,20,35,40);
82 $bplot = new BarPlot($report->getData());
85 $bplot->SetFillColor('orange');
87 $bplot->value->Show();
88 //$bplot->value->SetAngle(90);
89 //$bplot->value->SetFormat('%0.1f');
93 $graph->title->Set("Hours Recorded (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
94 $graph->subtitle->Set($sys_name);
95 $graph->xaxis->title->Set("Date");
96 $graph->yaxis->title->Set("Hours");
99 $graph->xaxis->SetTickLabels($report->getDates());