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 'Select State/Province' => ts('Select State/Province'),
178 'Select Country' => ts('Select Country'),
179 'RichTextEditor' => ts('Rich Text Editor'),
180 'Autocomplete-Select' => ts('Autocomplete-Select'),
181 'Link' => ts('Link'),
182 'ContactReference' => ts('Autocomplete-Select'),
187 * Various pre defined extensions for dynamic properties and groups.
192 public static function customGroupExtends() {
193 $customGroupExtends = [
194 'Activity' => ts('Activities'),
195 'Relationship' => ts('Relationships'),
196 'Contribution' => ts('Contributions'),
197 'ContributionRecur' => ts('Recurring Contributions'),
198 'Group' => ts('Groups'),
199 'Membership' => ts('Memberships'),
200 'Event' => ts('Events'),
201 'Participant' => ts('Participants'),
202 'ParticipantRole' => ts('Participants (Role)'),
203 'ParticipantEventName' => ts('Participants (Event Name)'),
204 'ParticipantEventType' => ts('Participants (Event Type)'),
205 'Pledge' => ts('Pledges'),
206 'Grant' => ts('Grants'),
207 'Address' => ts('Addresses'),
208 'Campaign' => ts('Campaigns'),
210 $contactTypes = self
::contactType();
211 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
212 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
213 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
214 return $customGroupExtends;
218 * Styles for displaying the custom data group.
222 public static function customGroupStyle() {
225 'Inline' => ts('Inline'),
226 'Tab with table' => ts('Tab with table'),
231 * For displaying the uf group types.
235 public static function ufGroupTypes() {
237 'Profile' => ts('Standalone Form or Directory'),
238 'Search Profile' => ts('Search Views'),
241 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
243 'User Registration' => ts('Drupal User Registration'),
244 'User Account' => ts('View/Edit Drupal User Account'),
251 * The status of a contact within a group.
255 public static function groupContactStatus() {
257 'Added' => ts('Added'),
258 'Removed' => ts('Removed'),
259 'Pending' => ts('Pending'),
264 * List of Group Types.
268 public static function groupType() {
270 'query' => ts('Dynamic'),
271 'static' => ts('Static'),
276 * Compose the parameters for a date select object.
278 * @param string|null $type
280 * @param string|null $format
281 * date format (QF format)
282 * @param null $minOffset
283 * @param null $maxOffset
284 * @param string $context
288 * @throws CRM_Core_Exception
290 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
291 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
293 'addEmptyOption' => TRUE,
294 'emptyOptionText' => ts('- select -'),
295 'emptyOptionValue' => '',
299 $date['format'] = $format;
303 $dao = new CRM_Core_DAO_PreferencesDate();
305 if (!$dao->find(TRUE)) {
306 throw new CRM_Core_Exception('Date preferences not configured.');
309 $maxOffset = $dao->end
;
312 $minOffset = $dao->start
;
315 $date['format'] = $dao->date_format
;
316 $date['time'] = (bool) $dao->time_format
;
319 if (empty($date['format'])) {
320 if ($context === 'Input') {
321 $date['format'] = Civi
::settings()->get('dateInputFormat');
324 $date['format'] = 'M d';
329 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
330 if (!isset($date['time'])) {
331 $date['time'] = FALSE;
335 $date['minYear'] = $year - (int) $minOffset;
336 $date['maxYear'] = $year +
(int) $maxOffset;
341 * Values for UF form visibility options.
345 public static function ufVisibility() {
347 'User and User Admin Only' => ts('User and User Admin Only'),
348 'Public Pages' => ts('Expose Publicly'),
349 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
354 * Values for group form visibility options.
358 public static function groupVisibility() {
360 'User and User Admin Only' => ts('User and User Admin Only'),
361 'Public Pages' => ts('Public Pages'),
366 * Different type of Mailing Components.
370 public static function mailingComponents() {
372 'Header' => ts('Header'),
373 'Footer' => ts('Footer'),
374 'Reply' => ts('Reply Auto-responder'),
375 'OptOut' => ts('Opt-out Message'),
376 'Subscribe' => ts('Subscription Confirmation Request'),
377 'Welcome' => ts('Welcome Message'),
378 'Unsubscribe' => ts('Unsubscribe Message'),
379 'Resubscribe' => ts('Resubscribe Message'),
388 public function getHours() {
390 for ($i = 0; $i <= 6; $i++
) {
401 public function getMinutes() {
403 for ($i = 0; $i < 60; $i = $i +
15) {
410 * Get the Map Provider.
413 * array of map providers
415 public static function mapProvider() {
418 $map = ['' => '- select -'] + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
424 * Get the Geocoding Providers from available plugins.
427 * array of geocoder providers
429 public static function geoProvider() {
432 $geo = ['' => '- select -'] + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
438 * Get options for displaying tax.
442 * @throws \CRM_Core_Exception
444 public function taxDisplayOptions() {
446 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
447 1 => CRM_Utils_Money
::format(120),
449 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
450 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
452 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
453 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
459 * Get the Address Standardization Providers from available plugins.
462 * array of address standardization providers
464 public static function addressProvider() {
467 $addr = array_merge(['' => '- select -'], CRM_Utils_System
::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
473 * Different type of Mailing Tokens.
477 public static function mailingTokens() {
479 '{action.unsubscribe}' => ts('Unsubscribe via email'),
480 '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
481 '{action.resubscribe}' => ts('Resubscribe via email'),
482 '{action.resubscribeUrl}' => ts('Resubscribe via web page'),
483 '{action.optOut}' => ts('Opt out via email'),
484 '{action.optOutUrl}' => ts('Opt out via web page'),
485 '{action.forward}' => ts('Forward this email (link)'),
486 '{action.reply}' => ts('Reply to this email (link)'),
487 '{action.subscribeUrl}' => ts('Subscribe via web page'),
488 '{mailing.key}' => ts('Mailing key'),
489 '{mailing.name}' => ts('Mailing name'),
490 '{mailing.group}' => ts('Mailing group'),
491 '{mailing.viewUrl}' => ts('Mailing permalink'),
492 ] + self
::domainTokens();
500 public static function domainTokens() {
502 '{domain.name}' => ts('Domain name'),
503 '{domain.address}' => ts('Domain (organization) address'),
504 '{domain.phone}' => ts('Domain (organization) phone'),
505 '{domain.email}' => ts('Domain (organization) email'),
510 * Different type of Activity Tokens.
514 public static function activityTokens() {
516 '{activity.activity_id}' => ts('Activity ID'),
517 '{activity.subject}' => ts('Activity Subject'),
518 '{activity.details}' => ts('Activity Details'),
519 '{activity.activity_date_time}' => ts('Activity Date Time'),
524 * Different type of Membership Tokens.
528 public static function membershipTokens() {
530 '{membership.id}' => ts('Membership ID'),
531 '{membership.status}' => ts('Membership Status'),
532 '{membership.type}' => ts('Membership Type'),
533 '{membership.start_date}' => ts('Membership Start Date'),
534 '{membership.join_date}' => ts('Membership Join Date'),
535 '{membership.end_date}' => ts('Membership End Date'),
536 '{membership.fee}' => ts('Membership Fee'),
541 * Different type of Event Tokens.
545 public static function eventTokens() {
547 '{event.event_id}' => ts('Event ID'),
548 '{event.title}' => ts('Event Title'),
549 '{event.start_date}' => ts('Event Start Date'),
550 '{event.end_date}' => ts('Event End Date'),
551 '{event.event_type}' => ts('Event Type'),
552 '{event.summary}' => ts('Event Summary'),
553 '{event.contact_email}' => ts('Event Contact Email'),
554 '{event.contact_phone}' => ts('Event Contact Phone'),
555 '{event.description}' => ts('Event Description'),
556 '{event.location}' => ts('Event Location'),
557 '{event.fee_amount}' => ts('Event Fees'),
558 '{event.info_url}' => ts('Event Info URL'),
559 '{event.registration_url}' => ts('Event Registration URL'),
560 '{event.balance}' => ts('Event Balance'),
565 * Different type of Event Tokens.
569 public static function contributionTokens() {
571 '{contribution.contribution_id}' => ts('Contribution ID'),
572 '{contribution.total_amount}' => ts('Total Amount'),
573 '{contribution.fee_amount}' => ts('Fee Amount'),
574 '{contribution.net_amount}' => ts('Net Amount'),
575 '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
576 '{contribution.receive_date}' => ts('Contribution Date Received'),
577 '{contribution.payment_instrument}' => ts('Payment Method'),
578 '{contribution.trxn_id}' => ts('Transaction ID'),
579 '{contribution.invoice_id}' => ts('Invoice ID'),
580 '{contribution.currency}' => ts('Currency'),
581 '{contribution.cancel_date}' => ts('Contribution Cancel Date'),
582 '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'),
583 '{contribution.receipt_date}' => ts('Receipt Date'),
584 '{contribution.thankyou_date}' => ts('Thank You Date'),
585 '{contribution.contribution_source}' => ts('Contribution Source'),
586 '{contribution.amount_level}' => ts('Amount Level'),
587 //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'),
588 //'{contribution.honor_contact_id}' => ts('Honor Contact ID'),
589 '{contribution.contribution_status_id}' => ts('Contribution Status'),
590 //'{contribution.honor_type_id}' => ts('Honor Type ID'),
591 //'{contribution.address_id}' => ts('Address ID'),
592 '{contribution.check_number}' => ts('Check Number'),
593 '{contribution.campaign}' => ts('Contribution Campaign'),
594 ], CRM_Utils_Token
::getCustomFieldTokens('contribution', TRUE));
598 * Different type of Contact Tokens.
602 public static function contactTokens() {
603 static $tokens = NULL;
605 $additionalFields = [
606 'checksum' => ['title' => ts('Checksum')],
607 'contact_id' => ['title' => ts('Internal Contact ID')],
609 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
611 $values = array_merge(array_keys($exportFields));
614 //FIXME:skipping some tokens for time being.
628 $customFields = CRM_Core_BAO_CustomField
::getFields(['Individual', 'Address']);
629 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
631 foreach ($values as $val) {
632 if (in_array($val, $skipTokens)) {
635 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
636 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
637 if ($customFieldId) {
638 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
639 if (!empty($customFields[$customFieldId])) {
640 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
644 // Support legacy token names
645 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
646 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
650 // Get all the hook tokens too
652 CRM_Utils_Hook
::tokens($hookTokens);
653 foreach ($hookTokens as $tokenValues) {
654 foreach ($tokenValues as $key => $value) {
655 if (is_numeric($key)) {
658 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
659 $key = '{' . $key . '}';
661 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
662 $value = $matches[1];
664 $tokens[$key] = $value;
673 * Different type of Participant Tokens.
677 public static function participantTokens() {
678 static $tokens = NULL;
680 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
682 $values = array_merge(array_keys($exportFields));
685 // skipping some tokens for time being.
688 'participant_is_pay_later',
689 'participant_is_test',
690 'participant_contact_id',
691 'participant_fee_currency',
692 'participant_campaign_id',
693 'participant_status',
694 'participant_discount_name',
697 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
699 foreach ($values as $key => $val) {
700 if (in_array($val, $skipTokens)) {
703 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
704 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
705 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
708 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
716 * @param int $caseTypeId
719 public static function caseTokens($caseTypeId = NULL) {
720 static $tokens = NULL;
722 foreach (CRM_Case_BAO_Case
::fields() as $field) {
723 $tokens["{case.{$field['name']}}"] = $field['title'];
726 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
727 foreach ($customFields as $id => $field) {
728 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
735 * CiviCRM supported date input formats.
739 public static function getDatePluginInputFormats() {
741 'mm/dd/yy' => ts('mm/dd/yy (12/31/2009)'),
742 'dd/mm/yy' => ts('dd/mm/yy (31/12/2009)'),
743 'yy-mm-dd' => ts('yy-mm-dd (2009-12-31)'),
744 'dd-mm-yy' => ts('dd-mm-yy (31-12-2009)'),
745 'dd.mm.yy' => ts('dd.mm.yy (31.12.2009)'),
746 'M d, yy' => ts('M d, yy (Dec 31, 2009)'),
747 'd M yy' => ts('d M yy (31 Dec 2009)'),
748 'MM d, yy' => ts('MM d, yy (December 31, 2009)'),
749 'd MM yy' => ts('d MM yy (31 December 2009)'),
750 'DD, d MM yy' => ts('DD, d MM yy (Thursday, 31 December 2009)'),
751 'mm/dd' => ts('mm/dd (12/31)'),
752 'dd-mm' => ts('dd-mm (31-12)'),
753 'yy-mm' => ts('yy-mm (2009-12)'),
754 'M yy' => ts('M yy (Dec 2009)'),
755 'yy' => ts('yy (2009)'),
764 public static function getTimeFormats() {
766 '1' => ts('12 Hours'),
767 '2' => ts('24 Hours'),
772 * Get numeric options.
779 public static function getNumericOptions($start = 0, $end = 10) {
780 $numericOptions = [];
781 for ($i = $start; $i <= $end; $i++
) {
782 $numericOptions[$i] = $i;
784 return $numericOptions;
792 public static function getBarcodeTypes() {
794 'barcode' => ts('Linear (1D)'),
795 'qrcode' => ts('QR code'),
804 public static function getDedupeRuleTypes() {
806 'Unsupervised' => ts('Unsupervised'),
807 'Supervised' => ts('Supervised'),
808 'General' => ts('General'),
813 * Campaign group types.
817 public static function getCampaignGroupTypes() {
819 'Include' => ts('Include'),
820 'Exclude' => ts('Exclude'),
825 * Subscription history method.
829 public static function getSubscriptionHistoryMethods() {
831 'Admin' => ts('Admin'),
832 'Email' => ts('Email'),
843 public static function getPremiumUnits() {
846 'week' => ts('Week'),
847 'month' => ts('Month'),
848 'year' => ts('Year'),
857 public static function getExtensionTypes() {
859 'payment' => ts('Payment'),
860 'search' => ts('Search'),
861 'report' => ts('Report'),
862 'module' => ts('Module'),
872 public static function getJobFrequency() {
875 'Yearly' => ts('Yearly'),
876 'Quarter' => ts('Quarterly'),
877 'Monthly' => ts('Monthly'),
878 'Weekly' => ts('Weekly'),
880 'Daily' => ts('Daily'),
881 'Hourly' => ts('Hourly'),
882 'Always' => ts('Every time cron job is run'),
887 * Search builder operators.
891 public static function getSearchBuilderOperators() {
900 'NOT IN' => ts('Not In'),
901 'LIKE' => ts('Like'),
902 'NOT LIKE' => ts('Not Like'),
903 'RLIKE' => ts('Regex'),
904 'IS EMPTY' => ts('Is Empty'),
905 'IS NOT EMPTY' => ts('Not Empty'),
906 'IS NULL' => ts('Is Null'),
907 'IS NOT NULL' => ts('Not Null'),
912 * Profile group types.
916 public static function getProfileGroupType() {
917 $profileGroupType = [
918 'Activity' => ts('Activities'),
919 'Contribution' => ts('Contributions'),
920 'Membership' => ts('Memberships'),
921 'Participant' => ts('Participants'),
923 $contactTypes = self
::contactType();
924 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
925 $profileGroupType = array_merge($contactTypes, $profileGroupType);
927 return $profileGroupType;
931 * Word replacement match type.
935 public static function getWordReplacementMatchType() {
937 'exactMatch' => ts('Exact Match'),
938 'wildcardMatch' => ts('Wildcard Match'),
943 * Mailing group types.
947 public static function getMailingGroupTypes() {
949 'Include' => ts('Include'),
950 'Exclude' => ts('Exclude'),
951 'Base' => ts('Base'),
956 * Mailing Job Status.
960 public static function getMailingJobStatus() {
962 'Scheduled' => ts('Scheduled'),
963 'Running' => ts('Running'),
964 'Complete' => ts('Complete'),
965 'Paused' => ts('Paused'),
966 'Canceled' => ts('Canceled'),
973 public static function billingMode() {
975 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
976 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
977 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
984 public static function contributeMode() {
986 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
987 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
988 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
993 * Frequency unit for schedule reminders.
999 public static function getRecurringFrequencyUnits($count = 1) {
1000 // @todo this used to refer to the 'recur_frequency_unit' option_values which
1001 // is for recurring payments and probably not good to re-use for recurring entities.
1002 // If something other than a hard-coded list is desired, add a new option_group.
1004 'hour' => ts('hour', ['plural' => 'hours', 'count' => $count]),
1005 'day' => ts('day', ['plural' => 'days', 'count' => $count]),
1006 'week' => ts('week', ['plural' => 'weeks', 'count' => $count]),
1007 'month' => ts('month', ['plural' => 'months', 'count' => $count]),
1008 'year' => ts('year', ['plural' => 'years', 'count' => $count]),
1013 * Relative Date Terms.
1017 public static function getRelativeDateTerms() {
1019 'previous' => ts('Previous'),
1020 'previous_2' => ts('Previous 2'),
1021 'previous_before' => ts('Prior to Previous'),
1022 'before_previous' => ts('All Prior to Previous'),
1023 'earlier' => ts('To End of Previous'),
1024 'greater_previous' => ts('From End of Previous'),
1025 'greater' => ts('From Start Of Current'),
1026 'current' => ts('Current'),
1027 'ending_3' => ts('Last 3'),
1028 'ending_2' => ts('Last 2'),
1029 'ending' => ts('Last'),
1030 'this' => ts('This'),
1031 'starting' => ts('Upcoming'),
1032 'less' => ts('To End of'),
1033 'next' => ts('Next'),
1038 * Relative Date Units.
1042 public static function getRelativeDateUnits() {
1044 'year' => ts('Years'),
1045 'fiscal_year' => ts('Fiscal Years'),
1046 'quarter' => ts('Quarters'),
1047 'month' => ts('Months'),
1048 'week' => ts('Weeks'),
1049 'day' => ts('Days'),
1054 * Exportable document formats.
1058 public static function documentFormat() {
1060 'pdf' => ts('Portable Document Format (.pdf)'),
1061 'docx' => ts('MS Word (.docx)'),
1062 'odt' => ts('Open Office (.odt)'),
1063 'html' => ts('Webpage (.html)'),
1068 * Application type of document.
1072 public static function documentApplicationType() {
1074 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1075 'odt' => 'application/vnd.oasis.opendocument.text',
1080 * Activity Text options.
1084 public static function activityTextOptions() {
1086 2 => ts('Details Only'),
1087 3 => ts('Subject Only'),
1093 * Relationship permissions
1097 public static function getPermissionedRelationshipOptions() {
1099 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1100 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1101 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1106 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1109 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1111 public static function getDashboardEntriesCount() {
1113 $optionValues[-1] = ts('show all');
1114 for ($i = 10; $i <= 100; $i +
= 10) {
1115 $optionValues[$i] = $i;
1117 return $optionValues;
1121 * Dropdown options for quicksearch in the menu
1124 * @throws \CiviCRM_API3_Exception
1126 public static function quicksearchOptions() {
1127 $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);
1129 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1130 'contact_id' => ts('Contact ID'),
1131 'external_identifier' => ts('External ID'),
1132 'first_name' => ts('First Name'),
1133 'last_name' => ts('Last Name'),
1134 'email' => ts('Email'),
1135 'phone_numeric' => ts('Phone'),
1136 'street_address' => ts('Street Address'),
1137 'city' => ts('City'),
1138 'postal_code' => ts('Postal Code'),
1139 'job_title' => ts('Job Title'),
1141 $custom = civicrm_api3('CustomField', 'get', [
1142 'return' => ['name', 'label', 'custom_group_id.title'],
1143 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1144 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1145 'custom_group_id.is_active' => 1,
1147 'is_searchable' => 1,
1148 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1150 foreach ($custom['values'] as $field) {
1151 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];
1157 * Get components (translated for display.
1161 * @throws \Exception
1163 public static function getComponentSelectValues() {
1165 $components = CRM_Core_Component
::getComponents();
1166 foreach ($components as $name => $object) {
1167 $ret[$name] = $object->info
['translatedName'];
1176 public static function fieldSerialization() {
1178 CRM_Core_DAO
::SERIALIZE_SEPARATOR_BOOKEND
=> 'separator_bookend',
1179 CRM_Core_DAO
::SERIALIZE_SEPARATOR_TRIMMED
=> 'separator_trimmed',
1180 CRM_Core_DAO
::SERIALIZE_JSON
=> 'json',
1181 CRM_Core_DAO
::SERIALIZE_PHP
=> 'php',
1182 CRM_Core_DAO
::SERIALIZE_COMMA
=> 'comma',
1189 public static function navigationMenuSeparator() {
1192 ts('After menu element'),
1193 ts('Before menu element'),
1200 public static function relationshipOrientation() {
1202 'a_b' => ts('A to B'),
1203 'b_a' => ts('B to A'),