function theme_calendar_date_combo in Calendar 5.2
Format a from/to date in the calendar view.
Alter the display as appropriate for the type of view. We can fine-tune the display to show only the time in the calendar month and week cells but the whole date in other places.
3 theme calls to theme_calendar_date_combo()
- theme_calendar_ical_field in ./
calendar_ical.module - Views field theme for an ical field.
- theme_calendar_ical_node in ./
calendar_ical.module - Theme for an entire ical node.
- theme_calendar_views_field in ./
calendar.theme - Wrapper around views_theme_field() to properly format the dates in the view. Use the usual views field formatting for all other fields.
File
- ./
calendar.theme, line 783
Code
function theme_calendar_date_combo($field, $node, $label, $view) {
switch ($view->calendar_display) {
// Some of the calendar views need a smaller date format.
case 'calendar':
switch ($view->calendar_type) {
case 'year':
// We don't display individual dates in the calendar year view.
return;
case 'week':
case 'month':
// No room for a label or the full date in these small
// displays, show only the time.
$format = $node->format_time;
$label = '';
break;
case 'day':
$format = $node->format;
break;
}
break;
// For non-calendar views, like lists and tables, show the entire date.
default:
$format = $node->format;
break;
}
$date1 = theme('date_all_day', $field, 'date1', $node->calendar_start_date, $node->calendar_end_date, $format, $node, $view);
$date2 = theme('date_all_day', $field, 'date2', $node->calendar_start_date, $node->calendar_end_date, $format, $node, $view);
// No date values, display nothing.
if (empty($date1) && empty($date2)) {
$output = '';
}
elseif ($date1 == $date2 || empty($date2)) {
$output = '<span class="date-display-single">' . $date1 . '</span>';
}
elseif (date_format($node->calendar_start_date, $node->format_time) != date_format($node->calendar_end_date, $node->format_time) && $format != $node->format_time) {
$date_format = date_limit_format($format, array(
'year',
'month',
'day',
));
$output = '<span class="date-display-single">' . date_format($node->calendar_start_date, $date_format) . '</span> ' . '<span class="date-display-start">' . date_format($node->calendar_start_date, $node->format_time) . '</span>' . '<span class="date-display-separator"> - </span>' . '<span class="date-display-end">' . date_format($node->calendar_end_date, $node->format_time) . '</span>';
}
else {
$output = '<span class="date-display-start">' . $date1 . '</span>' . '<span class="date-display-separator"> - </span>' . '<span class="date-display-end">' . $date2 . '</span>';
}
return $output;
}