add chart
[disclosr.git] / documents / template.inc.php
blob:a/documents/template.inc.php -> blob:b/documents/template.inc.php
--- a/documents/template.inc.php
+++ b/documents/template.inc.php
@@ -21,7 +21,7 @@
 
   <!-- Mobile viewport optimized: h5bp.com/viewport -->
   <meta name="viewport" content="width=device-width">
-
+<link rel="alternate" type="application/rss+xml" title="Latest Disclosure Log Entries" href="rss.xml.php" />
   <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
 <meta name="google-site-verification" content="jkknX5g2FCpQvrW030b1Nq2hyoa6mb3EDiA7kCoHNj8" />
 
@@ -89,7 +89,7 @@
       <hr>
 
       <footer>
-        <p>&copy; Company 2012</p>
+        <p>Not affiliated with or endorsed by any government agency.</p>
       </footer>
       <script type="text/javascript">
 
@@ -128,23 +128,40 @@
 </html>
 <?php
 }
-
+function truncate($string, $length, $stopanywhere=false) {
+    //truncates a string to a certain char length, stopping on a word if not specified otherwise.
+    if (strlen($string) > $length) {
+        //limit hit!
+        $string = substr($string,0,($length -3));
+        if ($stopanywhere) {
+            //stop anywhere
+            $string .= '...';
+        } else{
+            //stop on a word.
+            $string = substr($string,0,strrpos($string,' ')).'...';
+        }
+    }
+    return $string;
+}
 function displayLogEntry($row, $idtoname) {
-    echo "<div><h2>".$row->value->date.": ".$row->value->title." (".$idtoname[$row->value->agencyID].")</h2> <p>".str_replace("\n","<br>",$row->value->description);
+    $result = "";
+    $result .= "<div><h2>".$row->value->date.": ".truncate($row->value->title, 80)." (".$idtoname[$row->value->agencyID].")</h2>";
+    echo "<p> Title".$row->value->title."<br/>".str_replace("\n","<br>",$row->value->description);
 if (isset($row->value->notes)) {
-echo " <br>Note: ".$row->value->notes;
+$result .= " <br>Note: ".$row->value->notes;
 }
-echo "</p>";
+$result .= "</p>";
 
 if (isset($row->value->links)){
-echo "<h3>Links/Documents</h3><ul>";
+$result .= "<h3>Links/Documents</h3><ul>";
 foreach ($row->value->links as $link) {
-    echo "<li><a href='$link'>".$link."</a></li>";
+    $result .= "<li><a href='$link'>".$link."</a></li>";
 }
 
-        echo "</ul>";
+        $result .= "</ul>";
 }
-        echo "<small><A href='".$row->value->url."'>View original source...</a> ID: ".$row->value->docID."</small>";
-echo"</div>";
+        $result .= "<small><A href='".$row->value->url."'>View original source...</a> ID: ".strip_tags($row->value->docID)."</small>";
+$result .= "</div>";
+return $result;
 }