function theme_calendar_time_row_heading in Calendar 7.3
Same name and namespace in other branches
- 6.2 theme/theme.inc \theme_calendar_time_row_heading()
- 6.2 calendar_multiday/theme/theme.inc \theme_calendar_time_row_heading()
- 7 theme/theme.inc \theme_calendar_time_row_heading()
- 7 calendar_multiday/theme/theme.inc \theme_calendar_time_row_heading()
- 7.2 theme/theme.inc \theme_calendar_time_row_heading()
- 7.2 calendar_multiday/theme/theme.inc \theme_calendar_time_row_heading()
Format the time row headings in the week and day view.
2 theme calls to theme_calendar_time_row_heading()
- template_preprocess_calendar_day in theme/
theme.inc - Display a day view.
- template_preprocess_calendar_week in theme/
theme.inc - Display a week view.
File
- theme/
theme.inc, line 611 - Theme functions for the Calendar module.
Code
function theme_calendar_time_row_heading($vars) {
$start_time = $vars['start_time'];
$next_start_time = $vars['next_start_time'];
$curday_date = $vars['curday_date'];
static $format_hour, $format_ampm;
if (empty($format_hour)) {
$format = variable_get('date_format_short', 'm/d/Y - H:i');
if (substr($start_time, -5) == '00:00' && substr($next_start_time, -5) == '00:00') {
$limit = array(
'hour',
);
}
else {
$limit = array(
'hour',
'minute',
);
}
$format_hour = str_replace(array(
'a',
'A',
), '', date_limit_format($format, $limit));
$format_ampm = strstr($format, 'a') ? 'a' : (strstr($format, 'A') ? 'A' : '');
}
if ($start_time == '00:00:00' && $next_start_time == '23:59:59') {
$hour = t('All times');
}
elseif ($start_time == '00:00:00') {
$date = date_create($curday_date . ' ' . $next_start_time);
$hour = t('Before @time', array(
'@time' => date_format($date, $format_hour),
));
}
else {
$date = date_create($curday_date . ' ' . $start_time);
$hour = date_format($date, $format_hour);
}
if (!empty($date)) {
$ampm = date_format($date, $format_ampm);
}
else {
$ampm = '';
}
return array(
'hour' => $hour,
'ampm' => $ampm,
);
}