From e6d65a52129b693199189609d88c73f3da52277a Mon Sep 17 00:00:00 2001 From: abijah Date: Tue, 18 Aug 2009 01:33:38 +0000 Subject: [PATCH] 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@612 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/views/helpers/format.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/site/views/helpers/format.php b/site/views/helpers/format.php index daa16cb..e8735fd 100644 --- a/site/views/helpers/format.php +++ b/site/views/helpers/format.php @@ -61,7 +61,7 @@ class FormatHelper extends AppHelper { $date_html = ''.$date_html.''; 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 = ''.$date_html.''; } @@ -100,7 +100,7 @@ class FormatHelper extends AppHelper { return $comment; } - function age($datetime, $class, $min_span = 0) { + function age($datetime, $class, $suffix = false, $min_span = 0) { if (!isset($datetime)) return null; @@ -207,9 +207,12 @@ class FormatHelper extends AppHelper { $age .= ' ' . self::_n($approx, $unit); - if ($backwards) - $age .= ' ago'; - + if ($suffix) { + if ($backwards) + $age .= ' from now'; + else + $age .= ' ago'; + } } $age = ''.__($age, true).'';