You are here

function _view_casetracker_project_options in Case Tracker 6

Same name and namespace in other branches
  1. 7 casetracker.views_default.inc \_view_casetracker_project_options()

File

./casetracker.views_default.inc, line 20

Code

function _view_casetracker_project_options() {
  $view = new view();
  $view->name = 'casetracker_project_options';
  $view->description = 'Case Tracker > Project options query builder';
  $view->tag = 'casetracker';
  $view->view_php = '';
  $view->base_table = 'node';
  $view->is_cacheable = FALSE;
  $view->api_version = 2;
  $view->disabled = FALSE;

  /* Edit this to true to make a default view disabled initially */
  $handler = $view
    ->new_display('default', 'Defaults', 'default');
  $handler
    ->override_option('fields', array(
    'title' => array(
      'label' => '',
      'link_to_node' => 0,
      'exclude' => 0,
      'id' => 'title',
      'table' => 'node',
      'field' => 'title',
      'relationship' => 'none',
    ),
  ));
  $handler
    ->override_option('sorts', array(
    'title' => array(
      'order' => 'ASC',
      'id' => 'title',
      'table' => 'node',
      'field' => 'title',
      'relationship' => 'none',
    ),
  ));

  // Add project node types from stored variable
  $projects = array();
  foreach (variable_get('casetracker_project_node_types', array(
    'casetracker_basic_project',
  )) as $type) {
    $projects[$type] = $type;
  }
  $filters = array(
    'status' => array(
      'operator' => '=',
      'value' => 1,
      'group' => '0',
      'exposed' => FALSE,
      'expose' => array(
        'operator' => FALSE,
        'label' => '',
      ),
      'id' => 'status',
      'table' => 'node',
      'field' => 'status',
      'relationship' => 'none',
    ),
    'type' => array(
      'operator' => 'in',
      'value' => $projects,
      'group' => '0',
      'exposed' => FALSE,
      'expose' => array(
        'operator' => FALSE,
        'label' => '',
      ),
      'id' => 'type',
      'table' => 'node',
      'field' => 'type',
      'relationship' => 'none',
    ),
  );
  $handler
    ->override_option('filters', $filters);
  $handler
    ->override_option('access', array(
    'type' => 'perm',
    'perm' => 'access content',
  ));
  $handler
    ->override_option('items_per_page', 0);
  return $view;
}