Code: Select all
function invoices_init(&$options, $memberInfo, &$args){
// modify the status field of the table view query to display 'Due' invoices in bold red
$oldArray=$options->QueryFieldsTV;
$options->QueryFieldsTV='';
foreach($oldArray as $field => $caption){
if($field=='`invoices`.`status`'){
$options->QueryFieldsTV['IF(`invoices`.`status`=\'Due\', \'<b style="color: red;">Due</b>\', IF(`invoices`.`status`=\'Paid\', \'<b style="color: green;">Paid</b>\', `invoices`.`status`))']=$caption;
}else{
$options->QueryFieldsTV[$field]=$caption;
}
}
return TRUE;
}
It doesn't seem to work if I add another IF.... in the "$options->QueryFieldsTV['IF(`invoices`...." line.
Also, how would the code look like, if I want to color an additional field, invoices.status and invoices.somethingelse?
Thanks in advance for any help. Much appreciated.
I am on AppGini 5.51