You are here

function _spaces_calendar_views_calendar in Spaces 5.2

Same name and namespace in other branches
  1. 5 spaces_calendar/spaces_calendar.module \_spaces_calendar_views_calendar()
1 string reference to '_spaces_calendar_views_calendar'
spaces_calendar_views_default_views in spaces_calendar/spaces_calendar.module
Implementation of hook_default_views

File

spaces_calendar/spaces_calendar.module, line 264

Code

function _spaces_calendar_views_calendar() {
  $view = new stdClass();
  $view->name = 'spaces_calendar';
  $view->description = t('Calendar view of events.');
  $view->access = array();
  $view->menu = TRUE;
  $view->menu_title = t('Calendar');
  $view->page = TRUE;
  $view->page_title = 'Calendar';
  $view->page_type = 'calendar';
  $view->page_footer = _spaces_calendar_ical_enabled() && module_exists('feedapi_node_views') ? '<?php print theme("links", _spaces_calendar_feed_links(), array("class" => "clear-block calendar-key")); ?>' : '';
  $view->page_footer_format = '2';
  $view->view_args_php = '';
  $view->url = 'calendar';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '100';
  $view->sort = array();
  $view->argument = array(
    array(
      'type' => 'calendar_year',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array(
      'type' => 'calendar_month',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'node_data_' . variable_get('spaces_calendar_datefield', ''),
      'field' => variable_get('spaces_calendar_datefield', '') . '_value',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'short',
    ),
  );
  if (_spaces_calendar_ical_enabled() && module_exists('feedapi_node_views')) {
    $view->field[] = array(
      'tablename' => 'feedapi_node_item_feed',
      'field' => 'feed_nid',
      'label' => '',
      'options' => 'nolink',
    );
  }
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array(
        0 => variable_get('spaces_calendar_nodetype', ''),
        1 => variable_get('spaces_calendar_feed_itemtype', ''),
      ),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'all',
      'options' => '',
      'value' => 'all',
    ),
  );
  $view->requires = array(
    'node',
    'node_data_' . variable_get('spaces_calendar_datefield', ''),
    'og_ancestry',
  );
  return $view;
}