Moritz Schmidt 10 vuotta sitten
vanhempi
commit
e9fd0b4e88
2 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 10 0
      includes/functions.inc.php
  2. 1 1
      templates/calllist.php

+ 10 - 0
includes/functions.inc.php

@@ -122,4 +122,14 @@ function getEditableLink($elementId, $type, $pk, $title, $value, $class = '') {
 	return $link;
 }
 
+function getExcerptFromString($string, $count = 50) {
+	if(strlen($string) > $count) {
+		$string = substr($string, 0, $count);
+  		$string = substr($string, 0, strrpos($string, " "));
+		$string = $string . " ...";
+	}
+
+	return $string;
+}
+
 ?>

+ 1 - 1
templates/calllist.php

@@ -13,7 +13,7 @@ foreach($this->_['calls'] as $call) {
     echo '<tr>';
     echo '<td>' . $call->getCallDate() . '</td>';
     echo '<td>' . $call->getCallerTelNr() . '</td>';
-    echo '<td>' . $call->getNotes() . '</td>';
+    echo '<td>' . getExcerptFromString($call->getNotes()) . '</td>';
     echo '<td><i class="fa fa-clock-o"></i></td>';
     echo '<td><a class="edit-call fancybox.ajax" href="ajax.php?action=editCall&callID=' . $call->getID() . '"><i class="fa fa-wrench"></i></a></td>';
     echo '</tr>';