2 // $Id: casetracker.views.inc,v 1.3.2.1 2009/03/02 15:59:54 jmiccolis Exp $
5 * Implementation of hook_views_data().
7 function casetracker_views_data() {
9 $tables = array('casetracker_case', 'casetracker_case_states',);
10 foreach ($tables as $table) {
11 $function = "casetracker_views_data_$table";
17 // ---------- Table casetracker_case
18 function casetracker_views_data_casetracker_case() {
19 $data['casetracker_case']['table']['group'] = t('Case Tracker');
20 $data['casetracker_case']['table']['join'] = array(
22 'left_field' => 'vid',
26 $data['casetracker_case']['pid'] = array(
27 'title' => t('Project'),
29 'handler' => 'casetracker_views_handler_field_project_name',
30 'help' => t('Display the name of the Case Tracker project.'),
31 'click sortable' => TRUE,
34 'handler' => 'casetracker_views_handler_filter_project_options',
35 'help' => t('Filter Case Tracker cases by their project.'),
37 'relationship' => array(
38 'handler' => 'views_handler_relationship',
41 'label' => t('project'),
44 $data['casetracker_case']['assign_to'] = array(
45 'title' => t('Assigned to'),
47 'handler' => 'casetracker_views_handler_field_user_name',
48 'help' => t('Display the user name the case has been assigned to.'),
49 'click sortable' => TRUE,
52 'handler' => 'casetracker_views_handler_filter_user_options',
53 'help' => t('Filter Case Tracker cases by the assigned user.'),
56 $data['casetracker_case']['case_priority_id'] = array(
57 'title' => t('Case priority'),
59 'handler' => 'casetracker_views_handler_field_priority_name',
60 'help' => t('Display the priority of the case.'),
61 'click sortable' => TRUE,
64 'handler' => 'casetracker_views_handler_filter_priority_options',
65 'help' => t('Filter Case Tracker cases by priority.'),
68 'handler' => 'views_handler_sort',
69 'help' => t('Sort by Case Tracker priority.'),
72 'handler' => 'casetracker_views_handler_argument_priority',
73 'help' => t('The Case Tracker priority ID.'),
76 $data['casetracker_case']['case_status_id'] = array(
77 'title' => t('Case status'),
79 'handler' => 'casetracker_views_handler_field_status_name',
80 'help' => t('Display the status of the case.'),
81 'click sortable' => TRUE,
84 'handler' => 'casetracker_views_handler_filter_status_options',
85 'help' => t('Filter Case Tracker cases by status.'),
88 'handler' => 'views_handler_sort',
89 'help' => t('Sort by Case Tracker status.'),
92 'handler' => 'casetracker_views_handler_argument_status',
93 'help' => t('The Case Tracker status ID.'),
96 $data['casetracker_case']['case_type_id'] = array(
97 'title' => t('Case type'),
99 'handler' => 'casetracker_views_handler_field_type_name',
100 'help' => t('Display the type of the case.'),
101 'click sortable' => TRUE,
104 'handler' => 'casetracker_views_handler_filter_type_options',
105 'help' => t('Filter Case Tracker cases by type.'),
108 'handler' => 'casetracker_views_handler_argument_type',
109 'help' => t('The Case Tracker type ID.'),
112 $data['casetracker_case']['case_count'] = array(
113 'title' => t('Project: Case count'),
116 'handler' => 'casetracker_views_handler_field_case_count',
117 'help' => t('Provides a count and link to the cases in a given project.'),
124 function casetracker_views_data_casetracker_case_states() {
125 $data['casetracker_case_states']['table']['group'] = t('Case Tracker');
126 $data['casetracker_case_states']['table']['join'] = array(
128 'left_table' => 'casetracker_case',
129 'left_field' => 'case_status_id',
133 $data['casetracker_case_states']['case_state_name'] = array(
134 'title' => t('Case Tracker: State Name'),
136 'handler' => 'views_handler_sort',
137 'help' => t('Sort by Case Tracker state name.'),
145 * Implementation of hook_views_data_alter().
147 function casetracker_views_data_alter(&$data) {
148 $data['node']['case'] = array(
149 'title' => t('Case Tracker case'),
150 'help' => t('Whether the node is a casetracker case'),
152 'handler' => 'casetracker_views_handler_filter_case',
155 $data['node']['project'] = array(
156 'title' => t('Case Tracker project'),
157 'help' => t('Whether the node is a casetracker project'),
159 'handler' => 'casetracker_views_handler_filter_project',
165 * Implementation of hook_views_handlers().
167 function casetracker_views_handlers() {
170 'path' => drupal_get_path('module', 'casetracker') .'/includes',
173 // ---------- Fields ----------
174 // fields: casetracker_case
175 'casetracker_views_handler_field_project_name' => array(
176 'parent' => 'views_handler_field',
178 'casetracker_views_handler_field_user_name' => array(
179 'parent' => 'views_handler_field',
181 'casetracker_views_handler_field_priority_name' => array(
182 'parent' => 'views_handler_field',
184 'casetracker_views_handler_field_status_name' => array(
185 'parent' => 'views_handler_field',
187 'casetracker_views_handler_field_type_name' => array(
188 'parent' => 'views_handler_field',
190 'casetracker_views_handler_field_case_count' => array(
191 'parent' => 'views_handler_field',
194 // ---------- Filters ----------
195 // filters: casetracker_case
196 'casetracker_views_handler_filter_user_options' => array(
197 'parent' => 'views_handler_filter_many_to_one',
199 'casetracker_views_handler_filter_priority_options' => array(
200 'parent' => 'views_handler_filter_many_to_one',
202 'casetracker_views_handler_filter_status_options' => array(
203 'parent' => 'views_handler_filter_many_to_one',
205 'casetracker_views_handler_filter_type_options' => array(
206 'parent' => 'views_handler_filter_many_to_one',
208 'casetracker_views_handler_filter_project_options' => array(
209 'parent' => 'views_handler_filter_many_to_one',
212 // arguments: casetracker_case
213 'casetracker_views_handler_argument_status' => array(
214 'parent' => 'views_handler_argument_numeric',
216 'casetracker_views_handler_argument_priority' => array(
217 'parent' => 'views_handler_argument_numeric',
219 'casetracker_views_handler_argument_type' => array(
220 'parent' => 'views_handler_argument_numeric',
223 // filters: casetracker_project
224 'casetracker_views_handler_filter_project_published' => array(
225 'parent' => 'views_handler_filter_equality',
228 // filters: node-type
229 'casetracker_views_handler_filter_case' => array(
230 'parent' => 'views_handler_filter',
232 'casetracker_views_handler_filter_project' => array(
233 'parent' => 'views_handler_filter',