]> git.datanom.net - qtadmin.git/blobdiff - wblist.php
First upload of wblist page
[qtadmin.git] / wblist.php
index 115fff0bbd73bdc670ae1adf833f45bb0b0f7d8c..0486db7c5b50fd850c4d3124bce82c2f987fd7d5 100644 (file)
@@ -3,6 +3,34 @@
     require_once 'config.php';
     require_once $CFG->root . 'lib/utils.inc.php';
 
+       function createHeader($data) {
+               $out = '<th>Id</th>';
+               foreach ($data as $head => $value) {
+                       $out .= "<th>$head</th>";
+               }
+               
+               return $out;
+       }
+       
+       function parseResponse($raw) {
+               if (count($raw) < 1) {
+                       return '';
+               }
+               $headers = createHeader($raw[0]);
+               $r = "<table><tr>$headers</tr>";
+               $i = 1;
+               foreach ($raw as $obj) {
+                       $r .= "<tr><td>$i</td>";
+                       foreach ($obj as $value) {
+                               $r .= "<td>$value</td>";
+                       }
+                       $r .= '</tr>';
+               }
+               $r .= '</table>';
+               
+               return $r;
+       }
+
     $util = new Utils;
 
     if ($util->isLoggedIn()) {
@@ -16,7 +44,7 @@
                if ($subfunction == 'all') {
                        $list = $util->makeRestCall('/show');
                        if ($list) {
-                               $out = '<pre>'.var_export($list, true).'</pre>';
+                               $out = parseResponse($list);
                        } else {
                                $out = '<p>Connection to REST service failed</p>';
                        }
This page took 0.056362 seconds and 5 git commands to generate.