You are here

function theme_calendar_time_row_heading in Calendar 7

Same name in this branch
  1. 7 theme/theme.inc \theme_calendar_time_row_heading()
  2. 7 calendar_multiday/theme/theme.inc \theme_calendar_time_row_heading()
Same name and namespace in other branches
  1. 6.2 theme/theme.inc \theme_calendar_time_row_heading()
  2. 6.2 calendar_multiday/theme/theme.inc \theme_calendar_time_row_heading()
  3. 7.3 theme/theme.inc \theme_calendar_time_row_heading()
  4. 7.2 theme/theme.inc \theme_calendar_time_row_heading()
  5. 7.2 calendar_multiday/theme/theme.inc \theme_calendar_time_row_heading()

Format the time row headings in the week and day view.

4 theme calls to theme_calendar_time_row_heading()
template_preprocess_calendar_day in theme/theme.inc
Display a day view.
template_preprocess_calendar_day in calendar_multiday/theme/theme.inc
Display a day view.
template_preprocess_calendar_week in theme/theme.inc
Display a week view.
template_preprocess_calendar_week in calendar_multiday/theme/theme.inc
Display a week view.

File

theme/theme.inc, line 720
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');
    $format_hour = str_replace(array(
      'a',
      'A',
    ), '', date_limit_format($format, array(
      'hour',
      'minute',
    )));
    $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,
  );
}