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'),
184 * Various pre defined extensions for dynamic properties and groups.
189 public static function customGroupExtends() {
190 $customGroupExtends = [
191 'Activity' => ts('Activities'),
192 'Relationship' => ts('Relationships'),
193 'Contribution' => ts('Contributions'),
194 'ContributionRecur' => ts('Recurring Contributions'),
195 'Group' => ts('Groups'),
196 'Membership' => ts('Memberships'),
197 'Event' => ts('Events'),
198 'Participant' => ts('Participants'),
199 'ParticipantRole' => ts('Participants (Role)'),
200 'ParticipantEventName' => ts('Participants (Event Name)'),
201 'ParticipantEventType' => ts('Participants (Event Type)'),
202 'Pledge' => ts('Pledges'),
203 'Grant' => ts('Grants'),
204 'Address' => ts('Addresses'),
205 'Campaign' => ts('Campaigns'),
207 $contactTypes = self
::contactType();
208 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
209 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
210 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
211 return $customGroupExtends;
215 * Styles for displaying the custom data group.
219 public static function customGroupStyle() {
222 'Inline' => ts('Inline'),
223 'Tab with table' => ts('Tab with table'),
228 * For displaying the uf group types.
232 public static function ufGroupTypes() {
234 'Profile' => ts('Standalone Form or Directory'),
235 'Search Profile' => ts('Search Views'),
238 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
240 'User Registration' => ts('Drupal User Registration'),
241 'User Account' => ts('View/Edit Drupal User Account'),
248 * The status of a contact within a group.
252 public static function groupContactStatus() {
254 'Added' => ts('Added'),
255 'Removed' => ts('Removed'),
256 'Pending' => ts('Pending'),
261 * List of Group Types.
265 public static function groupType() {
267 'query' => ts('Dynamic'),
268 'static' => ts('Static'),
273 * Compose the parameters for a date select object.
275 * @param string|null $type
277 * @param string|null $format
278 * date format (QF format)
279 * @param null $minOffset
280 * @param null $maxOffset
281 * @param string $context
285 * @throws CRM_Core_Exception
287 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
288 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
290 'addEmptyOption' => TRUE,
291 'emptyOptionText' => ts('- select -'),
292 'emptyOptionValue' => '',
296 $date['format'] = $format;
300 $dao = new CRM_Core_DAO_PreferencesDate();
302 if (!$dao->find(TRUE)) {
303 throw new CRM_Core_Exception('Date preferences not configured.');
306 $maxOffset = $dao->end
;
309 $minOffset = $dao->start
;
312 $date['format'] = $dao->date_format
;
313 $date['time'] = (bool) $dao->time_format
;
316 if (empty($date['format'])) {
317 if ($context === 'Input') {
318 $date['format'] = Civi
::settings()->get('dateInputFormat');
321 $date['format'] = 'M d';
326 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
327 if (!isset($date['time'])) {
328 $date['time'] = FALSE;
332 $date['minYear'] = $year - (int) $minOffset;
333 $date['maxYear'] = $year +
(int) $maxOffset;
338 * Values for UF form visibility options.
342 public static function ufVisibility() {
344 'User and User Admin Only' => ts('User and User Admin Only'),
345 'Public Pages' => ts('Expose Publicly'),
346 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
351 * Values for group form visibility options.
355 public static function groupVisibility() {
357 'User and User Admin Only' => ts('User and User Admin Only'),
358 'Public Pages' => ts('Public Pages'),
363 * Different type of Mailing Components.
367 public static function mailingComponents() {
369 'Header' => ts('Header'),
370 'Footer' => ts('Footer'),
371 'Reply' => ts('Reply Auto-responder'),
372 'OptOut' => ts('Opt-out Message'),
373 'Subscribe' => ts('Subscription Confirmation Request'),
374 'Welcome' => ts('Welcome Message'),
375 'Unsubscribe' => ts('Unsubscribe Message'),
376 'Resubscribe' => ts('Resubscribe Message'),
385 public function getHours() {
387 for ($i = 0; $i <= 6; $i++
) {
398 public function getMinutes() {
400 for ($i = 0; $i < 60; $i = $i +
15) {
407 * Get the Map Provider.
410 * array of map providers
412 public static function mapProvider() {
415 $map = ['' => '- select -'] + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
421 * Get the Geocoding Providers from available plugins.
424 * array of geocoder providers
426 public static function geoProvider() {
429 $geo = ['' => '- select -'] + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
435 * Get options for displaying tax.
439 * @throws \CRM_Core_Exception
441 public function taxDisplayOptions() {
443 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
444 1 => CRM_Utils_Money
::format(120),
446 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
447 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
449 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
450 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
456 * Get the Address Standardization Providers from available plugins.
459 * array of address standardization providers
461 public static function addressProvider() {
464 $addr = array_merge(['' => '- select -'], CRM_Utils_System
::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
470 * Different type of Mailing Tokens.
474 public static function mailingTokens() {
476 '{action.unsubscribe}' => ts('Unsubscribe via email'),
477 '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
478 '{action.resubscribe}' => ts('Resubscribe via email'),
479 '{action.resubscribeUrl}' => ts('Resubscribe via web page'),
480 '{action.optOut}' => ts('Opt out via email'),
481 '{action.optOutUrl}' => ts('Opt out via web page'),
482 '{action.forward}' => ts('Forward this email (link)'),
483 '{action.reply}' => ts('Reply to this email (link)'),
484 '{action.subscribeUrl}' => ts('Subscribe via web page'),
485 '{mailing.key}' => ts('Mailing key'),
486 '{mailing.name}' => ts('Mailing name'),
487 '{mailing.group}' => ts('Mailing group'),
488 '{mailing.viewUrl}' => ts('Mailing permalink'),
489 ] + self
::domainTokens();
497 public static function domainTokens() {
499 '{domain.name}' => ts('Domain name'),
500 '{domain.address}' => ts('Domain (organization) address'),
501 '{domain.phone}' => ts('Domain (organization) phone'),
502 '{domain.email}' => ts('Domain (organization) email'),
507 * Different type of Activity Tokens.
511 public static function activityTokens() {
513 '{activity.activity_id}' => ts('Activity ID'),
514 '{activity.subject}' => ts('Activity Subject'),
515 '{activity.details}' => ts('Activity Details'),
516 '{activity.activity_date_time}' => ts('Activity Date Time'),
521 * Different type of Membership Tokens.
525 public static function membershipTokens() {
527 '{membership.id}' => ts('Membership ID'),
528 '{membership.status}' => ts('Membership Status'),
529 '{membership.type}' => ts('Membership Type'),
530 '{membership.start_date}' => ts('Membership Start Date'),
531 '{membership.join_date}' => ts('Membership Join Date'),
532 '{membership.end_date}' => ts('Membership End Date'),
533 '{membership.fee}' => ts('Membership Fee'),
538 * Different type of Event Tokens.
542 public static function eventTokens() {
544 '{event.event_id}' => ts('Event ID'),
545 '{event.title}' => ts('Event Title'),
546 '{event.start_date}' => ts('Event Start Date'),
547 '{event.end_date}' => ts('Event End Date'),
548 '{event.event_type}' => ts('Event Type'),
549 '{event.summary}' => ts('Event Summary'),
550 '{event.contact_email}' => ts('Event Contact Email'),
551 '{event.contact_phone}' => ts('Event Contact Phone'),
552 '{event.description}' => ts('Event Description'),
553 '{event.location}' => ts('Event Location'),
554 '{event.fee_amount}' => ts('Event Fees'),
555 '{event.info_url}' => ts('Event Info URL'),
556 '{event.registration_url}' => ts('Event Registration URL'),
557 '{event.balance}' => ts('Event Balance'),
562 * Different type of Event Tokens.
566 public static function contributionTokens() {
568 '{contribution.contribution_id}' => ts('Contribution ID'),
569 '{contribution.total_amount}' => ts('Total Amount'),
570 '{contribution.fee_amount}' => ts('Fee Amount'),
571 '{contribution.net_amount}' => ts('Net Amount'),
572 '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
573 '{contribution.receive_date}' => ts('Contribution Date Received'),
574 '{contribution.payment_instrument}' => ts('Payment Method'),
575 '{contribution.trxn_id}' => ts('Transaction ID'),
576 '{contribution.invoice_id}' => ts('Invoice ID'),
577 '{contribution.currency}' => ts('Currency'),
578 '{contribution.cancel_date}' => ts('Contribution Cancel Date'),
579 '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'),
580 '{contribution.receipt_date}' => ts('Receipt Date'),
581 '{contribution.thankyou_date}' => ts('Thank You Date'),
582 '{contribution.contribution_source}' => ts('Contribution Source'),
583 '{contribution.amount_level}' => ts('Amount Level'),
584 //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'),
585 //'{contribution.honor_contact_id}' => ts('Honor Contact ID'),
586 '{contribution.contribution_status_id}' => ts('Contribution Status'),
587 //'{contribution.honor_type_id}' => ts('Honor Type ID'),
588 //'{contribution.address_id}' => ts('Address ID'),
589 '{contribution.check_number}' => ts('Check Number'),
590 '{contribution.campaign}' => ts('Contribution Campaign'),
591 ], CRM_Utils_Token
::getCustomFieldTokens('contribution', TRUE));
595 * Different type of Contact Tokens.
599 public static function contactTokens() {
600 static $tokens = NULL;
602 $additionalFields = [
603 'checksum' => ['title' => ts('Checksum')],
604 'contact_id' => ['title' => ts('Internal Contact ID')],
606 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
608 $values = array_merge(array_keys($exportFields));
611 //FIXME:skipping some tokens for time being.
625 $customFields = CRM_Core_BAO_CustomField
::getFields(['Individual', 'Address']);
626 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
628 foreach ($values as $val) {
629 if (in_array($val, $skipTokens)) {
632 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
633 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
634 if ($customFieldId) {
635 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
636 if (!empty($customFields[$customFieldId])) {
637 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
641 // Support legacy token names
642 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
643 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
647 // Get all the hook tokens too
649 CRM_Utils_Hook
::tokens($hookTokens);
650 foreach ($hookTokens as $tokenValues) {
651 foreach ($tokenValues as $key => $value) {
652 if (is_numeric($key)) {
655 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
656 $key = '{' . $key . '}';
658 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
659 $value = $matches[1];
661 $tokens[$key] = $value;
670 * Different type of Participant Tokens.
674 public static function participantTokens() {
675 static $tokens = NULL;
677 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
679 $values = array_merge(array_keys($exportFields));
682 // skipping some tokens for time being.
685 'participant_is_pay_later',
686 'participant_is_test',
687 'participant_contact_id',
688 'participant_fee_currency',
689 'participant_campaign_id',
690 'participant_status',
691 'participant_discount_name',
694 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
696 foreach ($values as $key => $val) {
697 if (in_array($val, $skipTokens)) {
700 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
701 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
702 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
705 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
713 * @param int $caseTypeId
716 public static function caseTokens($caseTypeId = NULL) {
717 static $tokens = NULL;
719 foreach (CRM_Case_BAO_Case
::fields() as $field) {
720 $tokens["{case.{$field['name']}}"] = $field['title'];
723 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
724 foreach ($customFields as $id => $field) {
725 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
732 * CiviCRM supported date input formats.
736 public static function getDatePluginInputFormats() {
738 'mm/dd/yy' => ts('mm/dd/yy (12/31/2009)'),
739 'dd/mm/yy' => ts('dd/mm/yy (31/12/2009)'),
740 'yy-mm-dd' => ts('yy-mm-dd (2009-12-31)'),
741 'dd-mm-yy' => ts('dd-mm-yy (31-12-2009)'),
742 'dd.mm.yy' => ts('dd.mm.yy (31.12.2009)'),
743 'M d, yy' => ts('M d, yy (Dec 31, 2009)'),
744 'd M yy' => ts('d M yy (31 Dec 2009)'),
745 'MM d, yy' => ts('MM d, yy (December 31, 2009)'),
746 'd MM yy' => ts('d MM yy (31 December 2009)'),
747 'DD, d MM yy' => ts('DD, d MM yy (Thursday, 31 December 2009)'),
748 'mm/dd' => ts('mm/dd (12/31)'),
749 'dd-mm' => ts('dd-mm (31-12)'),
750 'yy-mm' => ts('yy-mm (2009-12)'),
751 'M yy' => ts('M yy (Dec 2009)'),
752 'yy' => ts('yy (2009)'),
761 public static function getTimeFormats() {
763 '1' => ts('12 Hours'),
764 '2' => ts('24 Hours'),
769 * Get numeric options.
776 public static function getNumericOptions($start = 0, $end = 10) {
777 $numericOptions = [];
778 for ($i = $start; $i <= $end; $i++
) {
779 $numericOptions[$i] = $i;
781 return $numericOptions;
789 public static function getBarcodeTypes() {
791 'barcode' => ts('Linear (1D)'),
792 'qrcode' => ts('QR code'),
801 public static function getDedupeRuleTypes() {
803 'Unsupervised' => ts('Unsupervised'),
804 'Supervised' => ts('Supervised'),
805 'General' => ts('General'),
810 * Campaign group types.
814 public static function getCampaignGroupTypes() {
816 'Include' => ts('Include'),
817 'Exclude' => ts('Exclude'),
822 * Subscription history method.
826 public static function getSubscriptionHistoryMethods() {
828 'Admin' => ts('Admin'),
829 'Email' => ts('Email'),
840 public static function getPremiumUnits() {
843 'week' => ts('Week'),
844 'month' => ts('Month'),
845 'year' => ts('Year'),
854 public static function getExtensionTypes() {
856 'payment' => ts('Payment'),
857 'search' => ts('Search'),
858 'report' => ts('Report'),
859 'module' => ts('Module'),
869 public static function getJobFrequency() {
872 'Yearly' => ts('Yearly'),
873 'Quarter' => ts('Quarterly'),
874 'Monthly' => ts('Monthly'),
875 'Weekly' => ts('Weekly'),
877 'Daily' => ts('Daily'),
878 'Hourly' => ts('Hourly'),
879 'Always' => ts('Every time cron job is run'),
884 * Search builder operators.
888 public static function getSearchBuilderOperators() {
897 'NOT IN' => ts('Not In'),
898 'LIKE' => ts('Like'),
899 'NOT LIKE' => ts('Not Like'),
900 'RLIKE' => ts('Regex'),
901 'IS EMPTY' => ts('Is Empty'),
902 'IS NOT EMPTY' => ts('Not Empty'),
903 'IS NULL' => ts('Is Null'),
904 'IS NOT NULL' => ts('Not Null'),
909 * Profile group types.
913 public static function getProfileGroupType() {
914 $profileGroupType = [
915 'Activity' => ts('Activities'),
916 'Contribution' => ts('Contributions'),
917 'Membership' => ts('Memberships'),
918 'Participant' => ts('Participants'),
920 $contactTypes = self
::contactType();
921 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
922 $profileGroupType = array_merge($contactTypes, $profileGroupType);
924 return $profileGroupType;
928 * Word replacement match type.
932 public static function getWordReplacementMatchType() {
934 'exactMatch' => ts('Exact Match'),
935 'wildcardMatch' => ts('Wildcard Match'),
940 * Mailing group types.
944 public static function getMailingGroupTypes() {
946 'Include' => ts('Include'),
947 'Exclude' => ts('Exclude'),
948 'Base' => ts('Base'),
953 * Mailing Job Status.
957 public static function getMailingJobStatus() {
959 'Scheduled' => ts('Scheduled'),
960 'Running' => ts('Running'),
961 'Complete' => ts('Complete'),
962 'Paused' => ts('Paused'),
963 'Canceled' => ts('Canceled'),
970 public static function billingMode() {
972 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
973 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
974 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
981 public static function contributeMode() {
983 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
984 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
985 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
990 * Frequency unit for schedule reminders.
996 public static function getRecurringFrequencyUnits($count = 1) {
997 // @todo this used to refer to the 'recur_frequency_unit' option_values which
998 // is for recurring payments and probably not good to re-use for recurring entities.
999 // If something other than a hard-coded list is desired, add a new option_group.
1001 'hour' => ts('hour', ['plural' => 'hours', 'count' => $count]),
1002 'day' => ts('day', ['plural' => 'days', 'count' => $count]),
1003 'week' => ts('week', ['plural' => 'weeks', 'count' => $count]),
1004 'month' => ts('month', ['plural' => 'months', 'count' => $count]),
1005 'year' => ts('year', ['plural' => 'years', 'count' => $count]),
1010 * Relative Date Terms.
1014 public static function getRelativeDateTerms() {
1016 'previous' => ts('Previous'),
1017 'previous_2' => ts('Previous 2'),
1018 'previous_before' => ts('Prior to Previous'),
1019 'before_previous' => ts('All Prior to Previous'),
1020 'earlier' => ts('To End of Previous'),
1021 'greater_previous' => ts('From End of Previous'),
1022 'greater' => ts('From Start Of Current'),
1023 'current' => ts('Current'),
1024 'ending_3' => ts('Last 3'),
1025 'ending_2' => ts('Last 2'),
1026 'ending' => ts('Last'),
1027 'this' => ts('This'),
1028 'starting' => ts('Upcoming'),
1029 'less' => ts('To End of'),
1030 'next' => ts('Next'),
1035 * Relative Date Units.
1039 public static function getRelativeDateUnits() {
1041 'year' => ts('Years'),
1042 'fiscal_year' => ts('Fiscal Years'),
1043 'quarter' => ts('Quarters'),
1044 'month' => ts('Months'),
1045 'week' => ts('Weeks'),
1046 'day' => ts('Days'),
1051 * Exportable document formats.
1055 public static function documentFormat() {
1057 'pdf' => ts('Portable Document Format (.pdf)'),
1058 'docx' => ts('MS Word (.docx)'),
1059 'odt' => ts('Open Office (.odt)'),
1060 'html' => ts('Webpage (.html)'),
1065 * Application type of document.
1069 public static function documentApplicationType() {
1071 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1072 'odt' => 'application/vnd.oasis.opendocument.text',
1077 * Activity Text options.
1081 public static function activityTextOptions() {
1083 2 => ts('Details Only'),
1084 3 => ts('Subject Only'),
1090 * Relationship permissions
1094 public static function getPermissionedRelationshipOptions() {
1096 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1097 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1098 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1103 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1106 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1108 public static function getDashboardEntriesCount() {
1110 $optionValues[-1] = ts('show all');
1111 for ($i = 10; $i <= 100; $i +
= 10) {
1112 $optionValues[$i] = $i;
1114 return $optionValues;
1118 * Dropdown options for quicksearch in the menu
1121 * @throws \CiviCRM_API3_Exception
1123 public static function quicksearchOptions() {
1124 $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);
1126 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1127 'contact_id' => ts('Contact ID'),
1128 'external_identifier' => ts('External ID'),
1129 'first_name' => ts('First Name'),
1130 'last_name' => ts('Last Name'),
1131 'email' => ts('Email'),
1132 'phone_numeric' => ts('Phone'),
1133 'street_address' => ts('Street Address'),
1134 'city' => ts('City'),
1135 'postal_code' => ts('Postal Code'),
1136 'job_title' => ts('Job Title'),
1138 $custom = civicrm_api3('CustomField', 'get', [
1139 'return' => ['name', 'label', 'custom_group_id.title'],
1140 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1141 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1142 'custom_group_id.is_active' => 1,
1144 'is_searchable' => 1,
1145 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1147 foreach ($custom['values'] as $field) {
1148 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];
1154 * Get components (translated for display.
1158 * @throws \Exception
1160 public static function getComponentSelectValues() {
1162 $components = CRM_Core_Component
::getComponents();
1163 foreach ($components as $name => $object) {
1164 $ret[$name] = $object->info
['translatedName'];
1173 public static function fieldSerialization() {
1175 CRM_Core_DAO
::SERIALIZE_SEPARATOR_BOOKEND
=> 'separator_bookend',
1176 CRM_Core_DAO
::SERIALIZE_SEPARATOR_TRIMMED
=> 'separator_trimmed',
1177 CRM_Core_DAO
::SERIALIZE_JSON
=> 'json',
1178 CRM_Core_DAO
::SERIALIZE_PHP
=> 'php',
1179 CRM_Core_DAO
::SERIALIZE_COMMA
=> 'comma',
1186 public static function navigationMenuSeparator() {
1189 ts('After menu element'),
1190 ts('Before menu element'),
1197 public static function relationshipOrientation() {
1199 'a_b' => ts('A to B'),
1200 'b_a' => ts('B to A'),