Port to sette library
[disclosr.git] / getAgency.php
blob:a/getAgency.php -> blob:b/getAgency.php
<?php <?php
   
include_once('common.inc.php'); include_once('common.inc.php');
include_header(); include_header();
  $db = $server->get_db('disclosr-agencies');
$sag->setDatabase("disclosr-agencies", true);  
//get an agency record as json/html, search by name/abn/id //get an agency record as json/html, search by name/abn/id
// by name = startkey="Ham"&endkey="Ham\ufff0" // by name = startkey="Ham"&endkey="Ham\ufff0"
// edit? // 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) { foreach ($rows as $row) {
   
echo "<table>"; 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>"; 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')) { if (is_a($value, 'stdClass')) {
echo "<tr><td>$key</td><td>".var_dump($value,true)."</td></tr>"; echo "<tr><td>$key</td><td>".var_dump($value,true)."</td></tr>";
} else echo "<tr><td>$key</td><td>$value</td></tr>"; } else echo "<tr><td>$key</td><td>$value</td></tr>";
} // also show documents/URLs available } // also show documents/URLs available
   
echo "</table>"; echo "</table>";
} }
   
include_footer(); include_footer();