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
20 class CRM_Core_SelectValues
{
27 public static function boolean() {
35 * Preferred mail format.
39 public static function pmf() {
52 public static function privacy() {
54 'do_not_phone' => ts('Do not phone'),
55 'do_not_email' => ts('Do not email'),
56 'do_not_mail' => ts('Do not mail'),
57 'do_not_sms' => ts('Do not sms'),
58 'do_not_trade' => ts('Do not trade'),
59 'is_opt_out' => ts('No bulk emails (User Opt Out)'),
64 * Various pre defined contact super types.
68 public static function contactType() {
69 return CRM_Contact_BAO_ContactType
::basicTypePairs();
73 * Various pre defined unit list.
75 * @param string $unitType
78 public static function unitList($unitType = NULL) {
81 'month' => ts('month'),
84 if ($unitType === 'duration') {
85 $unitList['lifetime'] = ts('lifetime');
91 * Membership type unit.
95 public static function membershipTypeUnitList() {
96 return self
::unitList('duration');
100 * Various pre defined period types.
104 public static function periodType() {
106 'rolling' => ts('Rolling'),
107 'fixed' => ts('Fixed'),
112 * Various pre defined email selection methods.
116 public static function emailSelectMethods() {
118 'automatic' => ts('Automatic'),
119 'location-only' => ts('Only send to email addresses assigned to the specified location'),
120 'location-prefer' => ts('Prefer email addresses assigned to the specified location'),
121 'location-exclude' => ts('Exclude email addresses assigned to the specified location'),
126 * Various pre defined member visibility options.
130 public static function memberVisibility() {
132 'Public' => ts('Public'),
133 'Admin' => ts('Admin'),
138 * Member auto-renew options
142 public static function memberAutoRenew() {
144 ts('No auto-renew option'),
145 ts('Give option, but not required'),
146 ts('Auto-renew required'),
151 * Various pre defined event dates.
155 public static function eventDate() {
157 'start_date' => ts('start date'),
158 'end_date' => ts('end date'),
159 'join_date' => ts('member since'),
164 * Custom form field types.
168 public static function customHtmlType() {
170 'Text' => ts('Single-line input field (text or numeric)'),
171 'TextArea' => ts('Multi-line text box (textarea)'),
172 'Select' => ts('Drop-down (select list)'),
173 'Radio' => ts('Radio buttons'),
174 'CheckBox' => ts('Checkbox(es)'),
175 'Select Date' => ts('Select Date'),
176 'File' => ts('File'),
177 'RichTextEditor' => ts('Rich Text Editor'),
178 'Autocomplete-Select' => ts('Autocomplete-Select'),
179 'Link' => ts('Link'),
180 'ContactReference' => ts('Autocomplete-Select'),
185 * Various pre defined extensions for dynamic properties and groups.
190 public static function customGroupExtends() {
191 $customGroupExtends = [
192 'Activity' => ts('Activities'),
193 'Relationship' => ts('Relationships'),
194 'Contribution' => ts('Contributions'),
195 'ContributionRecur' => ts('Recurring Contributions'),
196 'Group' => ts('Groups'),
197 'Membership' => ts('Memberships'),
198 'Event' => ts('Events'),
199 'Participant' => ts('Participants'),
200 'ParticipantRole' => ts('Participants (Role)'),
201 'ParticipantEventName' => ts('Participants (Event Name)'),
202 'ParticipantEventType' => ts('Participants (Event Type)'),
203 'Pledge' => ts('Pledges'),
204 'Grant' => ts('Grants'),
205 'Address' => ts('Addresses'),
206 'Campaign' => ts('Campaigns'),
208 $contactTypes = self
::contactType();
209 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
210 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
211 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
212 return $customGroupExtends;
216 * Styles for displaying the custom data group.
220 public static function customGroupStyle() {
223 'Inline' => ts('Inline'),
224 'Tab with table' => ts('Tab with table'),
229 * For displaying the uf group types.
233 public static function ufGroupTypes() {
235 'Profile' => ts('Standalone Form or Directory'),
236 'Search Profile' => ts('Search Views'),
239 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
241 'User Registration' => ts('Drupal User Registration'),
242 'User Account' => ts('View/Edit Drupal User Account'),
249 * The status of a contact within a group.
253 public static function groupContactStatus() {
255 'Added' => ts('Added'),
256 'Removed' => ts('Removed'),
257 'Pending' => ts('Pending'),
262 * List of Group Types.
266 public static function groupType() {
268 'query' => ts('Dynamic'),
269 'static' => ts('Static'),
274 * Compose the parameters for a date select object.
276 * @param string|null $type
278 * @param string|null $format
279 * date format (QF format)
280 * @param null $minOffset
281 * @param null $maxOffset
282 * @param string $context
286 * @throws CRM_Core_Exception
288 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
289 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
291 'addEmptyOption' => TRUE,
292 'emptyOptionText' => ts('- select -'),
293 'emptyOptionValue' => '',
297 $date['format'] = $format;
301 $dao = new CRM_Core_DAO_PreferencesDate();
303 if (!$dao->find(TRUE)) {
304 throw new CRM_Core_Exception('Date preferences not configured.');
307 $maxOffset = $dao->end
;
310 $minOffset = $dao->start
;
313 $date['format'] = $dao->date_format
;
314 $date['time'] = (bool) $dao->time_format
;
317 if (empty($date['format'])) {
318 if ($context === 'Input') {
319 $date['format'] = Civi
::settings()->get('dateInputFormat');
322 $date['format'] = 'M d';
327 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
328 if (!isset($date['time'])) {
329 $date['time'] = FALSE;
333 $date['minYear'] = $year - (int) $minOffset;
334 $date['maxYear'] = $year +
(int) $maxOffset;
339 * Values for UF form visibility options.
343 public static function ufVisibility() {
345 'User and User Admin Only' => ts('User and User Admin Only'),
346 'Public Pages' => ts('Expose Publicly'),
347 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
352 * Values for group form visibility options.
356 public static function groupVisibility() {
358 'User and User Admin Only' => ts('User and User Admin Only'),
359 'Public Pages' => ts('Public Pages'),
364 * Different type of Mailing Components.
368 public static function mailingComponents() {
370 'Header' => ts('Header'),
371 'Footer' => ts('Footer'),
372 'Reply' => ts('Reply Auto-responder'),
373 'OptOut' => ts('Opt-out Message'),
374 'Subscribe' => ts('Subscription Confirmation Request'),
375 'Welcome' => ts('Welcome Message'),
376 'Unsubscribe' => ts('Unsubscribe Message'),
377 'Resubscribe' => ts('Resubscribe Message'),
386 public function getHours() {
388 for ($i = 0; $i <= 6; $i++
) {
399 public function getMinutes() {
401 for ($i = 0; $i < 60; $i = $i +
15) {
408 * Get the Map Provider.
411 * array of map providers
413 public static function mapProvider() {
416 $map = ['' => '- select -'] + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
422 * Get the Geocoding Providers from available plugins.
425 * array of geocoder providers
427 public static function geoProvider() {
430 $geo = ['' => '- select -'] + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
436 * Get options for displaying tax.
440 * @throws \CRM_Core_Exception
442 public function taxDisplayOptions() {
444 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
445 1 => CRM_Utils_Money
::format(120),
447 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
448 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
450 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
451 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
457 * Get the Address Standardization Providers from available plugins.
460 * array of address standardization providers
462 public static function addressProvider() {
465 $addr = array_merge(['' => '- select -'], CRM_Utils_System
::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
471 * Different type of Mailing Tokens.
475 public static function mailingTokens() {
477 '{action.unsubscribe}' => ts('Unsubscribe via email'),
478 '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
479 '{action.resubscribe}' => ts('Resubscribe via email'),
480 '{action.resubscribeUrl}' => ts('Resubscribe via web page'),
481 '{action.optOut}' => ts('Opt out via email'),
482 '{action.optOutUrl}' => ts('Opt out via web page'),
483 '{action.forward}' => ts('Forward this email (link)'),
484 '{action.reply}' => ts('Reply to this email (link)'),
485 '{action.subscribeUrl}' => ts('Subscribe via web page'),
486 '{mailing.key}' => ts('Mailing key'),
487 '{mailing.name}' => ts('Mailing name'),
488 '{mailing.group}' => ts('Mailing group'),
489 '{mailing.viewUrl}' => ts('Mailing permalink'),
490 ] + self
::domainTokens();
498 public static function domainTokens() {
500 '{domain.name}' => ts('Domain name'),
501 '{domain.address}' => ts('Domain (organization) address'),
502 '{domain.phone}' => ts('Domain (organization) phone'),
503 '{domain.email}' => ts('Domain (organization) email'),
508 * Different type of Activity Tokens.
512 public static function activityTokens() {
514 '{activity.activity_id}' => ts('Activity ID'),
515 '{activity.subject}' => ts('Activity Subject'),
516 '{activity.details}' => ts('Activity Details'),
517 '{activity.activity_date_time}' => ts('Activity Date Time'),
522 * Different type of Membership Tokens.
526 public static function membershipTokens() {
528 '{membership.id}' => ts('Membership ID'),
529 '{membership.status}' => ts('Membership Status'),
530 '{membership.type}' => ts('Membership Type'),
531 '{membership.start_date}' => ts('Membership Start Date'),
532 '{membership.join_date}' => ts('Membership Join Date'),
533 '{membership.end_date}' => ts('Membership End Date'),
534 '{membership.fee}' => ts('Membership Fee'),
539 * Different type of Event Tokens.
543 public static function eventTokens() {
545 '{event.event_id}' => ts('Event ID'),
546 '{event.title}' => ts('Event Title'),
547 '{event.start_date}' => ts('Event Start Date'),
548 '{event.end_date}' => ts('Event End Date'),
549 '{event.event_type}' => ts('Event Type'),
550 '{event.summary}' => ts('Event Summary'),
551 '{event.contact_email}' => ts('Event Contact Email'),
552 '{event.contact_phone}' => ts('Event Contact Phone'),
553 '{event.description}' => ts('Event Description'),
554 '{event.location}' => ts('Event Location'),
555 '{event.fee_amount}' => ts('Event Fees'),
556 '{event.info_url}' => ts('Event Info URL'),
557 '{event.registration_url}' => ts('Event Registration URL'),
558 '{event.balance}' => ts('Event Balance'),
563 * Different type of Event Tokens.
567 public static function contributionTokens() {
569 '{contribution.contribution_id}' => ts('Contribution ID'),
570 '{contribution.total_amount}' => ts('Total Amount'),
571 '{contribution.fee_amount}' => ts('Fee Amount'),
572 '{contribution.net_amount}' => ts('Net Amount'),
573 '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
574 '{contribution.receive_date}' => ts('Contribution Date Received'),
575 '{contribution.payment_instrument}' => ts('Payment Method'),
576 '{contribution.trxn_id}' => ts('Transaction ID'),
577 '{contribution.invoice_id}' => ts('Invoice ID'),
578 '{contribution.currency}' => ts('Currency'),
579 '{contribution.cancel_date}' => ts('Contribution Cancel Date'),
580 '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'),
581 '{contribution.receipt_date}' => ts('Receipt Date'),
582 '{contribution.thankyou_date}' => ts('Thank You Date'),
583 '{contribution.contribution_source}' => ts('Contribution Source'),
584 '{contribution.amount_level}' => ts('Amount Level'),
585 //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'),
586 //'{contribution.honor_contact_id}' => ts('Honor Contact ID'),
587 '{contribution.contribution_status_id}' => ts('Contribution Status'),
588 //'{contribution.honor_type_id}' => ts('Honor Type ID'),
589 //'{contribution.address_id}' => ts('Address ID'),
590 '{contribution.check_number}' => ts('Check Number'),
591 '{contribution.campaign}' => ts('Contribution Campaign'),
592 ], CRM_Utils_Token
::getCustomFieldTokens('contribution', TRUE));
596 * Different type of Contact Tokens.
600 public static function contactTokens() {
601 static $tokens = NULL;
603 $additionalFields = [
604 'checksum' => ['title' => ts('Checksum')],
605 'contact_id' => ['title' => ts('Internal Contact ID')],
607 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
609 $values = array_merge(array_keys($exportFields));
612 //FIXME:skipping some tokens for time being.
626 $customFields = CRM_Core_BAO_CustomField
::getFields(['Individual', 'Address']);
627 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
629 foreach ($values as $val) {
630 if (in_array($val, $skipTokens)) {
633 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
634 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
635 if ($customFieldId) {
636 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
637 if (!empty($customFields[$customFieldId])) {
638 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
642 // Support legacy token names
643 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
644 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
648 // Get all the hook tokens too
650 CRM_Utils_Hook
::tokens($hookTokens);
651 foreach ($hookTokens as $tokenValues) {
652 foreach ($tokenValues as $key => $value) {
653 if (is_numeric($key)) {
656 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
657 $key = '{' . $key . '}';
659 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
660 $value = $matches[1];
662 $tokens[$key] = $value;
671 * Different type of Participant Tokens.
675 public static function participantTokens() {
676 static $tokens = NULL;
678 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
680 $values = array_merge(array_keys($exportFields));
683 // skipping some tokens for time being.
686 'participant_is_pay_later',
687 'participant_is_test',
688 'participant_contact_id',
689 'participant_fee_currency',
690 'participant_campaign_id',
691 'participant_status',
692 'participant_discount_name',
695 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
697 foreach ($values as $key => $val) {
698 if (in_array($val, $skipTokens)) {
701 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
702 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
703 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
706 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
714 * @param int $caseTypeId
717 public static function caseTokens($caseTypeId = NULL) {
718 static $tokens = NULL;
720 foreach (CRM_Case_BAO_Case
::fields() as $field) {
721 $tokens["{case.{$field['name']}}"] = $field['title'];
724 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
725 foreach ($customFields as $id => $field) {
726 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
733 * CiviCRM supported date input formats.
737 public static function getDatePluginInputFormats() {
739 'mm/dd/yy' => ts('mm/dd/yy (12/31/2009)'),
740 'dd/mm/yy' => ts('dd/mm/yy (31/12/2009)'),
741 'yy-mm-dd' => ts('yy-mm-dd (2009-12-31)'),
742 'dd-mm-yy' => ts('dd-mm-yy (31-12-2009)'),
743 'dd.mm.yy' => ts('dd.mm.yy (31.12.2009)'),
744 'M d, yy' => ts('M d, yy (Dec 31, 2009)'),
745 'd M yy' => ts('d M yy (31 Dec 2009)'),
746 'MM d, yy' => ts('MM d, yy (December 31, 2009)'),
747 'd MM yy' => ts('d MM yy (31 December 2009)'),
748 'DD, d MM yy' => ts('DD, d MM yy (Thursday, 31 December 2009)'),
749 'mm/dd' => ts('mm/dd (12/31)'),
750 'dd-mm' => ts('dd-mm (31-12)'),
751 'yy-mm' => ts('yy-mm (2009-12)'),
752 'M yy' => ts('M yy (Dec 2009)'),
753 'yy' => ts('yy (2009)'),
762 public static function getTimeFormats() {
764 '1' => ts('12 Hours'),
765 '2' => ts('24 Hours'),
770 * Get numeric options.
777 public static function getNumericOptions($start = 0, $end = 10) {
778 $numericOptions = [];
779 for ($i = $start; $i <= $end; $i++
) {
780 $numericOptions[$i] = $i;
782 return $numericOptions;
790 public static function getBarcodeTypes() {
792 'barcode' => ts('Linear (1D)'),
793 'qrcode' => ts('QR code'),
802 public static function getDedupeRuleTypes() {
804 'Unsupervised' => ts('Unsupervised'),
805 'Supervised' => ts('Supervised'),
806 'General' => ts('General'),
811 * Campaign group types.
815 public static function getCampaignGroupTypes() {
817 'Include' => ts('Include'),
818 'Exclude' => ts('Exclude'),
823 * Subscription history method.
827 public static function getSubscriptionHistoryMethods() {
829 'Admin' => ts('Admin'),
830 'Email' => ts('Email'),
841 public static function getPremiumUnits() {
844 'week' => ts('Week'),
845 'month' => ts('Month'),
846 'year' => ts('Year'),
855 public static function getExtensionTypes() {
857 'payment' => ts('Payment'),
858 'search' => ts('Search'),
859 'report' => ts('Report'),
860 'module' => ts('Module'),
870 public static function getJobFrequency() {
873 'Yearly' => ts('Yearly'),
874 'Quarter' => ts('Quarterly'),
875 'Monthly' => ts('Monthly'),
876 'Weekly' => ts('Weekly'),
878 'Daily' => ts('Daily'),
879 'Hourly' => ts('Hourly'),
880 'Always' => ts('Every time cron job is run'),
885 * Search builder operators.
889 public static function getSearchBuilderOperators() {
898 'NOT IN' => ts('Not In'),
899 'LIKE' => ts('Like'),
900 'NOT LIKE' => ts('Not Like'),
901 'RLIKE' => ts('Regex'),
902 'IS EMPTY' => ts('Is Empty'),
903 'IS NOT EMPTY' => ts('Not Empty'),
904 'IS NULL' => ts('Is Null'),
905 'IS NOT NULL' => ts('Not Null'),
910 * Profile group types.
914 public static function getProfileGroupType() {
915 $profileGroupType = [
916 'Activity' => ts('Activities'),
917 'Contribution' => ts('Contributions'),
918 'Membership' => ts('Memberships'),
919 'Participant' => ts('Participants'),
921 $contactTypes = self
::contactType();
922 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
923 $profileGroupType = array_merge($contactTypes, $profileGroupType);
925 return $profileGroupType;
929 * Word replacement match type.
933 public static function getWordReplacementMatchType() {
935 'exactMatch' => ts('Exact Match'),
936 'wildcardMatch' => ts('Wildcard Match'),
941 * Mailing group types.
945 public static function getMailingGroupTypes() {
947 'Include' => ts('Include'),
948 'Exclude' => ts('Exclude'),
949 'Base' => ts('Base'),
954 * Mailing Job Status.
958 public static function getMailingJobStatus() {
960 'Scheduled' => ts('Scheduled'),
961 'Running' => ts('Running'),
962 'Complete' => ts('Complete'),
963 'Paused' => ts('Paused'),
964 'Canceled' => ts('Canceled'),
971 public static function billingMode() {
973 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
974 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
975 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
982 public static function contributeMode() {
984 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
985 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
986 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
991 * Frequency unit for schedule reminders.
997 public static function getRecurringFrequencyUnits($count = 1) {
998 // @todo this used to refer to the 'recur_frequency_unit' option_values which
999 // is for recurring payments and probably not good to re-use for recurring entities.
1000 // If something other than a hard-coded list is desired, add a new option_group.
1002 'hour' => ts('hour', ['plural' => 'hours', 'count' => $count]),
1003 'day' => ts('day', ['plural' => 'days', 'count' => $count]),
1004 'week' => ts('week', ['plural' => 'weeks', 'count' => $count]),
1005 'month' => ts('month', ['plural' => 'months', 'count' => $count]),
1006 'year' => ts('year', ['plural' => 'years', 'count' => $count]),
1011 * Relative Date Terms.
1015 public static function getRelativeDateTerms() {
1017 'previous' => ts('Previous'),
1018 'previous_2' => ts('Previous 2'),
1019 'previous_before' => ts('Prior to Previous'),
1020 'before_previous' => ts('All Prior to Previous'),
1021 'earlier' => ts('To End of Previous'),
1022 'greater_previous' => ts('From End of Previous'),
1023 'greater' => ts('From Start Of Current'),
1024 'current' => ts('Current'),
1025 'ending_3' => ts('Last 3'),
1026 'ending_2' => ts('Last 2'),
1027 'ending' => ts('Last'),
1028 'this' => ts('This'),
1029 'starting' => ts('Upcoming'),
1030 'less' => ts('To End of'),
1031 'next' => ts('Next'),
1036 * Relative Date Units.
1040 public static function getRelativeDateUnits() {
1042 'year' => ts('Years'),
1043 'fiscal_year' => ts('Fiscal Years'),
1044 'quarter' => ts('Quarters'),
1045 'month' => ts('Months'),
1046 'week' => ts('Weeks'),
1047 'day' => ts('Days'),
1052 * Exportable document formats.
1056 public static function documentFormat() {
1058 'pdf' => ts('Portable Document Format (.pdf)'),
1059 'docx' => ts('MS Word (.docx)'),
1060 'odt' => ts('Open Office (.odt)'),
1061 'html' => ts('Webpage (.html)'),
1066 * Application type of document.
1070 public static function documentApplicationType() {
1072 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1073 'odt' => 'application/vnd.oasis.opendocument.text',
1078 * Activity Text options.
1082 public static function activityTextOptions() {
1084 2 => ts('Details Only'),
1085 3 => ts('Subject Only'),
1091 * Relationship permissions
1095 public static function getPermissionedRelationshipOptions() {
1097 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1098 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1099 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1104 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1107 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1109 public static function getDashboardEntriesCount() {
1111 $optionValues[-1] = ts('show all');
1112 for ($i = 10; $i <= 100; $i +
= 10) {
1113 $optionValues[$i] = $i;
1115 return $optionValues;
1119 * Dropdown options for quicksearch in the menu
1122 * @throws \CiviCRM_API3_Exception
1124 public static function quicksearchOptions() {
1125 $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);
1127 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1128 'contact_id' => ts('Contact ID'),
1129 'external_identifier' => ts('External ID'),
1130 'first_name' => ts('First Name'),
1131 'last_name' => ts('Last Name'),
1132 'email' => ts('Email'),
1133 'phone_numeric' => ts('Phone'),
1134 'street_address' => ts('Street Address'),
1135 'city' => ts('City'),
1136 'postal_code' => ts('Postal Code'),
1137 'job_title' => ts('Job Title'),
1139 $custom = civicrm_api3('CustomField', 'get', [
1140 'return' => ['name', 'label', 'custom_group_id.title'],
1141 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1142 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1143 'custom_group_id.is_active' => 1,
1145 'is_searchable' => 1,
1146 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1148 foreach ($custom['values'] as $field) {
1149 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];
1155 * Get components (translated for display.
1159 * @throws \Exception
1161 public static function getComponentSelectValues() {
1163 $components = CRM_Core_Component
::getComponents();
1164 foreach ($components as $name => $object) {
1165 $ret[$name] = $object->info
['translatedName'];
1174 public static function fieldSerialization() {
1176 CRM_Core_DAO
::SERIALIZE_SEPARATOR_BOOKEND
=> 'separator_bookend',
1177 CRM_Core_DAO
::SERIALIZE_SEPARATOR_TRIMMED
=> 'separator_trimmed',
1178 CRM_Core_DAO
::SERIALIZE_JSON
=> 'json',
1179 CRM_Core_DAO
::SERIALIZE_PHP
=> 'php',
1180 CRM_Core_DAO
::SERIALIZE_COMMA
=> 'comma',
1187 public static function navigationMenuSeparator() {
1190 ts('After menu element'),
1191 ts('Before menu element'),
1198 public static function relationshipOrientation() {
1200 'a_b' => ts('A to B'),
1201 'b_a' => ts('B to A'),