The table row class function does some comparisons against the % of complete the node claims to be and the % of time that has elapsed to figure out what the class for the row representing that node should be. In my case I wanted the rows to have a color co-ordination based on how behind/ahead of schedule they were.
<?php
function tr_class($data, $complete) {
if ($data == "100%") {
if ($complete < 100) {
$class = 'pastdue';
}
else {
$class = 'complete';
}
}
else {
if ($data > $complete) {
$diff = ceil(($data - $complete)/10);
switch($diff) {
case 1:
$class = "ten_behind";
break;
case 2:
$class = "twenty_behind";
break;
case 3:
$class = "thirty_behind";
break;
case 4:
$class = "fourty_behind";
break;
case 5:
$class = "fifty_behind";
break;
case 6:
$class = "sixty_behind";
break;
case 7:
$class = "seventy_behind";
break;
case 8:
$class = "eighty_behind";
break;
case 9:
$class = "ninety_behind";
break;
}
}
else {
$class = "ahead";
}
}
return $class;
}
?>