Code: Select all
$nextcheck = get_datetime_string_from_datetime($xml->servicestatus->next_check, "", DT_SHORT_DATE_TIME, DF_AUTO, gettext("Not scheduled"));
$output .= '<tr'><td>' . gettext('Next Check') . ':</td><td>' . $nextcheck . '</td></tr>';
Code: Select all
$nextcheck = get_datetime_string_from_datetime($xml->servicestatus->next_check, "", DT_SHORT_DATE_TIME, DF_AUTO, gettext("Not scheduled"));
$nowepoch = time();
$nextcheckepoch = strtotime($xml->servicestatus->next_check);
if ($nowepoch > $nextcheckepoch) {
$nextcheckclass = ' style="background-color:#FF795F"';
} else {
$nextcheckclass = ' style="background-color:#B2FF5F"';
}
$output .= '<tr' . $nextcheckclass . '><td>' . gettext('Next Check') . ':</td><td>' . $nextcheck . '</td></tr>';

I know I should be using classes instead of in-line styles and I'm sure my hacknslash coding make some people cringe. I wonder about timezone issues or if it will really go red when not fresh. Feel free to tell me how I'm doing it wrong. For now I need to get back to my actual projects. Just wanted to share and hopefully something like this might make it into future versions. I do want something on hosts and summary pages as well but I don't want to make yet another thing I have to retro-fit into multiple files on every upgrade.