From 8fd66316678bceab5ad8a36dafd3a783d729d2a7 Mon Sep 17 00:00:00 2001 From: dg9vh Date: Sat, 2 Jul 2016 13:33:37 +0000 Subject: [PATCH] colorizing table lines to warning = yellow and danger = light red if reflector\'s not responding since 30 or 60 minutes. --- include/ysfgatewayinfo.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/ysfgatewayinfo.php b/include/ysfgatewayinfo.php index b2066c5..4787c68 100644 --- a/include/ysfgatewayinfo.php +++ b/include/ysfgatewayinfo.php @@ -40,12 +40,25 @@ "; + $timestamp = $reflector[4]; + $timestamp2 = new DateTime($timestamp); + $now = new DateTime(); + $timestamp2->add(new DateInterval('PT60M')); + if ($now->format('U') >= $timestamp2->format('U')) { + echo ""; + } else { + $timestamp2 = new DateTime($timestamp); + $timestamp2->add(new DateInterval('PT30M')); + if ($now->format('U') >= $timestamp2->format('U')) { + echo ""; + } else {echo ""; + } + } echo "$counter"; for ($i = 0; $i < 5; $i++) { echo"$reflector[$i]"; } - echo ""; + echo "\n"; $counter++; } }