You are here

function theme_calendar_show_nav in Calendar 5

Format the calendar navigation

2 theme calls to theme_calendar_show_nav()
calendar_views_pre_view in ./calendar.module
Implementation of hook_views_pre_view()
theme_calendar_view_calendar in ./calendar.theme
Calendar Views plugin theme, overrides default views theme to create a calendar view.

File

./calendar.theme, line 270

Code

function theme_calendar_show_nav($view, $mini = FALSE, $links = FALSE) {
  calendar_load_calendar_api();

  // add links to the top of the calendar to switch from one view to another
  if ($links) {
    $view->real_url = calendar_real_url($view, $view->args);
    $base_url = $view->real_url . '/' . $view->year;
    $month = $view->month && $view->month != CALENDAR_EMPTY_ARG ? $view->month : calendar_user_date('month');
    $day = $view->day && $view->day != CALENDAR_EMPTY_ARG ? $view->day : calendar_user_date('day');
    $week = $view->week && $view->week != CALENDAR_EMPTY_ARG ? $view->week : calendar_user_date('week');
    $append = calendar_url_append($view);
    if ($_GET['view']) {
      $append .= '&view=' . $_GET['view'];
    }
    $calendar_links[] = array(
      'title' => t('Year'),
      'href' => $view->real_url . '/' . $view->year,
      'query' => $append,
    );
    $calendar_links[] = array(
      'title' => t('Month'),
      'href' => $view->real_url . '/' . $view->year . '/' . $month,
      'query' => $append,
    );

    // Week calculation is not supported for historical dates.
    if ($view->year > 1970) {

      // Hiding week view for now since it isn't working right.

      //$calendar_links[] = array('title' => t('Week'), 'href' => $view->real_url .'/'. $view->year .'/W'. $week, 'query' => $append);
    }
    $calendar_links[] = array(
      'title' => t('Day'),
      'href' => $view->real_url . '/' . $view->year . '/' . $month . '/' . $day,
      'query' => $append,
    );
    $output .= theme('calendar_links', $calendar_links, 'month');
  }
  $output .= '<div class="calendar-calendar">' . theme('calendar_nav_wrapper', calendar_nav($view, $mini), array()) . '</div>';
  return $output;
}