X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/02c51774c63fea1166adc8229c925fb48b9b4041..c6e155714d4facf6297b5159057c1483a59609c8:/wblist.php
diff --git a/wblist.php b/wblist.php
index a646794..1f42f94 100644
--- a/wblist.php
+++ b/wblist.php
@@ -3,6 +3,35 @@
require_once 'config.php';
require_once $CFG->root . 'lib/utils.inc.php';
+ function createHeader($data) {
+ $out = '
Id | ';
+ foreach ($data as $head => $value) {
+ $out .= "$head | ";
+ }
+
+ return $out;
+ }
+
+ function parseResponse($raw) {
+ if (count($raw) < 1) {
+ return '';
+ }
+ $headers = createHeader($raw[0]);
+ $r = "$headers
";
+ $i = 1;
+ foreach ($raw as $obj) {
+ $r .= "$i | ";
+ foreach ($obj as $value) {
+ $r .= "$value | ";
+ }
+ $r .= '
';
+ $i++;
+ }
+ $r .= '
';
+
+ return $r;
+ }
+
$util = new Utils;
if ($util->isLoggedIn()) {
@@ -16,7 +45,7 @@
if ($subfunction == 'all') {
$list = $util->makeRestCall('/show');
if ($list) {
- $out = var_export($list, true);
+ $out = parseResponse($list);
} else {
$out = 'Connection to REST service failed
';
}