3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | This file is a part of CiviCRM. |
8 | CiviCRM is free software; you can copy, modify, and distribute it |
9 | under the terms of the GNU Affero General Public License |
10 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | CiviCRM is distributed in the hope that it will be useful, but |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15 | See the GNU Affero General Public License for more details. |
17 | You should have received a copy of the GNU Affero General Public |
18 | License and the CiviCRM Licensing Exception along |
19 | with this program; if not, contact CiviCRM LLC |
20 | at info[AT]civicrm[DOT]org. If you have questions about the |
21 | GNU Affero General Public License or the licensing of CiviCRM, |
22 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
23 +--------------------------------------------------------------------+
27 * Build the $data array for CiviGrant related tables
28 * Includes the following tables
31 function _civicrm_grant_data(&$data, $enabled) {
34 * CiviCRM Grants Base Table
37 $data['civicrm_grant']['table']['group'] = t('CiviCRM Grants');
39 $data['civicrm_grant']['table']['base'] = array(
40 // Governs the whole mozilla
42 'title' => t('CiviCRM Grants'),
43 'help' => t("View displays CiviCRM Grants, with relation to contacts."),
46 ///CiviCRM Grants - JOINS
48 $data['civicrm_grant']['table']['join'] = array(
49 // Directly links to contact table
50 'civicrm_contact' => array(
52 'field' => 'contact_id',
55 // Display Grants in User Views
56 $data['civicrm_grant']['table']['join']['users'] = array(
57 'left_table' => 'civicrm_uf_match',
58 'left_field' => 'contact_id',
59 'field' => 'contact_id',
62 //CiviCRM Grants - FIELDS
65 $data['civicrm_grant']['id'] = array(
66 'title' => t('Grant ID'),
67 'help' => t('The numeric ID of the Grant'),
69 'handler' => 'views_handler_field_numeric',
70 'click sortable' => TRUE,
73 'handler' => 'views_handler_argument_numeric',
77 'handler' => 'views_handler_filter_numeric',
78 'allow empty' => TRUE,
81 'handler' => 'views_handler_sort',
86 $data['civicrm_grant']['grant_status'] = array(
87 'title' => t('Grant Status'),
88 'real field' => 'status_id',
89 'help' => t('The Status of this Grant'),
91 'handler' => 'civicrm_handler_field_pseudo_constant',
92 'click sortable' => TRUE,
93 'pseudo class' => 'CRM_Core_PseudoConstant',
94 'pseudo method' => 'get',
95 'dao class' => 'CRM_Grant_DAO_Grant',
98 'handler' => 'views_handler_argument',
101 'handler' => 'civicrm_handler_filter_pseudo_constant',
102 'allow empty' => TRUE,
103 'pseudo class' => 'CRM_Core_PseudoConstant',
104 'pseudo method' => 'get',
105 'dao class' => 'CRM_Grant_DAO_Grant',
108 'handler' => 'views_handler_sort',
112 //Grant Application Received Date
113 $data['civicrm_grant']['application_received_date'] = array(
114 'title' => t('Application Received Date'),
115 'help' => t('Date the Grant application was received'),
117 'handler' => 'civicrm_handler_field_datetime',
118 'click sortable' => TRUE,
121 'handler' => 'civicrm_handler_filter_datetime',
125 'handler' => 'civicrm_handler_sort_date',
128 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Application Received Date', 'name' => 'application_received_date'));
130 //Grant Decision Date
131 $data['civicrm_grant']['decision_date'] = array(
132 'title' => t('Decision Date'),
133 'help' => t('Date on which Grant decision was made'),
135 'handler' => 'civicrm_handler_field_datetime',
136 'click sortable' => TRUE,
139 'handler' => 'civicrm_handler_filter_datetime',
143 'handler' => 'civicrm_handler_sort_date',
146 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Decision Date', 'name' => 'decision_date'));
148 //Grant Money Transfer Date
149 $data['civicrm_grant']['money_transfer_date'] = array(
150 'title' => t('Money Transfer Date'),
151 'help' => t('Date on which Grant money transfer was made'),
153 'handler' => 'civicrm_handler_field_datetime',
154 'click sortable' => TRUE,
157 'handler' => 'civicrm_handler_filter_datetime',
161 'handler' => 'civicrm_handler_sort_date',
164 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Money Transfer Date', 'name' => 'money_transfer_date'));
166 //Grant Report Due Date
167 $data['civicrm_grant']['grant_due_date'] = array(
168 'title' => t('Report Due Date'),
169 'help' => t('Date on which Grant report is due'),
171 'handler' => 'civicrm_handler_field_datetime',
172 'click sortable' => TRUE,
175 'handler' => 'civicrm_handler_filter_datetime',
179 'handler' => 'civicrm_handler_sort_date',
182 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Report Due Date', 'name' => 'grant_due_date'));
184 //Grant Report Due Date
185 $data['civicrm_grant']['grant_due_date'] = array(
186 'title' => t('Report Due Date'),
187 'help' => t('Date on which Grant report is due'),
189 'handler' => 'civicrm_handler_field_datetime',
190 'click sortable' => TRUE,
193 'handler' => 'civicrm_handler_filter_datetime',
197 'handler' => 'civicrm_handler_sort_date',
200 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Report Due Date', 'name' => 'grant_due_date'));
202 //Grant Report Received (boolean)
203 $data['civicrm_grant']['grant_report_received'] = array(
204 'title' => t('Grant Report Received'),
205 'help' => t('Has the Grant Report been received?'),
207 'handler' => 'views_handler_field_boolean',
208 'click sortable' => TRUE,
211 'handler' => 'views_handler_argument',
214 'handler' => 'views_handler_filter_boolean_operator',
217 'handler' => 'views_handler_sort',
222 $data['civicrm_grant']['grant_type'] = array(
223 'title' => t('Grant Type'),
224 'real field' => 'grant_type_id',
225 'help' => t('The Type of this Grant.'),
227 'handler' => 'civicrm_handler_field_pseudo_constant',
228 'click sortable' => TRUE,
229 'pseudo class' => 'CRM_Core_PseudoConstant',
230 'pseudo method' => 'get',
231 'dao class' => 'CRM_Grant_DAO_Grant',
234 'handler' => 'views_handler_argument',
237 'handler' => 'civicrm_handler_filter_pseudo_constant',
238 'allow empty' => TRUE,
239 'pseudo class' => 'CRM_Core_PseudoConstant',
240 'pseudo method' => 'get',
241 'dao class' => 'CRM_Grant_DAO_Grant',
244 'handler' => 'views_handler_sort',
248 //Grant Amount Requested
249 $data['civicrm_grant']['amount_total'] = array(
250 'title' => t('Amount Requested'),
251 'help' => t('Grant amount requested'),
253 'handler' => 'civicrm_handler_field_money',
254 'click sortable' => TRUE,
255 'currency field' => 'currency',
258 'handler' => 'views_handler_argument_numeric',
262 'handler' => 'views_handler_filter_numeric',
263 'allow empty' => TRUE,
266 'handler' => 'views_handler_sort',
270 //Grant Amount Requested (origninal currency)
271 $data['civicrm_grant']['amount_requested'] = array(
272 'title' => t('Amount Requested (origninal currency)'),
273 'help' => t('Amount requested for grant in original currency (if different)'),
275 'handler' => 'views_handler_field_numeric',
276 'click sortable' => TRUE,
279 'handler' => 'views_handler_argument_numeric',
283 'handler' => 'views_handler_filter_numeric',
284 'allow empty' => TRUE,
287 'handler' => 'views_handler_sort',
291 //Grant Amount Granted
292 $data['civicrm_grant']['amount_granted'] = array(
293 'title' => t('Amount Granted'),
294 'help' => t('Grant amount awarded'),
296 'handler' => 'civicrm_handler_field_money',
297 'click sortable' => TRUE,
298 'currency field' => 'currency',
301 'handler' => 'views_handler_argument_numeric',
305 'handler' => 'views_handler_filter_numeric',
306 'allow empty' => TRUE,
309 'handler' => 'views_handler_sort',
314 $data['civicrm_grant']['rationale'] = array(
315 'title' => t('Rationale'),
316 'help' => t('Grant rationale'),
318 'handler' => 'views_handler_field',
319 'click sortable' => TRUE,
322 'handler' => 'views_handler_argument_string',
325 'handler' => 'views_handler_filter_string',
326 'allow empty' => TRUE,
329 'handler' => 'views_handler_sort',