Fixed bug in the age() function that was preventing the ' ago' text. Of course, there are places it may not be desired, so I added a param to control the suffix.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@612 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-18 01:33:38 +00:00
parent 3a86a0f689
commit 480170b944

View File

@@ -61,7 +61,7 @@ class FormatHelper extends AppHelper {
$date_html = '<span class="fmt-date '.$class.'">'.$date_html.'</span>'; $date_html = '<span class="fmt-date '.$class.'">'.$date_html.'</span>';
if ($age) { if ($age) {
$date_html .= ' (' . self::age($date, $class, $time ? 0 : 60*60*24) . ')'; $date_html .= ' (' . self::age($date, $class, true, $time ? 0 : 60*60*24) . ')';
$date_html = '<span class="fmt-dateage '.$class.'">'.$date_html.'</span>'; $date_html = '<span class="fmt-dateage '.$class.'">'.$date_html.'</span>';
} }
@@ -100,7 +100,7 @@ class FormatHelper extends AppHelper {
return $comment; return $comment;
} }
function age($datetime, $class, $min_span = 0) { function age($datetime, $class, $suffix = false, $min_span = 0) {
if (!isset($datetime)) if (!isset($datetime))
return null; return null;
@@ -207,9 +207,12 @@ class FormatHelper extends AppHelper {
$age .= ' ' . self::_n($approx, $unit); $age .= ' ' . self::_n($approx, $unit);
if ($backwards) if ($suffix) {
$age .= ' ago'; if ($backwards)
$age .= ' from now';
else
$age .= ' ago';
}
} }
$age = '<span class="fmt-age '.$class.'">'.__($age, true).'</span>'; $age = '<span class="fmt-age '.$class.'">'.__($age, true).'</span>';