dotProject Recipe: colorize Project rows by Project Status
April 29, 2007
Dotproject | PHP | Snippets
On the main Project page, we changed the meaning of the background color of each project row to reflect the project status.


To make this change, in System Admin: System Lookup Values: ProjectStatusColor add the correct hex color values for each status


Click to enlarge


Ads by Google

Posted by ellen at April 29, 2007 05:44 PM
In each idx page (vw_idx_active.php, ivw_dx_proposed, etc.) search for "GLOBAL" and add in $project_status_color, since you need to work with those values.

<?php /* PROJECTS $Id: vw_idx_proposed.php,v 1.22.6.1 2005/09/12 11:45:38 pedroix Exp $ */
GLOBAL $AppUI, $projects, $project_priority, $company_id, $pstatus, $project_types, $currentTabId, $currentTabName; $project_priority_color; $project_status_color;$project_contacts;$contact_first_name;$contact_last_name; $project_type;$IDprojects; 

Define a new variable, $projectStatusColor, to be whatever the current value of ProjectStatusColor is.

$projectPriority = dPgetSysVal( 'ProjectPriority' );
$projectPriorityColor = dPgetSysVal( 'ProjectPriorityColor' );
$projectType = dPgetSysVal('ProjectType');
$projectStatusColor = dPgetSysVal( 'ProjectStatusColor' );</b> // added definition here


In each of the vw_idx_ ... files where you want the colors to show up, add the background-color code to each td of the project listing rows:

$s .= $CR . '<td align="center" style="background-color:'.$projectStatusColor[$row["project_status"]].'">'. ($start_date ? $start_date->format( $df ) : '-') .'</td>'; 
$s .= $CR . '<td nowrap="nowrap" style="background-color:'.$projectStatusColor[$row["project_status"]].'">' . htmlspecialchars( $row["user_username"], ENT_QUOTES ) . '</td>'

Ads by Google


Ads by Google

 RSS   |   Contact Me


Ads by Google