You are here

function location_views_default_views in Location 5.3

Same name and namespace in other branches
  1. 5 contrib/location_views/location_views.module \location_views_default_views()
  2. 6.3 location.views_default.inc \location_views_default_views()
  3. 7.5 location.views_default.inc \location_views_default_views()
  4. 7.3 location.views_default.inc \location_views_default_views()
  5. 7.4 location.views_default.inc \location_views_default_views()

Create default location view

File

contrib/location_views/location_views.module, line 293
Views-enables the location module.

Code

function location_views_default_views() {
  $view = new stdClass();
  $view->name = 'location_table';
  $view->description = 'Node location table.';
  $view->disabled = TRUE;
  $view->access = array();
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = '';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'table';
  $view->url = 'location/views';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->menu = TRUE;
  $view->menu_title = 'Location table';
  $view->menu_tab = FALSE;
  $view->menu_tab_weight = '0';
  $view->menu_tab_default = FALSE;
  $view->menu_tab_default_parent = NULL;
  $view->menu_tab_default_parent_type = 'tab';
  $view->menu_parent_tab_weight = '0';
  $view->menu_parent_title = '';
  $view->sort = array();
  $view->argument = array();
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Title:',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
      'sortable' => '1',
      'defaultsort' => 'ASC',
    ),
    array(
      'tablename' => 'location',
      'field' => 'street',
      'label' => 'Street:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'city',
      'label' => 'City:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'province',
      'label' => 'Province:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'postal_code',
      'label' => 'Postal Code:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'country',
      'label' => 'Country:',
      'sortable' => '1',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'location_instance_node',
      'field' => 'has_location',
      'operator' => 'IS NOT',
      'options' => '',
      'value' => '',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    'node',
    'location',
    'location_instance_node',
  );
  $views[$view->name] = $view;
  $view = new stdClass();
  $view->name = 'location_directory';
  $view->description = 'Location directory filtered by arguments in the url.';
  $view->disabled = TRUE;
  $view->access = array();
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Locations';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '';
  $view->page_footer_format = '1';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'table';
  $view->url = 'location/directory';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '10';
  $view->menu = TRUE;
  $view->menu_title = 'Locations';
  $view->menu_tab = FALSE;
  $view->menu_tab_weight = '0';
  $view->menu_tab_default = FALSE;
  $view->menu_tab_default_parent = NULL;
  $view->menu_tab_default_parent_type = 'tab';
  $view->menu_parent_tab_weight = '0';
  $view->menu_parent_title = '';
  $view->sort = array();
  $view->argument = array(
    array(
      'type' => 'country',
      'argdefault' => '6',
      'title' => '%1',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array(
      'type' => 'province',
      'argdefault' => '6',
      'title' => '%2',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array(
      'type' => 'city',
      'argdefault' => '6',
      'title' => '%3',
      'options' => '1',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Title:',
      'handler' => 'views_handler_field_nodelink',
      'sortable' => '1',
      'options' => 'link',
    ),
    array(
      'tablename' => 'location',
      'field' => 'street',
      'label' => 'Street:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'city',
      'label' => 'City:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'province',
      'label' => 'Province:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'postal_code',
      'label' => 'Postal Code:',
      'sortable' => '1',
    ),
    array(
      'tablename' => 'location',
      'field' => 'country',
      'label' => 'Country:',
      'sortable' => '1',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'location_instance_node',
      'field' => 'has_location',
      'operator' => 'IS NOT',
      'options' => '',
      'value' => '',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    node,
    location,
    location_instance_node,
  );
  $views[$view->name] = $view;
  if (module_exists('usernode')) {
    $view = new stdClass();
    $view->name = 'user_location_table';
    $view->description = 'User location table.';
    $view->disabled = TRUE;
    $view->access = array();
    $view->view_args_php = '';
    $view->page = TRUE;
    $view->page_title = '';
    $view->page_header = '';
    $view->page_header_format = '1';
    $view->page_footer = '';
    $view->page_footer_format = '1';
    $view->page_empty = '';
    $view->page_empty_format = '1';
    $view->page_type = 'table';
    $view->url = 'location/users';
    $view->use_pager = TRUE;
    $view->nodes_per_page = '10';
    $view->menu = TRUE;
    $view->menu_title = 'User location table';
    $view->menu_tab = FALSE;
    $view->menu_tab_weight = '0';
    $view->menu_tab_default = FALSE;
    $view->menu_tab_default_parent = NULL;
    $view->menu_tab_default_parent_type = 'tab';
    $view->menu_parent_tab_weight = '0';
    $view->menu_parent_title = '';
    $view->sort = array();
    $view->argument = array();
    $view->field = array(
      array(
        'tablename' => 'node',
        'field' => 'title',
        'label' => 'Title:',
        'handler' => 'views_handler_field_nodelink',
        'sortable' => '1',
        'defaultsort' => 'ASC',
        'options' => 'link',
      ),
      array(
        'tablename' => 'user_location',
        'field' => 'street',
        'label' => 'Street:',
        'sortable' => '1',
      ),
      array(
        'tablename' => 'user_location',
        'field' => 'city',
        'label' => 'City:',
        'sortable' => '1',
      ),
      array(
        'tablename' => 'user_location',
        'field' => 'province',
        'label' => 'Province:',
        'sortable' => '1',
      ),
      array(
        'tablename' => 'user_location',
        'field' => 'postal_code',
        'label' => 'Postal Code:',
        'sortable' => '1',
      ),
      array(
        'tablename' => 'user_location',
        'field' => 'country',
        'label' => 'Country:',
        'sortable' => '1',
      ),
    );
    $view->filter = array(
      array(
        'tablename' => 'node',
        'field' => 'status',
        'operator' => '=',
        'options' => '',
        'value' => '1',
      ),
      array(
        'tablename' => 'node',
        'field' => 'type',
        'operator' => 'OR',
        'options' => '',
        'value' => array(
          0 => 'usernode',
        ),
      ),
      array(
        'tablename' => 'location_instance_user',
        'field' => 'has_location',
        'operator' => 'IS NOT',
        'options' => '',
        'value' => '',
      ),
    );
    $view->exposed_filter = array();
    $view->requires = array(
      node,
      user_location,
      location_instance_user,
    );
    $views[$view->name] = $view;
  }
  return $views;
}