not sure really
authorpaulr <me@pjr.cc>
Thu, 20 Oct 2011 02:37:23 +0000 (13:37 +1100)
committerpaulr <me@pjr.cc>
Thu, 20 Oct 2011 02:37:23 +0000 (13:37 +1100)
libcbfwr/web.php

index 289fe19..7f76f11 100644 (file)
@@ -90,7 +90,7 @@ function CBFBuildHomePage($urls)
        $comms = new Comms();
        
        
-       CBFWAddMessage("1", "i am a message");
+       CBFWAddMessage(rand(1,6), "i am a message");
        echo "<pre>";
        print_r($comms->getConfig(0));
        echo "\n\n\n";
@@ -166,10 +166,33 @@ function CBFWMessageBuilder()
        if(count($msgs) > 0) {
                echo "<table>";
                foreach($msgs as $key => $val) {
-                       $datetime = $val["timestamp"];
+                       $datetime = strftime("%c", $val["timestamp"]);
                        $sev = $val["level"];
                        $message = $val["message"];
-                       echo "<tr><td>$datetime</td><td>$sev</td><td>$message</td></tr>";
+                       
+                       $sevcolour = "#ddffdd";
+                       switch($sev) {
+                               case "1":
+                                       $sevcolour = "#ffaaaa";
+                                       break;
+                               case "2":
+                                       $sevcolour = "#ffdddd";
+                                       break;
+                               case "3":
+                                       $sevcolour = "#ffffdd";
+                                       break;
+                               case "4":
+                                       $sevcolour = "#ddffdd";
+                                       break;
+                               case "5":
+                                       $sevcolour = "#aaffaa";
+                                       break;
+                               case "6":
+                                       $sevcolour = "#ccaaaa";
+                                       break;
+                       }
+                       
+                       echo "<tr bgcolor=\"$sevcolour\"><td><i>$datetime</i></td><td>$message ($sev)</td></tr>";
                        $show++;
                        if($show >= $maxshow) break;
                }