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:
@@ -61,7 +61,7 @@ class FormatHelper extends AppHelper {
|
||||
$date_html = '<span class="fmt-date '.$class.'">'.$date_html.'</span>';
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
@@ -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 = '<span class="fmt-age '.$class.'">'.__($age, true).'</span>';
|
||||
|
||||
Reference in New Issue
Block a user