class PlcTable replaces functions plc_table_*
[plewww.git] / planetlab / events / index.php
index 625ae3c..f5c66c0 100644 (file)
@@ -153,19 +153,7 @@ function parse_dates () {
   return array($from_date,$from_time,$until_date,$until_time);
 }
 
-function my_is_int ($x) {
-    return (is_numeric($x) ? intval($x) == $x : false);
-}
-
 //////////////////////////////////////////////////////////// layout
-function truncate ($text,$numb,$etc = "...") {
-  if (strlen($text) > $numb) {
-    $text = substr($text, 0, $numb);
-    $text = $text.$etc;
-  }
-  return $text;
-}
-
 // outline node ids and person ids with a link
 function e_node ($node_id) {
   if (! $node_id) return "";
@@ -369,11 +357,9 @@ if ( ! plc_is_admin()) {
                 "D"=>"none",
                 );
 
-  $table_options=array('notes'=>array("The R column shows the call result value, a.k.a. fault_code",
-                                     "Click the button in the D(etails) column to get more details",
-                                     ),
-                      'max_pages'=>20);
-  plc_table_start("events",$headers,"0r",$table_options);
+  $table = new PlcTable ("events",$headers,"0r");
+  $table->set_options (array ('max_pages'=>20));
+  $table->start ();
   foreach ($events as $event) {
 
     // the call button
@@ -390,19 +376,22 @@ if ( ! plc_is_admin()) {
     //    $message=sprintf('<span title="%s">%s</span>',$message,$message);
 
     $message=truncate($event['message'],40);
-    plc_table_row_start($event['event_id']);
-    plc_table_cell(e_event($event['event_id']));
-    plc_table_cell(date('M/d/Y H:i', $event['time']));
-    plc_table_cell($event['call_name']);
-    plc_table_cell($message);
-    plc_table_cell(e_subjects($event));
-    plc_table_cell(e_issuer($event));
-    plc_table_cell(e_auth($event));
-    plc_table_cell(e_fault($event));
-    plc_table_cell($details);
-    plc_table_row_end();
+    $table->row_start();
+    $table->cell(e_event($event['event_id']));
+    $table->cell(date('M/d/Y H:i', $event['time']));
+    $table->cell($event['call_name']);
+    $table->cell($message);
+    $table->cell(e_subjects($event));
+    $table->cell(e_issuer($event));
+    $table->cell(e_auth($event));
+    $table->cell(e_fault($event));
+    $table->cell($details);
+    $table->row_end();
   }
-  plc_table_end("events");
+  $table->set_options(array('notes'=>array("The R column shows the call result value, a.k.a. fault_code",
+                                          "Click the button in the D(etails) column to get more details")));
+  $table->end();
+  
  }