Added a formatting method to print the age of a datetime object, and modified the lease view to use it. I anticipate customizing the function to be more fuzzy and less precise.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@89 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -64,4 +64,9 @@ class FormatHelper extends AppHelper {
|
|||||||
return $comment;
|
return $comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function age($datetime) {
|
||||||
|
return $time->timeAgoInWords($datetime,
|
||||||
|
array('end' => '+99 years'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,40 +20,38 @@ $unit = $lease['Unit'];
|
|||||||
if (isset($lease['Lease']))
|
if (isset($lease['Lease']))
|
||||||
$lease = $lease['Lease'];
|
$lease = $lease['Lease'];
|
||||||
|
|
||||||
$rows = array(array('ID', $lease['id']),
|
$rows = array(array('ID', $lease['id']),
|
||||||
array('Number', $lease['number']),
|
array('Number', $lease['number']),
|
||||||
array('Lease Type', $lease_type['name']),
|
array('Lease Type', $lease_type['name']),
|
||||||
array('Unit', $html->link($unit['id'],
|
array('Unit', $html->link($unit['id'],
|
||||||
array('controller' => 'units',
|
array('controller' => 'units',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$unit['id']))),
|
$unit['id']))),
|
||||||
array('Customer', $html->link($customer['name'],
|
array('Customer', $html->link($customer['name'],
|
||||||
array('controller' => 'customers',
|
array('controller' => 'customers',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$customer['id']))),
|
$customer['id']))),
|
||||||
array('Lease_Date', FormatHelper::date($lease['lease_date'])),
|
array('Lease_Date', FormatHelper::date($lease['lease_date'])),
|
||||||
array('Move-in Planned', FormatHelper::date($lease['movein_planned_date'])),
|
array('Move-in Planned', FormatHelper::date($lease['movein_planned_date'])),
|
||||||
array('Move-in', (FormatHelper::date($lease['movein_date'])
|
array('Move-in', (FormatHelper::date($lease['movein_date'])
|
||||||
. ' ('
|
. ' ('
|
||||||
. $time->timeAgoInWords($lease['movein_date'],
|
. FormatHelper::age($lease['movein_date'])
|
||||||
array('end' => '+99 years'))
|
. ')')),
|
||||||
. ')')),
|
array('Move-out', (FormatHelper::date($lease['moveout_date'])
|
||||||
array('Move-out', (FormatHelper::date($lease['moveout_date'])
|
. ' ('
|
||||||
. ' ('
|
. FormatHelper::age($lease['moveout_date'])
|
||||||
. $time->timeAgoInWords($lease['moveout_date'],
|
. ')')),
|
||||||
array('end' => '+99 years'))
|
|
||||||
. ')')),
|
|
||||||
array('Move-out Planned', FormatHelper::date($lease['moveout_planned_date'])),
|
array('Move-out Planned', FormatHelper::date($lease['moveout_planned_date'])),
|
||||||
array('Notice Given', FormatHelper::date($lease['notice_given_date'])),
|
array('Notice Given', FormatHelper::date($lease['notice_given_date'])),
|
||||||
array('Notice Received', FormatHelper::date($lease['notice_received_date'])),
|
array('Notice Received', FormatHelper::date($lease['notice_received_date'])),
|
||||||
array('Closed', FormatHelper::date($lease['close_date'])),
|
array('Closed', FormatHelper::date($lease['close_date'])),
|
||||||
array('Account', $html->link($account['name'],
|
array('Account', $html->link($account['name'],
|
||||||
array('controller' => 'accounts',
|
array('controller' => 'accounts',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$account['id']))),
|
$account['id']))),
|
||||||
array('Deposit', (FormatHelper::currency($lease['deposit']))),
|
array('Deposit', FormatHelper::currency($lease['deposit'])),
|
||||||
array('Rent', (FormatHelper::currency($lease['amount']))),
|
array('Rent', FormatHelper::currency($lease['amount'])),
|
||||||
array('Comment', $lease['comment']));
|
array('Comment', $lease['comment']));
|
||||||
|
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
|
|||||||
Reference in New Issue
Block a user