use bootstrap
[disclosr.git] / getAgency.php
blob:a/getAgency.php -> blob:b/getAgency.php
--- a/getAgency.php
+++ b/getAgency.php
@@ -4,8 +4,9 @@
 
 function displayValue($key, $value, $mode) {
     global $db, $schemas;
+    $ignoreKeys = Array("metadata" ,"metaTags", "statistics","rtkURLs","rtkDescriptions");
     if ($mode == "view") {
-        if (strpos($key, "_") === 0 || $key == "metadata" || $key == "metaTags" || $key == "statistics")
+        if (strpos($key, "_") === 0 || in_array($key,$ignoreKeys))
             return;
         echo "<tr>";
 
@@ -159,8 +160,31 @@
     }
 
     if ($mode == "view") {
-        echo '<div itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization" about="#' . $row['_id'] . '"><table width="100%">';
-        echo '<tr> <td colspan="2"><h3 itemprop="name">' . $row['name'] . "</h3></td></tr>";
+            echo ' <div class="container-fluid">
+      <div class="row-fluid">
+        <div class="span3">
+          <div class="well sidebar-nav">
+            <ul class="nav nav-list">
+              <li class="nav-header">Statistics</li>';
+            
+             if (isset($row['statistics']['employees'])) {
+                echo '<div><i class="icon-user" style="float:left"></i><p style="margin-left:16px;">';
+                $keys = array_keys($row['statistics']['employees']);
+                $lastkey = $keys[count($keys)-1];
+                echo $row['statistics']['employees'][$lastkey]['value'].' employees <small>('.$lastkey.')</small>';
+                echo '</div>';
+            }
+    echo '  </ul>
+          </div><!--/.well -->
+        </div><!--/span-->
+        <div class="span9">';
+        echo '<div itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization" about="#' . $row['_id'] . '">';
+        echo '<div class="hero-unit">
+            <h1 itemprop="name">' . $row['name'] . '</h1>';
+            if (isset($row['description'])) {
+                echo '<p>'.$row['description'].'</p>';
+            }
+        echo '</div><table width="100%">';
         echo "<tr><th>Field Name</th><th>Field Value</th></tr>";
     }
     if ($mode == "edit") {
@@ -192,6 +216,10 @@
     }
     if ($mode == "view") {
         echo "</table></div>";
+              echo '         </div><!--/span-->
+          </div><!--/row-->
+        </div><!--/span-->
+      </div><!--/row-->';
     }
     if ($mode == "edit") {
         echo '<input id="submitbutton" type="submit"/></form>';
@@ -199,24 +227,45 @@
 } else {
 // show all list
     include_header('Agencies');
+    echo ' <div class="container-fluid">
+      <div class="row-fluid">
+        <div class="span3">
+          <div class="well sidebar-nav">
+            <ul class="nav nav-list">
+              <li class="nav-header">Sidebar</li>';
+    echo '  </ul>
+          </div><!--/.well -->
+        </div><!--/span-->
+        <div class="span9">
+          <div class="hero-unit">
+            <h1>Hello, world!</h1>
+            <p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
+            <p><a class="btn btn-primary btn-large">Learn more &raquo;</a></p>
+          </div>
+          <div class="row-fluid">
+            <div class="span4">';
     try {
         $rows = $db->get_view("app", "byCanonicalName")->rows;
         //print_r($rows);
         $rowCount = count($rows);
-        echo '<ul>';
         foreach ($rows as $i => $row) {
-            if ($i % ($rowCount/3) == 0 && $i != 0 && $i != $rowCount -2 ) echo "<hr/>";
+            if ($i % ($rowCount/3) == 0 && $i != 0 && $i != $rowCount -2 ) echo '</div><div class="span4">';
             //   print_r($row);
-            echo '<li itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization foaf:Organization" about="getAgency.php?id=' . $row->value->_id . '">
+            echo '<span itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization foaf:Organization" about="getAgency.php?id=' . $row->value->_id . '">
 <a href="getAgency.php?id=' . $row->value->_id . '" rel="schema:url foaf:page" property="schema:name foaf:name" itemprop="url"><span itemprop="name">' .
             (isset($row->value->name) ? $row->value->name : "ERROR NAME MISSING") 
-            . '</span></a></li>';
-        }
-        echo "</ul>";
+            . '</span></a></span><br><br>';
+        }
+      
     } catch (SetteeRestClientException $e) {
         setteErrorHandler($e);
     }
+      echo '         </div><!--/span-->
+          </div><!--/row-->
+        </div><!--/span-->
+      </div><!--/row-->';
 }
+
 include_footer();
 ?>