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

@ -56,8 +56,8 @@ function theme_stormtask_tasks($form) {
function theme_stormtask_list($header, $tasks) {
$rows = array();
foreach ($tasks as $task) {
$datebegin = !empty($task->datebegin) ? format_date($task->datebegin, 'small') : '';
$dateend = !empty($task->dateend) ? format_date($task->dateend, 'small') : '';
$datebegin = !empty($task->datebegin) ? _format_short_date($task->datebegin) . '<br />' : '&nbsp;';
$dateend = !empty($task->dateend) ? _format_short_date($task->dateend) : '';
$rows[] = array(
// Add classes to each row in table.
// Allows customisation of row via css depending on the task's attributes (category, status, priority)
@ -71,9 +71,9 @@ function theme_stormtask_list($header, $tasks) {
'<span class="task-title status_' . str_replace(' ', '_', $task->taskstatus) . '">' . l($task->title, 'node/'. $task->nid) . theme('mark', node_mark($task->nid, $task->changed)) . '</span><br />' .
l($task->organization_title, 'node/'. $task->organization_nid) .' » '.
l($task->project_title, 'node/'. $task->project_nid),
substr($datebegin, 0, strpos($datebegin, ' ')) . '<br />' . substr($dateend, 0, strpos($dateend, ' ')),
$datebegin . $dateend,
$task->clip ? storm_icon('attached', t('Has attached files')) : '&nbsp;',
format_date($task->changed, 'small'),
_format_small_date($task->changed),
storm_icon('priority_'. $task->taskpriority, storm_attribute_value('Task priority', $task->taskpriority)),
array(
'data' => $task->comment_count,
@ -154,14 +154,14 @@ function theme_stormtask_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' => 12,
);
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' => 13,
);
}
@ -202,14 +202,14 @@ function theme_stormtask_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group3']['datebegin'] = array(
'#prefix' => '<div class="datebegin">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : substr(format_date($node->datebegin, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : _format_short_date($node->datebegin)),
'#weight' => 2,
);
$node->content['group3']['dateend'] = array(
'#prefix' => '<div class="dateend">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : substr(format_date($node->dateend, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : _format_short_date($node->dateend)),
'#weight' => 3,
);