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(forge_get_config('jpgraph_path').'/jpgraph.php');
30 require_once(forge_get_config('jpgraph_path').'/jpgraph_line.php');
31 require_once $gfcommon.'reporting/ReportTrackerAct.class.php';
33 $group_id = getIntFromRequest('group_id');
34 $atid = getIntFromRequest('atid');
35 $SPAN = getIntFromRequest('SPAN', REPORT_TYPE_MONTHLY);
36 $start = getIntFromRequest('start');
37 $end = getIntFromRequest('end');
42 $group =& group_get_object($group_id);
43 if (!$group || !is_object($group)) {
46 if ($group->isError()) {
47 if($group->isPermissionDeniedError()) {
48 exit_permission_denied($group->getErrorMessage());
50 exit_error(_('Error'), $group->getErrorMessage());
57 $report=new ReportTrackerAct($SPAN,$group_id,$atid,$start,$end);
60 // Check for error, such as license key problem
62 if ($report->isError()) {
63 echo $report->getErrorMessage();
67 // Create the graph. These two calls are always required
68 $graph = new Graph(640, 480,"auto");
69 $graph->SetMargin(50,10,35,80);
70 $graph->SetScale( "textlin");
71 //$graph->SetScale( "linlog");
72 //$graph ->SetYScale("log");
74 // Create the average time plot
75 $ydata =& $report->getAverageTimeData();
76 $lineplot =new LinePlot($ydata);
77 $lineplot ->SetColor("black");
78 $graph->Add( $lineplot);
80 // Create the open count plot
81 $ydata2 =& $report->getOpenCountData();
82 $lineplot2 =new LinePlot($ydata2);
83 $lineplot2 ->SetColor("blue");
84 $graph->Add( $lineplot2 );
86 // Create the still open count plot
87 $ydata3 =& $report->getStillOpenCountData();
88 $lineplot3 =new LinePlot($ydata3);
89 $lineplot3 ->SetColor("red");
90 $graph->Add( $lineplot3 );
93 $lineplot->SetLegend ("Avg Time Open (in days)");
94 $lineplot2 ->SetLegend("Total Opened");
95 $lineplot3 ->SetLegend("Total Still Open");
97 //echo "<pre>".print_r($report->getDates()).'<br />'.print_r($ydata).'<br />'.print_r($ydata2).'<br />'.print_r($ydata3);
98 //echo "<pre>".print_r($ydata2);
104 $graph->title->Set("Tracker Activity For: ".$group->getPublicName().
105 " (".date('Y-m-d',$report->getStartDate()) ." to ". date('Y-m-d',$report->getEndDate()) .")");
106 $graph->subtitle->Set($report_company_name);
107 //$graph->xaxis-> title->Set("Date" );
108 //$graph->yaxis-> title->Set("Number" );
110 $a=$report->getDates();
111 $graph->xaxis->SetTickLabels($a);
112 $graph->xaxis->SetLabelAngle(90);
113 $graph->xaxis->SetTextLabelInterval($report->getGraphInterval());