You are here

function theme_calendar_nav_title in Calendar 5

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

Theme the navigation bar title

Parameters

string $field_type - 'YEAR', 'MONTH', 'DAY', 'WEEK':

integer $view - the current view object:

Return value

string formatted title

1 theme call to theme_calendar_nav_title()
calendar_views_pre_view in ./calendar.module
Implementation of hook_views_pre_view()

File

./calendar.theme, line 244

Code

function theme_calendar_nav_title($field_type, $view) {
  calendar_load_date_api();
  switch ($field_type) {
    case 'YEAR':
      return $view->year;
    case 'MONTH':

      // Month navigation titles are used as links in blocks and in the year view.
      // For the timestamp, use the second day of the month because gm functions sometimes return the previous month
      $timestamp = date_array2unix(array(
        'year' => $view->year,
        'mon' => $view->month,
        'mday' => 2,
      ));
      if ($view->build_type == 'block' || $view->calendar_type == 'year') {
        return l(date_format_date('M Y', $timestamp), $view->real_url . '/' . $view->year . '/' . $view->month, array(), calendar_url_append($view));
      }
      else {
        return date_format_date('F Y', $timestamp);
      }
    case 'DAY':
      $timestamp = date_array2unix(array(
        'year' => $view->year,
        'mon' => $view->month,
        'mday' => $view->day,
        'hours' => 12,
      ));
      return date_format_date('l, F j Y', $timestamp);
    case 'WEEK':
      return t("Week of @date", array(
        '@date' => date_format_date('F j Y', calendar_week('start_timestamp', $view, $view->week)),
      ));
  }
}