1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<?php
/**
* Reporting System
*
* Copyright 2004 (c) GForge LLC
*
* @version $Id: projectact_graph.php 4358 2005-05-13 21:37:43Z tom $
* @author Tim Perdue tim@gforge.org
* @date 2003-03-16
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('pre.php');
require_once($sys_path_to_jpgraph.'/jpgraph.php');
require_once($sys_path_to_jpgraph.'/jpgraph_line.php');
require_once('common/reporting/ReportProjectAct.class');
$SPAN = getIntFromRequest('SPAN', 1);
$start = getIntFromRequest('start');
$end = getIntFromRequest('end');
$g_id = getIntFromRequest('g_id');
if (!$area) {
$area='tracker';
}
//
// Create Report
//
$report=new ReportProjectAct($SPAN,$g_id,$start,$end);
//
// Check for error, such as license key problem
//
if ($report->isError()) {
echo $report->getErrorMessage();
exit;
}
//
// Get Group Object
//
$g =& group_get_object($g_id);
if (!$g || $g->isError()) {
exit_error("Could Not Get Group");
}
// Create the graph. These two calls are always required
$graph = new Graph(640, 480,"auto");
$graph->SetMargin(50,10,35,50);
$graph->SetScale( "textlin");
//$graph->SetScale( "linlog");
//$graph ->SetYScale("log");
if ($area=='tracker') {
// Create the tracker open plot
$ydata =& $report->getTrackerOpened();
$lineplot =new LinePlot($ydata);
$lineplot ->SetColor("black");
$graph->Add( $lineplot);
// Create the tracker close plot
$ydata2 =& $report->getTrackerClosed();
$lineplot2 =new LinePlot($ydata2);
$lineplot2 ->SetColor("blue");
$graph->Add( $lineplot2 );
// Legends
$lineplot->SetLegend ($Language->getText('reporting','tracker_items_opened'));
$lineplot2 ->SetLegend($Language->getText('reporting','tracker_items_closed'));
} elseif ($area=='forum') {
// Create the forum plot
$ydata3 =& $report->getForum();
$lineplot3 =new LinePlot($ydata3);
$lineplot3 ->SetColor("orange");
$graph->Add( $lineplot3 );
// Legends
$lineplot3 ->SetLegend("Forum");
} elseif ($area=='docman') {
// Create the Docman plot
$ydata4 =& $report->getDocs();
$lineplot4 =new LinePlot($ydata4);
$lineplot4 ->SetColor("red");
$graph->Add( $lineplot4 );
// Legends
$lineplot4 ->SetLegend("Docs");
} elseif ($area=='downloads') {
// Create the Docman plot
$ydata4 =& $report->getDownloads();
$lineplot4 =new LinePlot($ydata4);
$lineplot4 ->SetColor("red");
$graph->Add( $lineplot4 );
// Legends
$lineplot4 ->SetLegend("Downloads");
} elseif ($area=='taskman') {
// Create the Tasks Opened plot
$ydata5 =& $report->getTaskOpened();
$lineplot5 =new LinePlot($ydata5);
$lineplot5 ->SetColor("purple");
$graph->Add( $lineplot5 );
// Create the Tasks Closed plot
$ydata6 =& $report->getTaskClosed();
$lineplot6 =new LinePlot($ydata6);
$lineplot6 ->SetColor("yellow");
$graph->Add( $lineplot6 );
// Legends
$lineplot5 ->SetLegend("Task Open");
$lineplot6 ->SetLegend("Task Close");
}
//
// Titles
//
$graph->title->Set("Project Activity For: ".$g->getPublicName().
" (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
$graph->subtitle->Set($sys_name);
//$graph->xaxis-> title->Set("Date" );
//$graph->yaxis-> title->Set("Number" );
$a=$report->getDates();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetTextLabelInterval($report->getGraphInterval());
// Display the graph
$graph->Stroke();
?>
|