You are here

function theme_calendar_date_box in Calendar 5

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

Format an date's day box in a calendar

Parameters

day: The day to display.

1 theme call to theme_calendar_date_box()
calendar_get_calendar in ./calendar_api.inc
Adapted from event_get_calendar() function in the event module Reworked to remove dependency on event module

File

./calendar.theme, line 556

Code

function theme_calendar_date_box($year, $month, $day, $view, $mini = FALSE, $selected = FALSE, $url, $append = '') {
  $url = $url ? $url . '/' . $year . '/' . $month . '/' . $day : 'calendar/' . $year . '/' . $month . '/' . $day;
  if ($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>';
    }
  }
  switch ($view) {
    case 'table':
      $output = '<div class="day">' . l(t('!month / !day', array(
        '!month' => $month,
        '!day' => $day,
      )), $url, NULL, $append) . '</div>' . "\n";
      break;
    case 'list':
      $output = '<div class="day">' . l(date_format_date('l, F j, Y', date_mktime(array(
        'mon' => $month,
        'mday' => $day,
        'year' => $year,
      ))), $url, NULL, $append) . '</div>' . "\n";
      break;
    case 'day':
      break;
    default:
      $output = '<div class="day">' . l($day, $url, NULL, $append) . '</div>' . "\n";
      break;
  }
  return $output;
}