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_line.php');
31 require_once $gfcommon.'reporting/ReportSiteAct.class.php';
32 require_once $gfwww.'include/unicode.php';
34 session_require( array('group'=>$sys_stats_group) );
36 $area = getStringFromRequest('area');
37 $SPAN = getIntFromRequest('SPAN');
38 $start = getIntFromRequest('start');
39 $end = getIntFromRequest('end');
44 $report=new ReportSiteAct($SPAN,$start,$end);
47 // Check for error, such as license key problem
49 if ($report->isError()) {
50 echo $report->getErrorMessage();
54 // Create the graph. These two calls are always required
55 $graph = new Graph(640, 480,"auto");
56 $graph->SetMargin(50,10,35,50);
57 $graph->SetScale( "textlin");
58 //$graph->SetScale( "linlog");
59 //$graph ->SetYScale("log");
61 if ($area=='tracker') {
63 // Create the tracker open plot
64 $ydata =& $report->getTrackerOpened();
65 $lineplot =new LinePlot($ydata);
66 $lineplot ->SetColor("black");
67 $graph->Add( $lineplot);
69 // Create the tracker close plot
70 $ydata2 =& $report->getTrackerClosed();
71 $lineplot2 =new LinePlot($ydata2);
72 $lineplot2 ->SetColor("blue");
73 $graph->Add( $lineplot2 );
76 $lineplot->SetLegend (convert_unicode(_('Tracker Items Opened')));
77 $lineplot2 ->SetLegend(convert_unicode(_('Tracker Items Closed')));
79 } elseif ($area=='forum') {
81 // Create the forum plot
82 $ydata3 =& $report->getForum();
83 $lineplot3 =new LinePlot($ydata3);
84 $lineplot3 ->SetColor("orange");
85 $graph->Add( $lineplot3 );
88 $lineplot3 ->SetLegend("Forum");
90 } elseif ($area=='docman') {
92 // Create the Docman plot
93 $ydata4 =& $report->getDocs();
94 $lineplot4 =new LinePlot($ydata4);
95 $lineplot4 ->SetColor("red");
96 $graph->Add( $lineplot4 );
99 $lineplot4 ->SetLegend("Docs");
101 } elseif ($area=='taskman') {
103 // Create the Tasks Opened plot
104 $ydata5 =& $report->getTaskOpened();
105 $lineplot5 =new LinePlot($ydata5);
106 $lineplot5 ->SetColor("purple");
107 $graph->Add( $lineplot5 );
109 // Create the Tasks Closed plot
110 $ydata6 =& $report->getTaskClosed();
111 $lineplot6 =new LinePlot($ydata6);
112 $lineplot6 ->SetColor("yellow");
113 $graph->Add( $lineplot6 );
116 $lineplot5 ->SetLegend("Task Open");
117 $lineplot6 ->SetLegend("Task Close");
119 } elseif ($area=='downloads') {
121 // Create the Downloads plot
122 $ydata5 =& $report->getDownloads();
123 $lineplot5 =new LinePlot($ydata5);
124 $lineplot5 ->SetColor("purple");
125 $graph->Add( $lineplot5 );
128 $lineplot5 ->SetLegend("Downloads");
136 $graph->title->Set("Site-Wide Activity (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
137 $graph->subtitle->Set(fusionforge_get_config ('forge_name'));
138 //$graph->xaxis-> title->Set("Date" );
139 //$graph->yaxis-> title->Set("Number" );
141 $a=$report->getDates();
142 $graph->xaxis->SetTickLabels($a);
143 $graph->xaxis->SetLabelAngle(90);
144 $graph->xaxis->SetTextLabelInterval($report->getGraphInterval());