commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / drupal / modules / views / components / civicrm.grant.inc
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | This file is a part of CiviCRM. |
7 | |
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. |
11 | |
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. |
16 | |
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 +--------------------------------------------------------------------+
24 */
25
26 /**
27 * Build the $data array for CiviGrant related tables
28 * Includes the following tables
29 * civicrm_grant
30 */
31 function _civicrm_grant_data(&$data, $enabled) {
32
33 /**
34 * CiviCRM Grants Base Table
35 */
36
37 $data['civicrm_grant']['table']['group'] = t('CiviCRM Grants');
38
39 $data['civicrm_grant']['table']['base'] = array(
40 // Governs the whole mozilla
41 'field' => 'id',
42 'title' => t('CiviCRM Grants'),
43 'help' => t("View displays CiviCRM Grants, with relation to contacts."),
44 );
45
46 ///CiviCRM Grants - JOINS
47
48 $data['civicrm_grant']['table']['join'] = array(
49 // Directly links to contact table
50 'civicrm_contact' => array(
51 'left_field' => 'id',
52 'field' => 'contact_id',
53 ),
54 );
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',
60 );
61
62 //CiviCRM Grants - FIELDS
63
64 //Numeric Grant ID
65 $data['civicrm_grant']['id'] = array(
66 'title' => t('Grant ID'),
67 'help' => t('The numeric ID of the Grant'),
68 'field' => array(
69 'handler' => 'views_handler_field_numeric',
70 'click sortable' => TRUE,
71 ),
72 'argument' => array(
73 'handler' => 'views_handler_argument_numeric',
74 'numeric' => TRUE,
75 ),
76 'filter' => array(
77 'handler' => 'views_handler_filter_numeric',
78 'allow empty' => TRUE,
79 ),
80 'sort' => array(
81 'handler' => 'views_handler_sort',
82 ),
83 );
84
85 //Grant Status
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'),
90 'field' => array(
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',
96 ),
97 'argument' => array(
98 'handler' => 'views_handler_argument',
99 ),
100 'filter' => array(
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',
106 ),
107 'sort' => array(
108 'handler' => 'views_handler_sort',
109 ),
110 );
111
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'),
116 'field' => array(
117 'handler' => 'civicrm_handler_field_datetime',
118 'click sortable' => TRUE,
119 ),
120 'filter' => array(
121 'handler' => 'civicrm_handler_filter_datetime',
122 'is date' => TRUE,
123 ),
124 'sort' => array(
125 'handler' => 'civicrm_handler_sort_date',
126 ),
127 );
128 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Application Received Date', 'name' => 'application_received_date'));
129
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'),
134 'field' => array(
135 'handler' => 'civicrm_handler_field_datetime',
136 'click sortable' => TRUE,
137 ),
138 'filter' => array(
139 'handler' => 'civicrm_handler_filter_datetime',
140 'is date' => TRUE,
141 ),
142 'sort' => array(
143 'handler' => 'civicrm_handler_sort_date',
144 ),
145 );
146 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Decision Date', 'name' => 'decision_date'));
147
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'),
152 'field' => array(
153 'handler' => 'civicrm_handler_field_datetime',
154 'click sortable' => TRUE,
155 ),
156 'filter' => array(
157 'handler' => 'civicrm_handler_filter_datetime',
158 'is date' => TRUE,
159 ),
160 'sort' => array(
161 'handler' => 'civicrm_handler_sort_date',
162 ),
163 );
164 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Money Transfer Date', 'name' => 'money_transfer_date'));
165
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'),
170 'field' => array(
171 'handler' => 'civicrm_handler_field_datetime',
172 'click sortable' => TRUE,
173 ),
174 'filter' => array(
175 'handler' => 'civicrm_handler_filter_datetime',
176 'is date' => TRUE,
177 ),
178 'sort' => array(
179 'handler' => 'civicrm_handler_sort_date',
180 ),
181 );
182 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Report Due Date', 'name' => 'grant_due_date'));
183
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'),
188 'field' => array(
189 'handler' => 'civicrm_handler_field_datetime',
190 'click sortable' => TRUE,
191 ),
192 'filter' => array(
193 'handler' => 'civicrm_handler_filter_datetime',
194 'is date' => TRUE,
195 ),
196 'sort' => array(
197 'handler' => 'civicrm_handler_sort_date',
198 ),
199 );
200 civicrm_views_add_date_arguments($data['civicrm_grant'], array('title' => 'Report Due Date', 'name' => 'grant_due_date'));
201
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?'),
206 'field' => array(
207 'handler' => 'views_handler_field_boolean',
208 'click sortable' => TRUE,
209 ),
210 'argument' => array(
211 'handler' => 'views_handler_argument',
212 ),
213 'filter' => array(
214 'handler' => 'views_handler_filter_boolean_operator',
215 ),
216 'sort' => array(
217 'handler' => 'views_handler_sort',
218 ),
219 );
220
221 //Grant Type
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.'),
226 'field' => array(
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',
232 ),
233 'argument' => array(
234 'handler' => 'views_handler_argument',
235 ),
236 'filter' => array(
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',
242 ),
243 'sort' => array(
244 'handler' => 'views_handler_sort',
245 ),
246 );
247
248 //Grant Amount Requested
249 $data['civicrm_grant']['amount_total'] = array(
250 'title' => t('Amount Requested'),
251 'help' => t('Grant amount requested'),
252 'field' => array(
253 'handler' => 'civicrm_handler_field_money',
254 'click sortable' => TRUE,
255 'currency field' => 'currency',
256 ),
257 'argument' => array(
258 'handler' => 'views_handler_argument_numeric',
259 'numeric' => TRUE,
260 ),
261 'filter' => array(
262 'handler' => 'views_handler_filter_numeric',
263 'allow empty' => TRUE,
264 ),
265 'sort' => array(
266 'handler' => 'views_handler_sort',
267 ),
268 );
269
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)'),
274 'field' => array(
275 'handler' => 'views_handler_field_numeric',
276 'click sortable' => TRUE,
277 ),
278 'argument' => array(
279 'handler' => 'views_handler_argument_numeric',
280 'numeric' => TRUE,
281 ),
282 'filter' => array(
283 'handler' => 'views_handler_filter_numeric',
284 'allow empty' => TRUE,
285 ),
286 'sort' => array(
287 'handler' => 'views_handler_sort',
288 ),
289 );
290
291 //Grant Amount Granted
292 $data['civicrm_grant']['amount_granted'] = array(
293 'title' => t('Amount Granted'),
294 'help' => t('Grant amount awarded'),
295 'field' => array(
296 'handler' => 'civicrm_handler_field_money',
297 'click sortable' => TRUE,
298 'currency field' => 'currency',
299 ),
300 'argument' => array(
301 'handler' => 'views_handler_argument_numeric',
302 'numeric' => TRUE,
303 ),
304 'filter' => array(
305 'handler' => 'views_handler_filter_numeric',
306 'allow empty' => TRUE,
307 ),
308 'sort' => array(
309 'handler' => 'views_handler_sort',
310 ),
311 );
312
313 //Grant Rationale
314 $data['civicrm_grant']['rationale'] = array(
315 'title' => t('Rationale'),
316 'help' => t('Grant rationale'),
317 'field' => array(
318 'handler' => 'views_handler_field',
319 'click sortable' => TRUE,
320 ),
321 'argument' => array(
322 'handler' => 'views_handler_argument_string',
323 ),
324 'filter' => array(
325 'handler' => 'views_handler_filter_string',
326 'allow empty' => TRUE,
327 ),
328 'sort' => array(
329 'handler' => 'views_handler_sort',
330 ),
331 );
332 }
333