[evolvis-commits] r7978: Adding Gantt Chartin?==?UTF-8?Q?g↵
mirabilos at evolvis.org
mirabilos at evolvis.org
Thu Feb 24 15:54:30 CET 2011
Author: mirabilos
Date: 2011-02-24 15:54:30 +0100 (Thu, 24 Feb 2011)
New Revision: 7978
Added:
trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/gantt.php
trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/ganttpage.php
Modified:
trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/task.php
Log:
Adding Gantt Charting
Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/gantt.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/gantt.php (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/gantt.php 2011-02-24 14:54:30 UTC (rev 7978)
@@ -0,0 +1,81 @@
+<?php
+
+require_once('jpgraph/jpgraph.php');
+require_once('jpgraph/jpgraph_gantt.php');
+require_once('common/pm/ProjectTaskFactory.class');
+
+$ptf = new ProjectTaskFactory($pg);
+if (!$ptf || !is_object($ptf)) {
+ exit_error('Error','Could Not Get ProjectTaskFactory');
+} elseif ($ptf->isError()) {
+ exit_error('Error',$ptf->getErrorMessage());
+}
+
+$ptf->setup($offset,$_order,$max_rows,$set,$_assigned_to,$_status,$_category_id);
+if ($ptf->isError()) {
+ exit_error('Error',$ptf->getErrorMessage());
+}
+
+$pt_arr =& $ptf->getTasks();
+if ($ptf->isError()) {
+ exit_error('Error',$ptf->getErrorMessage());
+}
+
+if ($_size==640) {
+ $graph = new GanttGraph (640,480, "auto");
+} elseif ($_size==1024) {
+ $graph = new GanttGraph (1024,768, "auto");
+} elseif ($_size==1600) {
+ $graph = new GanttGraph (1600,1200, "auto");
+} else {
+ $graph = new GanttGraph (800,600, "auto");
+}
+$graph->SetShadow();
+
+// Add title and subtitle
+$graph->title-> Set($pg->getName());
+//$graph->title-> SetFont( FF_ARIAL, FS_BOLD, 12);
+$graph->subtitle-> Set("(Draft version)");
+
+// Show day, week and month scale
+if ($_resolution == 'Days') {
+ $graph->ShowHeaders( GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
+} elseif ($_resolution == 'Weeks') {
+ $graph->ShowHeaders( GANTT_HWEEK | GANTT_HMONTH);
+} else {
+ $graph->ShowHeaders( GANTT_HMONTH);
+}
+
+// Instead of week number show the date for the first day in the week
+// on the week scale
+$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
+
+// Make the week scale font smaller than the default
+$graph->scale->week->SetFont(FF_FONT0 );
+
+// Use the short name of the month together with a 2 digit year
+// on the month scale
+$graph->scale->month->SetStyle( MONTHSTYLE_SHORTNAMEYEAR2);
+
+$rows=count($pt_arr);
+
+for ($i=0; $i<$rows; $i++) {
+ // Format the bar for the first activity
+ // ($row,$title,$startdate,$enddate)
+ $activity[$i] = new GanttBar ($i, $pt_arr[$i]->getSummary(), date('Y-m-d',$pt_arr[$i]->getStartDate()), date('Y-m-d',$pt_arr[$i]->getEndDate()));
+
+ // Yellow diagonal line pattern on a red background
+ $activity[$i]->SetPattern(BAND_RDIAG, "yellow");
+ $activity[$i]->SetFillColor ("red");
+ $activity[$i]->progress->Set( (( $pt_arr[$i]->getPercentComplete() ) ? (1/$pt_arr[$i]->getPercentComplete()) : 0));
+ $activity[$i]->progress->SetPattern(BAND_RDIAG, "blue");
+ // Finally add the bar to the graph
+ $graph->Add( $activity[$i] );
+}
+
+//echo $rows;
+
+// Display the Gantt chart
+$graph->Stroke();
+
+?>
Added: trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/ganttpage.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/ganttpage.php (rev 0)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/ganttpage.php 2011-02-24 14:54:30 UTC (rev 7978)
@@ -0,0 +1,127 @@
+<?php
+/**
+ * GForge Project Management Facility
+ *
+ * Copyright 2002 GForge, LLC
+ * http://gforge.org/
+ *
+ * @version $Id$
+ */
+/*
+
+ Project/Task Manager
+ By Tim Perdue, Sourceforge, 11/99
+ Heavy rewrite by Tim Perdue April 2000
+
+ Total rewrite in OO and GForge coding guidelines 12/2002 by Tim Perdue
+*/
+
+//pm_header(array('title'=>'Browse Tasks','pagename'=>$pagename,'group_project_id'=>$group_project_id,'sectionvals'=>$g->getPublicName()));
+
+?>
+<html>
+<body>
+<?php
+/*
+ creating a custom technician box which includes "any" and "unassigned"
+*/
+
+$res_tech=$pg->getTechnicians();
+
+$tech_id_arr=util_result_column_to_array($res_tech,0);
+$tech_id_arr[]='0'; //this will be the 'any' row
+
+$tech_name_arr=util_result_column_to_array($res_tech,1);
+$tech_name_arr[]='Any';
+
+$tech_box=html_build_select_box_from_arrays ($tech_id_arr,$tech_name_arr,'_assigned_to',$_assigned_to,true,'Unassigned');
+
+/*
+ creating a custom category box which includes "any" and "none"
+*/
+
+$res_cat=$pg->getCategories();
+
+$cat_id_arr=util_result_column_to_array($res_cat,0);
+$cat_id_arr[]='0'; //this will be the 'any' row
+
+$cat_name_arr=util_result_column_to_array($res_cat,1);
+$cat_name_arr[]='Any';
+
+$cat_box=html_build_select_box_from_arrays ($cat_id_arr,$cat_name_arr,'_category_id',$_category_id,true,'None');
+
+/*
+ Creating a custom sort box
+*/
+$title_arr=array();
+$title_arr[]='Task ID';
+$title_arr[]='Summary';
+$title_arr[]='Start Date';
+$title_arr[]='End Date';
+$title_arr[]='Percent Complete';
+
+$order_col_arr=array();
+$order_col_arr[]='project_task_id';
+$order_col_arr[]='summary';
+$order_col_arr[]='start_date';
+$order_col_arr[]='end_date';
+$order_col_arr[]='percent_complete';
+$order_box=html_build_select_box_from_arrays ($order_col_arr,$title_arr,'_order',$_order,false);
+
+$dispres_title_arr=array();
+$dispres_title_arr[]='Months';
+$dispres_title_arr[]='Weeks';
+$dispres_title_arr[]='Days';
+if (!$_resolution) {
+ $_resolution='Weeks';
+}
+$dispres_box=html_build_select_box_from_arrays ($dispres_title_arr,$dispres_title_arr,'_resolution',$_resolution,false);
+
+/*
+ Graph Size Box
+*/
+$size_col_arr=array();
+$size_col_arr[]=640;
+$size_col_arr[]=800;
+$size_col_arr[]=1024;
+$size_col_arr[]=1600;
+
+$size_title_arr=array();
+$size_title_arr[]='640 x 480';
+$size_title_arr[]='800 x 600';
+$size_title_arr[]='1024 x 768';
+$size_title_arr[]='1600 x 1200';
+if (!$_size) {
+ $_size='800';
+}
+$size_box=html_build_select_box_from_arrays ($size_col_arr,$size_title_arr,'_size',$_size,false);
+/*
+ Show the new pop-up boxes to select assigned to and/or status
+*/
+echo '<table width="10%" BORDER="0">
+ <form action="'. $PHP_SELF .'?group_id='.$group_id.'&group_project_id='.$group_project_id.'&func=ganttpage" method="post">
+ <input type="hidden" name="set" value="custom">
+ <tr>
+ <td><font size="-1">Assignee:<br>'. $tech_box .'</td>
+ <td><font size="-1">Status:<br>'. $pg->statusBox('_status',$_status,'Any') .'</td>
+ <td><font size="-1">Category:<br>'. $cat_box .'</td>
+ <td><font size="-1">Sort On:<br>'. $order_box .'</td>
+ <td><font size="-1">Resolution:<br>'. $dispres_box .'</td>
+ <td><font size="-1">Size:<br>'. $size_box .'</td>
+ <td><font size="-1"><input type="SUBMIT" name="SUBMIT" value="Browse"></td>
+ </tr></form></table>';
+
+echo '<img src="'. $PHP_SELF .
+ '?func=ganttchart&group_id='.$group_id.
+ '&group_project_id='.$group_project_id.
+ '&_assigned_to='.$_assigned_to.
+ '&_order='.$_order.
+ '&_resolution='.$_resolution.
+ '&_category_id='.$_category_id.
+ '&_size='.$_size.
+ '&rand='.time().'">';
+
+//pm_footer(array());
+?>
+</body>
+</html>
Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/task.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/task.php 2011-02-24 14:54:29 UTC (rev 7977)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/pm/task.php 2011-02-24 14:54:30 UTC (rev 7978)
@@ -166,6 +166,14 @@
}
//
+ // Show the page surrounding the gantt chart
+ //
+ case 'ganttpage' : {
+ include 'ganttpage.php';
+ break;
+ }
+
+ //
// Show a gantt chart
//
case 'ganttchart' : {
More information about the evolvis-commits
mailing list