5 * Copyright 2004 (c) GForge LLC
7 * @author Tim Perdue tim@gforge.org
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once('../../env.inc.php');
27 require_once $gfcommon.'include/pre.php';
28 require_once(forge_get_config('jpgraph_path').'/jpgraph.php');
29 require_once(forge_get_config('jpgraph_path').'/jpgraph_line.php');
30 require_once $gfcommon.'reporting/ReportTrackerAct.class.php';
32 $group_id = getIntFromRequest('group_id');
33 $atid = getIntFromRequest('atid');
34 $SPAN = getIntFromRequest('SPAN', REPORT_TYPE_MONTHLY);
35 $start = getIntFromRequest('start');
36 $end = getIntFromRequest('end');
41 $group = group_get_object($group_id);
42 if (!$group || !is_object($group)) {
45 if ($group->isError()) {
46 if($group->isPermissionDeniedError()) {
47 exit_permission_denied($group->getErrorMessage());
49 exit_error(_('Error'), $group->getErrorMessage());
56 $report=new ReportTrackerAct($SPAN,$group_id,$atid,$start,$end);
59 // Check for error, such as license key problem
61 if ($report->isError()) {
62 echo $report->getErrorMessage();
66 // Create the graph. These two calls are always required
67 $graph = new Graph(640, 480,"auto");
68 $graph->SetMargin(50,10,35,80);
69 $graph->SetScale( "textlin");
70 //$graph->SetScale( "linlog");
71 //$graph ->SetYScale("log");
73 // Create the average time plot
74 $ydata =& $report->getAverageTimeData();
75 $lineplot =new LinePlot($ydata);
76 $lineplot ->SetColor("black");
77 $graph->Add( $lineplot);
79 // Create the open count plot
80 $ydata2 =& $report->getOpenCountData();
81 $lineplot2 =new LinePlot($ydata2);
82 $lineplot2 ->SetColor("blue");
83 $graph->Add( $lineplot2 );
85 // Create the still open count plot
86 $ydata3 =& $report->getStillOpenCountData();
87 $lineplot3 =new LinePlot($ydata3);
88 $lineplot3 ->SetColor("red");
89 $graph->Add( $lineplot3 );
92 $lineplot->SetLegend ("Avg Time Open (in days)");
93 $lineplot2 ->SetLegend("Total Opened");
94 $lineplot3 ->SetLegend("Total Still Open");
96 //echo "<pre>".print_r($report->getDates()).'<br />'.print_r($ydata).'<br />'.print_r($ydata2).'<br />'.print_r($ydata3);
97 //echo "<pre>".print_r($ydata2);
103 $graph->title->Set("Tracker Activity For: ".$group->getPublicName().
104 " (".date('Y-m-d',$report->getStartDate()) ." to ". date('Y-m-d',$report->getEndDate()) .")");
105 $graph->subtitle->Set($report_company_name);
106 //$graph->xaxis-> title->Set("Date" );
107 //$graph->yaxis-> title->Set("Number" );
109 $a=$report->getDates();
110 $graph->xaxis->SetTickLabels($a);
111 $graph->xaxis->SetLabelAngle(90);
112 $graph->xaxis->SetTextLabelInterval($report->getGraphInterval());