Make common include for DB/template
[disclosr.git] / getAgency.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
 
include_once('common.inc.php');
include_header();
 
$sag->setDatabase("disclosr-agencies", true);
//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
foreach ($rows as $row) {
    echo "<table>";
    echo '<tr> <td colspan="2"><h3>' . $row->doc->agencyName . "</h3></td></tr>";
    echo "<tr><th>Field Name</th><th>Field Value</th></tr>";
foreach ($row->doc 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>";
        } // also show documents/URLs available
 
    echo "</table>";
}
 
include_footer();