dotProject Recipe: colorize Project rows by Project Status

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


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>'