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/ReportUserAct.class.php';
32 require_once $gfwww.'include/unicode.php';
34 session_require( array('group'=>$sys_stats_group) );
36 $dev_id = getStringFromRequest('dev_id');
37 $SPAN = getIntFromRequest('SPAN');
38 $start = getIntFromRequest('start');
39 $end = getIntFromRequest('end');
40 $area = getStringFromRequest('area');
45 $report=new ReportUserAct($SPAN,$dev_id,$start,$end);
48 // Check for error, such as license key problem
50 if ($report->isError()) {
51 echo $report->getErrorMessage();
58 $u =& user_get_object($dev_id);
59 if (!$u || $u->isError()) {
60 exit_error("Could Not Get User");
63 // Create the graph. These two calls are always required
64 $graph = new Graph(640, 480,"auto");
65 $graph->SetMargin(50,10,35,50);
66 $graph->SetScale( "textlin");
67 //$graph->SetScale( "linlog");
68 //$graph ->SetYScale("log");
70 if ($area=='tracker') {
72 // Create the tracker open plot
73 $ydata =& $report->getTrackerOpened();
74 $lineplot =new LinePlot($ydata);
75 $lineplot ->SetColor("black");
76 $graph->Add( $lineplot);
78 // Create the tracker close plot
79 $ydata2 =& $report->getTrackerClosed();
80 $lineplot2 =new LinePlot($ydata2);
81 $lineplot2 ->SetColor("blue");
82 $graph->Add( $lineplot2 );
85 $lineplot->SetLegend (convert_unicode(_('Tracker Items Opened')));
86 $lineplot2 ->SetLegend(convert_unicode(_('Tracker Items Closed')));
88 } elseif ($area=='forum') {
90 // Create the forum plot
91 $ydata3 =& $report->getForum();
92 $lineplot3 =new LinePlot($ydata3);
93 $lineplot3 ->SetColor("orange");
94 $graph->Add( $lineplot3 );
97 $lineplot3 ->SetLegend("Forum");
99 } elseif ($area=='docman') {
101 // Create the Docman plot
102 $ydata4 =& $report->getDocs();
103 $lineplot4 =new LinePlot($ydata4);
104 $lineplot4 ->SetColor("red");
105 $graph->Add( $lineplot4 );
108 $lineplot4 ->SetLegend("Docs");
110 } elseif ($area=='taskman') {
112 // Create the Tasks Opened plot
113 $ydata5 =& $report->getTaskOpened();
114 $lineplot5 =new LinePlot($ydata5);
115 $lineplot5 ->SetColor("purple");
116 $graph->Add( $lineplot5 );
118 // Create the Tasks Closed plot
119 $ydata6 =& $report->getTaskClosed();
120 $lineplot6 =new LinePlot($ydata6);
121 $lineplot6 ->SetColor("yellow");
122 $graph->Add( $lineplot6 );
125 $lineplot5 ->SetLegend("Task Open");
126 $lineplot6 ->SetLegend("Task Close");
133 $graph->title->Set("User Activity For: ".$u->getRealName()
134 ." (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
135 $graph->subtitle->Set(forge_get_config ('forge_name'));
136 //$graph->xaxis-> title->Set("Date" );
137 //$graph->yaxis-> title->Set("Number" );
139 $a=$report->getDates();
140 $graph->xaxis->SetTickLabels($a);
141 $graph->xaxis->SetLabelAngle(90);
142 $graph->xaxis->SetTextLabelInterval($report->getGraphInterval());