You are here

function template_preprocess_calendar_datebox in Calendar 7.3

Same name and namespace in other branches
  1. 8 calendar.theme.inc \template_preprocess_calendar_datebox()
  2. 6.2 theme/theme.inc \template_preprocess_calendar_datebox()
  3. 6.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_datebox()
  4. 7 theme/theme.inc \template_preprocess_calendar_datebox()
  5. 7 calendar_multiday/theme/theme.inc \template_preprocess_calendar_datebox()
  6. 7.2 theme/theme.inc \template_preprocess_calendar_datebox()
  7. 7.2 calendar_multiday/theme/theme.inc \template_preprocess_calendar_datebox()

Create the calendar date box.

File

theme/theme.inc, line 551
Theme functions for the Calendar module.

Code

function template_preprocess_calendar_datebox(&$vars) {
  $date = $vars['date'];
  $view = $vars['view'];
  $vars['day'] = intval(substr($date, 8, 2));
  $force_view_url = !empty($view->date_info->block) ? TRUE : FALSE;
  $month_path = calendar_granularity_path($view, 'month');
  $year_path = calendar_granularity_path($view, 'year');
  $day_path = calendar_granularity_path($view, 'day');
  $vars['url'] = str_replace(array(
    $month_path,
    $year_path,
  ), $day_path, date_pager_url($view, NULL, $date, $force_view_url));
  $vars['link'] = !empty($day_path) ? l($vars['day'], $vars['url']) : $vars['day'];
  $vars['granularity'] = $view->date_info->granularity;
  $vars['mini'] = !empty($view->date_info->mini);
  if ($vars['mini']) {
    if (!empty($vars['selected'])) {
      $vars['class'] = 'mini-day-on';
    }
    else {
      $vars['class'] = 'mini-day-off';
    }
  }
  else {
    $vars['class'] = 'day';
  }
}