You are here

function theme_calendar_date_box in Calendar 5.2

Same name and namespace in other branches
  1. 5 calendar.theme \theme_calendar_date_box()

Format an date's day box in a calendar

Parameters

date: The day to display in YYYY-MM-DD format.

view: The view being displayed.

items: The list of all items in the current view.

params: An array of paramters.

selected: Whether the current date has nodes.

Return value

A themed day.

1 theme call to theme_calendar_date_box()
calendar_build_day in ./calendar.inc
Build the contents of a single day for the $rows results.

File

./calendar.theme, line 699

Code

function theme_calendar_date_box($date, $view, $items, $params, $selected = FALSE) {
  $parts = explode('-', substr($date, 0, 10));
  $year = $parts[0];
  $month = intval($parts[1]);
  $day = intval($parts[2]);
  $querystring = calendar_querystring($view);
  if ($view->build_type == 'embed') {
    $url = $view->page_url;
    $block_identifier = isset($view->block_identifier) ? $view->block_identifier : 'mini';
    $append = (!empty($querystring) ? $querystring . '&' : '') . $block_identifier . '=' . $view->real_url . '/' . date_pad($year, 4) . '/' . date_pad($month) . '/' . date_pad($day);
  }
  else {
    $url = $view->real_url . '/' . date_pad($year, 4) . '/' . date_pad($month) . '/' . date_pad($day);
    $append = $params['append'];
  }
  if ($view->mini) {
    if ($selected) {
      return '<div class="mini-day-on">' . l($day, $url, NULL, $append) . '</div>';
    }
    else {
      return '<div class="mini-day-off">' . l($day, $url, NULL, $append) . '</div>';
    }
  }
  if ($view->calendar_type != 'day') {
    return '<div class="day">' . l($day, $url, NULL, $append) . '</div>' . "\n";
  }
  $output = '<div class="day">' . l($day, $url, NULL, $append) . '</div>' . "\n";
  return $output;
}