View source
<?php
function casetracker_views_default_views() {
$list = array(
'casetracker_project_options',
'casetracker_project_cases',
'casetracker_assignee_options',
);
$views = array();
foreach ($list as $view_name) {
$view = call_user_func('_view_' . $view_name);
$views[$view->name] = $view;
}
return $views;
}
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;
$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',
),
));
$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;
}
function _view_casetracker_assignee_options() {
$view = new view();
$view->name = 'casetracker_assignee_options';
$view->description = 'Case tracker > User options query builder';
$view->tag = 'casetracker';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Defaults', 'default');
$handler
->override_option('fields', array(
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 0,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
'uid' => array(
'label' => 'Uid',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_user' => 0,
'exclude' => 0,
'id' => 'uid',
'table' => 'users',
'field' => 'uid',
'relationship' => 'none',
),
));
$handler
->override_option('sorts', array(
'name' => array(
'order' => 'ASC',
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'none',
),
));
$handler
->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'users',
'field' => 'status',
'relationship' => 'none',
),
));
$handler
->override_option('access', array(
'type' => 'perm',
'perm' => 'access content',
));
$handler
->override_option('items_per_page', 0);
return $view;
}
function _view_casetracker_project_cases() {
$view = new view();
$view->name = 'casetracker_project_cases';
$view->description = 'Case Tracker > Cases by project page';
$view->tag = 'casetracker';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Defaults', 'default');
$handler
->override_option('relationships', array(
'assign_to' => array(
'label' => 'Assigned to',
'required' => 1,
'id' => 'assign_to',
'table' => 'casetracker_case',
'field' => 'assign_to',
'relationship' => 'none',
),
));
$handler
->override_option('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'last_updated' => array(
'label' => 'Last updated',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'last_updated',
'table' => 'node_comment_statistics',
'field' => 'last_updated',
'relationship' => 'none',
),
'case_priority_id' => array(
'label' => 'Priority',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'case_priority_id',
'table' => 'casetracker_case',
'field' => 'case_priority_id',
'relationship' => 'none',
),
'case_status_id' => array(
'label' => 'Status',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'case_status_id',
'table' => 'casetracker_case',
'field' => 'case_status_id',
'relationship' => 'none',
),
'case_type_id' => array(
'label' => 'Type',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'case_type_id',
'table' => 'casetracker_case',
'field' => 'case_type_id',
'relationship' => 'none',
),
'name' => array(
'label' => 'Name',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => 'Unassigned',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'relationship' => 'assign_to',
),
));
$handler
->override_option('sorts', array(
'last_updated' => array(
'order' => 'DESC',
'granularity' => 'second',
'id' => 'last_updated',
'table' => 'node_comment_statistics',
'field' => 'last_updated',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler
->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'case' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'case',
'table' => 'node',
'field' => 'case',
'relationship' => 'none',
),
'pid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'pid_op',
'identifier' => 'pid',
'label' => 'Project',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'pid',
'table' => 'casetracker_case',
'field' => 'pid',
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'case_type_id' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'case_type_id_op',
'identifier' => 'case_type_id',
'label' => 'Type',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'case_type_id',
'table' => 'casetracker_case',
'field' => 'case_type_id',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'case_priority_id' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'case_priority_id_op',
'identifier' => 'case_priority_id',
'label' => 'Priority',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'case_priority_id',
'table' => 'casetracker_case',
'field' => 'case_priority_id',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'case_status_id' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'case_status_id_op',
'identifier' => 'case_status_id',
'label' => 'Status',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'case_status_id',
'table' => 'casetracker_case',
'field' => 'case_status_id',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler
->override_option('access', array(
'type' => 'perm',
'perm' => 'access content',
));
$handler
->override_option('cache', array(
'type' => 'none',
));
$handler
->override_option('title', 'Cases');
$handler
->override_option('use_ajax', TRUE);
$handler
->override_option('items_per_page', 20);
$handler
->override_option('use_pager', '1');
$handler
->override_option('style_plugin', 'table');
$handler
->override_option('style_options', array(
'grouping' => '',
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'case_number' => 'case_number',
'title' => 'title',
'last_updated' => 'last_updated',
'case_priority_id' => 'case_priority_id',
'case_status_id' => 'case_status_id',
'case_type_id' => 'case_type_id',
'assign_to' => 'assign_to',
),
'info' => array(
'case_number' => array(
'sortable' => 1,
'separator' => '',
),
'title' => array(
'sortable' => 1,
'separator' => '',
),
'last_updated' => array(
'sortable' => 1,
'separator' => '',
),
'case_priority_id' => array(
'sortable' => 1,
'separator' => '',
),
'case_status_id' => array(
'sortable' => 1,
'separator' => '',
),
'case_type_id' => array(
'sortable' => 1,
'separator' => '',
),
'assign_to' => array(
'sortable' => 1,
'separator' => '',
),
),
'default' => '-1',
));
$handler = $view
->new_display('page', 'Cases', 'page_1');
$handler
->override_option('path', 'casetracker');
$handler
->override_option('menu', array(
'type' => 'normal',
'title' => 'Case Tracker',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view
->new_display('page', 'My cases', 'page_2');
$handler
->override_option('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'last_updated' => array(
'label' => 'Last updated',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'last_updated',
'table' => 'node_comment_statistics',
'field' => 'last_updated',
'relationship' => 'none',
),
'case_priority_id' => array(
'label' => 'Priority',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'case_priority_id',
'table' => 'casetracker_case',
'field' => 'case_priority_id',
'relationship' => 'none',
),
'case_status_id' => array(
'label' => 'Status',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'case_status_id',
'table' => 'casetracker_case',
'field' => 'case_status_id',
'relationship' => 'none',
),
'case_type_id' => array(
'label' => 'Type',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'case_type_id',
'table' => 'casetracker_case',
'field' => 'case_type_id',
'relationship' => 'none',
),
));
$handler
->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'case' => array(
'id' => 'case',
'table' => 'node',
'field' => 'case',
),
'assign_to' => array(
'operator' => 'or',
'value' => array(
'***CURRENT_USER***' => '***CURRENT_USER***',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'assign_to',
'table' => 'casetracker_case',
'field' => 'assign_to',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'pid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'pid_op',
'identifier' => 'pid',
'label' => 'Project',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'id' => 'pid',
'table' => 'casetracker_case',
'field' => 'pid',
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'case_type_id' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'case_type_id_op',
'identifier' => 'case_type_id',
'label' => 'Type',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'case_type_id',
'table' => 'casetracker_case',
'field' => 'case_type_id',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'case_priority_id' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'case_priority_id_op',
'identifier' => 'case_priority_id',
'label' => 'Priority',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'case_priority_id',
'table' => 'casetracker_case',
'field' => 'case_priority_id',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
'case_status_id' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'case_status_id_op',
'identifier' => 'case_status_id',
'label' => 'Status',
'optional' => 1,
'single' => 0,
'remember' => 0,
'reduce' => 0,
),
'id' => 'case_status_id',
'table' => 'casetracker_case',
'field' => 'case_status_id',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler
->override_option('title', 'My cases');
$handler
->override_option('path', 'casetracker/my');
$handler
->override_option('menu', array(
'type' => 'tab',
'title' => 'My cases',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view
->new_display('page', 'Projects', 'page_3');
$handler
->override_option('relationships', array());
$handler
->override_option('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'last_updated' => array(
'label' => 'Last updated',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'date_format' => 'small',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'last_updated',
'table' => 'node_comment_statistics',
'field' => 'last_updated',
'relationship' => 'none',
),
));
$handler
->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'project' => array(
'operator' => '=',
'value' => '',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'project',
'table' => 'node',
'field' => 'project',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler
->override_option('title', 'Projects');
$handler
->override_option('path', 'casetracker/projects');
$handler
->override_option('menu', array(
'type' => 'tab',
'title' => 'Projects',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));
$handler = $view
->new_display('page', 'Default tab', 'page_4');
$handler
->override_option('path', 'casetracker/cases');
$handler
->override_option('menu', array(
'type' => 'default tab',
'title' => 'Cases',
'description' => '',
'weight' => '0',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'none',
'title' => 'Casetracker',
'description' => '',
'weight' => '0',
));
return $view;
}