You are here

function theme_calendar_view_calendar in Calendar 5

Calendar Views plugin theme, overrides default views theme to create a calendar view.

1 theme call to theme_calendar_view_calendar()
theme_calendar_view_summary in ./calendar.theme
Calendar summary display.

File

./calendar.theme, line 26

Code

function theme_calendar_view_calendar(&$view, &$items, $type) {
  if ($type == 'block' || !calendar_is_calendar_arg($view)) {
    $view->calendar_type = 'month';
  }
  $mini = $view->calendar_type == 'year' || $view->build_type == 'block' ? TRUE : FALSE;
  $links = $view->build_type == 'block' ? FALSE : TRUE;

  // Bail out here to display regular views views instead of calendar.
  // Check first for 'view' in url, then for 'calendar_display_format' variable, default to normal calendar display.
  if ($_GET['view'] && $view->build_type == 'page') {
    $display = check_plain($_GET['view']);
  }
  else {
    $display_formats = calendar_get_formats($view);
    $display = $view->build_type == 'block' ? $display_formats['block'] : $display_formats[$view->calendar_type];
  }
  switch ($display) {
    case 'table':
      $view->table_header = _views_construct_header($view, _views_get_fields());
      return theme('calendar_show_nav', $view, $mini, $links) . theme('calendar_view_table', $view, $items, $type);
    case 'teasers':
      return theme('calendar_show_nav', $view, $mini, $links) . theme('calendar_view_teasers', $view, $items, $type);
    case 'nodes':
      return theme('calendar_show_nav', $view, $mini, $links) . theme('calendar_view_nodes', $view, $items, $type);
    case 'list':
      return theme('calendar_show_nav', $view, $mini, $links) . theme('calendar_view_list', $view, $items, $type);
  }
  $results = calendar_get_nodes($view, $items, $type);
  $nodes = (array) $results['nodes'];
  $params = (array) $results['params'];

  // Weeks still aren't working right in all situations, turning them off for now.
  $params[with_weekno] = FALSE;
  $nodes = array_merge($nodes, (array) calendar_add_items($view, 'calendar'));
  return theme('calendar_show_nav', $view, $mini, $links) . calendar_get_calendar($view->calendar_type, $nodes, 'calendar', '', $params);
}