[evolvis-commits] r9828: Release of Reporting Module↵

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Feb 24 17:32:13 CET 2011


Author: mirabilos
Date: 2011-02-24 17:32:13 +0100 (Thu, 24 Feb 2011)
New Revision: 9828

Added:
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/Report.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectAct.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectTime.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSetup.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteAct.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteTime.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportTrackerAct.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAct.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAdded.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserCum.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserTime.class
   trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/report_utils.php
   trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/reporting_cron.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/index.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/rebuild.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timeadd.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timecategory.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/trackerpie_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum_graph.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usersummary.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime_graph.php
Removed:
   trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/project_stats_utils.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/stats_graph.php
Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog
   trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/README
   trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class
   trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/mod_task.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/index.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/tracker/reporting/index.php
Log:
Release of Reporting Module


Modified: trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/ChangeLog	2011-02-24 16:32:13 UTC (rev 9828)
@@ -1,3 +1,10 @@
+2004-07-28  Tim Perdue  <tim at gforge.org>
+
+	* vote_function.php modified to make the pop-up boxes more
+	professionally worded
+
+	* Reporting module released
+
 2004-07-28  Francisco Gimeno <kikov at kikov.org>
 	* www/include/languages/Spanish.tab: solved a lot of
 	typos and changes to the formal pronoun. Applied patch#847

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/Report.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/Report.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/Report.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,139 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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
+ */
+
+DEFINE('REPORT_DAY_SPAN',24*60*60);
+DEFINE('REPORT_WEEK_SPAN',7*24*60*60);
+DEFINE('REPORT_MONTH_SPAN',30*24*60*60);
+
+DEFINE('REPORT_TYPE_DAILY',1);
+DEFINE('REPORT_TYPE_WEEKLY',2);
+DEFINE('REPORT_TYPE_MONTHLY',3);
+DEFINE('REPORT_TYPE_OA',4);
+
+class Report extends Error {
+
+//var $adjust_days=array('Sun'=>0, 'Sat'=>6, 'Fri'=>5, 'Thu'=>4, 'Wed'=>3, 'Tue'=>2, 'Mon'=>1);
+var $adjust_days=array('Sun'=>'0.0', 'Sat'=>1, 'Fri'=>2, 'Thu'=>3, 'Wed'=>4, 'Tue'=>5, 'Mon'=>6);
+var $month_start_arr=array();
+var $week_start_arr=array();
+var $site_start_date;
+var $data;
+var $labels;
+var $span;
+var $start_date;
+var $end_date;
+var $span_name=array(1=>'Daily',2=>'Weekly',3=>'Monthly',4=>'OverAll');
+var $graph_interval=array(1=>7,2=>1,3=>1,4=>1);
+
+function Report() {
+	$this->Error();
+	//
+	//	All reporting action will be done in GMT timezone
+	//
+	putenv('TZ=GMT');
+}
+
+/**
+ *	get the unix time that this install was setup.
+ */
+function getMinDate() {
+	if (!$this->site_start_date) {
+		$res=db_query("select min(add_date) AS start_date from users where add_date > 0;");
+		$this->site_start_date=db_result($res,0,'start_date');
+	}
+	return $this->site_start_date;
+}
+
+function &getMonthStartArr() {
+	if (count($this->month_start_arr) < 1) {
+		$min_date=$this->getMinDate();
+		for ($i=0; $i<24; $i++) {
+			$this->month_start_arr[]=mktime(0,0,0,date('m')+1-$i,1,date('Y'));
+			if ($this->month_start_arr[$i] < $min_date) {
+				break;
+			}
+		}
+	}
+	return $this->month_start_arr;
+}
+
+function &getWeekStartArr() {
+	if (count($this->week_start_arr) < 1) {
+		$min_date=$this->getMinDate();
+		$start=mktime(0,0,0,date('m'),(date('d')+$this->adjust_days[date('D')]),date('Y'));
+		for ($i=0; $i<104; $i++) {
+			$this->week_start_arr[]=($start-REPORT_WEEK_SPAN*$i);
+			if ($this->week_start_arr[$i] < $min_date) {
+				break;
+			}
+		}
+	}
+	return $this->week_start_arr;
+}
+
+function setSpan($span) {
+	$this->span=$span;
+}
+
+function getSpanName() {
+	return $this->span_name[$this->span];
+}
+
+function setData($result,$column) {
+	$this->data =& util_result_column_to_array($result,$column);
+}
+
+function setDates($result,$column) {
+	$arr =& util_result_column_to_array($result,$column);
+	for ($i=0; $i<count($arr); $i++) {
+		$this->labels[$i] = date('M d',$arr[$i]);
+	}
+}
+
+function getGraphInterval() {
+	return $this->graph_interval[$this->span];
+}
+
+function &getData() {
+	return $this->data;
+}
+
+function &getDates() {
+	return $this->labels;
+}
+
+function getStartDate() {
+	return $this->start_date;
+}
+
+function getEndDate() {
+	return $this->end_date;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectAct.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectAct.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectAct.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,114 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportProjectAct extends Report {
+
+var $res;
+
+function ReportProjectAct($span,$group_id,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$group_id) {
+		$this->setError('No group_id');
+		return false;
+	}
+	if (!$span || $span == REPORT_TYPE_MONTHLY) {
+
+		$res=db_query("SELECT * FROM rep_group_act_monthly 
+			WHERE group_id='$group_id' AND month BETWEEN '$start' AND '$end' ORDER BY month");
+
+	} elseif ($span == REPORT_TYPE_WEEKLY) {
+
+		$res=db_query("SELECT * FROM rep_group_act_weekly 
+			WHERE group_id='$group_id' AND week BETWEEN '$start' AND '$end' ORDER BY week");
+
+	} elseif ($span == REPORT_TYPE_DAILY) {
+
+		$res=db_query("SELECT * FROM rep_group_act_daily 
+			WHERE group_id='$group_id' AND day BETWEEN '$start' AND '$end' ORDER BY day ASC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportProjectAct:: '.db_error());
+		return false;
+	}
+	$this->setSpan($span);
+	$this->setDates($res,1);
+	$this->res=$res;
+	return true;
+}
+
+function &getTrackerOpened() {
+	return util_result_column_to_array($this->res,2);
+}
+
+function &getTrackerClosed() {
+	return util_result_column_to_array($this->res,3);
+}
+
+function &getForum() {
+	return util_result_column_to_array($this->res,4);
+}
+
+function &getDocs() {
+	return util_result_column_to_array($this->res,5);
+}
+
+function &getDownloads() {
+	return util_result_column_to_array($this->res,6);
+}
+
+function &getCVSCommits() {
+	return util_result_column_to_array($this->res,7);
+}
+
+function &getTaskOpened() {
+	return util_result_column_to_array($this->res,8);
+}
+
+function &getTaskClosed() {
+	return util_result_column_to_array($this->res,9);
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectTime.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectTime.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportProjectTime.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,124 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportProjectTime extends Report {
+
+function ReportProjectTime($group_id,$type,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$group_id) {
+		$this->setError('No User_id');
+		return false;
+	}
+
+	//
+	//	Task report
+	//
+	if (!$type || $type=='tasks') {
+
+		$res=db_query("SELECT pt.summary,sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE pgl.group_project_id=pt.group_project_id
+			AND pgl.group_id='$group_id'
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			GROUP BY pt.summary
+			ORDER BY hours DESC");
+
+	//
+	//	Category report
+	//
+	} elseif ($type=='category') {
+
+		$res=db_query("SELECT rtc.category_name, sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, rep_time_category rtc, project_task pt, project_group_list pgl
+			WHERE pgl.group_id='$group_id' 
+			AND pgl.group_project_id=pt.group_project_id
+			AND rtt.project_task_id=pt.project_task_id
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.time_code=rtc.time_code
+			GROUP BY rtc.category_name
+			ORDER BY hours DESC");
+
+	//
+	//	Percentage this user spent on a specific subproject
+	//
+	} elseif ($type=='subproject') {
+
+		$res=db_query("SELECT pgl.project_name, sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE pgl.group_id='$group_id'
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			AND pt.group_project_id=pgl.group_project_id
+			GROUP BY pgl.project_name
+			ORDER BY hours DESC");
+
+	} else {
+
+	//
+	//	Biggest Users
+	//
+		$res=db_query("SELECT u.realname, sum(rtt.hours) AS hours 
+			FROM users u, rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE pgl.group_id='$group_id'
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			AND pt.group_project_id=pgl.group_project_id
+			AND u.user_id=rtt.user_id
+			GROUP BY u.realname
+			ORDER BY hours DESC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportUserAct:: '.db_error());
+		return false;
+	}
+
+	$this->labels = util_result_column_to_array($res,0);
+	$this->setData($res,1);
+	return true;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSetup.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSetup.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSetup.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,1038 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportSetup extends Report {
+
+function ReportSetup() {
+	$this->Report();
+
+}
+
+function initialSetup() {
+	$this->createTables();
+	if (!$this->initialData()) {
+		return false;
+	} else {
+		return true;
+	}
+}
+
+function createTables() {
+
+//time tracking
+//DROP TABLE rep_time_category;
+	$sql[]="CREATE TABLE rep_time_category (
+	time_code serial UNIQUE,
+	category_name text
+	);";
+	//$sql[]="DROP TABLE rep_time_tracking;";
+	$sql[]="CREATE TABLE rep_time_tracking (
+	week int not null,
+	report_date int not null,
+	user_id int not null,
+	project_task_id int not null,
+	time_code int not null CONSTRAINT reptimetrk_timecode REFERENCES rep_time_category(time_code),
+	hours float not null
+	);";
+//	$sql[]="CREATE UNIQUE INDEX reptimetrk_weekusrtskcde ON 
+//		rep_time_tracking (week,user_id,project_task_id,time_code);";
+	$sql[]="CREATE INDEX reptimetracking_userdate ON 
+		rep_time_tracking (user_id,week);";
+
+	$sql[]="INSERT INTO rep_time_category VALUES ('1','Coding');";
+	$sql[]="INSERT INTO rep_time_category VALUES ('2','Testing');";
+	$sql[]="INSERT INTO rep_time_category VALUES ('3','Meeting');";
+	$sql[]="SELECT setval('rep_time_category_time_code_seq',(SELECT max(time_code) FROM rep_time_category));";
+
+//added users
+	$sql[]="DROP TABLE rep_users_added_daily;";
+	$sql[]="CREATE TABLE rep_users_added_daily (
+	day int not null primary key,
+	added int not null default 0);";
+
+	$sql[]="DROP TABLE rep_users_added_weekly";
+	$sql[]="CREATE TABLE rep_users_added_weekly (
+	week int not null primary key,
+	added int not null default 0);";
+
+	$sql[]="DROP TABLE rep_users_added_monthly";
+	$sql[]="CREATE TABLE rep_users_added_monthly (
+	month int not null primary key,
+	added int not null default 0);";
+
+//cumulative users
+	$sql[]="DROP TABLE rep_users_cum_daily";
+	$sql[]="CREATE TABLE rep_users_cum_daily (
+	day int not null primary key,
+	total int not null default 0);";
+
+	$sql[]="DROP TABLE rep_users_cum_weekly";
+	$sql[]="CREATE TABLE rep_users_cum_weekly (
+	week int not null primary key,
+	total int not null default 0);";
+
+	$sql[]="DROP TABLE rep_users_cum_monthly";
+	$sql[]="CREATE TABLE rep_users_cum_monthly (
+	month int not null primary key,
+	total int not null default 0);";
+
+//per-user activity
+	$sql[]="DROP TABLE rep_user_act_daily";
+	$sql[]="CREATE TABLE rep_user_act_daily (
+	user_id int not null,
+	day int not null,
+	tracker_opened int not null,
+	tracker_closed int not null,
+	forum int not null,
+	docs int not null,
+	cvs_commits int not null,
+	tasks_opened int not null,
+	tasks_closed int not null,
+	PRIMARY KEY (user_id,day));";
+
+	$sql[]="DROP TABLE rep_user_act_weekly";
+	$sql[]="CREATE TABLE rep_user_act_weekly (
+	user_id int not null,
+	week int not null,
+	tracker_opened int not null,
+	tracker_closed int not null,
+	forum int not null,
+	docs int not null,
+	cvs_commits int not null,
+	tasks_opened int not null,
+	tasks_closed int not null,
+	PRIMARY KEY (user_id,week));";
+
+	$sql[]="DROP TABLE rep_user_act_monthly";
+	$sql[]="CREATE TABLE rep_user_act_monthly (
+	user_id int not null,
+	month int not null,
+	tracker_opened int not null,
+	tracker_closed int not null,
+	forum int not null,
+	docs int not null,
+	cvs_commits int not null,
+	tasks_opened int not null,
+	tasks_closed int not null,
+	PRIMARY KEY (user_id,month));";
+
+	$sql[]="DROP VIEW rep_user_act_oa_vw";
+	$sql[]="CREATE VIEW rep_user_act_oa_vw AS
+	SELECT user_id,
+	sum(tracker_opened) AS tracker_opened,
+	sum(tracker_closed) AS tracker_closed,
+	sum(forum) AS forum, 
+	sum(docs) AS docs, 
+	sum(cvs_commits) AS cvs_commits,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed 
+	FROM rep_user_act_monthly
+	GROUP BY user_id;";
+
+//per-project activity
+	$sql[]="DROP TABLE rep_group_act_daily";
+	$sql[]="CREATE TABLE rep_group_act_daily (
+	group_id int not null,
+	day int not null,
+	tracker_opened int not null,
+	tracker_closed int not null,
+	forum int not null,
+	docs int not null,
+	downloads int not null,
+	cvs_commits int not null,
+	tasks_opened int not null,
+	tasks_closed int not null,
+	PRIMARY KEY (group_id,day));";
+
+	$sql[]="DROP INDEX repgroupactdaily_day";
+	$sql[]="CREATE INDEX repgroupactdaily_day ON rep_group_act_daily(day)";
+
+	$sql[]="DROP TABLE rep_group_act_weekly";
+	$sql[]="CREATE TABLE rep_group_act_weekly (
+	group_id int not null,
+	week int not null,
+	tracker_opened int not null,
+	tracker_closed int not null,
+	forum int not null,
+	docs int not null,
+	downloads int not null,
+	cvs_commits int not null,
+	tasks_opened int not null,
+	tasks_closed int not null,
+	PRIMARY KEY (group_id,week));";
+
+	$sql[]="DROP INDEX repgroupactweekly_week";
+	$sql[]="CREATE INDEX repgroupactweekly_week ON rep_group_act_weekly(week)";
+
+	$sql[]="DROP TABLE rep_group_act_monthly";
+	$sql[]="CREATE TABLE rep_group_act_monthly (
+	group_id int not null,
+	month int not null,
+	tracker_opened int not null,
+	tracker_closed int not null,
+	forum int not null,
+	docs int not null,
+	downloads int not null,
+	cvs_commits int not null,
+	tasks_opened int not null,
+	tasks_closed int not null,
+	PRIMARY KEY (group_id,month));";
+
+	$sql[]="DROP INDEX repgroupactmonthly_month";
+	$sql[]="CREATE INDEX repgroupactmonthly_month ON rep_group_act_monthly(month)";
+
+	$sql[]="DROP VIEW rep_group_act_oa_vw";
+	$sql[]="CREATE VIEW rep_group_act_oa_vw AS
+	SELECT group_id,
+	sum(tracker_opened) AS tracker_opened,
+	sum(tracker_closed) AS tracker_closed,
+	sum(forum) AS forum,
+	sum(docs) AS docs,
+	sum(downloads) AS downloads,
+	sum(cvs_commits) AS cvs_commits,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed
+	FROM rep_group_act_monthly
+	GROUP BY group_id;";
+
+//overall activity
+	$sql[]="DROP VIEW rep_site_act_daily_vw";
+	$sql[]="CREATE VIEW rep_site_act_daily_vw AS 
+	SELECT day,
+	sum(tracker_opened) AS tracker_opened,
+	sum(tracker_closed) AS tracker_closed,
+	sum(forum) AS forum,
+	sum(docs) AS docs,
+	sum(downloads) AS downloads,
+	sum(cvs_commits) AS cvs_commits,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed
+	FROM rep_group_act_daily
+	GROUP BY day;";
+
+	$sql[]="DROP VIEW rep_site_act_weekly_vw";
+	$sql[]="CREATE VIEW rep_site_act_weekly_vw AS 
+	SELECT week,
+	sum(tracker_opened) AS tracker_opened,
+	sum(tracker_closed) AS tracker_closed,
+	sum(forum) AS forum,
+	sum(docs) AS docs,
+	sum(downloads) AS downloads,
+	sum(cvs_commits) AS cvs_commits,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed
+	FROM rep_group_act_weekly
+	GROUP BY week;";
+
+	$sql[]="DROP VIEW rep_site_act_monthly_vw";
+	$sql[]="CREATE VIEW rep_site_act_monthly_vw AS
+	SELECT month,
+	sum(tracker_opened) AS tracker_opened,
+	sum(tracker_closed) AS tracker_closed,
+	sum(forum) AS forum,
+	sum(docs) AS docs,
+	sum(downloads) AS downloads,
+	sum(cvs_commits) AS cvs_commits,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed
+	FROM rep_group_act_monthly
+	GROUP BY month;";
+
+	$sql[]="DROP VIEW rep_site_act_oa_vw";
+	$sql[]="CREATE VIEW rep_site_act_oa_vw AS
+	sum(tracker_opened) AS tracker_opened,
+	sum(tracker_closed) AS tracker_closed,
+	sum(forum) AS forum,
+	sum(docs) AS docs,
+	sum(downloads) AS downloads,
+	sum(cvs_commits) AS cvs_commits,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed
+	FROM rep_group_act_monthly;";
+
+	for ($i=0; $i<count($sql); $i++) {
+
+		$res=db_query($sql[$i]);
+
+	}
+
+}
+
+function initialData() {
+	if (!$this->backfill_users_added_daily()) {
+		return false;
+	}
+	if (!$this->backfill_users_added_weekly()) {
+		return false;
+	}
+	if (!$this->backfill_users_added_monthly()) {
+		return false;
+	}
+	if (!$this->backfill_users_cum_daily()) {
+		return false;
+	}
+	if (!$this->backfill_users_cum_weekly()) {
+		return false;
+	}
+	if (!$this->backfill_users_cum_monthly()) {
+		return false;
+	}
+	if (!$this->backfill_user_act_daily()) {
+		return false;
+	}
+	if (!$this->backfill_user_act_weekly()) {
+		return false;
+	}
+	if (!$this->backfill_user_act_monthly()) {
+		return false;
+	}
+	if (!$this->backfill_group_act_daily()) {
+		return false;
+	}
+	if (!$this->backfill_group_act_weekly()) {
+		return false;
+	}
+	if (!$this->backfill_group_act_monthly()) {
+		return false;
+	}
+	return true;
+
+}
+
+function dailyData() {
+	if (!$this->backfill_users_added_daily(1)) {
+		return false;
+	}
+	if (!$this->backfill_users_added_weekly(1)) {
+		return false;
+	}
+	if (!$this->backfill_users_added_monthly(2)) {
+		return false;
+	}
+	if (!$this->backfill_users_cum_daily(1)) {
+		return false;
+	}
+	if (!$this->backfill_users_cum_weekly(1)) {
+		return false;
+	}
+	if (!$this->backfill_users_cum_monthly(2)) {
+		return false;
+	}
+	if (!$this->backfill_user_act_daily(1)) {
+		return false;
+	}
+	if (!$this->backfill_user_act_weekly(1)) {
+		return false;
+	}
+	if (!$this->backfill_user_act_monthly(2)) {
+		return false;
+	}
+	if (!$this->backfill_group_act_daily(1)) {
+		return false;
+	}
+	if (!$this->backfill_group_act_weekly(1)) {
+		return false;
+	}
+	if (!$this->backfill_group_act_monthly(2)) {
+		return false;
+	}
+	return true;
+}
+/**
+ *	Add a row to the users_added_daily report table.
+ *
+ *	@param	int	Day - the unix time of the beginning of the day.
+ *	@return	boolean	Success.
+ */
+function users_added_daily($day) {
+	db_query("DELETE FROM rep_users_added_daily WHERE day='$day'");
+
+	$sql="INSERT INTO rep_users_added_daily (day,added) 
+		VALUES ('$day',(SELECT count(*) FROM users WHERE status='A' AND add_date 
+		BETWEEN '$day' AND '". ($day + REPORT_DAY_SPAN - 1) ."' ))";
+	return db_query($sql);
+}
+
+/**
+ *	Populate the users_added_daily report table.
+ *
+ *	@return	boolean	Success.
+ */
+function backfill_users_added_daily($count=10000) {
+	$today=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
+	if (!$start_date=$this->getMinDate()) {
+		$this->setError('backfill_users_added_daily:: Could Not Get Start Date');
+		return false;
+	}
+	while (true) {
+		$day=($today-($i*REPORT_DAY_SPAN));
+		if (!$this->users_added_daily($day)) {
+			$this->setError('backfill_users_added_daily:: Error adding daily row: '.db_error());
+			return false;
+		}
+		if ($day < $start_date) {
+			break;
+		}
+		$i++;
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the users_added_weekly report table.
+ *
+ *  @param  int Week - the unix time of the beginning of the sunday for this week.
+ *  @return boolean Success.
+ */
+function users_added_weekly($week) {
+	db_query("DELETE FROM rep_users_added_weekly WHERE week='$week'");
+
+	$sql="INSERT INTO rep_users_added_weekly (week,added)
+		VALUES ('$week',(SELECT count(*) FROM users WHERE status='A' AND add_date
+		BETWEEN '$week' AND '". ($week+REPORT_WEEK_SPAN-1) ."' ))";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the users_added_weekly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_users_added_weekly($count=10000) {
+
+	$arr =& $this->getWeekStartArr();
+
+	for ($i=0; $i<count($arr); $i++) {
+		if (!$this->users_added_weekly($arr[$i])) {
+			$this->setError('backfill_users_added_weekly:: Error adding weekly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the users_added_monthly report table.
+ *
+ *  @param  int month_start - the unix time of the beginning of the month.
+ *  @param  int month_end - the unix time of the end of the month.
+ *  @return boolean Success.
+ */
+function users_added_monthly($month,$end) {
+	db_query("DELETE FROM rep_users_added_monthly WHERE month='$month'");
+
+	$sql="INSERT INTO rep_users_added_monthly (month,added)
+		VALUES ('$month',(SELECT count(*) FROM users WHERE status='A' AND add_date
+		BETWEEN '$month' AND '$end' ))";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the users_added_monthly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_users_added_monthly($count=10000) {
+
+	$arr =& $this->getMonthStartArr();
+
+//skipping first one
+	for ($i=1; $i<count($arr); $i++) {
+		if (!$this->users_added_monthly($arr[$i],($arr[$i-1]-1))) {
+			$this->setError('backfill_users_added_monthly:: Error adding monthly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+
+// ******************************
+
+
+/**
+ *	Add a row to the users_cum_daily report table.
+ *
+ *	@param	int	Day - the unix time of the beginning of the day.
+ *	@return	boolean	Success.
+ */
+function users_cum_daily($day) {
+	db_query("DELETE FROM rep_users_cum_daily WHERE day='$day'");
+
+	$sql="INSERT INTO rep_users_cum_daily (day,total) 
+		VALUES ('$day',(SELECT count(*) FROM users WHERE status='A' AND add_date 
+		BETWEEN '0' AND '$day'))";
+	return db_query($sql);
+}
+
+/**
+ *	Populate the users_cum_daily report table.
+ *
+ *	@return	boolean	Success.
+ */
+function backfill_users_cum_daily($count=10000) {
+	$today=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
+	if (!$start_date=$this->getMinDate()) {
+		$this->setError('backfill_users_cum_daily:: Could Not Get Start Date');
+		return false;
+	}
+	while (true) {
+		$day=$today-($i*REPORT_DAY_SPAN);
+		if (!$this->users_cum_daily($day)) {
+			$this->setError('backfill_users_cum_daily:: Error adding daily row: '.db_error());
+			return false;
+		}
+		if ($day < $start_date) {
+			break;
+		}
+		$i++;
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the users_cum_weekly report table.
+ *
+ *  @param  int Week - the unix time of the beginning of the sunday for this week.
+ *  @return boolean Success.
+ */
+function users_cum_weekly($week) {
+	db_query("DELETE FROM rep_users_cum_weekly WHERE week='$week'");
+
+	$sql="INSERT INTO rep_users_cum_weekly (week,total)
+		VALUES ('$week',(SELECT count(*) FROM users WHERE status='A' AND add_date
+		BETWEEN '0' AND '". ($week+REPORT_WEEK_SPAN-1 ). "'))";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the users_cum_weekly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_users_cum_weekly($count=10000) {
+
+	$arr =& $this->getWeekStartArr();
+
+	for ($i=0; $i<count($arr); $i++) {
+		if (!$this->users_cum_weekly($arr[$i])) {
+			$this->setError('backfill_users_cum_weekly:: Error adding weekly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the users_cum_monthly report table.
+ *
+ *  @param  int month_start - the unix time of the beginning of the month.
+ *  @param  int month_end - the unix time of the end of the month.
+ *  @return boolean Success.
+ */
+function users_cum_monthly($month,$end) {
+	db_query("DELETE FROM rep_users_cum_monthly WHERE month='$month'");
+
+	$sql="INSERT INTO rep_users_cum_monthly (month,total)
+		VALUES ('$month',(SELECT count(*) FROM users WHERE status='A' AND add_date
+		BETWEEN '0' AND '$end'))";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the users_cum_monthly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_users_cum_monthly($count=10000) {
+
+	$arr =& $this->getMonthStartArr();
+
+//skip first one
+	for ($i=1; $i<count($arr); $i++) {
+		if (!$this->users_cum_monthly($arr[$i],($arr[$i-1]-1))) {
+			$this->setError('backfill_users_cum_monthly:: Error adding monthly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+
+// ************************
+
+
+/**
+ *	Add a row to the user_act_daily report table.
+ *
+ *	@param	int	Day - the unix time of the beginning of the day.
+ *	@return	boolean	Success.
+ */
+function user_act_daily($day) {
+
+	db_query("DELETE FROM rep_user_act_daily WHERE day='$day'");
+
+$sql="INSERT INTO rep_user_act_daily
+SELECT user_id,day,coalesce(tracker_opened,0) AS tracker_opened,
+	coalesce(tracker_closed,0) AS tracker_closed,
+	coalesce(forum,0) AS forum,
+	coalesce(docs,0) AS docs,
+	coalesce(cvs_commits,0) AS cvs_commits,
+	coalesce(tasks_opened,0) AS tasks_opened,
+	coalesce(tasks_closed,0) AS tasks_closed
+	FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM 
+	(SELECT submitted_by AS user_id, '$day'::int AS day, count(*) AS tracker_opened
+	FROM artifact
+	WHERE open_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	GROUP BY user_id,day) aopen 
+
+FULL OUTER JOIN 
+	(SELECT assigned_to AS user_id, '$day'::int AS day, count(*) AS tracker_closed
+	FROM artifact
+	WHERE close_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	GROUP BY user_id,day ) aclosed USING (user_id,day)) foo1
+
+FULL OUTER JOIN 
+	(SELECT posted_by AS user_id, '$day'::int AS day, count(*) AS forum
+	FROM forum
+	WHERE post_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	GROUP BY user_id,day ) forum USING (user_id,day)) foo2
+
+FULL OUTER JOIN
+	(SELECT created_by AS user_id, '$day'::int AS day, count(*) AS docs
+	FROM doc_data
+	WHERE createdate BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."' 
+	GROUP BY user_id,day ) docs USING (user_id,day)) foo3
+
+FULL OUTER JOIN
+	(SELECT user_id,$day AS day, sum(commits) AS cvs_commits
+	FROM stats_cvs_user
+	WHERE month='". date('Ym') ."' AND day='". date('d') ."'
+	GROUP BY user_id,day ) cvs USING (user_id,day)) foo4
+
+FULL OUTER JOIN
+	(SELECT created_by AS user_id, '$day'::int AS day, count(*) AS tasks_opened
+	FROM project_task
+	WHERE start_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	GROUP BY user_id,day ) topen USING (user_id,day)) foo5
+
+FULL OUTER JOIN
+	(SELECT mod_by AS user_id, '$day'::int AS day, count(*) AS tasks_closed 
+	FROM project_history
+	WHERE mod_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	AND old_value='1' AND field_name='status_id'
+	GROUP BY user_id,day ) tclosed USING (user_id,day)) foo6";
+
+	return db_query($sql);
+
+}
+
+/**
+ *	Populate the user_act_daily report table.
+ *
+ *	@return	boolean	Success.
+ */
+function backfill_user_act_daily($count=10000) {
+	$today=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
+	if (!$start_date=$this->getMinDate()) {
+		$this->setError('backfill_user_act_daily:: Could Not Get Start Date');
+		return false;
+	}
+	while (true) {
+		$day=$today-($i*REPORT_DAY_SPAN);
+		if (!$this->user_act_daily($day)) {
+			$this->setError('backfill_user_act_daily:: Error adding daily row: '.db_error());
+			return false;
+		}
+		if ($day < $start_date) {
+			break;
+		}
+		$i++;
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the user_act_weekly report table.
+ *
+ *  @param  int Week - the unix time of the beginning of the sunday for this week.
+ *  @return boolean Success.
+ */
+function user_act_weekly($week) {
+	db_query("DELETE FROM rep_user_act_weekly WHERE week='$week'");
+
+	$sql="INSERT INTO rep_user_act_weekly (user_id,week,tracker_opened,tracker_closed,
+		forum,docs,cvs_commits,tasks_opened,tasks_closed)
+		SELECT user_id,'$week'::int AS week, sum(tracker_opened) AS tracker_opened,
+		sum(tracker_closed) AS tracker_closed,
+		sum(forum) AS forum,
+		sum(docs) AS docs,
+		sum(cvs_commits) AS cvs_commits,
+		sum(tasks_opened) AS tasks_opened,
+		sum(tasks_closed) AS tasks_closed
+		FROM rep_user_act_daily
+		WHERE DAY
+		BETWEEN '$week' AND '". ($week+REPORT_WEEK_SPAN-1) ."'
+		GROUP BY user_id,week";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the user_act_weekly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_user_act_weekly($count=10000) {
+
+	$arr =& $this->getWeekStartArr();
+
+	for ($i=0; $i<count($arr); $i++) {
+		if (!$this->user_act_weekly($arr[$i])) {
+			$this->setError('backfill_user_act_weekly:: Error adding weekly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the user_act_monthly report table.
+ *
+ *  @param  int month_start - the unix time of the beginning of the month.
+ *  @param  int month_end - the unix time of the end of the month.
+ *  @return boolean Success.
+ */
+function user_act_monthly($month,$end) {
+	db_query("DELETE FROM rep_user_act_monthly WHERE month='$month'");
+
+	$sql="INSERT INTO rep_user_act_monthly (user_id,month,tracker_opened,tracker_closed,
+		forum,docs,cvs_commits,tasks_opened,tasks_closed)
+		SELECT user_id,'$month'::int AS month, sum(tracker_opened) AS tracker_opened,
+		sum(tracker_closed) AS tracker_closed,
+		sum(forum) AS forum,
+		sum(docs) AS docs,
+		sum(cvs_commits) AS cvs_commits,
+		sum(tasks_opened) AS tasks_opened,
+		sum(tasks_closed) AS tasks_closed
+		FROM rep_user_act_daily
+		WHERE DAY
+		BETWEEN '$month' AND '$end'
+		GROUP BY user_id,month";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the user_act_monthly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_user_act_monthly($count=10000) {
+
+	$arr =& $this->getMonthStartArr();
+
+	for ($i=1; $i<count($arr); $i++) {
+		if (!$this->user_act_monthly($arr[$i],($arr[$i-1]-1))) {
+			$this->setError('backfill_user_act_monthly:: Error adding monthly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+// ************************
+
+
+/**
+ *	Add a row to the group_act_daily report table.
+ *
+ *	@param	int	Day - the unix time of the beginning of the day.
+ *	@return	boolean	Success.
+ */
+function group_act_daily($day) {
+
+	db_query("DELETE FROM rep_group_act_daily WHERE day='$day'");
+
+$sql="INSERT INTO rep_group_act_daily
+SELECT group_id,day,coalesce(tracker_opened,0) AS tracker_opened,
+	coalesce(tracker_closed,0) AS tracker_closed,
+	coalesce(forum,0) AS forum,
+	coalesce(docs,0) AS docs,
+	coalesce(downloads,0) AS downloads,
+	coalesce(cvs_commits,0) AS cvs_commits,
+	coalesce(tasks_opened,0) AS tasks_opened,
+	coalesce(tasks_closed,0) AS tasks_closed
+	FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM
+(SELECT * FROM 
+	(SELECT agl.group_id, '$day'::int AS day, count(*) AS tracker_opened
+	FROM artifact a, artifact_group_list agl
+	WHERE a.open_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	AND a.group_artifact_id=agl.group_artifact_id
+	GROUP BY group_id,day) aopen 
+
+FULL OUTER JOIN 
+	(SELECT agl.group_id, '$day'::int AS day, count(*) AS tracker_closed
+	FROM artifact a, artifact_group_list agl
+	WHERE a.close_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	AND a.group_artifact_id=agl.group_artifact_id
+	GROUP BY group_id,day ) aclosed USING (group_id,day)) foo1
+
+FULL OUTER JOIN 
+	(SELECT fgl.group_id, '$day'::int AS day, count(*) AS forum
+	FROM forum f, forum_group_list fgl
+	WHERE f.post_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	AND f.group_forum_id=fgl.group_forum_id
+	GROUP BY group_id,day ) forum USING (group_id,day)) foo2
+
+FULL OUTER JOIN
+	(SELECT group_id, '$day'::int AS day, count(*) AS docs
+	FROM doc_data
+	WHERE createdate BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."' 
+	GROUP BY group_id,day ) docs USING (group_id,day)) foo3
+
+FULL OUTER JOIN
+	(SELECT fp.group_id, '$day'::int AS day, count(*) AS downloads
+	FROM frs_package fp, frs_release fr, frs_file ff, frs_dlstats_file fdf
+	WHERE fp.package_id=fr.package_id
+	AND fr.release_id=ff.release_id
+	AND ff.file_id=fdf.file_id
+	AND fdf.month = '". date('Ym',$day) ."' AND fdf.day = '". date('d',$day) ."'
+	GROUP BY fp.group_id,day ) docs USING (group_id,day)) foo4
+
+FULL OUTER JOIN
+	(SELECT group_id,$day AS day, sum(commits) AS cvs_commits
+	FROM stats_cvs_group
+	WHERE month='". date('Ym',$day) ."' AND day='". date('d',$day) ."'
+	GROUP BY group_id,day ) cvs USING (group_id,day)) foo5
+
+FULL OUTER JOIN
+	(SELECT pgl.group_id, '$day'::int AS day,count(*) AS tasks_opened
+	FROM project_task pt, project_group_list pgl
+	WHERE pt.start_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	AND pt.group_project_id=pgl.group_project_id
+	GROUP BY group_id,day ) topen USING (group_id,day)) foo6
+
+FULL OUTER JOIN
+	(SELECT pgl.group_id, '$day'::int AS day, count(*) AS tasks_closed 
+	FROM project_history ph, project_task pt, project_group_list pgl
+	WHERE ph.mod_date BETWEEN '$day' AND '". ($day+REPORT_DAY_SPAN-1) ."'
+	AND ph.old_value='1' 
+	AND ph.field_name='status_id'
+	AND ph.project_task_id=pt.project_task_id
+	AND pt.group_project_id=pgl.group_project_id
+	GROUP BY group_id,day ) tclosed USING (group_id,day)) foo7";
+
+	return db_query($sql);
+
+}
+
+/**
+ *	Populate the group_act_daily report table.
+ *
+ *	@return	boolean	Success.
+ */
+function backfill_group_act_daily($count=10000) {
+	$today=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
+	if (!$start_date=$this->getMinDate()) {
+		$this->setError('backfill_group_act_daily:: Could Not Get Start Date');
+		return false;
+	}
+	while (true) {
+		$day=$today-($i*REPORT_DAY_SPAN);
+		if (!$this->group_act_daily($day)) {
+			$this->setError('backfill_group_act_daily:: Error adding daily row: '.db_error());
+			return false;
+		}
+		if ($day < $start_date) {
+			break;
+		}
+		$i++;
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the group_act_weekly report table.
+ *
+ *  @param  int Week - the unix time of the beginning of the sunday for this week.
+ *  @return boolean Success.
+ */
+function group_act_weekly($week) {
+	db_query("DELETE FROM rep_group_act_weekly WHERE week='$week'");
+
+	$sql="INSERT INTO rep_group_act_weekly (group_id,week,tracker_opened,tracker_closed,
+		forum,docs,downloads,cvs_commits,tasks_opened,tasks_closed)
+		SELECT group_id,'$week'::int AS week, sum(tracker_opened) AS tracker_opened,
+		sum(tracker_closed) AS tracker_closed,
+		sum(forum) AS forum,
+		sum(docs) AS docs,
+		sum(downloads) AS downloads,
+		sum(cvs_commits) AS cvs_commits,
+		sum(tasks_opened) AS tasks_opened,
+		sum(tasks_closed) AS tasks_closed
+		FROM rep_group_act_daily
+		WHERE DAY
+		BETWEEN '$week' AND '". ($week+REPORT_WEEK_SPAN-1) ."'
+		GROUP BY group_id,week";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the group_act_weekly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_group_act_weekly($count=10000) {
+
+	$arr =& $this->getWeekStartArr();
+
+	for ($i=0; $i<count($arr); $i++) {
+		if (!$this->group_act_weekly($arr[$i])) {
+			$this->setError('backfill_user_act_weekly:: Error adding weekly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the group_act_monthly report table.
+ *
+ *  @param  int month_start - the unix time of the beginning of the month.
+ *  @param  int month_end - the unix time of the end of the month.
+ *  @return boolean Success.
+ */
+function group_act_monthly($month,$end) {
+	db_query("DELETE FROM rep_group_act_monthly WHERE month='$month'");
+
+	$sql="INSERT INTO rep_group_act_monthly (group_id,month,tracker_opened,tracker_closed,
+		forum,docs,downloads,cvs_commits,tasks_opened,tasks_closed)
+		SELECT group_id,'$month'::int AS month, sum(tracker_opened) AS tracker_opened,
+		sum(tracker_closed) AS tracker_closed,
+		sum(forum) AS forum,
+		sum(docs) AS docs,
+		sum(downloads) AS downloads,
+		sum(cvs_commits) AS cvs_commits,
+		sum(tasks_opened) AS tasks_opened,
+		sum(tasks_closed) AS tasks_closed
+		FROM rep_group_act_daily
+		WHERE DAY
+		BETWEEN '$month' AND '$end'
+		GROUP BY group_id,month";
+	return db_query($sql);
+}
+
+/**
+ *  Populate the group_act_monthly report table.
+ *
+ *  @return boolean Success.
+ */
+function backfill_group_act_monthly($count=10000) {
+
+	$arr =& $this->getMonthStartArr();
+
+	for ($i=1; $i<count($arr); $i++) {
+		if (!$this->group_act_monthly($arr[$i],($arr[$i-1]-1))) {
+			$this->setError('backfill_group_act_monthly:: Error adding monthly row: '.db_error());
+			return false;
+		}
+		if ($i >= $count) {
+			break;
+		}
+	}
+	return true;
+}
+
+/**
+ *  Add a row to the rep_time_category table.
+ *
+ *	@param	string	The category name.
+ *  @return boolean Success.
+ */
+function addTimeCode($category_name) {
+	return db_query("INSERT INTO rep_time_category (category_name) VALUES ('$category_name')");
+}
+
+/**
+ *  Update the rep_time_category table.
+ *
+ *	@param	string	The category name.
+ *  @return boolean Success.
+ */
+function updateTimeCode($time_code, $category_name) {
+	return db_query("UPDATE rep_time_category SET category_name='$category_name' WHERE time_code='$time_code'");
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteAct.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteAct.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteAct.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportSiteAct extends Report {
+
+var $res;
+
+function ReportSiteAct($span,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$span || $span == REPORT_TYPE_MONTHLY) {
+
+		$res=db_query("SELECT * FROM rep_site_act_monthly_vw 
+			WHERE month BETWEEN '$start' AND '$end' ORDER BY month");
+
+	} elseif ($span == REPORT_TYPE_WEEKLY) {
+
+		$res=db_query("SELECT * FROM rep_site_act_weekly_vw 
+			WHERE week BETWEEN '$start' AND '$end' ORDER BY week");
+
+	} elseif ($span == REPORT_TYPE_DAILY) {
+
+		$res=db_query("SELECT * FROM rep_site_act_daily_vw 
+			WHERE day BETWEEN '$start' AND '$end' ORDER BY day ASC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportProjectAct:: '.db_error());
+		return false;
+	}
+	$this->setSpan($span);
+	$this->setDates($res,0);
+	$this->res=$res;
+	return true;
+}
+
+function &getTrackerOpened() {
+	return util_result_column_to_array($this->res,1);
+}
+
+function &getTrackerClosed() {
+	return util_result_column_to_array($this->res,2);
+}
+
+function &getForum() {
+	return util_result_column_to_array($this->res,3);
+}
+
+function &getDocs() {
+	return util_result_column_to_array($this->res,4);
+}
+
+function &getDownloads() {
+	return util_result_column_to_array($this->res,5);
+}
+
+function &getCVSCommits() {
+	return util_result_column_to_array($this->res,6);
+}
+
+function &getTaskOpened() {
+	return util_result_column_to_array($this->res,7);
+}
+
+function &getTaskClosed() {
+	return util_result_column_to_array($this->res,8);
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteTime.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteTime.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportSiteTime.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportSiteTime extends Report {
+
+function ReportSiteTime($type,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	//
+	//	Task report
+	//
+	if (!$type || $type=='tasks') {
+
+		$res=db_query("SELECT pt.summary,sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE pgl.group_project_id=pt.group_project_id
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			GROUP BY pt.summary
+			ORDER BY hours DESC");
+
+	//
+	//	Category report
+	//
+	} elseif ($type=='category') {
+
+		$res=db_query("SELECT rtc.category_name, sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, rep_time_category rtc
+			WHERE rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.time_code=rtc.time_code
+			GROUP BY rtc.category_name
+			ORDER BY hours DESC");
+
+	//
+	//	Percentage this user spent on a specific subproject
+	//
+	} elseif ($type=='subproject') {
+
+		$res=db_query("SELECT pgl.project_name, sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			AND pt.group_project_id=pgl.group_project_id
+			GROUP BY pgl.project_name
+			ORDER BY hours DESC");
+
+	} else {
+
+		$res=db_query("SELECT u.realname, sum(rtt.hours) AS hours 
+			FROM users u, rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE rtt.report_date BETWEEN '$start' AND '$end' 
+			AND u.user_id=rtt.user_id
+			GROUP BY u.realname
+			ORDER BY hours DESC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportUserAct:: '.db_error());
+		return false;
+	}
+
+	$this->labels = util_result_column_to_array($res,0);
+	$this->setData($res,1);
+	return true;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportTrackerAct.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportTrackerAct.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportTrackerAct.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,149 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportTrackerAct extends Report {
+
+var $res;
+var $avgtime;
+var $opencount;
+var $stillopencount;
+
+function ReportTrackerAct($span,$group_id,$atid,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y')-1);
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$group_id) {
+		$this->setError('No group_id');
+		return false;
+	}
+	if (!$span || $span == REPORT_TYPE_MONTHLY) {
+
+		$arr =& $this->getMonthStartArr();
+
+		for ($i=1; $i<count($arr); $i++) {
+			if ($arr[$i]<$start || $arr[$i]>$end) {
+				//skip this month as it's not in the range
+			} else {
+
+				$this->labels[]=date('M d',$arr[$i]).' <-> '.date('M d',($arr[$i-1]-1));
+				$this->avgtime[]=$this->getAverageTime($atid,$arr[$i],($arr[$i-1]-1));
+				$this->opencount[]=$this->getOpenCount($atid,$arr[$i],($arr[$i-1]-1));
+				$this->stillopencount[]=$this->getStillOpenCount($atid,$arr[$i],($arr[$i-1]-1));
+
+			}
+		}
+
+	} elseif ($span == REPORT_TYPE_WEEKLY) {
+
+		$arr =& $this->getWeekStartArr();
+
+		for ($i=1; $i<count($arr); $i++) {
+			if ($arr[$i]<$start || $arr[$i]>$end) {
+				//skip this month as it's not in the range
+			} else {
+
+				$this->labels[]=date('M d',$arr[$i]).' <-> '.date('M d',($arr[$i-1]-1));
+				$this->avgtime[]=$this->getAverageTime($atid,$arr[$i],($arr[$i-1]-1));
+				$this->opencount[]=$this->getOpenCount($atid,$arr[$i],($arr[$i-1]-1));
+				$this->stillopencount[]=$this->getStillOpenCount($atid,$arr[$i],($arr[$i-1]-1));
+
+			}
+		}
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	$this->setSpan($span);
+	$this->setDates($res,1);
+	$this->res=$res;
+	return true;
+}
+
+function getAverageTime($atid,$start,$end) {
+	$sql="SELECT avg((close_date-open_date)/(24*60*60)) AS avgtime
+		FROM artifact
+		WHERE group_artifact_id='$atid'
+		AND close_date > 0
+		AND (open_date >= '$start' AND open_date <= '$end')";
+	$res=db_query($sql);
+echo db_error();
+	return db_result($res,0,0);
+}
+
+function getOpenCount($atid,$start,$end) {
+	$sql="SELECT count(*)
+		FROM artifact
+		WHERE 
+		group_artifact_id='$atid'
+		AND open_date >= '$start'
+		AND open_date <= '$end'";
+
+	$res=db_query($sql);
+echo db_error();
+	return db_result($res,0,0);
+}
+
+function getStillOpenCount($atid,$start,$end) {
+	$sql="SELECT count(*)
+		FROM artifact
+		WHERE 
+		group_artifact_id='$atid'
+		AND open_date <= '$end'
+		AND (close_date >= '$end' OR close_date < 1 OR close_date is null)";
+
+	$res=db_query($sql);
+echo db_error();
+	return db_result($res,0,0);
+}
+
+function &getAverageTimeData() {
+	return $this->avgtime;
+}
+
+function &getOpenCountData() {
+	return $this->opencount;
+}
+
+function &getStillOpenCountData() {
+	return $this->stillopencount;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAct.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAct.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAct.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportUserAct extends Report {
+
+var $res;
+
+function ReportUserAct($span,$user_id,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$user_id) {
+		$this->setError('No User_id');
+		return false;
+	}
+	if (!$span || $span == REPORT_TYPE_MONTHLY) {
+
+		$res=db_query("SELECT * FROM rep_user_act_monthly 
+			WHERE user_id='$user_id' AND month BETWEEN '$start' AND '$end' ORDER BY month");
+
+	} elseif ($span == REPORT_TYPE_WEEKLY) {
+
+		$res=db_query("SELECT * FROM rep_user_act_weekly 
+			WHERE user_id='$user_id' AND week BETWEEN '$start' AND '$end' ORDER BY week");
+
+	} elseif ($span == REPORT_TYPE_DAILY) {
+
+		$res=db_query("SELECT * FROM rep_user_act_daily 
+			WHERE user_id='$user_id' AND day BETWEEN '$start' AND '$end' ORDER BY day ASC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportUserAct:: '.db_error());
+		return false;
+	}
+	$this->setSpan($span);
+	$this->setDates($res,1);
+	$this->res=$res;
+	return true;
+}
+
+function &getTrackerOpened() {
+	return util_result_column_to_array($this->res,2);
+}
+
+function &getTrackerClosed() {
+	return util_result_column_to_array($this->res,3);
+}
+
+function &getForum() {
+	return util_result_column_to_array($this->res,4);
+}
+
+function &getDocs() {
+	return util_result_column_to_array($this->res,5);
+}
+
+function &getCVSCommits() {
+	return util_result_column_to_array($this->res,6);
+}
+
+function &getTaskOpened() {
+	return util_result_column_to_array($this->res,7);
+}
+
+function &getTaskClosed() {
+	return util_result_column_to_array($this->res,8);
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAdded.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAdded.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserAdded.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportUserAdded extends Report {
+
+function ReportUserAdded($span,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$span || $span == REPORT_TYPE_MONTHLY) {
+
+		$res=db_query("SELECT * FROM rep_users_added_monthly 
+			WHERE month BETWEEN '$start' AND '$end' ORDER BY month");
+
+	} elseif ($span == REPORT_TYPE_WEEKLY) {
+
+		$res=db_query("SELECT * FROM rep_users_added_weekly 
+			WHERE week BETWEEN '$start' AND '$end' ORDER BY week");
+
+	} elseif ($span == REPORT_TYPE_DAILY) {
+
+		$res=db_query("SELECT * FROM rep_users_added_daily 
+			WHERE day BETWEEN '$start' AND '$end' ORDER BY day ASC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportUserAdded:: '.db_error());
+		return false;
+	}
+	$this->setSpan($span);
+	$this->setDates($res,0);
+	$this->setData($res,1);
+	return true;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserCum.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserCum.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserCum.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportUserCum extends Report {
+
+function ReportUserCum($span,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$span || $span == REPORT_TYPE_MONTHLY) {
+
+		$res=db_query("SELECT * FROM rep_users_cum_monthly 
+			WHERE month BETWEEN '$start' AND '$end' ORDER BY month");
+
+	} elseif ($span == REPORT_TYPE_WEEKLY) {
+
+		$res=db_query("SELECT * FROM rep_users_cum_weekly 
+			WHERE week BETWEEN '$start' AND '$end' ORDER BY week");
+
+	} elseif ($span == REPORT_TYPE_DAILY) {
+
+		$res=db_query("SELECT * FROM rep_users_cum_daily 
+			WHERE day BETWEEN '$start' AND '$end' ORDER BY day ASC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportUserAdded:: '.db_error());
+		return false;
+	}
+	$this->setSpan($span);
+	$this->setDates($res,0);
+	$this->setData($res,1);
+	return true;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserTime.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserTime.class	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/ReportUserTime.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,106 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/Report.class');
+
+class ReportUserTime extends Report {
+
+function ReportUserTime($user_id,$type,$start=0,$end=0) {
+	$this->Report();
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	if (!$user_id) {
+		$this->setError('No User_id');
+		return false;
+	}
+
+	//
+	//	Task report
+	//
+	if (!$type || $type=='tasks') {
+
+		$res=db_query("SELECT pt.summary,sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, project_task pt
+			WHERE rtt.user_id='$user_id' 
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			GROUP BY pt.summary
+			ORDER BY hours DESC");
+
+	//
+	//	Category report
+	//
+	} elseif ($type=='category') {
+
+		$res=db_query("SELECT rtc.category_name, sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, rep_time_category rtc
+			WHERE rtt.user_id='$user_id' 
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.time_code=rtc.time_code
+			GROUP BY rtc.category_name
+			ORDER BY hours DESC");
+
+	//
+	//	Percentage this user spent on a specific subproject
+	//
+	} elseif ($type=='subproject') {
+
+		$res=db_query("SELECT pgl.project_name, sum(rtt.hours) AS hours 
+			FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
+			WHERE rtt.user_id='$user_id' 
+			AND rtt.report_date BETWEEN '$start' AND '$end' 
+			AND rtt.project_task_id=pt.project_task_id
+			AND pt.group_project_id=pgl.group_project_id
+			GROUP BY pgl.project_name
+			ORDER BY hours DESC");
+
+	}
+
+	$this->start_date=$start;
+	$this->end_date=$end;
+
+	if (!$res || db_error()) {
+		$this->setError('ReportUserAct:: '.db_error());
+		return false;
+	}
+
+	$this->labels = util_result_column_to_array($res,0);
+	$this->setData($res,1);
+	return true;
+}
+
+}
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/report_utils.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/report_utils.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/reporting/report_utils.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,199 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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
+ */
+
+function report_header($title) {
+	global $HTML,$report_company_name,$sys_name;
+	echo $HTML->header(array('title'=>" Reporting: " . $title));
+	echo html_feedback_top($GLOBALS['feedback']);
+	echo "<h2>$report_company_name Reporting</h2><p>";
+}
+
+function report_footer() {
+	global $HTML;
+	echo html_feedback_bottom($GLOBALS['feedback']);
+	echo $HTML->footer(array());
+}
+
+function report_span_box($name='SPAN', $selected='1', $suppress_daily=false) {
+	if ($suppress_daily) {
+		$vals=array(2,3);
+		$titles=array('Weekly','Monthly');
+	} else {
+		$vals=array(1,2,3);
+		$titles=array('Daily','Weekly','Monthly');
+	}
+	return html_build_select_box_from_arrays ($vals,$titles,$name,$selected,false);
+}
+
+function report_weeks_box($Report, $name='week', $selected=false) {
+	global $sys_datefmt;
+	$arr =& $Report->getWeekStartArr();
+
+	$arr2=array();
+	for ($i=0; $i<count($arr); $i++) {
+		$arr2[$i]=date('Y-m-d',$arr[$i]) .' to '. date('Y-m-d',($arr[$i]+6*24*60*60));
+	}
+
+	return html_build_select_box_from_arrays ($arr,$arr2,$name,$selected,false);
+}
+
+function report_day_adjust_box($Report, $name='days_adjust', $selected=false) {
+
+	$days[]='0.0';
+	$days[]='1';
+	$days[]='2';
+	$days[]='3';
+	$days[]='4';
+	$days[]='5';
+	$days[]='6';
+	$names[]='Sunday';
+	$names[]='Monday';
+	$names[]='Tuesday';
+	$names[]='Wednesday';
+	$names[]='Thursday';
+	$names[]='Friday';
+	$names[]='Saturday';
+	return html_build_select_box_from_arrays ($days,$names,$name,$selected,false);
+
+//	return html_build_select_box_from_arrays (array_reverse(array_values($Report->adjust_days)),array_reverse(array_keys($Report->adjust_days)),$name,$selected,false);
+}
+
+function report_months_box($Report, $name='month', $selected=false) {
+	global $sys_datefmt;
+	$arr =& $Report->getMonthStartArr();
+
+	$arr2=array();
+	for ($i=0; $i<count($arr); $i++) {
+		$arr2[$i]=date('Y-m',$arr[$i]);
+	}
+
+	return html_build_select_box_from_arrays ($arr,$arr2,$name,$selected,false);
+}
+
+function report_useract_box($name='dev_id', $selected='1', $start_with='') {
+
+	if ($start_with) {
+		$sql2=" AND realname ILIKE '$start_with%' ";
+	}
+
+	$res=db_query("SELECT user_id,realname 
+		FROM users 
+		WHERE status='A' $sql2 
+		AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) ORDER BY realname");
+	return html_build_select_box($res, $name, $selected, false);
+}
+
+function report_usertime_box($name='dev_id', $selected='1', $start_with='') {
+
+	if ($start_with) {
+		$sql2=" AND realname ILIKE '$start_with%' ";
+	}
+
+	$res=db_query("SELECT user_id,realname 
+		FROM users 
+		WHERE status='A' $sql2 
+		AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) ORDER BY realname");
+	return html_build_select_box($res, $name, $selected, false);
+}
+
+function report_group_box($name='g_id', $selected='1') {
+
+	$res=db_query("SELECT group_id,group_name FROM groups WHERE status='A' ORDER BY group_name");
+	return html_build_select_box($res, $name, $selected, false);
+}
+
+function report_area_box($name='area', $selected='1') {
+	$arr[]='tracker';
+	$arr[]='forum';
+	$arr[]='docman';
+	$arr[]='taskman';
+	$arr[]='downloads';
+
+	$arr2[]='Tracker';
+	$arr2[]='Forum';
+	$arr2[]='Docman';
+	$arr2[]='Taskman';
+	$arr2[]='Downloads';
+	return html_build_select_box_from_arrays ($arr,$arr2,$name,$selected,false);
+}
+
+function report_tracker_box($name='datatype', $selected='1') {
+	$arr[]='Bugs';
+	$arr[]='Support';
+	$arr[]='Patches';
+	$arr[]='Feature Requests';
+	$arr[]='Other Trackers';
+	$arr[]='Forum Messages';
+	$arr[]='Tasks';
+	$arr[]='Downloads';
+
+	$arr2[]='1';
+	$arr2[]='2';
+	$arr2[]='3';
+	$arr2[]='4';
+	$arr2[]='0';
+	$arr2[]='5';
+	$arr2[]='6';
+	$arr2[]='7';
+	return html_build_select_box_from_arrays ($arr2,$arr,$name,$selected,false);
+}
+
+function report_time_category_box($name='category',$selected=false) {
+	global $report_time_category_res;
+	if (!$report_time_category_res) {
+		$report_time_category_res=db_query("SELECT * FROM rep_time_category");
+	}
+	return html_build_select_box($report_time_category_res,$name,$selected,false);
+}
+
+//
+//	Takes an array of labels and an array values and removes vals < 2% and sets up an "other"
+//
+function report_pie_arr($labels, $vals) {
+	global $pie_labels,$pie_vals;
+	//first get sum of all values
+	for ($i=0; $i<count($vals); $i++) {
+		$total += $vals[$i];
+	}
+
+	//now prune out vals where < 2%
+	for ($i=0; $i<count($vals); $i++) {
+		if (($vals[$i]/$total) < .02) {
+			$rem += $vals[$i];
+		} else {
+			$pie_labels[]=util_unconvert_htmlspecialchars($labels[$i])." (". number_format($vals[$i],1) .") ";
+			$pie_vals[]=number_format($vals[$i],1);
+		}
+	}
+	if ($rem > 0) {
+		$pie_labels[]='Other'." (". number_format($rem,1) .") ";
+		$pie_vals[]=number_format($rem,1);
+	}
+	
+}
+
+?>

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/README
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/README	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/README	2011-02-24 16:32:13 UTC (rev 9828)
@@ -66,3 +66,9 @@
 # Hourly send pending massmailings, if any
 #
 47 * * * * ~/gforge3/cronjobs/massmail.php
+
+#
+#       Reporting Process
+#
+25 07 * * * ~/gforge3/cronjobs/reporting_cron.php
+

Added: trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/reporting_cron.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/reporting_cron.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/reporting_cron.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,48 @@
+#! /usr/bin/php4 -f
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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 ('squal_pre.php');
+require ('common/reporting/ReportSetup.class');
+
+$report = new ReportSetup();
+
+if ($report->isError()) {
+	exit_error('Error',$report->getErrorMessage());
+}
+
+db_begin();
+
+if (!$report->dailyData()) {
+	exit_error('Error',$report->getErrorMessage());
+}
+
+db_commit();
+
+echo "Done: ".date('Ymd H:i').' - '.db_error();
+
+?>


Property changes on: trunk/gforge_base/evolvisforge-5.1/gforge/cronjobs/reporting_cron.php
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class	2011-02-24 16:32:13 UTC (rev 9828)
@@ -12,6 +12,7 @@
  *
  * @version   $Id$
  */
+require_once ('www/tracker/include/ArtifactTypeHtml.class');
 
 class Layout extends Error {
 
@@ -492,6 +493,10 @@
 			$TABS_DIRS[]='/admin/';
 			$TABS_TITLES[]=$Language->getText('menu','admin');
 		}
+		if (user_ismember($GLOBALS['sys_stats_group'])) {
+			$TABS_DIRS[]='/reporting/';
+			$TABS_TITLES[]=$Language->getText('menu','reporting');
+		}
 		if(isset($params['group']) && $params['group']) {
 			// get group info using the common result set
 			$project =& group_get_object($params['group']);
@@ -515,11 +520,16 @@
 			$selected=array_search("/snippet/", $TABS_DIRS);
 		} elseif (strstr($GLOBALS['REQUEST_URI'],'/people/')) {
 			$selected=array_search("/people/", $TABS_DIRS);
+		} elseif (strstr($GLOBALS['REQUEST_URI'],'/reporting/')) {
+			$selected=array_search('/reporting/',$TABS_DIRS);
 		} elseif (strstr($GLOBALS['REQUEST_URI'],'/admin/') && user_ismember(1,'A')) {
-			$selected=(count($TABS_DIRS)-1);
+			$selected=array_search('/admin/',$TABS_DIRS);;
 		} else {
 			$selected=0;
 		}
+		if (!$this->COLOR_SELECTED_TAB) {
+			$this->COLOR_SELECTED_TAB= '#e0e0e0';
+		}
 		echo $this->tabGenerator($TABS_DIRS,$TABS_TITLES,false,$selected,$this->COLOR_SELECTED_TAB,'100%');
 
 	}

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/mod_task.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/mod_task.php	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/mod_task.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -17,7 +17,14 @@
 */
 
 require_once('note.php');
+require_once('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
 
+$report=new Report();
+if ($report->isError()) {
+	exit_error('Error',$report->getErrorMessage());
+}
+
 pm_header(array('title'=>$Language->getText('pm_modtask','title'),'pagename'=>'pm_modtask','group_project_id'=>$group_project_id));
 
 ?>
@@ -175,8 +182,67 @@
 
 </table>
 </form>
+<p>
+<h3>Time Tracking</h3>
+<p>
 <?php
+$title_arr[]='Week';
+$title_arr[]='Day';
+$title_arr[]='Hours';
+$title_arr[]='Category';
+$title_arr[]='User';
+$title_arr[]=' ';
 
+echo $HTML->listTableTop ($title_arr);
+	echo '<form action="/reporting/timeadd.php" method="post" />
+	<input type="hidden" name="project_task_id" value="'.$project_task_id.'">
+	<input type="hidden" name="submit" value="1" />
+	<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+		<td align="middle">'. report_weeks_box($report, 'week') .'</td>
+		<td align="middle">'. report_day_adjust_box($report, 'days_adjust') .'</td>
+		<td align="middle"><input type="text" name="hours" value="" size="3" maxlength="3" /></td>
+		<td align="middle">'.report_time_category_box('time_code',false).'</td>
+		<td> </td>
+		<td align="middle"><input type="submit" name="add" value="Add" /><input type="submit" name="cancel" value="Cancel" /></td>
+	</tr></form>';
+
+//
+//	Display Time Recorded for this task
+//
+$sql="SELECT users.realname, rep_time_tracking.report_date, rep_time_tracking.hours, rep_time_category.category_name
+	FROM users,rep_time_tracking,rep_time_category
+	WHERE 
+	users.user_id=rep_time_tracking.user_id
+	AND rep_time_tracking.time_code=rep_time_category.time_code
+	AND rep_time_tracking.project_task_id='$project_task_id'";
+
+$res=db_query($sql);
+for ($i=0; $i<db_numrows($res); $i++) {
+
+	echo '
+	<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+	<td> </td>
+	<td>'.date($sys_datefmt,db_result($res,$i,'report_date')).'</td>
+	<td>'.db_result($res,$i,'hours').'</td>
+	<td>'.db_result($res,$i,'category_name').'</td>
+	<td>'.db_result($res,$i,'realname').'</td>
+	<td> </td></tr>';
+	$total_hours += db_result($res,$i,'hours');
+	
+}
+
+echo '
+<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+<td><strong>Total:</strong></td>
+<td> </td>
+<td>'.$total_hours.'</td>
+<td> </td>
+<td> </td>
+<td> </td></tr>';
+$total_hours += db_result($res,$i,'hours');
+
+echo $HTML->listTableBottom();
+
 pm_footer(array());
 
 // Local Variables:

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/index.php	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/index.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -1,103 +1,52 @@
 <?php
 /**
-  *
-  * Project Statistics Page
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  * @version   $Id$
-  *
-  */
+ * Project Statistics Page
+ * Copyright 2003 GForge, LLC
+ *
+ * @version   $Id$
+ */
 
 
 require_once('pre.php');
-require_once('project_stats_utils.php');
+require_once('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
 
 if ( !$group_id ) {
 	exit_no_group();
 }
 
-site_project_header(array('title'=>$Language->getText('project_stats','title')."".$groupname,'group'=>$group_id,'toptab'=>'home'));
-
-//
-// BEGIN PAGE CONTENT CODE
-//
-
-if (!$report) {
-	$report='last_7';
+$report=new Report();
+if ($report->isError()) {
+    exit_error($report->getErrorMessage());
 }
 
-print '<div align="center">';
-print '<span style="font-size:bigger"><strong>'.$Language->getText('project_stats','usage_statistics').'</strong></span><br />';
-print '<img src="stats_graph.php?group_id='.$group_id.'&report='. $report .'" />';
-print '</div>';
-
-if ( $report == 'last_7' ) {
-
-	print '<p>';
-	stats_project_daily( $group_id, 7 );
-
-} elseif ( $report == 'last_30' ) {
-
-	print '<p>';
-	stats_project_daily( $group_id, 30 );
-
-} elseif ( $report == 'months' ) {
-
-	print '<p>';
-	stats_project_monthly( $group_id );
-
-} else {
-
-	   // default stats display, DAILY
-	print '<p>';
-	stats_project_daily( $group_id, 7 );
-
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
 }
 
-print '</p><br /><p>';
-stats_project_all( $group_id );
+site_project_header(array('title'=>"Project statistics ".$groupname,'group'=>$group_id,'toptab'=>'home'));
 
-$reports_ids=array();
-$reports_ids[]='last_7';
-$reports_ids[]='last_30';
-$reports_ids[]='months';
-
-$reports_names=array();
-$reports_names[]=$Language->getText('project_stats','last_7_days');
-$reports_names[]=$Language->getText('project_stats','last_30_days');
-$reports_names[]=$Language->getText('project_stats','monthly');
-
+//
+// BEGIN PAGE CONTENT CODE
+//
 ?>
-</p>
-<div align="center">
-<form action="index.php" method="get">
-<?php echo $Language->getText('project_stats','view_reports') ?>:
-<?php
-
-	echo html_build_select_box_from_arrays($reports_ids, $reports_names, 'report', $report, false);
-
-?>
-  
-<input type="submit" value="<?php echo $Language->getText('project_stats','change_stats_view') ?>" />
-<input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
+<h3>Project Activity</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<input type="hidden" name="group_id" value="<?php echo $group_id; ?>">
+<table><tr>
+<td><strong>Area:</strong><br /><?php echo report_area_box('area',$area); ?></td>
+<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
 </form>
-</div>
-
-
+<p>
+<img src="/reporting/projectact_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end&g_id=$group_id&area=$area"; ?>" width="640" height="480">
 <?php
-if ($group_id && user_ismember($group_id)) {
-	print "
-	<p>
-	".$Language->getText('project_stats','detailed_statistics').":
-	<ul>
-	<li><a href=\"/tracker/?group_id=$group_id&period=$view&span=$span\">".$Language->getText('project_stats','tracker')."</a></li>
-	<li><a href=\"/pm/reporting/?group_id=$group_id&period=$view&span=$span\">".$Language->getText('project_stats','tasks')."</a></li>
-	</ul>
-	</p>";
-}
 
 site_project_footer( array() );
+
 ?>

Deleted: trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/project_stats_utils.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/project_stats_utils.php	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/project_stats_utils.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -1,240 +0,0 @@
-<?php
-/**
-  *
-  * Project Statistics Page
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  * @version   $Id$
-  *
-  */
-
-   // week_to_dates
-function week_to_dates( $week, $year = 0 ) {
-
-	if ( $year == 0 ) {
-		$year = gmstrftime("%Y", time() );
-	} 
-
-	   // One second into the New Year!
-	$beginning = gmmktime(0,0,0,1,1,$year);
-	while ( gmstrftime("%U", $beginning) < 1 ) {
-		   // 86,400 seconds? That's almost exactly one day!
-		$beginning += 86400;
-	}
-	$beginning += (86400 * 7 * ($week - 1));
-	$end = $beginning + (86400 * 6);
-
-	return array( $beginning, $end );
-}
-
-
-   // stats_project_daily
-function stats_project_daily( $group_id, $span = 7 ) {
-	global $HTML;
-	global $Language;
-
-	//
-	//	We now only have 30 & 7-day views
-	//
-	if ( $span != 30 && $span != 7) { 
-		$span = 7;
-	}
-
-	$sql="SELECT * FROM stats_project_vw
-		WHERE group_id='$group_id' ORDER BY month DESC, day DESC";
-
-	if ($span == 30) {
-		$res = db_query($sql, 30, 0, SYS_DB_STATS);
-	} else {
-		$res = db_query($sql,  7, 0, SYS_DB_STATS);
-	}
-
-	echo db_error();
-
-   // if there are any days, we have valid data.
-	if ( ($valid_days = db_numrows( $res )) > 0 ) {
-		?>
-		<p><strong><?php echo $Language->getText('project_stats_utils','stats_for_days',array($valid_days )) ?></strong></p>
-
-		<p><table width="100%" cellpadding="0" cellspacing="1" border="0">
-			<tr valign="top">
-			<td><strong><?php echo $Language->getText('project_stats_utils','date') ?></strong></td>
-			<td><strong><?php echo $Language->getText('project_stats_utils','rank') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','page_views') ?> </strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','dl') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','bugs') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','support') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','patches') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','all_tracker') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','tasks') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','CVS') ?></strong></td>
-			</tr>
-
-		<?php
-		
-		while ( $row = db_fetch_array($res) ) {
-			$i++;
-			print	'<tr ' . $HTML->boxGetAltRowStyle($i) . '>'
-				. '<td>' . gmstrftime("%e %b %Y", gmmktime(0,0,0,substr($row["month"],4,2),$row["day"],substr($row["month"],0,4)) ) . '</td>'
-				//. '<td>' . $row["month"] . " " . $row["day"] . '</td>'
-				. '<td>' . sprintf("%d", $row["group_ranking"]) . " ( " . sprintf("%0.2f", $row["group_metric"]) . ' ) </td>'
-				. '<td align="right">' . number_format( $row["subdomain_views"] + $row['site_views'],0 ) . '</td>'
-				. '<td align="right">' . number_format( $row["downloads"],0 ) . '</td>'
-				. '<td align="right">  ' . number_format($row["bugs_opened"],0) . " ( " . number_format($row["bugs_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["support_opened"],0) . " ( " . number_format($row["support_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["patches_opened"],0) . " ( " . number_format($row["patches_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["artifacts_opened"],0) . " ( " . number_format($row["artifacts_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["tasks_opened"],0) . " ( " . number_format($row["tasks_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["cvs_commits"],0) . '</td>'
-				. '</tr>' . "\n";
-		}
-
-		?>
-		</table></p>
-		<?php
-
-	} else {
-		echo $Language->getText('project_stats_utils','project_did_not_exits');
-		echo db_error() .'</p>';
-	}
-
-}
-
-   // stats_project_monthly
-function stats_project_monthly( $group_id ) {
-	global $HTML;
-	global $Language;
-	$res = db_query("
-		SELECT * FROM stats_project_months 
-		WHERE group_id='$group_id'
-		ORDER BY group_id DESC, month DESC
-	", -1, 0, SYS_DB_STATS);
-
-	   // if there are any weeks, we have valid data.
-	if ( ($valid_months = db_numrows( $res )) > 1 ) {
-
-		?>
-		<p><strong><?php echo $Language->getText('project_stats_utils','stats_for_months',array($valid_months )) ?></strong></p>
-
-		<p><table width="100%" cellpadding="0" cellspacing="1" border="0">
-			<tr valign="top">
-			<td><strong><?php echo $Language->getText('project_stats_utils','month') ?></strong></td>
-			<td><strong><?php echo $Language->getText('project_stats_utils','rank') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','page_views') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','dl') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','bugs') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','support') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','patches') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','all_tracker') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','tasks') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','CVS') ?></strong></td>
-			</tr>
-
-		<?php
-
-		while ( $row = db_fetch_array($res) ) {
-			$i++;
-
-			print	'<tr ' . $HTML->boxGetAltRowStyle($i) . '>'
-				. '<td>' . gmstrftime("%B %Y", mktime(0,0,1,substr($row["month"],4,2),1,substr($row["month"],0,4)) ) . '</td>'
-				. '<td>' . sprintf("%d", $row["group_ranking"]) . " ( " . sprintf("%0.2f", $row["group_metric"]) . ' ) </td>'
-				. '<td align="right">' . number_format( $row["subdomain_views"] + $row['site_views'],0 ) . '</td>'
-				. '<td align="right">' . number_format( $row["downloads"],0 ) . '</td>'
-				. '<td align="right">  ' . number_format($row["bugs_opened"],0) . " ( " . number_format($row["bugs_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["support_opened"],0) . " ( " . number_format($row["support_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["patches_opened"],0) . " ( " . number_format($row["patches_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["artifacts_opened"],0) . " ( " . number_format($row["artifacts_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["tasks_opened"],0) . " ( " . number_format($row["tasks_closed"],0) . ' )</td>'
-				. '<td align="right">  ' . number_format($row["cvs_commits"],0) . '</td>'
-				. '</tr>' . "\n";
-		}
-
-		?>
-		</table></p>
-		<?php
-
-	} else {
-		echo $Language->getText('project_stats_utils','project_did_not_exits')."<p>";
-		echo db_error();
-	}
-}
-
-function stats_project_all( $group_id ) {
-	global $HTML;
-	global $Language;
-	$res = db_query("
-		SELECT *
-		FROM stats_project_all_vw
-		WHERE group_id='$group_id'
-	", -1, 0, SYS_DB_STATS);
-	$row = db_fetch_array($res);
-//	echo db_error();
-
-	?>
-	<p><strong><?php echo $Language->getText('project_stats_utils','stats_all_time') ?></strong></p>
-
-	<p><table width="100%" cellpadding="0" cellspacing="1" border="0">
-		<tr valign="top">
-			<td><strong><?php echo $Language->getText('project_stats_utils','month') ?></strong></td>
-			<td><strong><?php echo $Language->getText('project_stats_utils','rank') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','page_views') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','dl') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','bugs') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','support') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','patches') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','all_tracker') ?> </strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','tasks') ?></strong></td>
-			<td align="right"><strong><?php echo $Language->getText('project_stats_utils','CVS') ?></strong></td>
-		</tr>
-
-	<tr <?php echo $HTML->boxGetAltRowStyle(1); ?>>
-		<td><?php echo $row["day"]; ?> <?php echo $Language->getText('project_stats_utils','days') ?> </td>
-		<td><?php echo sprintf("%d", $row["group_ranking"]) . " ( " . sprintf("%0.2f", $row["group_metric"]); ?> ) </td>
-		<td align="right"><?php echo number_format( $row["subdomain_views"] + $row['site_views'],0); ?></td>
-		<td align="right"><?php echo number_format( $row["downloads"],0); ?></td>
-		<td align="right"><?php echo number_format($row["bugs_opened"],0) . " ( " . number_format($row["bugs_closed"],0); ?> )</td>
-		<td align="right"><?php echo number_format($row["support_opened"],0) . " ( " . number_format($row["support_closed"],0); ?> )</td>
-		<td align="right"><?php echo number_format($row["patches_opened"],0) . " ( " . number_format($row["patches_closed"],0); ?> )</td>
-		<td align="right"><?php echo number_format($row["artifacts_opened"],0) . " ( " . number_format($row["artifacts_closed"],0); ?> )</td>
-		<td align="right"><?php echo number_format($row["tasks_opened"],0) . " ( " . number_format($row["tasks_closed"],0); ?> )</td>
-		<td align="right"><?php echo number_format($row["cvs_commits"],0); ?></td>
-		</tr>
-
-	</table></p>
-
-	<?php
-
-}
-
-
-function period2seconds($period_name,$span) {
-	if (!$period_name || $period_name=="lifespan") {
-		return "";
-	}
-
-	if (!$span) $span=1;
-
-	if ($period_name=="day") {
-		return 60*60*24*$span;
-	} else if ($period_name=="week") {
-		return 60*60*24*7*$span;
-	} else if ($period_name=="month") {
-		return 60*60*24*30*$span;
-	} else if ($period_name=="year") {
-		return 60*60*24*365*$span;
-	}
-}
-
-function period2sql($period_name,$span,$field_name) {
-	$time_now=time();
-	$seconds=period2seconds($period_name,$span);
-
-	if (!$seconds) return "";
-
-	return "AND $field_name>=" . (string)($time_now-$seconds) ." \n";
-}
-
-?>

Deleted: trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/stats_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/stats_graph.php	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/project/stats/stats_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -1,142 +0,0 @@
-<?php
-/**
-  *
-  * Project Statistics Graph
-  *
-  * This script produces PNG image which shows graph of downloads/pageviews
-  * across the time.
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  * @version   $Id$
-  *
-  */
-require_once('pre.php');
-require_once('graph_lib.php');
-require_once('project_stats_utils.php');
-
-if (!$group_id) {
-	exit_no_group();
-}
-
-if (!$report) {
-	$report = 'last_7';
-}   
-
-$unit = 'days';
-//
-//	Data will be fetched in DESC order, then flipped into ASC order
-//
-$j = 0;
-if ( $report == 'last_7' ) {
-	$sql = "
-		SELECT month,day,downloads, subdomain_views as views,site_views as views2
-		FROM stats_project_vw
-		WHERE group_id='$group_id' ORDER BY month desc, day desc limit 7
-	";
-	$res=db_query($sql);
-	$rows=db_numrows($res);
-	$db_error=db_error();
-	while (	$row = db_fetch_array($res) ) {
-		$xdata[$j]	  = $j;
-		$xlabel[$j]	 = substr($row['month'],4) . "-" . $row['day'];
-		$ydata1[$j]	 = $row["views"] + $row["views2"];
-		$ydata2[$j]	 = $row["downloads"];
-		$j++;
-	}
-	$xdata = array_reverse($xdata);
-	$xlabel = array_reverse($xlabel);
-} elseif ( $report == 'last_30' ) {
-	$res=db_query("
-		SELECT month,day,downloads, subdomain_views as views,site_views as views2 
-		FROM stats_project_vw
-		WHERE group_id='$group_id' ORDER BY month desc, day desc limit 30
-	");
-	$rows=db_numrows($res);
-	$db_error=db_error();
-	while (	$row = db_fetch_array($res) ) {
-		$xdata[$j]	  = $j;
-		$xlabel[$j]	 = substr($row['month'],4) . "-" . $row['day'];
-		$ydata1[$j]	 = $row["views"] + $row["views2"];
-		$ydata2[$j]	 = $row["downloads"];
-		$j++;
-	}
-	$xdata = array_reverse($xdata);
-	$xlabel = array_reverse($xlabel);
-} elseif ( $report == 'months' ) {
-	$res = db_query("
-		SELECT month,'15',downloads,subdomain_views as views,site_views as views2 
-		FROM stats_project_months 
-		WHERE group_id='$group_id'
-		ORDER BY group_id ASC, month ASC
-	", -1, 0, SYS_DB_STATS);
-	$unit = 'months';
-	$rows=db_numrows($res);
-	$db_error=db_error();
-	while (	$row = db_fetch_array($res) ) {
-		$xdata[$j]	  = $j;
-		$xlabel[$j]	 = substr($row['month'],4) . "-" . $row['day'];
-		$ydata1[$j]	 = $row["views"] + $row["views2"];
-		$ydata2[$j]	 = $row["downloads"];
-		$j++;
-	}
-} else {
-	$res=db_query("
-		SELECT month,day,downloads, subdomain_views as views,site_views as views2
-		FROM stats_project_vw
-		WHERE group_id='$group_id' ORDER BY month ASC, day ASC
-	", 7, 23, SYS_DB_STATS);
-	$rows=db_numrows($res);
-	$db_error=db_error();
-	while (	$row = db_fetch_array($res) ) {
-		$xdata[$j]	  = $j;
-		$xlabel[$j]	 = substr($row['month'],4) . "-" . $row['day'];
-		$ydata1[$j]	 = $row["views"] + $row["views2"];
-		$ydata2[$j]	 = $row["downloads"];
-		$j++;
-	}
-}
-
-
-//
-//	Add dummy data to keep graph from breaking
-//
-if ($rows < 1) {
-	$xdata[$j]=0;
-	$xlabel[$j]	 = "0-0";
-	$ydata1[$j]	 = 0;
-	$ydata2[$j]	 = 0;
-	$j++;
-	$xdata[$j]=1;
-	$xlabel[$j]	 = "0-1";
-	$ydata1[$j]	 = 0;
-	$ydata2[$j]	 = 0;
-}
-
-$graph = new Graph(600, 350);
-
-//$graph->addDebug( "We appended $j/$rows rows of data to the graphing set." );
-
-@$data1 = $graph->AddData($xdata,$ydata1,$xlabel);
-@$data2 = $graph->AddData($xdata,$ydata2,$xlabel);
-
-$graph->DrawGrid('gray');
-$graph->LineGraph( $data1, 'red' );
-$graph->LineGraph( $data2, 'blue' );
-$graph->SetTitle($Language->getText('project_stats_graph','statistics', array($GLOBALS['sys_name'],group_getname($group_id))) );
-if ($unit=='days'){
-	$graph->SetSubTitle($Language->getText('project_stats_graph','page_view_days',array($j)));
-} elseif ($unit=='months'){
-	$graph->SetSubTitle($Language->getText('project_stats_graph','page_view_months',array($j)));
-}
-
-$graph->SetxTitle($Language->getText('project_stats_graph','date'));
-$graph->SetyTitle($Language->getText('project_stats_graph','views'));
-
-$graph->DrawAxis();
-//$graph->showDebug();
-$graph->ShowGraph('png');
-
-?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/index.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/index.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+require_once('common/reporting/ReportSetup.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+echo report_header('Main Page');
+
+?>
+<h3>Users</h3>
+<p>
+<a href="useradded.php?SPAN=1">Users Added Weekly (graph)</a><br />
+<a href="usercum.php?SPAN=1">Cumulative Users Weekly (graph)</a><br />
+<a href="useract.php">Activity (graph)</a><br />
+<p>
+<h3>Projects</h3>
+<p>
+Project-specific reports: Tracker, Task Mgr, Forums, Doc Mgr, Downloads<br />
+<a href="projectact.php">Activity (graph)</a><br />
+<p>
+<h3>Site-Wide</h3>
+<p>
+Site-wide reports: Tracker, Task Mgr, Forums, Doc Mgr, Downloads<br />
+<a href="toolspie.php">Pie (graph)</a><br />
+<a href="siteact.php">Line (graph)</a><br />
+<p>
+<h3>Time-Tracking</h3>
+<p>
+<a href="usertime.php">Individual User Time Report (graph)</a> <a href="usertime.php?typ=r">(report)</a><br />
+<a href="projecttime.php">Individual Project Time Report (graph)</a> <a href="projecttime.php?typ=r">(report)</a><br />
+<a href="sitetime.php">Site-Wide Time Report (graph)</a> <a href="sitetime.php?typ=r">(report)</a><br />
+<a href="sitetimebar.php">Site-Wide Total Hours Graph (graph)</a> <a href="sitetimebar.php?typ=r">(report)</a><br />
+<a href="usersummary.php">Site-Wide Task & Hours (report)</a><br />
+<p>
+<h3>Administrative</h3>
+<p>
+<a href="rebuild.php">Initialize / Rebuild Reporting Tables</a><br />
+<a href="timecategory.php">Manage Time Tracker Categories</a><br />
+<a href="http://gforge.org/tracker/?atid=116&group_id=7&func=browse">File Support Request</a><br />
+<a href="http://gforge.org/tracker/?atid=118&group_id=7&func=browse">File Feature Request</a><br />
+<p>
+<?php
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+
+echo report_header('Project Activity');
+
+?>
+<h3>Project Activity</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<input type="hidden" name="sw" value="<?php echo $sw; ?>">
+<table><tr>
+<td><strong>Project:</strong><br /><?php echo report_group_box('g_id',$g_id); ?></td>
+<td><strong>Area:</strong><br /><?php echo report_area_box('area',$area); ?></td>
+<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<?php if ($g_id) { ?>
+	<img src="projectact_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end&g_id=$g_id&area=$area"; ?>" width="640" height="480">
+	<p>
+	<?php
+
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projectact_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,157 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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');
+
+if (!$SPAN) {
+	$SPAN=1;
+}
+
+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 ("Trk Open");
+	$lineplot2 ->SetLegend("Trk Close");
+
+} 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($report_company_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();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/ReportProjectTime.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+echo report_header('Time Tracking By Project');
+
+$a[]='By Task';
+$a[]='By Category';
+$a[]='By Subproject';
+$a[]='By User';
+
+$a2[]='tasks';
+$a2[]='category';
+$a2[]='subproject';
+$a2[]='user';
+
+?>
+<h3>Time Tracking By Project</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<input type="hidden" name="sw" value="<?php echo $sw; ?>">
+<input type="hidden" name="typ" value="<?php echo $typ; ?>">
+<table><tr>
+<td><strong>Project:</strong><br /><?php echo report_group_box('g_id',$g_id); ?></td>
+<td><strong>Type:</strong><br /><?php echo html_build_select_box_from_arrays($a2,$a,'type',$type,false); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<?php 
+	if ($g_id && $typ=='r') {
+		$report=new ReportProjectTime($g_id,$type,$start,$end);
+
+		$labels = $report->labels;
+	    $data = $report->getData();
+
+	    echo $HTML->listTableTop (array('Type','Time'));
+
+	    for ($i=0; $i<count($labels); $i++) {
+
+		echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
+			'<td>'. $labels[$i] .'</td><td>'. $data[$i] .'</td></tr>';
+	    }
+
+	    echo $HTML->listTableBottom ();
+
+	} elseif ($g_id) { ?>
+	<img src="projecttime_graph.php?<?php echo "start=$start&end=$end&g_id=$g_id&type=$type"; ?>" width="640" height="480">
+	<p>
+	<?php
+
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/projecttime_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_pie.php');
+require_once($sys_path_to_jpgraph.'jpgraph_pie3d.php');
+require_once('common/reporting/ReportProjectTime.class');
+require_once('common/reporting/report_utils.php');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportProjectTime($g_id,$type,$start,$end);
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+if (!isset($datatype)) {
+	$datatype=1;
+}
+
+if (!$start) {
+	$start=mktime(0,0,0,date('m'),1,date('Y'));;
+}
+if (!$end) {
+	$end=time();
+} else {
+	$end--;
+}
+
+// Create the graph. These two calls are always required
+$graph  = new PieGraph(640, 480,"auto");
+//$graph->SetMargin(50,10,35,50);
+
+$arr['tasks']='By Task';
+$arr['category']='By Category';
+$arr['subproject']='By Subproject';
+$arr['user']='By User';
+
+$graph->title->Set("Time Report ".$arr[$type]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
+$graph->subtitle->Set($report_company_name);
+
+report_pie_arr($report->labels,$report->getData());
+
+$p1  = new PiePlot3D( $pie_vals );
+$p1->ExplodeSlice (0);
+$p1->SetLegends( $pie_labels );
+$graph->Add( $p1);
+
+// Display the graph
+$graph->Stroke();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/rebuild.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/rebuild.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/rebuild.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+require_once('common/reporting/ReportSetup.class');
+
+session_require( array('group'=>$sys_stats_group,'A') );
+
+echo report_header('Main Page');
+
+if ($submit && $im_sure) {
+
+	$r = new ReportSetup();
+
+	if (!$r->initialSetup()) {
+		echo $r->getErrorMessage();
+	} else {
+		Header("Location: index.php?feedback=Successfully+Rebuilt");
+	}
+
+}
+
+?>
+<h3>Reporting System Initialization</h3>
+<p>
+Occasionally, if cronjobs failed or the database was damaged, 
+you may have to rebuild the reporting tables.
+<p>
+If you are sure you want to rebuild all the reporting tables, 
+check the "I'm Sure" box and click the button below.
+<p>
+This could take a couple minutes, so DO NOT CLICK MORE THAN ONCE.
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="post">
+<input type="checkbox" name="im_sure" value="1">I'm Sure<p>
+<p>
+<input type="submit" name="submit" value="Press ONLY ONCE">
+</form>
+
+<?php
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+
+echo report_header('Site-Wide Activity');
+
+?>
+<h3>Site-Wide Activity</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<table><tr>
+<td><strong>Area:</strong><br /><?php echo report_area_box('area',$area); ?></td>
+<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<?php if ($area) { ?>
+	<img src="siteact_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end&area=$area"; ?>" width="640" height="480">
+	<p>
+	<?php
+
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/siteact_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,144 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_log.php');
+require_once($sys_path_to_jpgraph.'jpgraph_line.php');
+require_once('common/reporting/ReportSiteAct.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportSiteAct($SPAN,$start,$end); 
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+// 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 ("Trk Open");
+	$lineplot2 ->SetLegend("Trk Close");
+
+} 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=='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");
+
+} elseif ($area=='downloads') {
+
+	// Create the Downloads plot
+	$ydata5  =& $report->getDownloads();
+	$lineplot5 =new LinePlot($ydata5);
+	$lineplot5 ->SetColor("purple");
+	$graph->Add( $lineplot5 );
+
+	//	Legends
+	$lineplot5 ->SetLegend("Downloads");
+
+}
+
+
+//
+//	Titles
+//
+$graph->title->Set("Site-Wide Activity (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
+$graph->subtitle->Set($report_company_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();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/ReportSiteTime.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+echo report_header('Site-Wide Time Tracking');
+
+$a[]='By Task';
+$a[]='By Category';
+$a[]='By Subproject';
+$a[]='By User';
+
+$a2[]='tasks';
+$a2[]='category';
+$a2[]='subproject';
+$a2[]='user';
+
+?>
+<h3>Site-Wide Time Tracking</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<input type="hidden" name="typ" value="<?php echo $typ; ?>">
+<table><tr>
+<td><strong>Type:</strong><br /><?php echo html_build_select_box_from_arrays($a2,$a,'type',$type,false); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<?php 
+if ($typ =='r') {
+
+	$report=new ReportSiteTime($type,$start,$end);
+	$labels = $report->labels;
+	$data = $report->getData();
+
+	echo $HTML->listTableTop (array('Type','Time'));
+
+	for ($i=0; $i<count($labels); $i++) {
+
+		echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
+		'<td>'. $labels[$i] .'</td><td>'. $data[$i] .'</td></tr>';
+
+	}
+
+	echo $HTML->listTableBottom ();
+
+} else {
+?>
+<img src="sitetime_graph.php?<?php echo "start=$start&end=$end&type=$type"; ?>" width="640" height="480">
+<?php
+}
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetime_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_pie.php');
+require_once($sys_path_to_jpgraph.'jpgraph_pie3d.php');
+require_once('common/reporting/ReportSiteTime.class');
+require_once('common/reporting/report_utils.php');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportSiteTime($type,$start,$end);
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+if (!isset($datatype)) {
+	$datatype=1;
+}
+
+if (!$start) {
+	$start=mktime(0,0,0,date('m'),1,date('Y'));;
+}
+if (!$end) {
+	$end=time();
+} else {
+	$end--;
+}
+
+// Create the graph. These two calls are always required
+$graph  = new PieGraph(640, 480,"auto");
+//$graph->SetMargin(50,10,35,50);
+
+$arr['tasks']='By Task';
+$arr['category']='By Category';
+$arr['subproject']='By Subproject';
+$arr['user']='By User';
+
+$graph->title->Set("Time Report ".$arr[$type]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
+$graph->subtitle->Set($report_company_name);
+
+report_pie_arr($report->labels,$report->getData());
+
+$p1  = new PiePlot3D( $pie_vals );
+$p1->ExplodeSlice (0);
+$p1->SetLegends( $pie_labels );
+$graph->Add( $p1);
+
+// Display the graph
+$graph->Stroke();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+echo report_header('Site-Wide Time Tracking');
+
+?>
+<h3>Site-Wide Time Tracking</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<input type="hidden" name="typ" value="<?php echo $typ; ?>">
+<table><tr>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<?php 
+if ($typ=='r') {
+
+	if (!$start) {
+		$start=mktime(0,0,0,date('m'),1,date('Y'));;
+	}
+	if (!$end) {
+		$end=time();
+	} else {
+		$end--;
+	}
+
+	$res=db_query("SELECT week,sum(hours)
+		FROM rep_time_tracking
+		WHERE week
+		BETWEEN '$start' AND '$end' GROUP BY week");
+
+	$report->setDates($res,0);
+	$report->setData($res,1);
+	$data=$report->getData();
+	$labels=$report->getDates();
+	echo $HTML->listTableTop (array('Week','Time'));
+
+	for ($i=0; $i<count($labels); $i++) {
+
+		echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
+		'<td>'. $labels[$i] .'</td><td>'. $data[$i] .'</td></tr>';
+
+	}
+
+	echo $HTML->listTableBottom ();
+
+} else { ?>
+	<img src="sitetimebar_graph.php?<?php echo "start=$start&end=$end"; ?>" width="640" height="480">
+	<?php
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/sitetimebar_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_bar.php');
+require_once('common/reporting/Report.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new Report();
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+if (!$start) {
+	$start=mktime(0,0,0,date('m'),1,date('Y'));;
+}
+if (!$end) {
+	$end=time();
+} else {
+	$end--;
+}
+
+$res=db_query("SELECT week,sum(hours) 
+	FROM rep_time_tracking 
+	WHERE week 
+	BETWEEN '$start' AND '$end' GROUP BY week");
+
+$report->setDates($res,0);
+$report->setData($res,1);
+
+//////
+// Create the graph. These two calls are always required
+$graph = new Graph(640,480,"auto");    
+$graph->SetScale("textlin");
+$graph->yaxis->scale->SetGrace(20);
+
+// Add a drop shadow
+//$graph->SetShadow();
+
+// Adjust the margin a bit to make more room for titles
+$graph->img->SetMargin(40,20,35,40);
+
+// Create a bar pot
+$bplot = new BarPlot($report->getData());
+
+// Adjust fill color
+$bplot->SetFillColor('orange');
+$bplot->SetShadow();
+$bplot->value->Show();
+//$bplot->value->SetAngle(90);
+//$bplot->value->SetFormat('%0.1f');
+$graph->Add($bplot);
+
+// Setup the titles
+$graph->title->Set("Hours Recorded (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
+$graph->subtitle->Set($report_company_name);
+$graph->xaxis->title->Set("Date");
+$graph->yaxis->title->Set("Hours");
+
+// Setup X-axis
+$graph->xaxis->SetTickLabels($report->getDates());
+
+// Display the graph
+$graph->Stroke();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timeadd.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timeadd.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timeadd.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,223 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+if (!session_loggedin()) {
+	exit_not_logged_in();
+}
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error('Error',$report->getErrorMessage());
+}
+
+if ($submit) {
+/*
+	if ($update) {
+		
+		if ($project_task_id && $report_date && $time_code) {
+			$res=db_query("UPDATE rep_time_tracking 
+				SET time_code='$time_code', hours='$hours'
+				WHERE user_id='".user_getid()."'
+				AND report_date='$report_date'
+				AND project_task_id='$project_task_id'
+				AND time_code='$old_time_code'");
+			if (!$res || db_affected_rows($res) < 1) {
+				exit_error('Error',db_error());
+			} else {
+				$feedback='Successfully Updated';
+			}
+		}
+
+	} else
+*/
+	if ($delete) {
+
+		if ($project_task_id && $report_date && $old_time_code) {
+			$res=db_query("DELETE FROM rep_time_tracking 
+				WHERE user_id='".user_getid()."'
+				AND report_date='$report_date'
+				AND project_task_id='$project_task_id'
+				AND time_code='$old_time_code'");
+			if (!$res || db_affected_rows($res) < 1) {
+				exit_error('Error',db_error());
+			} else {
+				$feedback='Successfully Deleted';
+			}
+		} else {
+			echo "$project_task_id && $report_date && $old_time_code";
+		}
+
+	} elseif ($add) {
+		if ($project_task_id && $week && $days_adjust && $time_code && $hours) {
+
+			//$date_list = split('[- :]',$report_date,5);
+        	//$report_date = mktime($date_list[3],$date_list[4],0,$date_list[1],$date_list[2],$date_list[0]);
+			//make it 12 NOON of the report_date
+			$report_date=($week + ($days_adjust*REPORT_DAY_SPAN))+(12*60*60);
+			$res=db_query("INSERT INTO rep_time_tracking (user_id,week,report_date,project_task_id,time_code,hours) 
+				VALUES ('".user_getid()."','$week','$report_date','$project_task_id','$time_code','$hours')");
+			if (!$res || db_affected_rows($res) < 1) {
+				exit_error('Error',db_error());
+			} else {
+				$feedback='Successfully Added';
+			}
+		} else {
+			echo "$project_task_id && $week && $days_adjust && $time_code && $hours";
+			exit_error('Error','All Field Are Required.');
+		}
+
+	}
+}
+
+if ($week) {
+
+	report_header('Time Tracking');
+
+	if (!$group_project_id) {
+		$respm=db_query("SELECT pgl.group_project_id,g.group_name || '**' || pgl.project_name
+		FROM groups g, project_group_list pgl, user_group ug
+		WHERE ug.user_id='".user_getid()."' 
+		AND ug.group_id=g.group_id
+		AND g.group_id=pgl.group_id
+		ORDER BY group_name,project_name");
+	}
+	?>
+	<h3>Time Entries For The Week Starting <?php echo date('Y-m-d',$week); ?></h3>
+	<p>
+	<?php
+	$res=db_query("SELECT pt.project_task_id, pgl.project_name || '**' || pt.summary AS name, 
+			rtt.hours, rtt.report_date, rtc.category_name, rtt.time_code
+			FROM groups g, project_group_list pgl, project_task pt, rep_time_tracking rtt,
+			rep_time_category rtc
+			WHERE rtt.week='$week'
+			AND rtt.time_code=rtc.time_code
+			AND rtt.user_id='".user_getid()."'
+			AND g.group_id=pgl.group_id
+			AND pgl.group_project_id=pt.group_project_id
+			AND pt.project_task_id=rtt.project_task_id 
+			ORDER BY rtt.report_date");
+	$rows=db_numrows($res);
+	if ($group_project_id || $rows) {
+
+		$title_arr[]='Project/Task';
+		$title_arr[]='Date';
+		$title_arr[]='Hours';
+		$title_arr[]='Category';
+		$title_arr[]=' ';
+
+		echo $HTML->listTableTop ($title_arr);
+
+		while ($r=&db_fetch_array($res)) {
+			echo '<form action="'.$PHP_SELF.'?week='.$week.'&project_task_id='.$r['project_task_id'].'" method="post" />
+			<input type="hidden" name="submit" value="1" />
+			<input type="hidden" name="report_date" value="'.$r['report_date'] .'" />
+			<input type="hidden" name="old_time_code" value="'.$r['time_code'] .'" />
+			<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+				<td align="middle">'.$r['name'].'</td>
+				<td align="middle">'. date( 'D, M d, Y',$r['report_date']) .'</td>
+				<td align="middle"><!-- <input type="text" name="hours" value="'. $r['hours'] .'" size="3" maxlength="3" /> -->'.$r['hours'].'</td>
+				<td align="middle"><!-- '.report_time_category_box('time_code',$r['time_code']).' -->'.$r['category_name'].'</td>
+				<td align="middle"><!-- <input type="submit" name="update" value="Update" /> -->
+				<input type="submit" name="delete" value="Delete" /></td>
+			</tr></form>';
+			$total_hours += $r['hours'];
+		}
+		if ($group_project_id) {
+
+			$respt=db_query("SELECT project_task_id,summary FROM project_task WHERE group_project_id='$group_project_id'");
+
+			echo '<form action="'.$PHP_SELF.'?week='.$week.'" method="post" />
+			<input type="hidden" name="submit" value="1" />
+			<tr '.$HTML->boxGetAltRowStyle($xi++).'>
+				<td align="middle">'. html_build_select_box ($respt,'project_task_id',false,false) .'</td>
+				<td align="middle"><input type="text" name="report_date" value="'. date('Y-m-d',$week) .'" size="10" maxlength="10" /></td>
+				<td align="middle"><input type="text" name="hours" value="" size="3" maxlength="3" /></td>
+				<td align="middle">'.report_time_category_box('time_code',false).'</td>
+				<td align="middle"><input type="submit" name="add" value="Add" /><input type="submit" name="cancel" value="Cancel" /></td>
+			</tr></form>';
+
+		}
+		echo '<tr '.$HTML->boxGetAltRowStyle($xi++).'><td colspan="2"><strong>Total Hours:</strong></td><td><strong>'.$total_hours.'</strong></td><td colspan="2"></td></tr>';
+		echo $HTML->listTableBottom();
+
+	}
+	if (!$group_project_id) {
+		?>
+		<p>
+		<h3>Add Entry</h3>
+		<p>
+		Choose a Project/Subproject in the Task Manager. You will then have to choose 
+		a Task and category to record your time in.
+		<p>
+		<form action="<?php echo $PHP_SELF; ?>" method="get" />
+		<input type="hidden" name="week" value="<?php echo $week; ?>" />
+		<table>
+		<tr>
+			<td><strong>Task Manager Project:</strong></td>
+			<td><?php echo html_build_select_box ($respm,'group_project_id',false,false); ?></td>
+			<td><input type="submit" name="submit" value="Next" /></td>
+		</tr>
+		</table>
+		</form>
+		<p>
+		<h3>Change Week</h3>
+		<p>
+		<form action="<?php echo $PHP_SELF; ?>" method="get" />
+		<?php echo report_weeks_box($report,'week'); ?><input type="submit" name="submit" value="Change Week" />
+		</form>
+		<?php
+	}
+//
+//	First Choose A Week to add/update/delete time sheet info
+//
+} else {
+
+	report_header('Time Tracking');
+
+	?>
+	<h3>Choose A Week to Record Or Edit Your Time.</h3>
+	<p>
+	After you choose a week, you will be prompted to choose a Project/Subproject in the 
+	Task Manager.
+	<p>
+	<form action="<?php echo $PHP_SELF; ?>" method="get" />
+	<strong>Week Starting:</strong><br />
+	<?php echo report_weeks_box($report,'week'); ?>
+	<p>
+	<input type="submit" name="submit" value="Next" />
+	</form>
+	<?php
+
+}
+
+report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timecategory.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timecategory.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/timecategory.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/ReportSetup.class');
+
+session_require( array('group'=>$sys_stats_group,'A') );
+
+
+if ($submit) {
+	if ($add) {
+
+		$r = new ReportSetup();
+		if (!$r->addTimeCode($category_name)) {
+			exit_error('Error',$r->getErrorMessage());
+		} else {
+			$feedback="Successful";
+		}
+
+	} elseif ($update) {
+
+		$r = new ReportSetup();
+
+		if (!$r->updateTimeCode($time_code,$category_name)) {
+			exit_error('Error',$r->getErrorMessage());
+		} else {
+			$feedback="Successful";
+		}
+
+		$time_code=false;
+		$category_name='';
+	}
+
+}
+
+echo report_header('Main Page');
+
+if ($time_code) {
+	$res1=db_query("SELECT * FROM rep_time_category WHERE time_code='$time_code'");
+	$category_name=db_result($res1,0,'category_name');
+}
+$res=db_query("SELECT * FROM rep_time_category");
+
+$arr[]='Time Code';
+$arr[]='Category Name';
+
+echo $HTML->listTableTop($arr);
+
+for ($i=0; $i<db_numrows($res); $i++) {
+	echo '<tr '.$HTML->boxGetAltRowStyle($i).'><td>'.db_result($res,$i,'time_code').'</td>
+		<td><a href="timecategory.php?time_code='.db_result($res,$i,'time_code').'">'.db_result($res,$i,'category_name').'</a></td></tr>';
+}
+
+echo $HTML->listTableBottom();
+
+?>
+<h3>Manage Time Tracker Categories</h3>
+<p>
+You can create categories for how time might be spent when completing a particular task.
+Examples of categories include "Meeting", "Coding", "Testing".
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="post">
+<input type="hidden" name="submit" value="1" />
+<input type="hidden" name="time_code" value="<?php echo $time_code; ?>" />
+<strong>Category Name:</strong><br />
+<input type="text" name="category_name" value="<?php echo $category_name; ?>" >
+<p>
+<?php
+
+if ($time_code) { 
+	echo '<input type="submit" name="update" value="Update" />';
+} else {
+	echo '<input type="submit" name="add" value="Add" />';
+}
+
+?>
+</form>
+
+<?php
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+session_require( array('group'=>$sys_stats_group) );
+
+echo report_header('Tool Pie Graphs');
+
+if (!isset($datatype)) {
+	$datatype=1;
+}
+
+?>
+<h3>Tool Pie Graphs</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<table><tr>
+<td><strong>Trackers:</strong><br /><?php echo report_tracker_box('datatype',$datatype); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<img src="toolspie_graph.php?<?php echo "datatype=$datatype&start=$start&end=$end"; ?>" width="640" height="480">
+<p>
+<?php
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/toolspie_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,145 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_pie.php');
+require_once($sys_path_to_jpgraph.'jpgraph_pie3d.php');
+require_once('common/reporting/Report.class');
+require_once('common/reporting/report_utils.php');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new Report();
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+if (!isset($datatype)) {
+	$datatype=1;
+}
+
+if (!$start) {
+	$start=mktime(0,0,0,date('m'),1,date('Y'));;
+}
+if (!$end) {
+	$end=time();
+} else {
+	$end--;
+}
+
+
+if ($datatype < 5) {
+
+	$sql="SELECT g.group_name,count(*) AS count
+	FROM groups g, artifact_group_list agl, artifact a
+	WHERE g.group_id=agl.group_id 
+	AND agl.group_artifact_id=a.group_artifact_id 
+	AND a.open_date BETWEEN '$start' AND '$end'
+	AND agl.datatype='$datatype'
+	GROUP BY group_name
+	ORDER BY count DESC";
+
+} elseif ($datatype == 5) {
+
+	$sql="SELECT g.group_name,count(*) AS count
+	FROM groups g, forum_group_list fgl, forum f
+	WHERE g.group_id=fgl.group_id
+	AND fgl.group_forum_id=f.group_forum_id
+	AND f.date BETWEEN '$start' AND '$end'
+	GROUP BY group_name
+	ORDER BY count DESC";
+
+} elseif ($datatype == 6) {
+
+	$sql="SELECT g.group_name,count(*) AS count
+	FROM groups g, project_group_list pgl, project_task pt
+	WHERE g.group_id=pgl.group_id
+	AND pgl.group_project_id=pt.group_project_id
+	AND pt.start_date BETWEEN '$start' AND '$end'
+	GROUP BY group_name
+	ORDER BY count DESC";
+
+} else {
+
+	$sql="SELECT g.group_name,count(*) AS count
+	FROM groups g, frs_package fp, frs_release fr, frs_file ff, frs_dlstats_file fdf
+	WHERE g.group_id=fp.group_id
+	AND fp.package_id=fr.package_id
+	AND fr.release_id=ff.release_id
+	AND ff.file_id=fdf.file_id
+	AND (((fdf.month > '". date('Ym',$start) ."') OR (fdf.month = '". date('Ym',$start) ."' AND fdf.day >= '". date('d',$start) ."'))
+	AND ((fdf.month < '". date('Ym',$end) ."') OR (fdf.month = '". date('Ym',$end) ."' AND fdf.day < '". date('d',$end) ."')))
+	GROUP BY group_name
+	ORDER BY count DESC";
+
+}
+
+//echo $sql;
+//exit;
+
+$res=db_query($sql);
+
+if (db_error()) {
+	exit_error('Error',db_error());
+}
+
+// Create the graph. These two calls are always required
+$graph  = new PieGraph(640, 480,"auto");
+//$graph->SetMargin(50,10,35,50);
+
+$arr[1]='Bugs';
+$arr[2]='Support Requests';
+$arr[3]='Patches';
+$arr[4]='Feature Requests';
+$arr[0]='Other Trackers';
+$arr[5]='Forum Messages';
+$arr[6]='Tasks';
+$arr[7]='Downloads';
+$graph->title->Set($arr[$datatype]." By Project (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
+$graph->subtitle->Set($report_company_name);
+
+// Create the tracker open plot
+report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1));
+
+$p1  = new PiePlot3D($pie_vals);
+$p1->ExplodeSlice (0);
+$p1->SetLegends($pie_labels);
+$graph->Add( $p1);
+
+// Display the graph
+$graph->Stroke();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/trackerpie_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/trackerpie_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/trackerpie_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_pie.php');
+require_once($sys_path_to_jpgraph.'jpgraph_pie3d.php');
+require_once('common/reporting/Report.class');
+require_once('common/reporting/report_utils.php');
+require_once('www/tracker/include/ArtifactTypeHtml.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new Report();
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+if (!isset($area)) {
+	$area='category';
+}
+
+if (!$start) {
+	$start=mktime(0,0,0,date('m'),1,date('Y'));;
+}
+if (!$end) {
+	$end=time();
+} else {
+	$end--;
+}
+
+
+if ($area == 'category') {
+
+	$sql="SELECT ac.category_name,count(*) 
+	FROM artifact a, artifact_category ac
+	WHERE a.group_artifact_id='$atid'
+	AND a.category_id=ac.id
+	AND a.open_date BETWEEN '$start' AND '$end'
+	GROUP BY category_name";
+
+} elseif ($area == 'group') {
+
+	$sql="SELECT ag.group_name,count(*) 
+	FROM artifact a, artifact_group ag
+	WHERE a.group_artifact_id='$atid'
+	AND a.artifact_group_id=ag.id
+	AND a.open_date BETWEEN '$start' AND '$end'
+	GROUP BY group_name";
+
+} elseif ($area == 'resolution') {
+
+	$sql="SELECT ar.resolution_name,count(*) 
+	FROM artifact a, artifact_resolution ar
+	WHERE a.group_artifact_id='$atid'
+	AND a.resolution_id=ar.id
+	AND a.open_date BETWEEN '$start' AND '$end'
+	GROUP BY resolution_name";
+
+} else {
+
+	$sql="SELECT u.realname,count(*) 
+	FROM artifact a, users u
+	WHERE a.group_artifact_id='$atid'
+	AND a.assigned_to=u.user_id
+	AND a.open_date BETWEEN '$start' AND '$end'
+	GROUP BY realname";
+
+}
+
+//echo $sql;
+//exit;
+
+$res=db_query($sql);
+
+if (db_error()) {
+	exit_error('Error',db_error());
+}
+
+// Create the graph. These two calls are always required
+$graph  = new PieGraph(640, 480,"auto");
+//$graph->SetMargin(50,10,35,50);
+
+$arr['category']='By Category';
+$arr['group']='By Group';
+$arr['resolution']='By Resolution';
+$arr['technician']='By Tecnician';
+$graph->title->Set($arr[$area]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
+$graph->subtitle->Set($report_company_name);
+
+// Create the tracker open plot
+report_pie_arr(util_result_column_to_array($res,0), util_result_column_to_array($res,1));
+
+$p1  = new PiePlot3D($pie_vals);
+$p1->ExplodeSlice (0);
+$p1->SetLegends($pie_labels);
+$graph->Add( $p1);
+
+// Display the graph
+$graph->Stroke();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+echo report_header('User Activity');
+
+$abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
+echo "Choose the <strong>First Letter</strong> of the name of the person you wish to report on.<p>";
+for ($i=0; $i<count($abc_array); $i++) {
+	if ($sw == $abc_array[$i]) {
+		echo '<strong>'.$abc_array[$i].'</strong> ';
+	} else { 
+		echo '<a href="useract.php?sw='.$abc_array[$i].'">'.$abc_array[$i].'</A> ';
+	}
+}
+
+if ($sw) {
+	?>
+	<h3>User Activity</h3>
+	<p>
+	<form action="<?php echo $PHP_SELF; ?>" method="get">
+	<input type="hidden" name="sw" value="<?php echo $sw; ?>">
+	<table><tr>
+	<td><strong>User:</strong><br /><?php echo report_useract_box('dev_id',$dev_id,$sw); ?></td>
+	<td><strong>Area:</strong><br /><?php echo report_area_box('area',$area); ?></td>
+	<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN); ?></td>
+	<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+	<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+	<td><input type="submit" name="submit" value="Refresh"></td>
+	</tr></table>
+	</form>
+	<p>
+	<?php if ($dev_id) { ?>
+		<img src="useract_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end&dev_id=$dev_id&area=$area"; ?>" width="640" height="480">
+		<p>
+		<?php
+
+	}
+
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useract_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,141 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_log.php');
+require_once($sys_path_to_jpgraph.'jpgraph_line.php');
+require_once('common/reporting/ReportUserAct.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportUserAct($SPAN,$dev_id,$start,$end); 
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+//
+// Get User Object
+//
+$u =& user_get_object($dev_id);
+if (!$u || $u->isError()) {
+	exit_error("Could Not Get User");
+}
+
+// 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 ("Trk Open");
+	$lineplot2 ->SetLegend("Trk Close");
+
+} 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=='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("User Activity For: ".$u->getRealName() 
+	." (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
+$graph->subtitle->Set($report_company_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();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error('Error',$report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+session_require( array('group'=>$sys_stats_group) );
+
+echo report_header('Users Added');
+
+?>
+<h3>Users Added</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<table><tr>
+<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<img src="useradded_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end"; ?>" width="640" height="480">
+<p>
+<?php
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/useradded_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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/ReportUserAdded.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportUserAdded($SPAN,$start,$end); 
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+// Some data
+$ydata  = $report->getData();
+
+// Create the graph. These two calls are always required
+$graph  = new Graph(640, 480,"auto");
+$graph->SetMargin(50,10,35,50);
+$graph->SetScale( "textlin");
+
+// Create the linear plot
+$lineplot =new LinePlot($ydata);
+$lineplot ->SetColor("black");
+$lineplot->SetFillColor("orange");
+
+// Add the plot to the graph
+$graph->Add( $lineplot);
+
+//$graph->SetMargin(10,10,25,10);
+$graph->title->Set("Users Added ".$report->getSpanName()
+	." (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
+$graph->subtitle->Set($report_company_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();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+session_require( array('group'=>$sys_stats_group) );
+
+echo report_header('Cumulative Users');
+
+?>
+<h3>Cumulative Users</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<table><tr>
+<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<img src="usercum_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end"; ?>" width="640" height="480">
+<p>
+<?php
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usercum_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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/ReportUserCum.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportUserCum($SPAN,$start,$end); 
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+// Some data
+$ydata  = $report->getData();
+
+// Create the graph. These two calls are always required
+$graph  = new Graph(640, 480,"auto");
+$graph->SetMargin(50,10,35,50);
+$graph->SetScale( "textlin");
+
+// Create the linear plot
+$lineplot =new LinePlot($ydata);
+$lineplot ->SetColor("black");
+$lineplot->SetFillColor("orange");
+
+// Add the plot to the graph
+$graph->Add( $lineplot);
+
+//$graph->SetMargin(10,10,25,10);
+$graph->title->Set("Cumulative Users ".$report->getSpanName()
+	." (".date('m/d/Y',$report->getStartDate()) ."-". date('m/d/Y',$report->getEndDate()) .")");
+$graph->subtitle->Set($report_company_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();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usersummary.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usersummary.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usersummary.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getWeekStartArr();
+	$start = $z[count($z)-1];
+}
+if (!$end) {
+	$end=$z[0];
+}
+if (!$tstat) {
+	$tstat='1';
+}
+
+$n[]='Any';
+$n[]='Open';
+$n[]='Closed';
+
+$l[]='1,2';
+$l[]='1';
+$l[]='2';
+
+echo report_header('User Summary Report');
+
+	?>
+	<h3>User Summary Report</h3>
+	<p>
+	Choose the range from the pop-up boxes below. The report will list all tasks with an open 
+	date in that range.
+	<p>
+    <form action="<?php echo $PHP_SELF; ?>" method="get">
+    <table><tr>
+    <td><strong>Start:</strong><br /><?php echo report_weeks_box($report, 'start', $start); ?></td>
+    <td><strong>End:</strong><br /><?php echo report_weeks_box($report, 'end', $end); ?></td>
+	<td><strong>Task Status:</strong><br /><?php echo html_build_select_box_from_arrays($l,$n,'tstat',$tstat,false); ?></td>
+    <td><input type="submit" name="submit" value="Refresh"></td>
+	</tr></table>
+	</form>
+	<p>
+	<?php
+
+$sql="SELECT users.realname,users.user_id,users.user_name, ps.status_name, pgl.group_id, pt.group_project_id, 
+pt.summary, pt.hours, pt.end_date, pt.project_task_id, pt.hours, sum(rtt.hours) AS remaining_hrs,
+(select sum(hours) from rep_time_tracking 
+	WHERE user_id=users.user_id 
+	AND project_task_id=pt.project_task_id
+	AND report_date BETWEEN '$start' AND '$end') AS cumulative_hrs
+FROM users, project_assigned_to pat, project_status ps, project_group_list pgl, project_task pt
+LEFT JOIN rep_time_tracking rtt USING (project_task_id)
+WHERE users.user_id=pat.assigned_to_id
+AND pgl.group_project_id=pt.group_project_id
+AND pat.project_task_id=pt.project_task_id
+AND pt.status_id=ps.status_id
+AND pt.status_id IN ($tstat)
+AND pt.start_date BETWEEN '$start' AND '$end'
+GROUP BY realname, users.user_id, user_name, status_name, pgl.group_id, pt.group_project_id, 
+	summary, pt.hours, end_date, pt.project_task_id, pt.hours";
+
+$res=db_query($sql);
+if (!$res || db_numrows($res) < 1) {
+	echo 'No Matches Found'.db_error();
+} else {
+
+	echo '<table border="1">
+			<tr>
+				<td><strong>Name</strong></td>
+				<td><strong>Task</strong></td>
+				<td><strong>Status</strong></td>
+				<td><strong>Cum. Hrs</strong></td>
+				<td><strong>Rem. Hrs</strong></td>
+				<td><strong>End Date</strong></td>
+			</tr>';
+	for ($i=0; $i<db_numrows($res); $i++) {
+		$name=db_result($res,$i,'realname');
+		if ($last_name != $name) {
+			echo '<tr><td colspan="6"><strong>'.$name.'</strong></td></tr>';
+			$last_name = $name;
+		}
+		echo '<tr><td> </td>
+				<td><a href="/pm/task.php?func=detailtask&group_id='.db_result($res,$i,'group_id')
+					.'&project_task_id='.db_result($res,$i,'project_task_id')
+					.'&group_project_id='.db_result($res,$i,'group_project_id')
+					.'" target="_blank">'.db_result($res,$i,'summary').'</a></td>
+				<td>'.db_result($res,$i,'status_name').'</td>
+				<td>'.number_format(db_result($res,$i,'cumulative_hrs'),1).'</td>
+				<td>'.number_format((db_result($res,$i,'hours')-db_result($res,$i,'remaining_hrs')),1).'</td>
+				<td>'.date($sys_datefmt,db_result($res,$i,'end_date')).'</td>
+				';
+
+		$task=db_result($res,$i,'project_task_id');
+		$sql2="SELECT g.group_name, g.group_id, agl.group_artifact_id, agl.name, a.artifact_id, a.summary
+		FROM project_task_artifact pta, artifact a, artifact_group_list agl, groups g
+		WHERE pta.project_task_id='$task'
+		AND pta.artifact_id=a.artifact_id
+		AND a.group_artifact_id=agl.group_artifact_id
+		AND agl.group_id=g.group_id";
+
+		$res2=db_query($sql2);
+		if (!$res2 || db_numrows($res2) < 1) {
+			echo db_error();
+		} else {
+			for ($j=0; $j<db_numrows($res2); $j++) {
+				$tracker=db_result($res2,$j,'group_name'). '*' .db_result($res2,$j,'name');
+				echo '<tr><td colspan="3"> </td>
+					<td>';
+				if ($last_tracker != $tracker) {
+					$last_tracker = $tracker;
+					echo $tracker;
+				} else {
+					echo ' ';
+				}
+				echo '</td>
+						<td colspan="2"><a href="/tracker/?func=detail&atid='.db_result($res2,$j,'group_artifact_id').
+						'&group_id='.db_result($res2,$j,'group_id').
+						'&aid='.db_result($res2,$j,'artifact_id').'" target="_blank">'.db_result($res2,$j,'summary').'</a></td></tr>';
+			}
+			$last_tracker='';
+		}
+
+	}
+	echo '</table>';
+
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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('common/reporting/report_utils.php');
+require_once('common/reporting/ReportUserTime.class');
+
+session_require( array('group'=>$sys_stats_group) );
+
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
+
+if (!$start) {
+	$z =& $report->getMonthStartArr();
+	$start = $z[count($z)-1];
+}
+
+
+echo report_header('User Time Reporting');
+
+$abc_array = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
+echo "Choose the <strong>First Letter</strong> of the name of the person you wish to report on.<p>";
+for ($i=0; $i<count($abc_array); $i++) {
+	if ($sw == $abc_array[$i]) {
+		echo '<strong>'.$abc_array[$i].'</strong> ';
+	} else { 
+		echo '<a href="usertime.php?sw='.$abc_array[$i].'&typ='.$typ.'">'.$abc_array[$i].'</A> ';
+	}
+}
+
+if ($sw) {
+
+	$a[]='By Task';
+	$a[]='By Category';
+	$a[]='By Subproject';
+
+	$a2[]='tasks';
+	$a2[]='category';
+	$a2[]='subproject';
+
+	?>
+	<h3>User Time Reporting</h3>
+	<p>
+	<form action="<?php echo $PHP_SELF; ?>" method="get">
+	<input type="hidden" name="sw" value="<?php echo $sw; ?>">
+	<input type="hidden" name="typ" value="<?php echo $typ; ?>">
+	<table><tr>
+	<td><strong>User:</strong><br /><?php echo report_usertime_box('dev_id',$dev_id,$sw); ?></td>
+	<td><strong>Type:</strong><br /><?php echo html_build_select_box_from_arrays($a2,$a,'type',$type,false); ?></td>
+	<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+	<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+	<td><input type="submit" name="submit" value="Refresh"></td>
+	</tr></table>
+	</form>
+	<p>
+	<?php
+		if ($dev_id && $typ=='r') {
+			$report=new ReportUserTime($dev_id,$type,$start,$end);
+			$labels = $report->labels;
+			$data = $report->getData();
+
+			echo $HTML->listTableTop (array('Type','Time'));
+
+			for ($i=0; $i<count($labels); $i++) {
+
+				echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
+					'<td>'. $labels[$i] .'</td><td>'. $data[$i] .'</td></tr>';
+
+			}
+
+			echo $HTML->listTableBottom ();
+
+		} elseif ($dev_id) { ?>
+		<img src="usertime_graph.php?<?php echo "start=$start&end=$end&dev_id=$dev_id&type=$type"; ?>" width="640" height="480">
+		<p>
+		<?php
+
+	}
+
+}
+
+echo report_footer();
+
+?>

Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime_graph.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime_graph.php	                        (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/reporting/usertime_graph.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Reporting System
+ *
+ * Copyright 2004 (c) GForge LLC
+ *
+ * @version   $Id$
+ * @author Tim Perdue tim at 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_pie.php');
+require_once($sys_path_to_jpgraph.'jpgraph_pie3d.php');
+require_once('common/reporting/ReportUserTime.class');
+require_once('common/reporting/report_utils.php');
+
+session_require( array('group'=>$sys_stats_group) );
+
+//
+//	Create Report
+//
+$report=new ReportUserTime($dev_id,$type,$start,$end);
+
+//
+//	Check for error, such as license key problem
+//
+if ($report->isError()) {
+	echo $report->getErrorMessage();
+	exit;
+}
+
+if (!isset($datatype)) {
+	$datatype=1;
+}
+
+if (!$start) {
+	$start=mktime(0,0,0,date('m'),1,date('Y'));;
+}
+if (!$end) {
+	$end=time();
+} else {
+	$end--;
+}
+
+// Create the graph. These two calls are always required
+$graph  = new PieGraph(640, 480,"auto");
+//$graph->SetMargin(50,10,35,50);
+
+$arr['tasks']='By Task';
+$arr['category']='By Category';
+$arr['subproject']='By Subproject';
+
+$graph->title->Set("Time Report ".$arr[$type]." (".date('m/d/Y',$start) ."-". date('m/d/Y',$end) .")");
+$graph->subtitle->Set($report_company_name);
+
+// Create the tracker open plot
+//$data  =& $report->getData();
+//$labels =& $report->labels;
+report_pie_arr($report->labels,$report->getData());
+
+$p1  = new PiePlot3D( $pie_vals );
+$p1->ExplodeSlice (0);
+$p1->SetLegends( $pie_labels );
+$graph->Add( $p1);
+
+// Display the graph
+$graph->Stroke();
+
+?>

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/tracker/reporting/index.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/tracker/reporting/index.php	2011-02-24 16:32:12 UTC (rev 9827)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/tracker/reporting/index.php	2011-02-24 16:32:13 UTC (rev 9828)
@@ -1,347 +1,106 @@
 <?php
 /**
-  *
-  * SourceForge Generic Tracker facility
-  *
-  * SourceForge: Breaking Down the Barriers to Open Source Development
-  * Copyright 1999-2001 (c) VA Linux Systems
-  * http://sourceforge.net
-  *
-  * @version   index.php,v 1.8 2003/11/04 20:30:49 lo-lan-do Exp
-  *
-  */
-
-
+ *	GForge Reporting System
+ *  Copyright 2003 GForge LLC
+ *
+ *  THIS SOFTWARE IS PROPRIETARY
+ */
 require_once('pre.php');
+require_once('common/reporting/report_utils.php');
+require_once('common/reporting/Report.class');
 require_once('www/tracker/include/ArtifactTypeHtml.class');
-require_once('www/project/stats/project_stats_utils.php');
-require_once('tool_reports.php');
 
-$page_title=$Language->getText('tracker_reporting','title');
-//$bar_colors=array("red","blue");
-$bar_colors=array("#F76D6D","#6D6DF7");
+$report=new Report();
+if ($report->isError()) {
+	exit_error($report->getErrorMessage());
+}
 
 $group =& group_get_object($group_id);
-exit_assert_object($group, 'Group');
+if (!$group || !is_object($group)) {
+	exit_error('Error','Error - Could Not Get Group');
+} elseif ($group->isError()) {
+	exit_error('Error',$group->getErrorMessage());
+}
 
-$perm =& $group->getPermission( session_get_user() );
-exit_assert_object($perm, 'Permission');
+if (!session_loggedin()) {
+	exit_not_logged_in();
+}
 
-function reporting_header($group_id) {
-	global $atid,$perm,$group_id;
-	global $Language,$HTML;
-	echo $HTML->subMenu(
-		array(
-			$Language->getText('group','short_tracker'),
-			$Language->getText('tracker','reporting'),
-			$Language->getText('tracker','admin')
-		),
-		array(
-			'/tracker/?group_id='.$group_id,
-			'/tracker/reporting/?group_id='.$group_id,
-			'/tracker/admin/?group_id='.$group_id
-			
-		)
-	);
-	if ($perm->isAdmin()) {
-		$alevel=' >= 0';
-	} else {
-		$alevel=' > 1';
-	}
-	$sql="SELECT agl.group_artifact_id,agl.name
-        	FROM artifact_group_list agl,artifact_perm ap
-        	WHERE agl.group_artifact_id=ap.group_artifact_id
-        	AND ap.user_id='". user_getid() ."'
-        	AND ap.perm_level $alevel
-        	AND agl.group_id='$group_id'";
-	$res=db_query($sql);
-
-	
-	reports_header(
-		$group_id,
-		array('aging','tech','category','group','resolution'),
-		array($Language->getText('tracker_reporting','aging_report'),$Language->getText('tracker_reporting','dist_by_technician'),$Language->getText('tracker_reporting','dist_by_category'),$Language->getText('tracker_reporting','dist_by_group'),$Language->getText('tracker_reporting','dist_by_resolution')),
-		'<strong>'.$Language->getText('tracker_reporting','artifact_type').': </strong>'
-		 .html_build_select_box($res,'atid',$atid,false)
-		 .'<br /><br />'
-	);
+$perm =& $group->getPermission( session_get_user() );
+if (!$perm || !is_object($perm)) {
+	exit_error('Error','Error - Could Not Get Perm');
+} elseif ($perm->isError()) {
+	exit_error('Error',$perm->getErrorMessage());
 }
 
-function quick_report($group_id,$title,$subtitle1,$sql1,$subtitle2,$sql2) {
-	global $bar_colors;
-	global $Language;
 
-        $group_name=array(group_getname($group_id));
-       echo site_project_header(array("title"=>$title,'group'=>$group_id,'pagename'=>'tracker_reporting','sectionvals'=>$group_name,
-           'toptab'=>'pm'));
-        reporting_header($group_id);
-        echo "\n<h1>$title</h1>";
-
-	reports_quick_graph($subtitle1,$sql1,$sql2,$bar_colors);
-
-	echo site_project_footer(array());
+//
+//	Get list of trackers this person can see
+//
+if ($perm->isArtifactAdmin()) {
+	$alevel=' >= 0';
+} else {
+	$alevel=' > 1';
 }
 
+$sql="SELECT agl.group_artifact_id,agl.name
+	FROM artifact_group_list agl,artifact_perm ap
+	WHERE agl.group_artifact_id=ap.group_artifact_id
+	AND ap.user_id='". user_getid() ."'
+	AND ap.perm_level $alevel
+	AND agl.group_id='$group_id'";
+$restracker=db_query($sql);
 
-if ($perm->isMember()) {
+//
+//	Build list of reports
+//
+$vals[]='activity'; $labels[]='Response Time';
+$vals[]='category'; $labels[]='By Category';
+$vals[]='group'; $labels[]='By Group';
+$vals[]='resolution'; $labels[]='By Resolution';
+$vals[]='technician'; $labels[]='By Tecnician';
 
-	include_once('www/include/HTML_Graphs.php');
-	
-	if ($what) {
-		
-		$period_clause=period2sql($period,$span,"open_date");
-		
-		if ($what=="aging") {
-			
-                        $group_name=array(group_getname($group_id));
-                       site_project_header(array ("title"=>$Language->getText(
-                           'tracker_reporting','aging_report'),
-                           'group'=>$group_id,
-                           'pagename'=>'tracker_reporting',
-                           'sectionvals'=>$group_name, 'toptab'=>'pm'));
-                        reporting_header($group_id);
-                        echo "\n<h1>".$Language->getText('tracker_reporting','aging_report')."</h1>";
 
-			$time_now=time();
-//			echo $time_now."<p>";
+//required params for site_project_header();
+$params['group']=$group_id;
+$params['toptab']='tracker';
+$params['pagename']='tracker';
+$params['sectionvals']=array($group->getPublicName());
 
-			if (!$period || $period=="lifespan") {
-				$period="month";
-				$span=12;
-			}
+echo site_project_header($params);
 
-			if (!$span) $span=1;
-			$sub_duration=period2seconds($period, 1);
-
-			for ($counter=1; $counter<=$span; $counter++) {
-
-				$start=($time_now-($counter*$sub_duration));
-				$end=($time_now-(($counter-1)*$sub_duration));
-
-				$sql="	SELECT avg((close_date-open_date)/(24*60*60)) 
-					FROM artifact
-					WHERE close_date > 0 
-					AND (open_date >= '$start' AND open_date <= '$end') 
-					AND resolution_id <> '2' 
-					AND group_artifact_id='$atid'";
-
-				$result = db_query($sql);
-
-				$names[$counter-1]=date("Y-m-d",($start))." to ".date("Y-m-d",($end));
-				$values[$counter-1]=((int)(db_result($result, 0,0)*1000))/1000;
-			}
-
-			GraphIt(
-				$names, $values,
-				$Language->getText('tracker_reporting','average_turnaround')
-			);
-
-			echo "<p> </p>";
-
-			for ($counter=1; $counter<=$span; $counter++) {
-
-				$start=($time_now-($counter*$sub_duration));
-				$end=($time_now-(($counter-1)*$sub_duration));
-
-				$sql="	SELECT count(*)
-					FROM artifact
-					WHERE open_date >= '$start'
-					AND open_date <= '$end'
-					AND resolution_id <> '2'
-					AND group_artifact_id='$atid'";
-
-				$result = db_query($sql);
-
-				$names[$counter-1]=date("Y-m-d",($start))." to ".date("Y-m-d",($end));
-				$values[$counter-1]=db_result($result, 0,0);
-			}
-
-			GraphIt($names, $values, $Language->getText('tracker_reporting','items_submitted'));
-
-			echo "<p>";
-
-			for ($counter=1; $counter<=$span; $counter++) {
-
-				$start=($time_now-($counter*$sub_duration));
-				$end=($time_now-(($counter-1)*$sub_duration));
-
-				$sql="	SELECT count(*)
-					FROM artifact
-					WHERE open_date <= '$end'
-					AND (close_date >= '$end' OR close_date < 1 OR close_date is null)
-					AND resolution_id <> '2'
-					AND group_artifact_id='$atid'";
-
-				$result = db_query($sql);
-
-				$names[$counter-1]=date("Y-m-d",($end));
-				$values[$counter-1]=db_result($result, 0,0);
-			}
-
-			GraphIt($names, $values, $Language->getText('tracker_reporting','items_open'));
-
-			echo "<p> </p>";
-
-			site_project_footer(array());
-
-		} else if ($what=="category") {
-
-			// Open
-			$sql1="
-				SELECT artifact_category.category_name AS Category,
-				       count(*) AS Count
-				FROM artifact_category,artifact 
-				WHERE artifact_category.id=artifact.category_id
-				AND artifact.status_id = '1'
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause 
-				GROUP BY Category";
-
-			// All
-			$sql2="
-				SELECT artifact_category.category_name AS Category,
-				       count(*) AS Count
-				FROM artifact_category,artifact
-				WHERE artifact_category.id=artifact.category_id
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause
-				GROUP BY Category";
-
-			quick_report(
-				$group_id,
-				$Language->getText('tracker_reporting','dist_by_category'),
-				$Language->getText('tracker_reporting','open_items_by_technician'),$sql1,
-				$Language->getText('tracker_reporting','all_by_technician'),$sql2
-			);
-
-		} else if ($what=="tech") {
-
-			// Open
-			$sql1="
-				SELECT users.user_name AS Technician, count(*) AS Count
-				FROM users,artifact
-				WHERE users.user_id=artifact.assigned_to
-				AND artifact.status_id = '1'
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause
-				GROUP BY Technician";
-
-			// All
-			$sql2="
-				SELECT users.user_name AS Technician, count(*) AS Count
-				FROM users,artifact 
-				WHERE users.user_id=artifact.assigned_to
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause
-				GROUP BY Technician";
-
-			quick_report(
-				$group_id,
-				$Language->getText('tracker_reporting','dist_by_technician'),
-				$Language->getText('tracker_reporting','open_items_by_technician'),$sql1,
-				$Language->getText('tracker_reporting','all_items_by_technician'),$sql2
-			);
-
-		} else if ($what=="group") {
-
-			// Open
-			$sql1="
-				SELECT artifact_group.group_name AS Group_Name,
-				      count(*) AS Count FROM artifact_group,artifact 
-				WHERE artifact_group.id=artifact.artifact_group_id
-				AND artifact.status_id = '1'
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause 
-				GROUP BY Group_Name";
-
-			// All
-			$sql2="
-				SELECT artifact_group.group_name AS Group_Name,
-				      count(*) AS Count FROM artifact_group,artifact
-				WHERE artifact_group.id=artifact.artifact_group_id
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause
-				GROUP BY Group_Name";
-
-			quick_report(
-				$group_id,
-				$Language->getText('tracker_reporting','dist_by_group'),
-				$Language->getText('tracker_reporting','open_by_group'),$sql1,
-				$Language->getText('tracker_reporting','all_by_group'),$sql2
-			);
-
-		} else if ($what=="resolution") {
-
-			// Open
-			$sql1="
-				SELECT artifact_resolution.resolution_name AS Resolution,
-				       count(*) AS Count
-				FROM artifact_resolution,artifact
-				WHERE artifact_resolution.id=artifact.resolution_id
-				AND artifact.status_id = '1'
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause 
-				GROUP BY Resolution";
-
-			// All
-			$sql2="
-				SELECT artifact_resolution.resolution_name AS Resolution,
-				       count(*) AS Count
-				FROM artifact_resolution,artifact
-				WHERE artifact_resolution.id=artifact.resolution_id
-				AND artifact.resolution_id <> '2'
-				AND artifact.group_artifact_id='$atid'
-				$period_clause
-				GROUP BY Resolution";
-
-			quick_report(
-				$group_id,
-				$Language->getText('tracker_reporting','dist_by_resolution'),
-				$Language->getText('tracker_reporting','open_items_by_resolution'),$sql1,
-				$Language->getText('tracker_reporting','all_by_resolution'),$sql2
-			);
-
+?>
+<h3>Project Activity</h3>
+<p>
+<form action="<?php echo $PHP_SELF; ?>" method="get">
+<input type="hidden" name="sw" value="<?php echo $sw; ?>">
+<input type="hidden" name="group_id" value="<?php echo $group_id; ?>">
+<table><tr>
+<td><strong>Tracker:</strong><br /><?php echo html_build_select_box($restracker,'atid',$atid,false); ?></td>
+<td><strong>Area:</strong><br /><?php echo html_build_select_box_from_arrays($vals, $labels, 'area',$area,false); ?></td>
+<td><strong>Type:</strong><br /><?php echo report_span_box('SPAN',$SPAN,true); ?></td>
+<td><strong>Start:</strong><br /><?php echo report_months_box($report, 'start', $start); ?></td>
+<td><strong>End:</strong><br /><?php echo report_months_box($report, 'end', $end); ?></td>
+<td><input type="submit" name="submit" value="Refresh"></td>
+</tr></table>
+</form>
+<p>
+<?php if ($atid) {
+		if (!$area || $area == 'activity') { 
+	?>
+	<img src="trackeract_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end&group_id=$group_id&atid=$atid"; ?>" width="640" height="480">
+	<p>
+	<?php
 		} else {
-			exit_missing_param();
+	?>
+	<img src="trackerpie_graph.php?<?php echo "SPAN=$SPAN&start=$start&end=$end&group_id=$group_id&atid=$atid&area=$area"; ?>" width="640" height="480">
+	<p>
+	<?php
+
 		}
 
-	} else {
-		/*
-			Show main page
-		*/
-
-		//required params for site_project_header();
-		$params['group'] = $group_id;
-		$params['toptab'] = 'tracker';
-		$params['title'] = $page_title;
-		$params['pagename'] = 'tracker_reporting';
-		$params['sectionvals']=array(group_getname($group_id));
-	
-		echo site_project_header($params);
-
-		reporting_header($group_id);
-
-		echo site_project_footer($params);
-
-	}
-
-} else {
-
-	// Cannot show reports
-
-	exit_permission_denied();
-
 }
 
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
+echo site_project_footer(array());
+
 ?>



More information about the evolvis-commits mailing list