3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
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
34 * @copyright CiviCRM LLC (c) 2004-2018
38 class CRM_Core_SelectValues
{
45 public static function boolean() {
53 * Preferred mail format.
57 public static function pmf() {
70 public static function privacy() {
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)'),
82 * Various pre defined contact super types.
86 public static function contactType() {
87 static $contactType = NULL;
89 $contactType = CRM_Contact_BAO_ContactType
::basicTypePairs();
95 * Various pre defined unit list.
97 * @param string $unitType
100 public static function unitList($unitType = NULL) {
103 'month' => ts('month'),
104 'year' => ts('year'),
106 if ($unitType == 'duration') {
107 $unitList['lifetime'] = ts('lifetime');
113 * Membership type unit.
117 public static function membershipTypeUnitList() {
118 return self
::unitList('duration');
122 * Various pre defined period types.
126 public static function periodType() {
128 'rolling' => ts('Rolling'),
129 'fixed' => ts('Fixed'),
134 * Various pre defined email selection methods.
138 public static function emailSelectMethods() {
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"),
143 'location-exclude' => ts("Exclude email addresses assigned to the specified location"),
148 * Various pre defined member visibility options.
152 public static function memberVisibility() {
154 'Public' => ts('Public'),
155 'Admin' => ts('Admin'),
160 * Member auto-renew options
164 public static function memberAutoRenew() {
166 ts('No auto-renew option'),
167 ts('Give option, but not required'),
168 ts('Auto-renew required'),
173 * Various pre defined event dates.
177 public static function eventDate() {
179 'start_date' => ts('start date'),
180 'end_date' => ts('end date'),
181 'join_date' => ts('member since'),
186 * Custom form field types.
190 public static function customHtmlType() {
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 'Link' => ts('Link'),
207 'ContactReference' => ts('Autocomplete-Select'),
212 * Various pre defined extensions for dynamic properties and groups.
217 public static function customGroupExtends() {
218 $customGroupExtends = array(
219 'Activity' => ts('Activities'),
220 'Relationship' => ts('Relationships'),
221 'Contribution' => ts('Contributions'),
222 'ContributionRecur' => ts('Recurring Contributions'),
223 'Group' => ts('Groups'),
224 'Membership' => ts('Memberships'),
225 'Event' => ts('Events'),
226 'Participant' => ts('Participants'),
227 'ParticipantRole' => ts('Participants (Role)'),
228 'ParticipantEventName' => ts('Participants (Event Name)'),
229 'ParticipantEventType' => ts('Participants (Event Type)'),
230 'Pledge' => ts('Pledges'),
231 'Grant' => ts('Grants'),
232 'Address' => ts('Addresses'),
233 'Campaign' => ts('Campaigns'),
235 $contactTypes = self
::contactType();
236 $contactTypes = !empty($contactTypes) ?
array('Contact' => 'Contacts') +
$contactTypes : array();
237 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
238 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
239 return $customGroupExtends;
243 * Styles for displaying the custom data group.
247 public static function customGroupStyle() {
250 'Inline' => ts('Inline'),
251 'Tab with table' => ts('Tab with table'),
256 * For displaying the uf group types.
260 public static function ufGroupTypes() {
261 $ufGroupType = array(
262 'Profile' => ts('Standalone Form or Directory'),
263 'Search Profile' => ts('Search Views'),
266 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
267 $ufGroupType +
= array(
268 'User Registration' => ts('Drupal User Registration'),
269 'User Account' => ts('View/Edit Drupal User Account'),
276 * The status of a contact within a group.
280 public static function groupContactStatus() {
282 'Added' => ts('Added'),
283 'Removed' => ts('Removed'),
284 'Pending' => ts('Pending'),
289 * List of Group Types.
293 public static function groupType() {
295 'query' => ts('Dynamic'),
296 'static' => ts('Static'),
301 * Compose the parameters for a date select object.
303 * @param string|NULL $type
305 * @param string|NULL $format
306 * date format (QF format)
307 * @param null $minOffset
308 * @param null $maxOffset
313 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
314 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
316 'addEmptyOption' => TRUE,
317 'emptyOptionText' => ts('- select -'),
318 'emptyOptionValue' => '',
322 $date['format'] = $format;
326 $dao = new CRM_Core_DAO_PreferencesDate();
328 if (!$dao->find(TRUE)) {
329 CRM_Core_Error
::fatal();
332 $maxOffset = $dao->end
;
335 $minOffset = $dao->start
;
338 $date['format'] = $dao->date_format
;
339 $date['time'] = (bool) $dao->time_format
;
342 if (empty($date['format'])) {
343 if ($context == 'Input') {
344 $date['format'] = Civi
::settings()->get('dateInputFormat');
347 $date['format'] = 'M d';
352 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
353 if (!isset($date['time'])) {
354 $date['time'] = FALSE;
358 $date['minYear'] = $year - (int) $minOffset;
359 $date['maxYear'] = $year +
(int) $maxOffset;
364 * Values for UF form visibility options.
368 public static function ufVisibility() {
370 'User and User Admin Only' => ts('User and User Admin Only'),
371 'Public Pages' => ts('Expose Publicly'),
372 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
377 * Values for group form visibility options.
381 public static function groupVisibility() {
383 'User and User Admin Only' => ts('User and User Admin Only'),
384 'Public Pages' => ts('Public Pages'),
389 * Different type of Mailing Components.
393 public static function mailingComponents() {
395 'Header' => ts('Header'),
396 'Footer' => ts('Footer'),
397 'Reply' => ts('Reply Auto-responder'),
398 'OptOut' => ts('Opt-out Message'),
399 'Subscribe' => ts('Subscription Confirmation Request'),
400 'Welcome' => ts('Welcome Message'),
401 'Unsubscribe' => ts('Unsubscribe Message'),
402 'Resubscribe' => ts('Resubscribe Message'),
411 public function getHours() {
413 for ($i = 0; $i <= 6; $i++
) {
424 public function getMinutes() {
426 for ($i = 0; $i < 60; $i = $i +
15) {
433 * Get the Map Provider.
436 * array of map providers
438 public static function mapProvider() {
441 $map = array('' => '- select -') + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
447 * Get the Geocoding Providers from available plugins.
450 * array of geocoder providers
452 public static function geoProvider() {
455 $geo = array('' => '- select -') + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
461 * Get the Address Standardization Providers from available plugins.
464 * array of address standardization providers
466 public static function addressProvider() {
469 $addr = array_merge(['' => '- select -'], CRM_Utils_System
::getPluginList('CRM/Utils/Address', '.php', array('BatchUpdate')));
475 * Different type of Mailing Tokens.
479 public static function mailingTokens() {
481 '{action.unsubscribe}' => ts('Unsubscribe via email'),
482 '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
483 '{action.resubscribe}' => ts('Resubscribe via email'),
484 '{action.resubscribeUrl}' => ts('Resubscribe via web page'),
485 '{action.optOut}' => ts('Opt out via email'),
486 '{action.optOutUrl}' => ts('Opt out via web page'),
487 '{action.forward}' => ts('Forward this email (link)'),
488 '{action.reply}' => ts('Reply to this email (link)'),
489 '{action.subscribeUrl}' => ts('Subscribe via web page'),
490 '{domain.name}' => ts('Domain name'),
491 '{domain.address}' => ts('Domain (organization) address'),
492 '{domain.phone}' => ts('Domain (organization) phone'),
493 '{domain.email}' => ts('Domain (organization) email'),
494 '{mailing.name}' => ts('Mailing name'),
495 '{mailing.group}' => ts('Mailing group'),
496 '{mailing.viewUrl}' => ts('Mailing permalink'),
501 * Different type of Activity Tokens.
505 public static function activityTokens() {
507 '{activity.activity_id}' => ts('Activity ID'),
508 '{activity.subject}' => ts('Activity Subject'),
509 '{activity.details}' => ts('Activity Details'),
510 '{activity.activity_date_time}' => ts('Activity Date Time'),
515 * Different type of Membership Tokens.
519 public static function membershipTokens() {
521 '{membership.id}' => ts('Membership ID'),
522 '{membership.status}' => ts('Membership Status'),
523 '{membership.type}' => ts('Membership Type'),
524 '{membership.start_date}' => ts('Membership Start Date'),
525 '{membership.join_date}' => ts('Membership Join Date'),
526 '{membership.end_date}' => ts('Membership End Date'),
527 '{membership.fee}' => ts('Membership Fee'),
532 * Different type of Event Tokens.
536 public static function eventTokens() {
538 '{event.event_id}' => ts('Event ID'),
539 '{event.title}' => ts('Event Title'),
540 '{event.start_date}' => ts('Event Start Date'),
541 '{event.end_date}' => ts('Event End Date'),
542 '{event.event_type}' => ts('Event Type'),
543 '{event.summary}' => ts('Event Summary'),
544 '{event.contact_email}' => ts('Event Contact Email'),
545 '{event.contact_phone}' => ts('Event Contact Phone'),
546 '{event.description}' => ts('Event Description'),
547 '{event.location}' => ts('Event Location'),
548 '{event.fee_amount}' => ts('Event Fees'),
549 '{event.info_url}' => ts('Event Info URL'),
550 '{event.registration_url}' => ts('Event Registration URL'),
551 '{event.balance}' => ts('Event Balance'),
556 * Different type of Event Tokens.
560 public static function contributionTokens() {
561 return array_merge(array(
562 '{contribution.contribution_id}' => ts('Contribution ID'),
563 '{contribution.total_amount}' => ts('Total Amount'),
564 '{contribution.fee_amount}' => ts('Fee Amount'),
565 '{contribution.net_amount}' => ts('Net Amount'),
566 '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
567 '{contribution.receive_date}' => ts('Contribution Date Received'),
568 '{contribution.payment_instrument}' => ts('Payment Method'),
569 '{contribution.trxn_id}' => ts('Transaction ID'),
570 '{contribution.invoice_id}' => ts('Invoice ID'),
571 '{contribution.currency}' => ts('Currency'),
572 '{contribution.cancel_date}' => ts('Contribution Cancel Date'),
573 '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'),
574 '{contribution.receipt_date}' => ts('Receipt Date'),
575 '{contribution.thankyou_date}' => ts('Thank You Date'),
576 '{contribution.contribution_source}' => ts('Contribution Source'),
577 '{contribution.amount_level}' => ts('Amount Level'),
578 //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'),
579 //'{contribution.honor_contact_id}' => ts('Honor Contact ID'),
580 '{contribution.contribution_status_id}' => ts('Contribution Status'),
581 //'{contribution.honor_type_id}' => ts('Honor Type ID'),
582 //'{contribution.address_id}' => ts('Address ID'),
583 '{contribution.check_number}' => ts('Check Number'),
584 '{contribution.campaign}' => ts('Contribution Campaign'),
585 ), CRM_Utils_Token
::getCustomFieldTokens('contribution', TRUE));
589 * Different type of Contact Tokens.
593 public static function contactTokens() {
594 static $tokens = NULL;
596 $additionalFields = array(
597 'checksum' => array('title' => ts('Checksum')),
598 'contact_id' => array('title' => ts('Internal Contact ID')),
600 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
602 $values = array_merge(array_keys($exportFields));
605 //FIXME:skipping some tokens for time being.
619 $customFields = CRM_Core_BAO_CustomField
::getFields(array('Individual', 'Address'));
620 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
622 foreach ($values as $val) {
623 if (in_array($val, $skipTokens)) {
626 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
627 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
628 if ($customFieldId) {
629 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
630 if (!empty($customFields[$customFieldId])) {
631 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
635 // Support legacy token names
636 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
637 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
641 // Get all the hook tokens too
642 $hookTokens = array();
643 CRM_Utils_Hook
::tokens($hookTokens);
644 foreach ($hookTokens as $tokenValues) {
645 foreach ($tokenValues as $key => $value) {
646 if (is_numeric($key)) {
649 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
650 $key = '{' . $key . '}';
652 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
653 $value = $matches[1];
655 $tokens[$key] = $value;
664 * Different type of Participant Tokens.
668 public static function participantTokens() {
669 static $tokens = NULL;
671 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
673 $values = array_merge(array_keys($exportFields));
676 // skipping some tokens for time being.
679 'participant_is_pay_later',
680 'participant_is_test',
681 'participant_contact_id',
682 'participant_fee_currency',
683 'participant_campaign_id',
684 'participant_status',
685 'participant_discount_name',
688 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
690 foreach ($values as $key => $val) {
691 if (in_array($val, $skipTokens)) {
694 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
695 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
696 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
699 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
707 * @param int $caseTypeId
710 public static function caseTokens($caseTypeId = NULL) {
711 static $tokens = NULL;
713 foreach (CRM_Case_BAO_Case
::fields() as $field) {
714 $tokens["{case.{$field['name']}}"] = $field['title'];
717 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
718 foreach ($customFields as $id => $field) {
719 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
726 * CiviCRM supported date input formats.
730 public static function getDatePluginInputFormats() {
731 $dateInputFormats = array(
732 "mm/dd/yy" => ts('mm/dd/yyyy (12/31/2009)'),
733 "dd/mm/yy" => ts('dd/mm/yyyy (31/12/2009)'),
734 "yy-mm-dd" => ts('yyyy-mm-dd (2009-12-31)'),
735 "dd-mm-yy" => ts('dd-mm-yyyy (31-12-2009)'),
736 'dd.mm.yy' => ts('dd.mm.yyyy (31.12.2009)'),
737 "M d, yy" => ts('M d, yyyy (Dec 31, 2009)'),
738 'd M yy' => ts('d M yyyy (31 Dec 2009)'),
739 "MM d, yy" => ts('MM d, yyyy (December 31, 2009)'),
740 'd MM yy' => ts('d MM yyyy (31 December 2009)'),
741 "DD, d MM yy" => ts('DD, d MM yyyy (Thursday, 31 December 2009)'),
742 "mm/dd" => ts('mm/dd (12/31)'),
743 "dd-mm" => ts('dd-mm (31-12)'),
744 "yy-mm" => ts('yyyy-mm (2009-12)'),
745 'M yy' => ts('M yyyy (Dec 2009)'),
746 "yy" => ts('yyyy (2009)'),
750 Year greater than 2000 get wrong result for following format
751 echo date( 'Y-m-d', strtotime( '7 Nov, 2001') );
752 echo date( 'Y-m-d', strtotime( '7 November, 2001') );
754 expected :: 2001-11-07
757 echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') );
758 echo date( 'Y-m-d', strtotime( 'November 7, 2001') );
762 return $dateInputFormats;
770 public static function getTimeFormats() {
772 '1' => ts('12 Hours'),
773 '2' => ts('24 Hours'),
778 * Get numeric options.
785 public static function getNumericOptions($start = 0, $end = 10) {
786 $numericOptions = array();
787 for ($i = $start; $i <= $end; $i++
) {
788 $numericOptions[$i] = $i;
790 return $numericOptions;
798 public static function getBarcodeTypes() {
800 'barcode' => ts('Linear (1D)'),
801 'qrcode' => ts('QR code'),
810 public static function getDedupeRuleTypes() {
812 'Unsupervised' => ts('Unsupervised'),
813 'Supervised' => ts('Supervised'),
814 'General' => ts('General'),
819 * Campaign group types.
823 public static function getCampaignGroupTypes() {
825 'Include' => ts('Include'),
826 'Exclude' => ts('Exclude'),
831 * Subscription history method.
835 public static function getSubscriptionHistoryMethods() {
837 'Admin' => ts('Admin'),
838 'Email' => ts('Email'),
849 public static function getPremiumUnits() {
852 'week' => ts('Week'),
853 'month' => ts('Month'),
854 'year' => ts('Year'),
863 public static function getExtensionTypes() {
865 'payment' => ts('Payment'),
866 'search' => ts('Search'),
867 'report' => ts('Report'),
868 'module' => ts('Module'),
878 public static function getJobFrequency() {
881 'Yearly' => ts('Yearly'),
882 'Quarter' => ts('Quarterly'),
883 'Monthly' => ts('Monthly'),
884 'Weekly' => ts('Weekly'),
886 'Daily' => ts('Daily'),
887 'Hourly' => ts('Hourly'),
888 'Always' => ts('Every time cron job is run'),
893 * Search builder operators.
897 public static function getSearchBuilderOperators($fieldType = NULL) {
906 'NOT IN' => ts('Not In'),
907 'LIKE' => ts('Like'),
908 'NOT LIKE' => ts('Not Like'),
909 'RLIKE' => ts('Regex'),
910 'IS EMPTY' => ts('Is Empty'),
911 'IS NOT EMPTY' => ts('Not Empty'),
912 'IS NULL' => ts('Is Null'),
913 'IS NOT NULL' => ts('Not Null'),
918 * Profile group types.
922 public static function getProfileGroupType() {
923 $profileGroupType = array(
924 'Activity' => ts('Activities'),
925 'Contribution' => ts('Contributions'),
926 'Membership' => ts('Memberships'),
927 'Participant' => ts('Participants'),
929 $contactTypes = self
::contactType();
930 $contactTypes = !empty($contactTypes) ?
array('Contact' => 'Contacts') +
$contactTypes : array();
931 $profileGroupType = array_merge($contactTypes, $profileGroupType);
933 return $profileGroupType;
938 * Word replacement match type.
942 public static function getWordReplacementMatchType() {
944 'exactMatch' => ts('Exact Match'),
945 'wildcardMatch' => ts('Wildcard Match'),
950 * Mailing group types.
954 public static function getMailingGroupTypes() {
956 'Include' => ts('Include'),
957 'Exclude' => ts('Exclude'),
958 'Base' => ts('Base'),
963 * Mailing Job Status.
967 public static function getMailingJobStatus() {
969 'Scheduled' => ts('Scheduled'),
970 'Running' => ts('Running'),
971 'Complete' => ts('Complete'),
972 'Paused' => ts('Paused'),
973 'Canceled' => ts('Canceled'),
980 public static function billingMode() {
982 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
983 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
984 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
991 public static function contributeMode() {
993 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
994 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
995 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
1000 * Frequency unit for schedule reminders.
1006 public static function getRecurringFrequencyUnits($count = 1) {
1007 // @todo this used to refer to the 'recur_frequency_unit' option_values which
1008 // is for recurring payments and probably not good to re-use for recurring entities.
1009 // If something other than a hard-coded list is desired, add a new option_group.
1011 'hour' => ts('hour', array('plural' => 'hours', 'count' => $count)),
1012 'day' => ts('day', array('plural' => 'days', 'count' => $count)),
1013 'week' => ts('week', array('plural' => 'weeks', 'count' => $count)),
1014 'month' => ts('month', array('plural' => 'months', 'count' => $count)),
1015 'year' => ts('year', array('plural' => 'years', 'count' => $count)),
1020 * Relative Date Terms.
1024 public static function getRelativeDateTerms() {
1026 'previous' => ts('Previous'),
1027 'previous_2' => ts('Previous 2'),
1028 'previous_before' => ts('Prior to Previous'),
1029 'before_previous' => ts('All Prior to Previous'),
1030 'earlier' => ts('To End of Previous'),
1031 'greater_previous' => ts('From End of Previous'),
1032 'greater' => ts('From Start Of Current'),
1033 'current' => ts('Current'),
1034 'ending_3' => ts('Last 3'),
1035 'ending_2' => ts('Last 2'),
1036 'ending' => ts('Last'),
1037 'this' => ts('This'),
1038 'starting' => ts('Upcoming'),
1039 'less' => ts('To End of'),
1040 'next' => ts('Next'),
1045 * Relative Date Units.
1049 public static function getRelativeDateUnits() {
1051 'year' => ts('Years'),
1052 'fiscal_year' => ts('Fiscal Years'),
1053 'quarter' => ts('Quarters'),
1054 'month' => ts('Months'),
1055 'week' => ts('Weeks'),
1056 'day' => ts('Days'),
1061 * Exportable document formats.
1065 public static function documentFormat() {
1067 'pdf' => ts('Portable Document Format (.pdf)'),
1068 'docx' => ts('MS Word (.docx)'),
1069 'odt' => ts('Open Office (.odt)'),
1070 'html' => ts('Webpage (.html)'),
1075 * Application type of document.
1079 public static function documentApplicationType() {
1081 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1082 'odt' => 'application/vnd.oasis.opendocument.text',
1087 * Activity Text options.
1091 public static function activityTextOptions() {
1093 2 => ts('Details Only'),
1094 3 => ts('Subject Only'),
1100 * Relationship permissions
1104 public static function getPermissionedRelationshipOptions() {
1106 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1107 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1108 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1113 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1116 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1118 public static function getDashboardEntriesCount() {
1120 $optionValues[-1] = ts('show all');
1121 for ($i = 10; $i <= 100; $i +
= 10) {
1122 $optionValues[$i] = $i;
1124 return $optionValues;
1128 * Dropdown options for quicksearch in the menu
1132 public static function quicksearchOptions() {
1133 $includeEmail = civicrm_api3('setting', 'getvalue', array('name' => 'includeEmailInName', 'group' => 'Search Preferences'));
1135 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1136 'contact_id' => ts('Contact ID'),
1137 'external_identifier' => ts('External ID'),
1138 'first_name' => ts('First Name'),
1139 'last_name' => ts('Last Name'),
1140 'email' => ts('Email'),
1141 'phone_numeric' => ts('Phone'),
1142 'street_address' => ts('Street Address'),
1143 'city' => ts('City'),
1144 'postal_code' => ts('Postal Code'),
1145 'job_title' => ts('Job Title'),
1147 $custom = civicrm_api3('CustomField', 'get', [
1148 'return' => ['name', 'label', 'custom_group_id.title'],
1149 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1150 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1151 'custom_group_id.is_active' => 1,
1153 'is_searchable' => 1,
1154 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1156 foreach ($custom['values'] as $field) {
1157 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];