Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
7e9e8871 | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * One place to store frequently used values in Select Elements. Note that | |
30 | * some of the below elements will be dynamic, so we'll probably have a | |
31 | * smart caching scheme on a per domain basis | |
32 | * | |
33 | * @package CRM | |
0f03f337 | 34 | * @copyright CiviCRM LLC (c) 2004-2017 |
6a488035 TO |
35 | * $Id$ |
36 | * | |
37 | */ | |
38 | class CRM_Core_SelectValues { | |
39 | ||
14f42e31 CW |
40 | /** |
41 | * Yes/No options | |
42 | * | |
43 | * @return array | |
44 | */ | |
45 | public static function boolean() { | |
46 | return array( | |
47 | 1 => ts('Yes'), | |
48 | 0 => ts('No'), | |
49 | ); | |
50 | } | |
51 | ||
6a488035 | 52 | /** |
f9e31d7f | 53 | * Preferred mail format. |
79d7553f | 54 | * |
76e7a76c | 55 | * @return array |
6a488035 | 56 | */ |
00be9182 | 57 | public static function pmf() { |
6795600d CW |
58 | return array( |
59 | 'Both' => ts('Both'), | |
60 | 'HTML' => ts('HTML'), | |
61 | 'Text' => ts('Text'), | |
62 | ); | |
6a488035 TO |
63 | } |
64 | ||
65 | /** | |
f9e31d7f | 66 | * Privacy options. |
76e7a76c CW |
67 | * |
68 | * @return array | |
6a488035 | 69 | */ |
00be9182 | 70 | public static function privacy() { |
6795600d CW |
71 | return array( |
72 | 'do_not_phone' => ts('Do not phone'), | |
73 | 'do_not_email' => ts('Do not email'), | |
74 | 'do_not_mail' => ts('Do not mail'), | |
75 | 'do_not_sms' => ts('Do not sms'), | |
76 | 'do_not_trade' => ts('Do not trade'), | |
77 | 'is_opt_out' => ts('No bulk emails (User Opt Out)'), | |
78 | ); | |
6a488035 TO |
79 | } |
80 | ||
81 | /** | |
f9e31d7f | 82 | * Various pre defined contact super types. |
76e7a76c CW |
83 | * |
84 | * @return array | |
6a488035 | 85 | */ |
00be9182 | 86 | public static function contactType() { |
6a488035 TO |
87 | static $contactType = NULL; |
88 | if (!$contactType) { | |
694e78fd | 89 | $contactType = CRM_Contact_BAO_ContactType::basicTypePairs(); |
6a488035 TO |
90 | } |
91 | return $contactType; | |
92 | } | |
93 | ||
94 | /** | |
f9e31d7f | 95 | * Various pre defined unit list. |
79d7553f | 96 | * |
76e7a76c CW |
97 | * @param string $unitType |
98 | * @return array | |
6a488035 | 99 | */ |
00be9182 | 100 | public static function unitList($unitType = NULL) { |
c3831ebd EM |
101 | $unitList = array( |
102 | 'day' => ts('day'), | |
103 | 'month' => ts('month'), | |
104 | 'year' => ts('year'), | |
105 | ); | |
106 | if ($unitType == 'duration') { | |
6795600d | 107 | $unitList['lifetime'] = ts('lifetime'); |
6a488035 TO |
108 | } |
109 | return $unitList; | |
110 | } | |
111 | ||
93bfa565 | 112 | /** |
f9e31d7f | 113 | * Membership type unit. |
76e7a76c CW |
114 | * |
115 | * @return array | |
93bfa565 | 116 | */ |
2aa397bc | 117 | public static function membershipTypeUnitList() { |
6795600d | 118 | return self::unitList('duration'); |
93bfa565 | 119 | } |
120 | ||
6a488035 | 121 | /** |
f9e31d7f | 122 | * Various pre defined period types. |
76e7a76c CW |
123 | * |
124 | * @return array | |
6a488035 | 125 | */ |
00be9182 | 126 | public static function periodType() { |
c3831ebd EM |
127 | return array( |
128 | 'rolling' => ts('Rolling'), | |
129 | 'fixed' => ts('Fixed'), | |
130 | ); | |
6a488035 TO |
131 | } |
132 | ||
bac4cd35 | 133 | /** |
f9e31d7f | 134 | * Various pre defined email selection methods. |
76e7a76c CW |
135 | * |
136 | * @return array | |
bac4cd35 | 137 | */ |
00be9182 | 138 | public static function emailSelectMethods() { |
bac4cd35 | 139 | return array( |
140 | 'automatic' => ts("Automatic"), | |
141 | 'location-only' => ts("Only send to email addresses assigned to the specified location"), | |
142 | 'location-prefer' => ts("Prefer email addresses assigned to the specified location"), | |
21dfd5f5 | 143 | 'location-exclude' => ts("Exclude email addresses assigned to the specified location"), |
bac4cd35 | 144 | ); |
145 | } | |
146 | ||
6a488035 | 147 | /** |
f9e31d7f | 148 | * Various pre defined member visibility options. |
76e7a76c CW |
149 | * |
150 | * @return array | |
6a488035 | 151 | */ |
00be9182 | 152 | public static function memberVisibility() { |
ab5e0c41 CW |
153 | return array( |
154 | 'Public' => ts('Public'), | |
155 | 'Admin' => ts('Admin'), | |
156 | ); | |
6a488035 TO |
157 | } |
158 | ||
dbd82592 CW |
159 | /** |
160 | * Member auto-renew options | |
76e7a76c CW |
161 | * |
162 | * @return array | |
dbd82592 CW |
163 | */ |
164 | public static function memberAutoRenew() { | |
165 | return array( | |
166 | ts('No auto-renew option'), | |
167 | ts('Give option, but not required'), | |
21dfd5f5 | 168 | ts('Auto-renew required'), |
dbd82592 CW |
169 | ); |
170 | } | |
171 | ||
6a488035 | 172 | /** |
f9e31d7f | 173 | * Various pre defined event dates. |
76e7a76c CW |
174 | * |
175 | * @return array | |
6a488035 | 176 | */ |
00be9182 | 177 | public static function eventDate() { |
c3831ebd EM |
178 | return array( |
179 | 'start_date' => ts('start date'), | |
180 | 'end_date' => ts('end date'), | |
181 | 'join_date' => ts('member since'), | |
182 | ); | |
6a488035 TO |
183 | } |
184 | ||
6a488035 | 185 | /** |
f9e31d7f | 186 | * Custom form field types. |
76e7a76c CW |
187 | * |
188 | * @return array | |
6a488035 | 189 | */ |
00be9182 | 190 | public static function customHtmlType() { |
c3831ebd EM |
191 | return array( |
192 | 'Text' => ts('Single-line input field (text or numeric)'), | |
193 | 'TextArea' => ts('Multi-line text box (textarea)'), | |
194 | 'Select' => ts('Drop-down (select list)'), | |
195 | 'Radio' => ts('Radio buttons'), | |
196 | 'CheckBox' => ts('Checkbox(es)'), | |
197 | 'Select Date' => ts('Select Date'), | |
198 | 'File' => ts('File'), | |
199 | 'Select State/Province' => ts('Select State/Province'), | |
200 | 'Multi-Select State/Province' => ts('Multi-Select State/Province'), | |
201 | 'Select Country' => ts('Select Country'), | |
202 | 'Multi-Select Country' => ts('Multi-Select Country'), | |
203 | 'RichTextEditor' => ts('Rich Text Editor'), | |
204 | 'Autocomplete-Select' => ts('Autocomplete-Select'), | |
205 | 'Multi-Select' => ts('Multi-Select'), | |
206 | 'AdvMulti-Select' => ts('AdvMulti-Select'), | |
207 | 'Link' => ts('Link'), | |
79dc94e4 | 208 | 'ContactReference' => ts('Autocomplete-Select'), |
c3831ebd | 209 | ); |
6a488035 TO |
210 | } |
211 | ||
212 | /** | |
f9e31d7f | 213 | * Various pre defined extensions for dynamic properties and groups. |
6a488035 | 214 | * |
76e7a76c CW |
215 | * @return array |
216 | * | |
6a488035 | 217 | */ |
00be9182 | 218 | public static function customGroupExtends() { |
c3831ebd EM |
219 | $customGroupExtends = array( |
220 | 'Activity' => ts('Activities'), | |
221 | 'Relationship' => ts('Relationships'), | |
222 | 'Contribution' => ts('Contributions'), | |
95974e8e | 223 | 'ContributionRecur' => ts('Recurring Contributions'), |
c3831ebd EM |
224 | 'Group' => ts('Groups'), |
225 | 'Membership' => ts('Memberships'), | |
226 | 'Event' => ts('Events'), | |
227 | 'Participant' => ts('Participants'), | |
228 | 'ParticipantRole' => ts('Participants (Role)'), | |
229 | 'ParticipantEventName' => ts('Participants (Event Name)'), | |
230 | 'ParticipantEventType' => ts('Participants (Event Type)'), | |
231 | 'Pledge' => ts('Pledges'), | |
232 | 'Grant' => ts('Grants'), | |
233 | 'Address' => ts('Addresses'), | |
234 | 'Campaign' => ts('Campaigns'), | |
235 | ); | |
236 | $contactTypes = self::contactType(); | |
6795600d CW |
237 | $contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array(); |
238 | $extendObjs = CRM_Core_OptionGroup::values('cg_extend_objects'); | |
c3831ebd | 239 | $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs); |
6a488035 TO |
240 | return $customGroupExtends; |
241 | } | |
242 | ||
243 | /** | |
f9e31d7f | 244 | * Styles for displaying the custom data group. |
6a488035 | 245 | * |
76e7a76c | 246 | * @return array |
6a488035 | 247 | */ |
00be9182 | 248 | public static function customGroupStyle() { |
c3831ebd EM |
249 | return array( |
250 | 'Tab' => ts('Tab'), | |
251 | 'Inline' => ts('Inline'), | |
252 | 'Tab with table' => ts('Tab with table'), | |
253 | ); | |
6a488035 TO |
254 | } |
255 | ||
256 | /** | |
f9e31d7f | 257 | * For displaying the uf group types. |
6a488035 | 258 | * |
76e7a76c | 259 | * @return array |
6a488035 | 260 | */ |
00be9182 | 261 | public static function ufGroupTypes() { |
c3831ebd EM |
262 | $ufGroupType = array( |
263 | 'Profile' => ts('Standalone Form or Directory'), | |
264 | 'Search Profile' => ts('Search Views'), | |
265 | ); | |
266 | ||
267 | if (CRM_Core_Config::singleton()->userSystem->supports_form_extensions) { | |
268 | $ufGroupType += array( | |
269 | 'User Registration' => ts('Drupal User Registration'), | |
270 | 'User Account' => ts('View/Edit Drupal User Account'), | |
6a488035 | 271 | ); |
6a488035 TO |
272 | } |
273 | return $ufGroupType; | |
274 | } | |
275 | ||
276 | /** | |
f9e31d7f | 277 | * The status of a contact within a group. |
6a488035 | 278 | * |
76e7a76c | 279 | * @return array |
6a488035 | 280 | */ |
00be9182 | 281 | public static function groupContactStatus() { |
c3831ebd EM |
282 | return array( |
283 | 'Added' => ts('Added'), | |
284 | 'Removed' => ts('Removed'), | |
285 | 'Pending' => ts('Pending'), | |
286 | ); | |
6a488035 TO |
287 | } |
288 | ||
289 | /** | |
f9e31d7f | 290 | * List of Group Types. |
76e7a76c CW |
291 | * |
292 | * @return array | |
6a488035 | 293 | */ |
00be9182 | 294 | public static function groupType() { |
c3831ebd EM |
295 | return array( |
296 | 'query' => ts('Dynamic'), | |
297 | 'static' => ts('Static'), | |
298 | ); | |
6a488035 TO |
299 | } |
300 | ||
301 | /** | |
f9e31d7f | 302 | * Compose the parameters for a date select object. |
6a488035 | 303 | * |
76e7a76c CW |
304 | * @param string|NULL $type |
305 | * the type of date | |
306 | * @param string|NULL $format | |
307 | * date format (QF format) | |
9bf2a591 EM |
308 | * @param null $minOffset |
309 | * @param null $maxOffset | |
6a488035 | 310 | * |
a6c01b45 CW |
311 | * @return array |
312 | * the date array | |
6a488035 | 313 | */ |
1285ac45 | 314 | public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') { |
315 | // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime. | |
6a488035 TO |
316 | $date = array( |
317 | 'addEmptyOption' => TRUE, | |
318 | 'emptyOptionText' => ts('- select -'), | |
319 | 'emptyOptionValue' => '', | |
320 | ); | |
321 | ||
322 | if ($format) { | |
323 | $date['format'] = $format; | |
324 | } | |
325 | else { | |
326 | if ($type) { | |
327 | $dao = new CRM_Core_DAO_PreferencesDate(); | |
328 | $dao->name = $type; | |
329 | if (!$dao->find(TRUE)) { | |
330 | CRM_Core_Error::fatal(); | |
331 | } | |
1285ac45 | 332 | if (!$maxOffset) { |
333 | $maxOffset = $dao->end; | |
334 | } | |
335 | if (!$minOffset) { | |
336 | $minOffset = $dao->start; | |
337 | } | |
6a488035 | 338 | |
6a488035 | 339 | $date['format'] = $dao->date_format; |
1285ac45 | 340 | $date['time'] = (bool) $dao->time_format; |
6a488035 TO |
341 | } |
342 | ||
a7488080 | 343 | if (empty($date['format'])) { |
1285ac45 | 344 | if ($context == 'Input') { |
345 | $date['format'] = Civi::settings()->get('dateInputFormat'); | |
1285ac45 | 346 | } |
347 | else { | |
348 | $date['format'] = 'M d'; | |
349 | } | |
6a488035 TO |
350 | } |
351 | } | |
2732685b | 352 | |
ed0ca248 | 353 | $date['smarty_view_format'] = CRM_Utils_Date::getDateFieldViewFormat($date['format']); |
1285ac45 | 354 | if (!isset($date['time'])) { |
355 | $date['time'] = FALSE; | |
356 | } | |
6a488035 | 357 | |
6795600d | 358 | $year = date('Y'); |
1285ac45 | 359 | $date['minYear'] = $year - (int) $minOffset; |
360 | $date['maxYear'] = $year + (int) $maxOffset; | |
6a488035 TO |
361 | return $date; |
362 | } | |
363 | ||
364 | /** | |
f9e31d7f | 365 | * Values for UF form visibility options. |
6a488035 | 366 | * |
76e7a76c | 367 | * @return array |
6a488035 | 368 | */ |
00be9182 | 369 | public static function ufVisibility() { |
c3831ebd EM |
370 | return array( |
371 | 'User and User Admin Only' => ts('User and User Admin Only'), | |
fac01cb1 DG |
372 | 'Public Pages' => ts('Expose Publicly'), |
373 | 'Public Pages and Listings' => ts('Expose Publicly and for Listings'), | |
c3831ebd | 374 | ); |
6a488035 TO |
375 | } |
376 | ||
93bfa565 | 377 | /** |
f9e31d7f | 378 | * Values for group form visibility options. |
93bfa565 | 379 | * |
76e7a76c | 380 | * @return array |
93bfa565 | 381 | */ |
00be9182 | 382 | public static function groupVisibility() { |
c3831ebd | 383 | return array( |
6795600d CW |
384 | 'User and User Admin Only' => ts('User and User Admin Only'), |
385 | 'Public Pages' => ts('Public Pages'), | |
386 | ); | |
93bfa565 | 387 | } |
388 | ||
6a488035 | 389 | /** |
f9e31d7f | 390 | * Different type of Mailing Components. |
6a488035 | 391 | * |
76e7a76c | 392 | * @return array |
6a488035 | 393 | */ |
00be9182 | 394 | public static function mailingComponents() { |
2aa397bc | 395 | return array( |
353ffa53 | 396 | 'Header' => ts('Header'), |
c3831ebd EM |
397 | 'Footer' => ts('Footer'), |
398 | 'Reply' => ts('Reply Auto-responder'), | |
399 | 'OptOut' => ts('Opt-out Message'), | |
400 | 'Subscribe' => ts('Subscription Confirmation Request'), | |
401 | 'Welcome' => ts('Welcome Message'), | |
402 | 'Unsubscribe' => ts('Unsubscribe Message'), | |
403 | 'Resubscribe' => ts('Resubscribe Message'), | |
404 | ); | |
6a488035 TO |
405 | } |
406 | ||
407 | /** | |
f9e31d7f | 408 | * Get hours. |
6a488035 | 409 | * |
76e7a76c | 410 | * @return array |
6a488035 | 411 | */ |
00be9182 | 412 | public function getHours() { |
9fab6f51 | 413 | $hours = array(); |
6a488035 TO |
414 | for ($i = 0; $i <= 6; $i++) { |
415 | $hours[$i] = $i; | |
416 | } | |
417 | return $hours; | |
418 | } | |
419 | ||
420 | /** | |
f9e31d7f | 421 | * Get minutes. |
6a488035 | 422 | * |
76e7a76c | 423 | * @return array |
6a488035 | 424 | */ |
00be9182 | 425 | public function getMinutes() { |
9fab6f51 | 426 | $minutes = array(); |
6a488035 TO |
427 | for ($i = 0; $i < 60; $i = $i + 15) { |
428 | $minutes[$i] = $i; | |
429 | } | |
430 | return $minutes; | |
431 | } | |
432 | ||
433 | /** | |
f9e31d7f | 434 | * Get the Map Provider. |
6a488035 | 435 | * |
a6c01b45 CW |
436 | * @return array |
437 | * array of map providers | |
6a488035 | 438 | */ |
00be9182 | 439 | public static function mapProvider() { |
6a488035 TO |
440 | static $map = NULL; |
441 | if (!$map) { | |
1ec598f3 | 442 | $map = array('' => '- select -') + CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl"); |
6a488035 TO |
443 | } |
444 | return $map; | |
445 | } | |
446 | ||
447 | /** | |
f9e31d7f | 448 | * Get the Geocoding Providers from available plugins. |
6a488035 | 449 | * |
a6c01b45 CW |
450 | * @return array |
451 | * array of geocoder providers | |
6a488035 | 452 | */ |
00be9182 | 453 | public static function geoProvider() { |
6a488035 TO |
454 | static $geo = NULL; |
455 | if (!$geo) { | |
1ec598f3 | 456 | $geo = array('' => '- select -') + CRM_Utils_System::getPluginList('CRM/Utils/Geocode'); |
6a488035 TO |
457 | } |
458 | return $geo; | |
459 | } | |
460 | ||
461 | /** | |
f9e31d7f | 462 | * Get the Address Standardization Providers from available plugins. |
6a488035 | 463 | * |
a6c01b45 CW |
464 | * @return array |
465 | * array of address standardization providers | |
6a488035 | 466 | */ |
00be9182 | 467 | public static function addressProvider() { |
6a488035 TO |
468 | static $addr = NULL; |
469 | if (!$addr) { | |
6795600d | 470 | $addr = CRM_Utils_System::getPluginList('CRM/Utils/Address', '.php', array('BatchUpdate')); |
6a488035 TO |
471 | } |
472 | return $addr; | |
473 | } | |
474 | ||
475 | /** | |
f9e31d7f | 476 | * Different type of Mailing Tokens. |
6a488035 | 477 | * |
76e7a76c | 478 | * @return array |
6a488035 | 479 | */ |
00be9182 | 480 | public static function mailingTokens() { |
c3831ebd EM |
481 | return array( |
482 | '{action.unsubscribe}' => ts('Unsubscribe via email'), | |
483 | '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'), | |
484 | '{action.resubscribe}' => ts('Resubscribe via email'), | |
485 | '{action.resubscribeUrl}' => ts('Resubscribe via web page'), | |
486 | '{action.optOut}' => ts('Opt out via email'), | |
487 | '{action.optOutUrl}' => ts('Opt out via web page'), | |
488 | '{action.forward}' => ts('Forward this email (link)'), | |
489 | '{action.reply}' => ts('Reply to this email (link)'), | |
490 | '{action.subscribeUrl}' => ts('Subscribe via web page'), | |
491 | '{domain.name}' => ts('Domain name'), | |
492 | '{domain.address}' => ts('Domain (organization) address'), | |
493 | '{domain.phone}' => ts('Domain (organization) phone'), | |
494 | '{domain.email}' => ts('Domain (organization) email'), | |
495 | '{mailing.name}' => ts('Mailing name'), | |
496 | '{mailing.group}' => ts('Mailing group'), | |
497 | '{mailing.viewUrl}' => ts('Mailing permalink'), | |
498 | ); | |
6a488035 TO |
499 | } |
500 | ||
501 | /** | |
f9e31d7f | 502 | * Different type of Activity Tokens. |
6a488035 | 503 | * |
76e7a76c | 504 | * @return array |
6a488035 | 505 | */ |
00be9182 | 506 | public static function activityTokens() { |
c3831ebd EM |
507 | return array( |
508 | '{activity.activity_id}' => ts('Activity ID'), | |
509 | '{activity.subject}' => ts('Activity Subject'), | |
510 | '{activity.details}' => ts('Activity Details'), | |
511 | '{activity.activity_date_time}' => ts('Activity Date Time'), | |
512 | ); | |
6a488035 TO |
513 | } |
514 | ||
515 | /** | |
f9e31d7f | 516 | * Different type of Membership Tokens. |
6a488035 | 517 | * |
76e7a76c | 518 | * @return array |
6a488035 | 519 | */ |
00be9182 | 520 | public static function membershipTokens() { |
c3831ebd EM |
521 | return array( |
522 | '{membership.id}' => ts('Membership ID'), | |
523 | '{membership.status}' => ts('Membership Status'), | |
524 | '{membership.type}' => ts('Membership Type'), | |
525 | '{membership.start_date}' => ts('Membership Start Date'), | |
526 | '{membership.join_date}' => ts('Membership Join Date'), | |
527 | '{membership.end_date}' => ts('Membership End Date'), | |
528 | '{membership.fee}' => ts('Membership Fee'), | |
529 | ); | |
6a488035 TO |
530 | } |
531 | ||
532 | /** | |
f9e31d7f | 533 | * Different type of Event Tokens. |
6a488035 | 534 | * |
76e7a76c | 535 | * @return array |
6a488035 | 536 | */ |
00be9182 | 537 | public static function eventTokens() { |
c3831ebd EM |
538 | return array( |
539 | '{event.event_id}' => ts('Event ID'), | |
540 | '{event.title}' => ts('Event Title'), | |
541 | '{event.start_date}' => ts('Event Start Date'), | |
542 | '{event.end_date}' => ts('Event End Date'), | |
543 | '{event.event_type}' => ts('Event Type'), | |
544 | '{event.summary}' => ts('Event Summary'), | |
545 | '{event.contact_email}' => ts('Event Contact Email'), | |
546 | '{event.contact_phone}' => ts('Event Contact Phone'), | |
547 | '{event.description}' => ts('Event Description'), | |
548 | '{event.location}' => ts('Event Location'), | |
549 | '{event.fee_amount}' => ts('Event Fees'), | |
550 | '{event.info_url}' => ts('Event Info URL'), | |
551 | '{event.registration_url}' => ts('Event Registration URL'), | |
21dfd5f5 | 552 | '{event.balance}' => ts('Event Balance'), |
c3831ebd | 553 | ); |
6a488035 TO |
554 | } |
555 | ||
556 | /** | |
f9e31d7f | 557 | * Different type of Event Tokens. |
6a488035 | 558 | * |
76e7a76c | 559 | * @return array |
6a488035 | 560 | */ |
00be9182 | 561 | public static function contributionTokens() { |
18c017c8 | 562 | return array_merge(array( |
c3831ebd EM |
563 | '{contribution.contribution_id}' => ts('Contribution ID'), |
564 | '{contribution.total_amount}' => ts('Total Amount'), | |
565 | '{contribution.fee_amount}' => ts('Fee Amount'), | |
566 | '{contribution.net_amount}' => ts('Net Amount'), | |
c94fc35e | 567 | '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'), |
7bc6b5bb | 568 | '{contribution.receive_date}' => ts('Contribution Date Received'), |
536f0e02 | 569 | '{contribution.payment_instrument}' => ts('Payment Method'), |
c3831ebd EM |
570 | '{contribution.trxn_id}' => ts('Transaction ID'), |
571 | '{contribution.invoice_id}' => ts('Invoice ID'), | |
572 | '{contribution.currency}' => ts('Currency'), | |
573 | '{contribution.cancel_date}' => ts('Contribution Cancel Date'), | |
574 | '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'), | |
575 | '{contribution.receipt_date}' => ts('Receipt Date'), | |
576 | '{contribution.thankyou_date}' => ts('Thank You Date'), | |
577 | '{contribution.contribution_source}' => ts('Contribution Source'), | |
578 | '{contribution.amount_level}' => ts('Amount Level'), | |
579 | //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'), | |
580 | //'{contribution.honor_contact_id}' => ts('Honor Contact ID'), | |
581 | '{contribution.contribution_status_id}' => ts('Contribution Status'), | |
582 | //'{contribution.honor_type_id}' => ts('Honor Type ID'), | |
583 | //'{contribution.address_id}' => ts('Address ID'), | |
584 | '{contribution.check_number}' => ts('Check Number'), | |
585 | '{contribution.campaign}' => ts('Contribution Campaign'), | |
18c017c8 | 586 | ), CRM_Utils_Token::getCustomFieldTokens('contribution', TRUE)); |
6a488035 TO |
587 | } |
588 | ||
589 | /** | |
f9e31d7f | 590 | * Different type of Contact Tokens. |
6a488035 | 591 | * |
76e7a76c | 592 | * @return array |
6a488035 | 593 | */ |
00be9182 | 594 | public static function contactTokens() { |
6a488035 TO |
595 | static $tokens = NULL; |
596 | if (!$tokens) { | |
2aa397bc | 597 | $additionalFields = array( |
353ffa53 | 598 | 'checksum' => array('title' => ts('Checksum')), |
6a488035 TO |
599 | 'contact_id' => array('title' => ts('Internal Contact ID')), |
600 | ); | |
601 | $exportFields = array_merge(CRM_Contact_BAO_Contact::exportableFields(), $additionalFields); | |
602 | ||
603 | $values = array_merge(array_keys($exportFields)); | |
604 | unset($values[0]); | |
605 | ||
606 | //FIXME:skipping some tokens for time being. | |
607 | $skipTokens = array( | |
353ffa53 TO |
608 | 'is_bulkmail', |
609 | 'group', | |
610 | 'tag', | |
611 | 'contact_sub_type', | |
612 | 'note', | |
613 | 'is_deceased', | |
614 | 'deceased_date', | |
615 | 'legal_identifier', | |
616 | 'contact_sub_type', | |
617 | 'user_unique_id', | |
6a488035 | 618 | ); |
ea921622 | 619 | |
72e34731 | 620 | $customFields = CRM_Core_BAO_CustomField::getFields(array('Individual', 'Address')); |
cc615373 | 621 | $legacyTokenNames = array_flip(CRM_Utils_Token::legacyContactTokens()); |
6a488035 | 622 | |
cc615373 | 623 | foreach ($values as $val) { |
6a488035 TO |
624 | if (in_array($val, $skipTokens)) { |
625 | continue; | |
626 | } | |
627 | //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734 | |
72e34731 CW |
628 | $customFieldId = CRM_Core_BAO_CustomField::getKeyID($val); |
629 | if ($customFieldId) { | |
630 | // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored | |
631 | if (!empty($customFields[$customFieldId])) { | |
632 | $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle']; | |
633 | } | |
6a488035 TO |
634 | } |
635 | else { | |
cc615373 CW |
636 | // Support legacy token names |
637 | $tokenName = CRM_Utils_Array::value($val, $legacyTokenNames, $val); | |
638 | $tokens["{contact.$tokenName}"] = $exportFields[$val]['title']; | |
6a488035 TO |
639 | } |
640 | } | |
641 | ||
9950a1c9 | 642 | // Get all the hook tokens too |
6a488035 TO |
643 | $hookTokens = array(); |
644 | CRM_Utils_Hook::tokens($hookTokens); | |
94bf1070 | 645 | foreach ($hookTokens as $tokenValues) { |
6a488035 TO |
646 | foreach ($tokenValues as $key => $value) { |
647 | if (is_numeric($key)) { | |
648 | $key = $value; | |
649 | } | |
650 | if (!preg_match('/^\{[^\}]+\}$/', $key)) { | |
651 | $key = '{' . $key . '}'; | |
652 | } | |
653 | if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) { | |
654 | $value = $matches[1]; | |
655 | } | |
656 | $tokens[$key] = $value; | |
657 | } | |
658 | } | |
659 | } | |
660 | ||
661 | return $tokens; | |
662 | } | |
663 | ||
ea921622 | 664 | /** |
f9e31d7f | 665 | * Different type of Participant Tokens. |
ea921622 | 666 | * |
76e7a76c | 667 | * @return array |
ea921622 | 668 | */ |
00be9182 | 669 | public static function participantTokens() { |
ea921622 KJ |
670 | static $tokens = NULL; |
671 | if (!$tokens) { | |
672 | $exportFields = CRM_Event_BAO_Participant::exportableFields(); | |
673 | ||
674 | $values = array_merge(array_keys($exportFields)); | |
675 | unset($values[0]); | |
676 | ||
677 | // skipping some tokens for time being. | |
678 | $skipTokens = array( | |
353ffa53 TO |
679 | 'event_id', |
680 | 'participant_is_pay_later', | |
681 | 'participant_is_test', | |
682 | 'participant_contact_id', | |
683 | 'participant_fee_currency', | |
684 | 'participant_campaign_id', | |
685 | 'participant_status', | |
686 | 'participant_discount_name', | |
ea921622 KJ |
687 | ); |
688 | ||
689 | $customFields = CRM_Core_BAO_CustomField::getFields('Participant'); | |
690 | ||
691 | foreach ($values as $key => $val) { | |
692 | if (in_array($val, $skipTokens)) { | |
693 | continue; | |
694 | } | |
695 | //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734 | |
696 | if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($val)) { | |
0d8afee2 | 697 | $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : ''; |
ea921622 KJ |
698 | } |
699 | else { | |
700 | $tokens["{participant.$val}"] = $exportFields[$val]['title']; | |
701 | } | |
702 | } | |
703 | } | |
704 | return $tokens; | |
705 | } | |
706 | ||
07945b3c | 707 | /** |
0fe4153d | 708 | * @param int $caseTypeId |
07945b3c CW |
709 | * @return array |
710 | */ | |
0fe4153d | 711 | public static function caseTokens($caseTypeId = NULL) { |
07945b3c CW |
712 | static $tokens = NULL; |
713 | if (!$tokens) { | |
714 | foreach (CRM_Case_BAO_Case::fields() as $field) { | |
715 | $tokens["{case.{$field['name']}}"] = $field['title']; | |
716 | } | |
717 | ||
0fe4153d | 718 | $customFields = CRM_Core_BAO_CustomField::getFields('Case', FALSE, FALSE, $caseTypeId); |
07945b3c CW |
719 | foreach ($customFields as $id => $field) { |
720 | $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}"; | |
721 | } | |
722 | } | |
723 | return $tokens; | |
724 | } | |
725 | ||
6a488035 | 726 | /** |
f9e31d7f | 727 | * CiviCRM supported date input formats. |
76e7a76c CW |
728 | * |
729 | * @return array | |
6a488035 | 730 | */ |
00be9182 | 731 | public static function getDatePluginInputFormats() { |
6a488035 TO |
732 | $dateInputFormats = array( |
733 | "mm/dd/yy" => ts('mm/dd/yyyy (12/31/2009)'), | |
734 | "dd/mm/yy" => ts('dd/mm/yyyy (31/12/2009)'), | |
735 | "yy-mm-dd" => ts('yyyy-mm-dd (2009-12-31)'), | |
736 | "dd-mm-yy" => ts('dd-mm-yyyy (31-12-2009)'), | |
737 | 'dd.mm.yy' => ts('dd.mm.yyyy (31.12.2009)'), | |
738 | "M d, yy" => ts('M d, yyyy (Dec 31, 2009)'), | |
739 | 'd M yy' => ts('d M yyyy (31 Dec 2009)'), | |
740 | "MM d, yy" => ts('MM d, yyyy (December 31, 2009)'), | |
741 | 'd MM yy' => ts('d MM yyyy (31 December 2009)'), | |
742 | "DD, d MM yy" => ts('DD, d MM yyyy (Thursday, 31 December 2009)'), | |
743 | "mm/dd" => ts('mm/dd (12/31)'), | |
744 | "dd-mm" => ts('dd-mm (31-12)'), | |
745 | "yy-mm" => ts('yyyy-mm (2009-12)'), | |
746 | 'M yy' => ts('M yyyy (Dec 2009)'), | |
747 | "yy" => ts('yyyy (2009)'), | |
748 | ); | |
749 | ||
750 | /* | |
e70a7fc0 TO |
751 | Year greater than 2000 get wrong result for following format |
752 | echo date( 'Y-m-d', strtotime( '7 Nov, 2001') ); | |
753 | echo date( 'Y-m-d', strtotime( '7 November, 2001') ); | |
754 | Return current year | |
755 | expected :: 2001-11-07 | |
756 | output :: 2009-11-07 | |
757 | However | |
758 | echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') ); | |
759 | echo date( 'Y-m-d', strtotime( 'November 7, 2001') ); | |
760 | gives proper result | |
76e7a76c | 761 | */ |
6a488035 | 762 | |
6a488035 TO |
763 | return $dateInputFormats; |
764 | } | |
765 | ||
6a488035 | 766 | /** |
f9e31d7f | 767 | * Time formats. |
76e7a76c CW |
768 | * |
769 | * @return array | |
6a488035 | 770 | */ |
00be9182 | 771 | public static function getTimeFormats() { |
6795600d CW |
772 | return array( |
773 | '1' => ts('12 Hours'), | |
6a488035 TO |
774 | '2' => ts('24 Hours'), |
775 | ); | |
6a488035 TO |
776 | } |
777 | ||
778 | /** | |
f9e31d7f | 779 | * Get numeric options. |
79d7553f | 780 | * |
76e7a76c CW |
781 | * @param int $start |
782 | * @param int $end | |
6a488035 | 783 | * |
76e7a76c | 784 | * @return array |
6a488035 TO |
785 | */ |
786 | public static function getNumericOptions($start = 0, $end = 10) { | |
9fab6f51 | 787 | $numericOptions = array(); |
6a488035 | 788 | for ($i = $start; $i <= $end; $i++) { |
2aa397bc | 789 | $numericOptions[$i] = $i; |
6a488035 TO |
790 | } |
791 | return $numericOptions; | |
792 | } | |
f38395f7 KJ |
793 | |
794 | /** | |
f9e31d7f | 795 | * Barcode types. |
76e7a76c CW |
796 | * |
797 | * @return array | |
f38395f7 | 798 | */ |
00be9182 | 799 | public static function getBarcodeTypes() { |
c3831ebd EM |
800 | return array( |
801 | 'barcode' => ts('Linear (1D)'), | |
802 | 'qrcode' => ts('QR code'), | |
803 | ); | |
f38395f7 | 804 | } |
77d0b1f8 | 805 | |
806 | /** | |
f9e31d7f | 807 | * Dedupe rule types. |
76e7a76c CW |
808 | * |
809 | * @return array | |
77d0b1f8 | 810 | */ |
00be9182 | 811 | public static function getDedupeRuleTypes() { |
c3831ebd EM |
812 | return array( |
813 | 'Unsupervised' => ts('Unsupervised'), | |
814 | 'Supervised' => ts('Supervised'), | |
815 | 'General' => ts('General'), | |
816 | ); | |
77d0b1f8 | 817 | } |
f80ce889 | 818 | |
819 | /** | |
f9e31d7f | 820 | * Campaign group types. |
76e7a76c CW |
821 | * |
822 | * @return array | |
f80ce889 | 823 | */ |
00be9182 | 824 | public static function getCampaignGroupTypes() { |
c3831ebd EM |
825 | return array( |
826 | 'Include' => ts('Include'), | |
827 | 'Exclude' => ts('Exclude'), | |
828 | ); | |
f80ce889 | 829 | } |
830 | ||
831 | /** | |
f9e31d7f | 832 | * Subscription history method. |
76e7a76c CW |
833 | * |
834 | * @return array | |
f80ce889 | 835 | */ |
00be9182 | 836 | public static function getSubscriptionHistoryMethods() { |
c3831ebd EM |
837 | return array( |
838 | 'Admin' => ts('Admin'), | |
839 | 'Email' => ts('Email'), | |
840 | 'Web' => ts('Web'), | |
841 | 'API' => ts('API'), | |
842 | ); | |
f80ce889 | 843 | } |
844 | ||
845 | /** | |
f9e31d7f | 846 | * Premium units. |
76e7a76c CW |
847 | * |
848 | * @return array | |
f80ce889 | 849 | */ |
00be9182 | 850 | public static function getPremiumUnits() { |
c3831ebd EM |
851 | return array( |
852 | 'day' => ts('Day'), | |
853 | 'week' => ts('Week'), | |
854 | 'month' => ts('Month'), | |
855 | 'year' => ts('Year'), | |
856 | ); | |
f80ce889 | 857 | } |
56251ea7 | 858 | |
859 | /** | |
f9e31d7f | 860 | * Extension types. |
76e7a76c CW |
861 | * |
862 | * @return array | |
56251ea7 | 863 | */ |
00be9182 | 864 | public static function getExtensionTypes() { |
2aa397bc | 865 | return array( |
c3831ebd EM |
866 | 'payment' => ts('Payment'), |
867 | 'search' => ts('Search'), | |
868 | 'report' => ts('Report'), | |
869 | 'module' => ts('Module'), | |
870 | 'sms' => ts('SMS'), | |
871 | ); | |
56251ea7 | 872 | } |
873 | ||
874 | /** | |
f9e31d7f | 875 | * Job frequency. |
76e7a76c CW |
876 | * |
877 | * @return array | |
56251ea7 | 878 | */ |
00be9182 | 879 | public static function getJobFrequency() { |
c3831ebd | 880 | return array( |
bda41fcb DRJ |
881 | // CRM-17669 |
882 | 'Yearly' => ts('Yearly'), | |
883 | 'Quarter' => ts('Quarterly'), | |
884 | 'Monthly' => ts('Monthly'), | |
885 | 'Weekly' => ts('Weekly'), | |
886 | ||
c3831ebd EM |
887 | 'Daily' => ts('Daily'), |
888 | 'Hourly' => ts('Hourly'), | |
889 | 'Always' => ts('Every time cron job is run'), | |
890 | ); | |
56251ea7 | 891 | } |
e204d358 | 892 | |
893 | /** | |
f9e31d7f | 894 | * Search builder operators. |
76e7a76c CW |
895 | * |
896 | * @return array | |
e204d358 | 897 | */ |
ed56d481 | 898 | public static function getSearchBuilderOperators($fieldType = NULL) { |
759094bd | 899 | $builderOperators = array( |
c3831ebd EM |
900 | '=' => '=', |
901 | '!=' => '≠', | |
902 | '>' => '>', | |
903 | '<' => '<', | |
904 | '>=' => '≥', | |
905 | '<=' => '≤', | |
906 | 'IN' => ts('In'), | |
afa0b07c | 907 | 'NOT IN' => ts('Not In'), |
c3831ebd | 908 | 'LIKE' => ts('Like'), |
afa0b07c | 909 | 'NOT LIKE' => ts('Not Like'), |
c3831ebd EM |
910 | 'RLIKE' => ts('Regex'), |
911 | 'IS EMPTY' => ts('Is Empty'), | |
912 | 'IS NOT EMPTY' => ts('Not Empty'), | |
913 | 'IS NULL' => ts('Is Null'), | |
914 | 'IS NOT NULL' => ts('Not Null'), | |
915 | ); | |
759094bd UP |
916 | if ($fieldType) { |
917 | switch ($fieldType) { | |
918 | case CRM_Utils_Type::T_STRING: | |
919 | unset($builderOperators['>']); | |
920 | unset($builderOperators['<']); | |
921 | unset($builderOperators['>=']); | |
922 | unset($builderOperators['<=']); | |
923 | break; | |
924 | } | |
925 | } | |
926 | return $builderOperators; | |
e204d358 | 927 | } |
928 | ||
929 | /** | |
f9e31d7f | 930 | * Profile group types. |
e204d358 | 931 | * |
76e7a76c | 932 | * @return array |
e204d358 | 933 | */ |
00be9182 | 934 | public static function getProfileGroupType() { |
c3831ebd EM |
935 | $profileGroupType = array( |
936 | 'Activity' => ts('Activities'), | |
937 | 'Contribution' => ts('Contributions'), | |
938 | 'Membership' => ts('Memberships'), | |
939 | 'Participant' => ts('Participants'), | |
940 | ); | |
941 | $contactTypes = self::contactType(); | |
6795600d | 942 | $contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array(); |
481a74f4 | 943 | $profileGroupType = array_merge($contactTypes, $profileGroupType); |
c3831ebd | 944 | |
e204d358 | 945 | return $profileGroupType; |
946 | } | |
947 | ||
948 | ||
949 | /** | |
f9e31d7f | 950 | * Word replacement match type. |
76e7a76c CW |
951 | * |
952 | * @return array | |
e204d358 | 953 | */ |
00be9182 | 954 | public static function getWordReplacementMatchType() { |
c3831ebd | 955 | return array( |
353ffa53 TO |
956 | 'exactMatch' => ts('Exact Match'), |
957 | 'wildcardMatch' => ts('Wildcard Match'), | |
958 | ); | |
e204d358 | 959 | } |
960 | ||
71a707c3 | 961 | /** |
f9e31d7f | 962 | * Mailing group types. |
76e7a76c CW |
963 | * |
964 | * @return array | |
71a707c3 | 965 | */ |
00be9182 | 966 | public static function getMailingGroupTypes() { |
c3831ebd EM |
967 | return array( |
968 | 'Include' => ts('Include'), | |
969 | 'Exclude' => ts('Exclude'), | |
970 | 'Base' => ts('Base'), | |
971 | ); | |
71a707c3 | 972 | } |
973 | ||
974 | /** | |
f9e31d7f | 975 | * Mailing Job Status. |
76e7a76c CW |
976 | * |
977 | * @return array | |
71a707c3 | 978 | */ |
00be9182 | 979 | public static function getMailingJobStatus() { |
c3831ebd EM |
980 | return array( |
981 | 'Scheduled' => ts('Scheduled'), | |
982 | 'Running' => ts('Running'), | |
983 | 'Complete' => ts('Complete'), | |
984 | 'Paused' => ts('Paused'), | |
985 | 'Canceled' => ts('Canceled'), | |
986 | ); | |
71a707c3 | 987 | } |
988 | ||
76e7a76c CW |
989 | /** |
990 | * @return array | |
991 | */ | |
00be9182 | 992 | public static function billingMode() { |
280f1b05 CW |
993 | return array( |
994 | CRM_Core_Payment::BILLING_MODE_FORM => 'form', | |
995 | CRM_Core_Payment::BILLING_MODE_BUTTON => 'button', | |
996 | CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify', | |
997 | ); | |
998 | } | |
999 | ||
367b5943 | 1000 | /** |
1001 | * @return array | |
1002 | */ | |
1003 | public static function contributeMode() { | |
1004 | return array( | |
1005 | CRM_Core_Payment::BILLING_MODE_FORM => 'direct', | |
1006 | CRM_Core_Payment::BILLING_MODE_BUTTON => 'directIPN', | |
1007 | CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify', | |
1008 | ); | |
1009 | } | |
1010 | ||
9775f926 | 1011 | /** |
f9e31d7f | 1012 | * Frequency unit for schedule reminders. |
76e7a76c | 1013 | * |
8fe4b69f CW |
1014 | * @param int $count |
1015 | * For pluralization | |
76e7a76c | 1016 | * @return array |
9775f926 | 1017 | */ |
8fe4b69f CW |
1018 | public static function getRecurringFrequencyUnits($count = 1) { |
1019 | // @todo this used to refer to the 'recur_frequency_unit' option_values which | |
1020 | // is for recurring payments and probably not good to re-use for recurring entities. | |
1021 | // If something other than a hard-coded list is desired, add a new option_group. | |
1022 | return array( | |
1023 | 'hour' => ts('hour', array('plural' => 'hours', 'count' => $count)), | |
1024 | 'day' => ts('day', array('plural' => 'days', 'count' => $count)), | |
1025 | 'week' => ts('week', array('plural' => 'weeks', 'count' => $count)), | |
1026 | 'month' => ts('month', array('plural' => 'months', 'count' => $count)), | |
1027 | 'year' => ts('year', array('plural' => 'years', 'count' => $count)), | |
1028 | ); | |
9775f926 | 1029 | } |
96025800 | 1030 | |
7537a84b J |
1031 | /** |
1032 | * Relative Date Terms. | |
1033 | * | |
1034 | * @return array | |
1035 | */ | |
1036 | public static function getRelativeDateTerms() { | |
1037 | return array( | |
1038 | 'previous' => ts('Previous'), | |
1039 | 'previous_2' => ts('Previous 2'), | |
1040 | 'previous_before' => ts('Prior to Previous'), | |
1041 | 'before_previous' => ts('All Prior to Previous'), | |
1042 | 'earlier' => ts('To End of Previous'), | |
1043 | 'greater_previous' => ts('From End of Previous'), | |
1044 | 'greater' => ts('From Start Of Current'), | |
1045 | 'current' => ts('Current'), | |
1046 | 'ending_3' => ts('Last 3'), | |
1047 | 'ending_2' => ts('Last 2'), | |
1048 | 'ending' => ts('Last'), | |
1049 | 'this' => ts('This'), | |
1050 | 'starting' => ts('Upcoming'), | |
1051 | 'less' => ts('To End of'), | |
1052 | 'next' => ts('Next'), | |
1053 | ); | |
1054 | } | |
1055 | ||
1056 | /** | |
1057 | * Relative Date Units. | |
1058 | * | |
1059 | * @return array | |
1060 | */ | |
1061 | public static function getRelativeDateUnits() { | |
1062 | return array( | |
1063 | 'year' => ts('Years'), | |
1064 | 'fiscal_year' => ts('Fiscal Years'), | |
1065 | 'quarter' => ts('Quarters'), | |
1066 | 'month' => ts('Months'), | |
1067 | 'week' => ts('Weeks'), | |
1068 | 'day' => ts('Days'), | |
1069 | ); | |
1070 | } | |
1071 | ||
0aeb5a1e CW |
1072 | /** |
1073 | * Exportable document formats. | |
1074 | * | |
1075 | * @return array | |
1076 | */ | |
1077 | public static function documentFormat() { | |
1078 | return array( | |
1079 | 'pdf' => ts('Portable Document Format (.pdf)'), | |
1080 | 'docx' => ts('MS Word (.docx)'), | |
1081 | 'odt' => ts('Open Office (.odt)'), | |
1082 | 'html' => ts('Webpage (.html)'), | |
1083 | ); | |
1084 | } | |
1085 | ||
90a73810 | 1086 | /** |
1087 | * Application type of document. | |
1088 | * | |
1089 | * @return array | |
1090 | */ | |
1091 | public static function documentApplicationType() { | |
1092 | return array( | |
1093 | 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', | |
1094 | 'odt' => 'application/vnd.oasis.opendocument.text', | |
1095 | ); | |
1096 | } | |
1097 | ||
1cd7479e | 1098 | /** |
1099 | * Activity Text options. | |
1100 | * | |
1101 | * @return array | |
1102 | */ | |
1103 | public static function activityTextOptions() { | |
1104 | return array( | |
1105 | 2 => ts('Details Only'), | |
1106 | 3 => ts('Subject Only'), | |
1107 | 6 => ts('Both'), | |
1108 | ); | |
1109 | } | |
1110 | ||
6a488035 | 1111 | } |