Port to sette library
[disclosr.git] / getAgency.php
blob:a/getAgency.php -> blob:b/getAgency.php
--- a/getAgency.php
+++ b/getAgency.php
@@ -2,17 +2,18 @@
 
 include_once('common.inc.php');
 include_header();
-
-$sag->setDatabase("disclosr-agencies", true);
+$db = $server->get_db('disclosr-agencies');
 //get an agency record as json/html, search by name/abn/id
 // by name = startkey="Ham"&endkey="Ham\ufff0"
 // edit?
-$rows = $sag->get('/_design/app/_view/byABN?include_docs=true')->body->rows; // &endkey='.$searchVar
+$rows = $db->get_view("app","byABN")->rows;
+//print_r($rows);
 foreach ($rows as $row) {
+
     echo "<table>";
-    echo '<tr> <td colspan="2"><h3>' . $row->doc->agencyName . "</h3></td></tr>";
+    echo '<tr> <td colspan="2"><h3>' . $row->value->name . "</h3></td></tr>";
     echo "<tr><th>Field Name</th><th>Field Value</th></tr>";
-foreach ($row->doc as $key => $value) {
+foreach ($row->value as $key => $value) {
             if (is_a($value, 'stdClass')) {
             		echo "<tr><td>$key</td><td>".var_dump($value,true)."</td></tr>";
             } else echo "<tr><td>$key</td><td>$value</td></tr>";