Merge branch 'master' of ssh://apples.lambdacomplex.org/git/disclosr
[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
@@ -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,10 +128,25 @@
 </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) {
     $result = "";
-    $result .= "<div><h2>".$row->value->date.": ".$row->value->title." (".$idtoname[$row->value->agencyID].")</h2> <p>".str_replace("\n","<br>",$row->value->description);
+    $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)) {
 $result .= " <br>Note: ".$row->value->notes;
 }