New function to format small and short dates

This commit is contained in:
Manuel Cillero 2017-09-17 08:14:59 +02:00
parent e2d79c1bb4
commit ce5f89b38f
18 changed files with 119 additions and 118 deletions

View file

@ -7,15 +7,13 @@
function theme_stormexpense_list($header, $expenses, $totals) {
$rows = array();
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
'<span class="expense-title">' . l($expense->title, 'node/'. $expense->nid) . theme('mark', node_mark($expense->nid, $expense->changed)) . '</span><br />' .
l($expense->organization_title, 'node/'. $expense->organization_nid) .
(!empty($expense->project_title) ? ' » ' . l($expense->project_title, 'node/'. $expense->project_nid) : '' ) .
(!empty($expense->task_title) ? '<br />' . l($expense->task_title, 'node/'. $expense->task_nid) . ' (' . t('task') . ')' : '' ) .
(!empty($expense->ticket_title) ? '<br />' . l($expense->ticket_title, 'node/'. $expense->ticket_nid) . ' (' . t('ticket') . ')' : '' ),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
array(
'data' => storm_icon_edit_node($expense, $_GET) .'&nbsp;'. storm_icon_delete_node($expense, $_GET),
@ -138,14 +136,14 @@ function theme_stormexpense_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 6,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 7,
);
}
@ -159,7 +157,7 @@ function theme_stormexpense_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group2']['expensedate'] = array(
'#prefix' => '<div class="expensedate">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date'), format_date($node->expensedate, 'custom', 'Y-m-d')),
'#value' => theme('storm_view_item', t('Date'), _format_short_date($node->expensedate)),
'#weight' => 1,
);
@ -250,13 +248,11 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
$expenses_total = 0;
$rows = array();
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->organization_title),
check_plain($expense->project_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;
@ -272,12 +268,10 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
t('Total', array(), $language));
$expenses_total = 0;
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->project_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;
@ -295,13 +289,11 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
t('Total', array(), $language));
$total_duration = 0;
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->project_title),
check_plain($expense->task_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;
@ -320,12 +312,10 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
t('Total', array(), $language));
$total_duration = 0;
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->task_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;