5 * Copyright 2003-2004 (c) GForge LLC
7 * This file is part of FusionForge.
9 * FusionForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with FusionForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 require_once('../env.inc.php');
25 require_once $gfcommon.'include/pre.php';
26 require_once(forge_get_config('jpgraph_path').'/jpgraph.php');
27 require_once(forge_get_config('jpgraph_path').'/jpgraph_line.php');
28 require_once $gfcommon.'reporting/ReportUserAct.class.php';
29 require_once $gfwww.'include/unicode.php';
31 session_require_global_perm ('forge_stats', 'read') ;
33 $dev_id = getStringFromRequest('dev_id');
34 $SPAN = getIntFromRequest('SPAN');
35 $start = getIntFromRequest('start');
36 $end = getIntFromRequest('end');
37 $area = getStringFromRequest('area');
42 $report=new ReportUserAct($SPAN,$dev_id,$start,$end);
45 // Check for error, such as license key problem
47 if ($report->isError()) {
48 exit_error($report->getErrorMessage());
54 $u =& user_get_object($dev_id);
55 if (!$u || $u->isError()) {
56 exit_error(_("Could Not Get User"));
59 // Create the graph. These two calls are always required
60 $graph = new Graph(640, 480,"auto");
61 $graph->SetMargin(50,10,35,50);
62 $graph->SetScale( "textlin");
63 //$graph->SetScale( "linlog");
64 //$graph ->SetYScale("log");
66 if ($area=='tracker') {
68 // Create the tracker open plot
69 $ydata =& $report->getTrackerOpened();
70 $lineplot =new LinePlot($ydata);
71 $lineplot ->SetColor("black");
72 $graph->Add( $lineplot);
74 // Create the tracker close plot
75 $ydata2 =& $report->getTrackerClosed();
76 $lineplot2 =new LinePlot($ydata2);
77 $lineplot2 ->SetColor("blue");
78 $graph->Add( $lineplot2 );
81 $lineplot->SetLegend (convert_unicode(_('Tracker Items Opened')));
82 $lineplot2 ->SetLegend(convert_unicode(_('Tracker Items Closed')));
84 } elseif ($area=='forum') {
86 // Create the forum plot
87 $ydata3 =& $report->getForum();
88 $lineplot3 =new LinePlot($ydata3);
89 $lineplot3 ->SetColor("orange");
90 $graph->Add( $lineplot3 );
93 $lineplot3 ->SetLegend("Forum");
95 } elseif ($area=='docman') {
97 // Create the Docman plot
98 $ydata4 =& $report->getDocs();
99 $lineplot4 =new LinePlot($ydata4);
100 $lineplot4 ->SetColor("red");
101 $graph->Add( $lineplot4 );
104 $lineplot4 ->SetLegend("Docs");
106 } elseif ($area=='taskman') {
108 // Create the Tasks Opened plot
109 $ydata5 =& $report->getTaskOpened();
110 $lineplot5 =new LinePlot($ydata5);
111 $lineplot5 ->SetColor("purple");
112 $graph->Add( $lineplot5 );
114 // Create the Tasks Closed plot
115 $ydata6 =& $report->getTaskClosed();
116 $lineplot6 =new LinePlot($ydata6);
117 $lineplot6 ->SetColor("yellow");
118 $graph->Add( $lineplot6 );
121 $lineplot5 ->SetLegend("Task Open");
122 $lineplot6 ->SetLegend("Task Close");
129 $graph->title->Set("User Activity For: ".$u->getRealName()
130 ." (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
131 $graph->subtitle->Set(forge_get_config ('forge_name'));
132 //$graph->xaxis-> title->Set("Date" );
133 //$graph->yaxis-> title->Set("Number" );
135 $a=$report->getDates();
136 $graph->xaxis->SetTickLabels($a);
137 $graph->xaxis->SetLabelAngle(90);
138 $graph->xaxis->SetTextLabelInterval($report->getGraphInterval());