diff options
author | Erich Eckner <git@eckner.net> | 2022-07-20 13:38:55 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2022-07-20 13:38:55 +0200 |
commit | 27def9d12e939794f5fc9e42375bb6340abd7bdc (patch) | |
tree | 562d36ec04fe0047e52318ae784b8693089dcfa9 | |
parent | fc333f6f06b47678750af15f9568657b2fa3f2a1 (diff) | |
download | colocation-27def9d12e939794f5fc9e42375bb6340abd7bdc.tar.xz |
colorize lines
-rw-r--r-- | html/index.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/html/index.php b/html/index.php index 776694b..2c15cde 100644 --- a/html/index.php +++ b/html/index.php @@ -38,17 +38,20 @@ $stm -> close(); </tr> <?php +function print_colorized($value, $text) { + echo '<font color="'; + if ($value == 1) + echo '#008000'; + else + echo '#800000'; + echo '">' . $text . '</font>'; +} + foreach ($values as $value) { ?> <tr> - <td><?php echo $value['machine']; ?></td> - <td><?php - -if ($value['value'] != 1) - echo 'not '; -echo $value['state']; - -?></td> - <td><?php echo $row['last_update']; ?></td> + <td><?php print_colorized($value['value'], $value['machine']); ?></td> + <td><?php print_colorized($value['value'], ($value['value'] == 1 ? '' : 'not ') . $value['state']); ?></td> + <td><?php print_colorized($value['value'], $row['last_update']); ?></td> </tr> <?php } |