3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * One place to store frequently used values in Select Elements. Note that
14 * some of the below elements will be dynamic, so we'll probably have a
15 * smart caching scheme on a per domain basis
18 * @copyright CiviCRM LLC https://civicrm.org/licensing
22 class CRM_Core_SelectValues
{
29 public static function boolean() {
37 * Preferred mail format.
41 public static function pmf() {
54 public static function privacy() {
56 'do_not_phone' => ts('Do not phone'),
57 'do_not_email' => ts('Do not email'),
58 'do_not_mail' => ts('Do not mail'),
59 'do_not_sms' => ts('Do not sms'),
60 'do_not_trade' => ts('Do not trade'),
61 'is_opt_out' => ts('No bulk emails (User Opt Out)'),
66 * Various pre defined contact super types.
70 public static function contactType() {
71 return CRM_Contact_BAO_ContactType
::basicTypePairs();
75 * Various pre defined unit list.
77 * @param string $unitType
80 public static function unitList($unitType = NULL) {
83 'month' => ts('month'),
86 if ($unitType === 'duration') {
87 $unitList['lifetime'] = ts('lifetime');
93 * Membership type unit.
97 public static function membershipTypeUnitList() {
98 return self
::unitList('duration');
102 * Various pre defined period types.
106 public static function periodType() {
108 'rolling' => ts('Rolling'),
109 'fixed' => ts('Fixed'),
114 * Various pre defined email selection methods.
118 public static function emailSelectMethods() {
120 'automatic' => ts('Automatic'),
121 'location-only' => ts('Only send to email addresses assigned to the specified location'),
122 'location-prefer' => ts('Prefer email addresses assigned to the specified location'),
123 'location-exclude' => ts('Exclude email addresses assigned to the specified location'),
128 * Various pre defined member visibility options.
132 public static function memberVisibility() {
134 'Public' => ts('Public'),
135 'Admin' => ts('Admin'),
140 * Member auto-renew options
144 public static function memberAutoRenew() {
146 ts('No auto-renew option'),
147 ts('Give option, but not required'),
148 ts('Auto-renew required'),
153 * Various pre defined event dates.
157 public static function eventDate() {
159 'start_date' => ts('start date'),
160 'end_date' => ts('end date'),
161 'join_date' => ts('member since'),
166 * Custom form field types.
170 public static function customHtmlType() {
172 'Text' => ts('Single-line input field (text or numeric)'),
173 'TextArea' => ts('Multi-line text box (textarea)'),
174 'Select' => ts('Drop-down (select list)'),
175 'Radio' => ts('Radio buttons'),
176 'CheckBox' => ts('Checkbox(es)'),
177 'Select Date' => ts('Select Date'),
178 'File' => ts('File'),
179 'Select State/Province' => ts('Select State/Province'),
180 'Select Country' => ts('Select Country'),
181 'RichTextEditor' => ts('Rich Text Editor'),
182 'Autocomplete-Select' => ts('Autocomplete-Select'),
183 'Link' => ts('Link'),
184 'ContactReference' => ts('Autocomplete-Select'),
189 * Various pre defined extensions for dynamic properties and groups.
194 public static function customGroupExtends() {
195 $customGroupExtends = [
196 'Activity' => ts('Activities'),
197 'Relationship' => ts('Relationships'),
198 'Contribution' => ts('Contributions'),
199 'ContributionRecur' => ts('Recurring Contributions'),
200 'Group' => ts('Groups'),
201 'Membership' => ts('Memberships'),
202 'Event' => ts('Events'),
203 'Participant' => ts('Participants'),
204 'ParticipantRole' => ts('Participants (Role)'),
205 'ParticipantEventName' => ts('Participants (Event Name)'),
206 'ParticipantEventType' => ts('Participants (Event Type)'),
207 'Pledge' => ts('Pledges'),
208 'Grant' => ts('Grants'),
209 'Address' => ts('Addresses'),
210 'Campaign' => ts('Campaigns'),
212 $contactTypes = self
::contactType();
213 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
214 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
215 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
216 return $customGroupExtends;
220 * Styles for displaying the custom data group.
224 public static function customGroupStyle() {
227 'Inline' => ts('Inline'),
228 'Tab with table' => ts('Tab with table'),
233 * For displaying the uf group types.
237 public static function ufGroupTypes() {
239 'Profile' => ts('Standalone Form or Directory'),
240 'Search Profile' => ts('Search Views'),
243 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
245 'User Registration' => ts('Drupal User Registration'),
246 'User Account' => ts('View/Edit Drupal User Account'),
253 * The status of a contact within a group.
257 public static function groupContactStatus() {
259 'Added' => ts('Added'),
260 'Removed' => ts('Removed'),
261 'Pending' => ts('Pending'),
266 * List of Group Types.
270 public static function groupType() {
272 'query' => ts('Dynamic'),
273 'static' => ts('Static'),
278 * Compose the parameters for a date select object.
280 * @param string|null $type
282 * @param string|null $format
283 * date format (QF format)
284 * @param null $minOffset
285 * @param null $maxOffset
286 * @param string $context
290 * @throws CRM_Core_Exception
292 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
293 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
295 'addEmptyOption' => TRUE,
296 'emptyOptionText' => ts('- select -'),
297 'emptyOptionValue' => '',
301 $date['format'] = $format;
305 $dao = new CRM_Core_DAO_PreferencesDate();
307 if (!$dao->find(TRUE)) {
308 throw new CRM_Core_Exception('Date preferences not configured.');
311 $maxOffset = $dao->end
;
314 $minOffset = $dao->start
;
317 $date['format'] = $dao->date_format
;
318 $date['time'] = (bool) $dao->time_format
;
321 if (empty($date['format'])) {
322 if ($context === 'Input') {
323 $date['format'] = Civi
::settings()->get('dateInputFormat');
326 $date['format'] = 'M d';
331 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
332 if (!isset($date['time'])) {
333 $date['time'] = FALSE;
337 $date['minYear'] = $year - (int) $minOffset;
338 $date['maxYear'] = $year +
(int) $maxOffset;
343 * Values for UF form visibility options.
347 public static function ufVisibility() {
349 'User and User Admin Only' => ts('User and User Admin Only'),
350 'Public Pages' => ts('Expose Publicly'),
351 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
356 * Values for group form visibility options.
360 public static function groupVisibility() {
362 'User and User Admin Only' => ts('User and User Admin Only'),
363 'Public Pages' => ts('Public Pages'),
368 * Different type of Mailing Components.
372 public static function mailingComponents() {
374 'Header' => ts('Header'),
375 'Footer' => ts('Footer'),
376 'Reply' => ts('Reply Auto-responder'),
377 'OptOut' => ts('Opt-out Message'),
378 'Subscribe' => ts('Subscription Confirmation Request'),
379 'Welcome' => ts('Welcome Message'),
380 'Unsubscribe' => ts('Unsubscribe Message'),
381 'Resubscribe' => ts('Resubscribe Message'),
390 public function getHours() {
392 for ($i = 0; $i <= 6; $i++
) {
403 public function getMinutes() {
405 for ($i = 0; $i < 60; $i = $i +
15) {
412 * Get the Map Provider.
415 * array of map providers
417 public static function mapProvider() {
420 $map = ['' => '- select -'] + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
426 * Get the Geocoding Providers from available plugins.
429 * array of geocoder providers
431 public static function geoProvider() {
434 $geo = ['' => '- select -'] + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
440 * Get options for displaying tax.
444 * @throws \CRM_Core_Exception
446 public function taxDisplayOptions() {
448 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
449 1 => CRM_Utils_Money
::format(120),
451 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
452 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
454 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
455 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
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', ['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 '{mailing.key}' => ts('Mailing key'),
491 '{mailing.name}' => ts('Mailing name'),
492 '{mailing.group}' => ts('Mailing group'),
493 '{mailing.viewUrl}' => ts('Mailing permalink'),
494 ] + self
::domainTokens();
502 public static function domainTokens() {
504 '{domain.name}' => ts('Domain name'),
505 '{domain.address}' => ts('Domain (organization) address'),
506 '{domain.phone}' => ts('Domain (organization) phone'),
507 '{domain.email}' => ts('Domain (organization) email'),
512 * Different type of Activity Tokens.
516 public static function activityTokens() {
518 '{activity.activity_id}' => ts('Activity ID'),
519 '{activity.subject}' => ts('Activity Subject'),
520 '{activity.details}' => ts('Activity Details'),
521 '{activity.activity_date_time}' => ts('Activity Date Time'),
526 * Different type of Membership Tokens.
530 public static function membershipTokens() {
532 '{membership.id}' => ts('Membership ID'),
533 '{membership.status}' => ts('Membership Status'),
534 '{membership.type}' => ts('Membership Type'),
535 '{membership.start_date}' => ts('Membership Start Date'),
536 '{membership.join_date}' => ts('Membership Join Date'),
537 '{membership.end_date}' => ts('Membership End Date'),
538 '{membership.fee}' => ts('Membership Fee'),
543 * Different type of Event Tokens.
547 public static function eventTokens() {
549 '{event.event_id}' => ts('Event ID'),
550 '{event.title}' => ts('Event Title'),
551 '{event.start_date}' => ts('Event Start Date'),
552 '{event.end_date}' => ts('Event End Date'),
553 '{event.event_type}' => ts('Event Type'),
554 '{event.summary}' => ts('Event Summary'),
555 '{event.contact_email}' => ts('Event Contact Email'),
556 '{event.contact_phone}' => ts('Event Contact Phone'),
557 '{event.description}' => ts('Event Description'),
558 '{event.location}' => ts('Event Location'),
559 '{event.fee_amount}' => ts('Event Fees'),
560 '{event.info_url}' => ts('Event Info URL'),
561 '{event.registration_url}' => ts('Event Registration URL'),
562 '{event.balance}' => ts('Event Balance'),
567 * Different type of Event Tokens.
571 public static function contributionTokens() {
573 '{contribution.contribution_id}' => ts('Contribution ID'),
574 '{contribution.total_amount}' => ts('Total Amount'),
575 '{contribution.fee_amount}' => ts('Fee Amount'),
576 '{contribution.net_amount}' => ts('Net Amount'),
577 '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
578 '{contribution.receive_date}' => ts('Contribution Date Received'),
579 '{contribution.payment_instrument}' => ts('Payment Method'),
580 '{contribution.trxn_id}' => ts('Transaction ID'),
581 '{contribution.invoice_id}' => ts('Invoice ID'),
582 '{contribution.currency}' => ts('Currency'),
583 '{contribution.cancel_date}' => ts('Contribution Cancel Date'),
584 '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'),
585 '{contribution.receipt_date}' => ts('Receipt Date'),
586 '{contribution.thankyou_date}' => ts('Thank You Date'),
587 '{contribution.contribution_source}' => ts('Contribution Source'),
588 '{contribution.amount_level}' => ts('Amount Level'),
589 //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'),
590 //'{contribution.honor_contact_id}' => ts('Honor Contact ID'),
591 '{contribution.contribution_status_id}' => ts('Contribution Status'),
592 //'{contribution.honor_type_id}' => ts('Honor Type ID'),
593 //'{contribution.address_id}' => ts('Address ID'),
594 '{contribution.check_number}' => ts('Check Number'),
595 '{contribution.campaign}' => ts('Contribution Campaign'),
596 ], CRM_Utils_Token
::getCustomFieldTokens('contribution', TRUE));
600 * Different type of Contact Tokens.
604 public static function contactTokens() {
605 static $tokens = NULL;
607 $additionalFields = [
608 'checksum' => ['title' => ts('Checksum')],
609 'contact_id' => ['title' => ts('Internal Contact ID')],
611 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
613 $values = array_merge(array_keys($exportFields));
616 //FIXME:skipping some tokens for time being.
630 $customFields = CRM_Core_BAO_CustomField
::getFields(['Individual', 'Address']);
631 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
633 foreach ($values as $val) {
634 if (in_array($val, $skipTokens)) {
637 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
638 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
639 if ($customFieldId) {
640 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
641 if (!empty($customFields[$customFieldId])) {
642 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
646 // Support legacy token names
647 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
648 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
652 // Get all the hook tokens too
654 CRM_Utils_Hook
::tokens($hookTokens);
655 foreach ($hookTokens as $tokenValues) {
656 foreach ($tokenValues as $key => $value) {
657 if (is_numeric($key)) {
660 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
661 $key = '{' . $key . '}';
663 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
664 $value = $matches[1];
666 $tokens[$key] = $value;
675 * Different type of Participant Tokens.
679 public static function participantTokens() {
680 static $tokens = NULL;
682 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
684 $values = array_merge(array_keys($exportFields));
687 // skipping some tokens for time being.
690 'participant_is_pay_later',
691 'participant_is_test',
692 'participant_contact_id',
693 'participant_fee_currency',
694 'participant_campaign_id',
695 'participant_status',
696 'participant_discount_name',
699 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
701 foreach ($values as $key => $val) {
702 if (in_array($val, $skipTokens)) {
705 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
706 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
707 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
710 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
718 * @param int $caseTypeId
721 public static function caseTokens($caseTypeId = NULL) {
722 static $tokens = NULL;
724 foreach (CRM_Case_BAO_Case
::fields() as $field) {
725 $tokens["{case.{$field['name']}}"] = $field['title'];
728 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
729 foreach ($customFields as $id => $field) {
730 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
737 * CiviCRM supported date input formats.
741 public static function getDatePluginInputFormats() {
743 'mm/dd/yy' => ts('mm/dd/yy (12/31/2009)'),
744 'dd/mm/yy' => ts('dd/mm/yy (31/12/2009)'),
745 'yy-mm-dd' => ts('yy-mm-dd (2009-12-31)'),
746 'dd-mm-yy' => ts('dd-mm-yy (31-12-2009)'),
747 'dd.mm.yy' => ts('dd.mm.yy (31.12.2009)'),
748 'M d, yy' => ts('M d, yy (Dec 31, 2009)'),
749 'd M yy' => ts('d M yy (31 Dec 2009)'),
750 'MM d, yy' => ts('MM d, yy (December 31, 2009)'),
751 'd MM yy' => ts('d MM yy (31 December 2009)'),
752 'DD, d MM yy' => ts('DD, d MM yy (Thursday, 31 December 2009)'),
753 'mm/dd' => ts('mm/dd (12/31)'),
754 'dd-mm' => ts('dd-mm (31-12)'),
755 'yy-mm' => ts('yy-mm (2009-12)'),
756 'M yy' => ts('M yy (Dec 2009)'),
757 'yy' => ts('yy (2009)'),
766 public static function getTimeFormats() {
768 '1' => ts('12 Hours'),
769 '2' => ts('24 Hours'),
774 * Get numeric options.
781 public static function getNumericOptions($start = 0, $end = 10) {
782 $numericOptions = [];
783 for ($i = $start; $i <= $end; $i++
) {
784 $numericOptions[$i] = $i;
786 return $numericOptions;
794 public static function getBarcodeTypes() {
796 'barcode' => ts('Linear (1D)'),
797 'qrcode' => ts('QR code'),
806 public static function getDedupeRuleTypes() {
808 'Unsupervised' => ts('Unsupervised'),
809 'Supervised' => ts('Supervised'),
810 'General' => ts('General'),
815 * Campaign group types.
819 public static function getCampaignGroupTypes() {
821 'Include' => ts('Include'),
822 'Exclude' => ts('Exclude'),
827 * Subscription history method.
831 public static function getSubscriptionHistoryMethods() {
833 'Admin' => ts('Admin'),
834 'Email' => ts('Email'),
845 public static function getPremiumUnits() {
848 'week' => ts('Week'),
849 'month' => ts('Month'),
850 'year' => ts('Year'),
859 public static function getExtensionTypes() {
861 'payment' => ts('Payment'),
862 'search' => ts('Search'),
863 'report' => ts('Report'),
864 'module' => ts('Module'),
874 public static function getJobFrequency() {
877 'Yearly' => ts('Yearly'),
878 'Quarter' => ts('Quarterly'),
879 'Monthly' => ts('Monthly'),
880 'Weekly' => ts('Weekly'),
882 'Daily' => ts('Daily'),
883 'Hourly' => ts('Hourly'),
884 'Always' => ts('Every time cron job is run'),
889 * Search builder operators.
893 public static function getSearchBuilderOperators() {
902 'NOT IN' => ts('Not In'),
903 'LIKE' => ts('Like'),
904 'NOT LIKE' => ts('Not Like'),
905 'RLIKE' => ts('Regex'),
906 'IS EMPTY' => ts('Is Empty'),
907 'IS NOT EMPTY' => ts('Not Empty'),
908 'IS NULL' => ts('Is Null'),
909 'IS NOT NULL' => ts('Not Null'),
914 * Profile group types.
918 public static function getProfileGroupType() {
919 $profileGroupType = [
920 'Activity' => ts('Activities'),
921 'Contribution' => ts('Contributions'),
922 'Membership' => ts('Memberships'),
923 'Participant' => ts('Participants'),
925 $contactTypes = self
::contactType();
926 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
927 $profileGroupType = array_merge($contactTypes, $profileGroupType);
929 return $profileGroupType;
933 * Word replacement match type.
937 public static function getWordReplacementMatchType() {
939 'exactMatch' => ts('Exact Match'),
940 'wildcardMatch' => ts('Wildcard Match'),
945 * Mailing group types.
949 public static function getMailingGroupTypes() {
951 'Include' => ts('Include'),
952 'Exclude' => ts('Exclude'),
953 'Base' => ts('Base'),
958 * Mailing Job Status.
962 public static function getMailingJobStatus() {
964 'Scheduled' => ts('Scheduled'),
965 'Running' => ts('Running'),
966 'Complete' => ts('Complete'),
967 'Paused' => ts('Paused'),
968 'Canceled' => ts('Canceled'),
975 public static function billingMode() {
977 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
978 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
979 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
986 public static function contributeMode() {
988 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
989 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
990 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
995 * Frequency unit for schedule reminders.
1001 public static function getRecurringFrequencyUnits($count = 1) {
1002 // @todo this used to refer to the 'recur_frequency_unit' option_values which
1003 // is for recurring payments and probably not good to re-use for recurring entities.
1004 // If something other than a hard-coded list is desired, add a new option_group.
1006 'hour' => ts('hour', ['plural' => 'hours', 'count' => $count]),
1007 'day' => ts('day', ['plural' => 'days', 'count' => $count]),
1008 'week' => ts('week', ['plural' => 'weeks', 'count' => $count]),
1009 'month' => ts('month', ['plural' => 'months', 'count' => $count]),
1010 'year' => ts('year', ['plural' => 'years', 'count' => $count]),
1015 * Relative Date Terms.
1019 public static function getRelativeDateTerms() {
1021 'previous' => ts('Previous'),
1022 'previous_2' => ts('Previous 2'),
1023 'previous_before' => ts('Prior to Previous'),
1024 'before_previous' => ts('All Prior to Previous'),
1025 'earlier' => ts('To End of Previous'),
1026 'greater_previous' => ts('From End of Previous'),
1027 'greater' => ts('From Start Of Current'),
1028 'current' => ts('Current'),
1029 'ending_3' => ts('Last 3'),
1030 'ending_2' => ts('Last 2'),
1031 'ending' => ts('Last'),
1032 'this' => ts('This'),
1033 'starting' => ts('Upcoming'),
1034 'less' => ts('To End of'),
1035 'next' => ts('Next'),
1040 * Relative Date Units.
1044 public static function getRelativeDateUnits() {
1046 'year' => ts('Years'),
1047 'fiscal_year' => ts('Fiscal Years'),
1048 'quarter' => ts('Quarters'),
1049 'month' => ts('Months'),
1050 'week' => ts('Weeks'),
1051 'day' => ts('Days'),
1056 * Exportable document formats.
1060 public static function documentFormat() {
1062 'pdf' => ts('Portable Document Format (.pdf)'),
1063 'docx' => ts('MS Word (.docx)'),
1064 'odt' => ts('Open Office (.odt)'),
1065 'html' => ts('Webpage (.html)'),
1070 * Application type of document.
1074 public static function documentApplicationType() {
1076 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1077 'odt' => 'application/vnd.oasis.opendocument.text',
1082 * Activity Text options.
1086 public static function activityTextOptions() {
1088 2 => ts('Details Only'),
1089 3 => ts('Subject Only'),
1095 * Relationship permissions
1099 public static function getPermissionedRelationshipOptions() {
1101 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1102 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1103 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1108 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1111 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1113 public static function getDashboardEntriesCount() {
1115 $optionValues[-1] = ts('show all');
1116 for ($i = 10; $i <= 100; $i +
= 10) {
1117 $optionValues[$i] = $i;
1119 return $optionValues;
1123 * Dropdown options for quicksearch in the menu
1126 * @throws \CiviCRM_API3_Exception
1128 public static function quicksearchOptions() {
1129 $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);
1131 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1132 'contact_id' => ts('Contact ID'),
1133 'external_identifier' => ts('External ID'),
1134 'first_name' => ts('First Name'),
1135 'last_name' => ts('Last Name'),
1136 'email' => ts('Email'),
1137 'phone_numeric' => ts('Phone'),
1138 'street_address' => ts('Street Address'),
1139 'city' => ts('City'),
1140 'postal_code' => ts('Postal Code'),
1141 'job_title' => ts('Job Title'),
1143 $custom = civicrm_api3('CustomField', 'get', [
1144 'return' => ['name', 'label', 'custom_group_id.title'],
1145 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1146 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1147 'custom_group_id.is_active' => 1,
1149 'is_searchable' => 1,
1150 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1152 foreach ($custom['values'] as $field) {
1153 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];
1159 * Get components (translated for display.
1163 * @throws \Exception
1165 public static function getComponentSelectValues() {
1167 $components = CRM_Core_Component
::getComponents();
1168 foreach ($components as $name => $object) {
1169 $ret[$name] = $object->info
['translatedName'];
1178 public static function fieldSerialization() {
1180 CRM_Core_DAO
::SERIALIZE_SEPARATOR_BOOKEND
=> 'separator_bookend',
1181 CRM_Core_DAO
::SERIALIZE_SEPARATOR_TRIMMED
=> 'separator_trimmed',
1182 CRM_Core_DAO
::SERIALIZE_JSON
=> 'json',
1183 CRM_Core_DAO
::SERIALIZE_PHP
=> 'php',
1184 CRM_Core_DAO
::SERIALIZE_COMMA
=> 'comma',
1191 public static function navigationMenuSeparator() {
1194 ts('After menu element'),
1195 ts('Before menu element'),