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 static $contactType = NULL;
73 $contactType = CRM_Contact_BAO_ContactType
::basicTypePairs();
79 * Various pre defined unit list.
81 * @param string $unitType
84 public static function unitList($unitType = NULL) {
87 'month' => ts('month'),
90 if ($unitType === 'duration') {
91 $unitList['lifetime'] = ts('lifetime');
97 * Membership type unit.
101 public static function membershipTypeUnitList() {
102 return self
::unitList('duration');
106 * Various pre defined period types.
110 public static function periodType() {
112 'rolling' => ts('Rolling'),
113 'fixed' => ts('Fixed'),
118 * Various pre defined email selection methods.
122 public static function emailSelectMethods() {
124 'automatic' => ts('Automatic'),
125 'location-only' => ts('Only send to email addresses assigned to the specified location'),
126 'location-prefer' => ts('Prefer email addresses assigned to the specified location'),
127 'location-exclude' => ts('Exclude email addresses assigned to the specified location'),
132 * Various pre defined member visibility options.
136 public static function memberVisibility() {
138 'Public' => ts('Public'),
139 'Admin' => ts('Admin'),
144 * Member auto-renew options
148 public static function memberAutoRenew() {
150 ts('No auto-renew option'),
151 ts('Give option, but not required'),
152 ts('Auto-renew required'),
157 * Various pre defined event dates.
161 public static function eventDate() {
163 'start_date' => ts('start date'),
164 'end_date' => ts('end date'),
165 'join_date' => ts('member since'),
170 * Custom form field types.
174 public static function customHtmlType() {
176 'Text' => ts('Single-line input field (text or numeric)'),
177 'TextArea' => ts('Multi-line text box (textarea)'),
178 'Select' => ts('Drop-down (select list)'),
179 'Radio' => ts('Radio buttons'),
180 'CheckBox' => ts('Checkbox(es)'),
181 'Select Date' => ts('Select Date'),
182 'File' => ts('File'),
183 'Select State/Province' => ts('Select State/Province'),
184 'Multi-Select State/Province' => ts('Multi-Select State/Province'),
185 'Select Country' => ts('Select Country'),
186 'Multi-Select Country' => ts('Multi-Select Country'),
187 'RichTextEditor' => ts('Rich Text Editor'),
188 'Autocomplete-Select' => ts('Autocomplete-Select'),
189 'Multi-Select' => ts('Multi-Select'),
190 'Link' => ts('Link'),
191 'ContactReference' => ts('Autocomplete-Select'),
196 * Various pre defined extensions for dynamic properties and groups.
201 public static function customGroupExtends() {
202 $customGroupExtends = [
203 'Activity' => ts('Activities'),
204 'Relationship' => ts('Relationships'),
205 'Contribution' => ts('Contributions'),
206 'ContributionRecur' => ts('Recurring Contributions'),
207 'Group' => ts('Groups'),
208 'Membership' => ts('Memberships'),
209 'Event' => ts('Events'),
210 'Participant' => ts('Participants'),
211 'ParticipantRole' => ts('Participants (Role)'),
212 'ParticipantEventName' => ts('Participants (Event Name)'),
213 'ParticipantEventType' => ts('Participants (Event Type)'),
214 'Pledge' => ts('Pledges'),
215 'Grant' => ts('Grants'),
216 'Address' => ts('Addresses'),
217 'Campaign' => ts('Campaigns'),
219 $contactTypes = self
::contactType();
220 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
221 $extendObjs = CRM_Core_OptionGroup
::values('cg_extend_objects');
222 $customGroupExtends = array_merge($contactTypes, $customGroupExtends, $extendObjs);
223 return $customGroupExtends;
227 * Styles for displaying the custom data group.
231 public static function customGroupStyle() {
234 'Inline' => ts('Inline'),
235 'Tab with table' => ts('Tab with table'),
240 * For displaying the uf group types.
244 public static function ufGroupTypes() {
246 'Profile' => ts('Standalone Form or Directory'),
247 'Search Profile' => ts('Search Views'),
250 if (CRM_Core_Config
::singleton()->userSystem
->supports_form_extensions
) {
252 'User Registration' => ts('Drupal User Registration'),
253 'User Account' => ts('View/Edit Drupal User Account'),
260 * The status of a contact within a group.
264 public static function groupContactStatus() {
266 'Added' => ts('Added'),
267 'Removed' => ts('Removed'),
268 'Pending' => ts('Pending'),
273 * List of Group Types.
277 public static function groupType() {
279 'query' => ts('Dynamic'),
280 'static' => ts('Static'),
285 * Compose the parameters for a date select object.
287 * @param string|null $type
289 * @param string|null $format
290 * date format (QF format)
291 * @param null $minOffset
292 * @param null $maxOffset
293 * @param string $context
297 * @throws CRM_Core_Exception
299 public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL, $context = 'display') {
300 // These options are deprecated. Definitely not used in datepicker. Possibly not even in jcalendar+addDateTime.
302 'addEmptyOption' => TRUE,
303 'emptyOptionText' => ts('- select -'),
304 'emptyOptionValue' => '',
308 $date['format'] = $format;
312 $dao = new CRM_Core_DAO_PreferencesDate();
314 if (!$dao->find(TRUE)) {
315 throw new CRM_Core_Exception('Date preferences not configured.');
318 $maxOffset = $dao->end
;
321 $minOffset = $dao->start
;
324 $date['format'] = $dao->date_format
;
325 $date['time'] = (bool) $dao->time_format
;
328 if (empty($date['format'])) {
329 if ($context === 'Input') {
330 $date['format'] = Civi
::settings()->get('dateInputFormat');
333 $date['format'] = 'M d';
338 $date['smarty_view_format'] = CRM_Utils_Date
::getDateFieldViewFormat($date['format']);
339 if (!isset($date['time'])) {
340 $date['time'] = FALSE;
344 $date['minYear'] = $year - (int) $minOffset;
345 $date['maxYear'] = $year +
(int) $maxOffset;
350 * Values for UF form visibility options.
354 public static function ufVisibility() {
356 'User and User Admin Only' => ts('User and User Admin Only'),
357 'Public Pages' => ts('Expose Publicly'),
358 'Public Pages and Listings' => ts('Expose Publicly and for Listings'),
363 * Values for group form visibility options.
367 public static function groupVisibility() {
369 'User and User Admin Only' => ts('User and User Admin Only'),
370 'Public Pages' => ts('Public Pages'),
375 * Different type of Mailing Components.
379 public static function mailingComponents() {
381 'Header' => ts('Header'),
382 'Footer' => ts('Footer'),
383 'Reply' => ts('Reply Auto-responder'),
384 'OptOut' => ts('Opt-out Message'),
385 'Subscribe' => ts('Subscription Confirmation Request'),
386 'Welcome' => ts('Welcome Message'),
387 'Unsubscribe' => ts('Unsubscribe Message'),
388 'Resubscribe' => ts('Resubscribe Message'),
397 public function getHours() {
399 for ($i = 0; $i <= 6; $i++
) {
410 public function getMinutes() {
412 for ($i = 0; $i < 60; $i = $i +
15) {
419 * Get the Map Provider.
422 * array of map providers
424 public static function mapProvider() {
427 $map = ['' => '- select -'] + CRM_Utils_System
::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
433 * Get the Geocoding Providers from available plugins.
436 * array of geocoder providers
438 public static function geoProvider() {
441 $geo = ['' => '- select -'] + CRM_Utils_System
::getPluginList('CRM/Utils/Geocode');
447 * Get options for displaying tax.
451 * @throws \CRM_Core_Exception
453 public function taxDisplayOptions() {
455 'Do_not_show' => ts('Do not show breakdown, only show total - i.e %1', [
456 1 => CRM_Utils_Money
::format(120),
458 'Inclusive' => ts('Show [tax term] inclusive price - i.e. %1', [
459 1 => ts('%1 (includes [tax term] of %2)', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
461 'Exclusive' => ts('Show [tax term] exclusive price - i.e. %1', [
462 1 => ts('%1 + %2 [tax term]', [1 => CRM_Utils_Money
::format(120), 2 => CRM_Utils_Money
::format(20)]),
468 * Get the Address Standardization Providers from available plugins.
471 * array of address standardization providers
473 public static function addressProvider() {
476 $addr = array_merge(['' => '- select -'], CRM_Utils_System
::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
482 * Different type of Mailing Tokens.
486 public static function mailingTokens() {
488 '{action.unsubscribe}' => ts('Unsubscribe via email'),
489 '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'),
490 '{action.resubscribe}' => ts('Resubscribe via email'),
491 '{action.resubscribeUrl}' => ts('Resubscribe via web page'),
492 '{action.optOut}' => ts('Opt out via email'),
493 '{action.optOutUrl}' => ts('Opt out via web page'),
494 '{action.forward}' => ts('Forward this email (link)'),
495 '{action.reply}' => ts('Reply to this email (link)'),
496 '{action.subscribeUrl}' => ts('Subscribe via web page'),
497 '{domain.name}' => ts('Domain name'),
498 '{domain.address}' => ts('Domain (organization) address'),
499 '{domain.phone}' => ts('Domain (organization) phone'),
500 '{domain.email}' => ts('Domain (organization) email'),
501 '{mailing.key}' => ts('Mailing key'),
502 '{mailing.name}' => ts('Mailing name'),
503 '{mailing.group}' => ts('Mailing group'),
504 '{mailing.viewUrl}' => ts('Mailing permalink'),
509 * Different type of Activity Tokens.
513 public static function activityTokens() {
515 '{activity.activity_id}' => ts('Activity ID'),
516 '{activity.subject}' => ts('Activity Subject'),
517 '{activity.details}' => ts('Activity Details'),
518 '{activity.activity_date_time}' => ts('Activity Date Time'),
523 * Different type of Membership Tokens.
527 public static function membershipTokens() {
529 '{membership.id}' => ts('Membership ID'),
530 '{membership.status}' => ts('Membership Status'),
531 '{membership.type}' => ts('Membership Type'),
532 '{membership.start_date}' => ts('Membership Start Date'),
533 '{membership.join_date}' => ts('Membership Join Date'),
534 '{membership.end_date}' => ts('Membership End Date'),
535 '{membership.fee}' => ts('Membership Fee'),
540 * Different type of Event Tokens.
544 public static function eventTokens() {
546 '{event.event_id}' => ts('Event ID'),
547 '{event.title}' => ts('Event Title'),
548 '{event.start_date}' => ts('Event Start Date'),
549 '{event.end_date}' => ts('Event End Date'),
550 '{event.event_type}' => ts('Event Type'),
551 '{event.summary}' => ts('Event Summary'),
552 '{event.contact_email}' => ts('Event Contact Email'),
553 '{event.contact_phone}' => ts('Event Contact Phone'),
554 '{event.description}' => ts('Event Description'),
555 '{event.location}' => ts('Event Location'),
556 '{event.fee_amount}' => ts('Event Fees'),
557 '{event.info_url}' => ts('Event Info URL'),
558 '{event.registration_url}' => ts('Event Registration URL'),
559 '{event.balance}' => ts('Event Balance'),
564 * Different type of Event Tokens.
568 public static function contributionTokens() {
570 '{contribution.contribution_id}' => ts('Contribution ID'),
571 '{contribution.total_amount}' => ts('Total Amount'),
572 '{contribution.fee_amount}' => ts('Fee Amount'),
573 '{contribution.net_amount}' => ts('Net Amount'),
574 '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
575 '{contribution.receive_date}' => ts('Contribution Date Received'),
576 '{contribution.payment_instrument}' => ts('Payment Method'),
577 '{contribution.trxn_id}' => ts('Transaction ID'),
578 '{contribution.invoice_id}' => ts('Invoice ID'),
579 '{contribution.currency}' => ts('Currency'),
580 '{contribution.cancel_date}' => ts('Contribution Cancel Date'),
581 '{contribution.cancel_reason}' => ts('Contribution Cancel Reason'),
582 '{contribution.receipt_date}' => ts('Receipt Date'),
583 '{contribution.thankyou_date}' => ts('Thank You Date'),
584 '{contribution.contribution_source}' => ts('Contribution Source'),
585 '{contribution.amount_level}' => ts('Amount Level'),
586 //'{contribution.contribution_recur_id}' => ts('Contribution Recurring ID'),
587 //'{contribution.honor_contact_id}' => ts('Honor Contact ID'),
588 '{contribution.contribution_status_id}' => ts('Contribution Status'),
589 //'{contribution.honor_type_id}' => ts('Honor Type ID'),
590 //'{contribution.address_id}' => ts('Address ID'),
591 '{contribution.check_number}' => ts('Check Number'),
592 '{contribution.campaign}' => ts('Contribution Campaign'),
593 ], CRM_Utils_Token
::getCustomFieldTokens('contribution', TRUE));
597 * Different type of Contact Tokens.
601 public static function contactTokens() {
602 static $tokens = NULL;
604 $additionalFields = [
605 'checksum' => ['title' => ts('Checksum')],
606 'contact_id' => ['title' => ts('Internal Contact ID')],
608 $exportFields = array_merge(CRM_Contact_BAO_Contact
::exportableFields(), $additionalFields);
610 $values = array_merge(array_keys($exportFields));
613 //FIXME:skipping some tokens for time being.
627 $customFields = CRM_Core_BAO_CustomField
::getFields(['Individual', 'Address']);
628 $legacyTokenNames = array_flip(CRM_Utils_Token
::legacyContactTokens());
630 foreach ($values as $val) {
631 if (in_array($val, $skipTokens)) {
634 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
635 $customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val);
636 if ($customFieldId) {
637 // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
638 if (!empty($customFields[$customFieldId])) {
639 $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
643 // Support legacy token names
644 $tokenName = CRM_Utils_Array
::value($val, $legacyTokenNames, $val);
645 $tokens["{contact.$tokenName}"] = $exportFields[$val]['title'];
649 // Get all the hook tokens too
651 CRM_Utils_Hook
::tokens($hookTokens);
652 foreach ($hookTokens as $tokenValues) {
653 foreach ($tokenValues as $key => $value) {
654 if (is_numeric($key)) {
657 if (!preg_match('/^\{[^\}]+\}$/', $key)) {
658 $key = '{' . $key . '}';
660 if (preg_match('/^\{([^\}]+)\}$/', $value, $matches)) {
661 $value = $matches[1];
663 $tokens[$key] = $value;
672 * Different type of Participant Tokens.
676 public static function participantTokens() {
677 static $tokens = NULL;
679 $exportFields = CRM_Event_BAO_Participant
::exportableFields();
681 $values = array_merge(array_keys($exportFields));
684 // skipping some tokens for time being.
687 'participant_is_pay_later',
688 'participant_is_test',
689 'participant_contact_id',
690 'participant_fee_currency',
691 'participant_campaign_id',
692 'participant_status',
693 'participant_discount_name',
696 $customFields = CRM_Core_BAO_CustomField
::getFields('Participant');
698 foreach ($values as $key => $val) {
699 if (in_array($val, $skipTokens)) {
702 //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
703 if ($customFieldId = CRM_Core_BAO_CustomField
::getKeyID($val)) {
704 $tokens["{participant.$val}"] = !empty($customFields[$customFieldId]) ?
$customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
707 $tokens["{participant.$val}"] = $exportFields[$val]['title'];
715 * @param int $caseTypeId
718 public static function caseTokens($caseTypeId = NULL) {
719 static $tokens = NULL;
721 foreach (CRM_Case_BAO_Case
::fields() as $field) {
722 $tokens["{case.{$field['name']}}"] = $field['title'];
725 $customFields = CRM_Core_BAO_CustomField
::getFields('Case', FALSE, FALSE, $caseTypeId);
726 foreach ($customFields as $id => $field) {
727 $tokens["{case.custom_$id}"] = "{$field['label']} :: {$field['groupTitle']}";
734 * CiviCRM supported date input formats.
738 public static function getDatePluginInputFormats() {
740 'mm/dd/yy' => ts('mm/dd/yy (12/31/2009)'),
741 'dd/mm/yy' => ts('dd/mm/yy (31/12/2009)'),
742 'yy-mm-dd' => ts('yy-mm-dd (2009-12-31)'),
743 'dd-mm-yy' => ts('dd-mm-yy (31-12-2009)'),
744 'dd.mm.yy' => ts('dd.mm.yy (31.12.2009)'),
745 'M d, yy' => ts('M d, yy (Dec 31, 2009)'),
746 'd M yy' => ts('d M yy (31 Dec 2009)'),
747 'MM d, yy' => ts('MM d, yy (December 31, 2009)'),
748 'd MM yy' => ts('d MM yy (31 December 2009)'),
749 'DD, d MM yy' => ts('DD, d MM yy (Thursday, 31 December 2009)'),
750 'mm/dd' => ts('mm/dd (12/31)'),
751 'dd-mm' => ts('dd-mm (31-12)'),
752 'yy-mm' => ts('yy-mm (2009-12)'),
753 'M yy' => ts('M yy (Dec 2009)'),
754 'yy' => ts('yy (2009)'),
763 public static function getTimeFormats() {
765 '1' => ts('12 Hours'),
766 '2' => ts('24 Hours'),
771 * Get numeric options.
778 public static function getNumericOptions($start = 0, $end = 10) {
779 $numericOptions = [];
780 for ($i = $start; $i <= $end; $i++
) {
781 $numericOptions[$i] = $i;
783 return $numericOptions;
791 public static function getBarcodeTypes() {
793 'barcode' => ts('Linear (1D)'),
794 'qrcode' => ts('QR code'),
803 public static function getDedupeRuleTypes() {
805 'Unsupervised' => ts('Unsupervised'),
806 'Supervised' => ts('Supervised'),
807 'General' => ts('General'),
812 * Campaign group types.
816 public static function getCampaignGroupTypes() {
818 'Include' => ts('Include'),
819 'Exclude' => ts('Exclude'),
824 * Subscription history method.
828 public static function getSubscriptionHistoryMethods() {
830 'Admin' => ts('Admin'),
831 'Email' => ts('Email'),
842 public static function getPremiumUnits() {
845 'week' => ts('Week'),
846 'month' => ts('Month'),
847 'year' => ts('Year'),
856 public static function getExtensionTypes() {
858 'payment' => ts('Payment'),
859 'search' => ts('Search'),
860 'report' => ts('Report'),
861 'module' => ts('Module'),
871 public static function getJobFrequency() {
874 'Yearly' => ts('Yearly'),
875 'Quarter' => ts('Quarterly'),
876 'Monthly' => ts('Monthly'),
877 'Weekly' => ts('Weekly'),
879 'Daily' => ts('Daily'),
880 'Hourly' => ts('Hourly'),
881 'Always' => ts('Every time cron job is run'),
886 * Search builder operators.
890 public static function getSearchBuilderOperators() {
899 'NOT IN' => ts('Not In'),
900 'LIKE' => ts('Like'),
901 'NOT LIKE' => ts('Not Like'),
902 'RLIKE' => ts('Regex'),
903 'IS EMPTY' => ts('Is Empty'),
904 'IS NOT EMPTY' => ts('Not Empty'),
905 'IS NULL' => ts('Is Null'),
906 'IS NOT NULL' => ts('Not Null'),
911 * Profile group types.
915 public static function getProfileGroupType() {
916 $profileGroupType = [
917 'Activity' => ts('Activities'),
918 'Contribution' => ts('Contributions'),
919 'Membership' => ts('Memberships'),
920 'Participant' => ts('Participants'),
922 $contactTypes = self
::contactType();
923 $contactTypes = !empty($contactTypes) ?
['Contact' => 'Contacts'] +
$contactTypes : [];
924 $profileGroupType = array_merge($contactTypes, $profileGroupType);
926 return $profileGroupType;
930 * Word replacement match type.
934 public static function getWordReplacementMatchType() {
936 'exactMatch' => ts('Exact Match'),
937 'wildcardMatch' => ts('Wildcard Match'),
942 * Mailing group types.
946 public static function getMailingGroupTypes() {
948 'Include' => ts('Include'),
949 'Exclude' => ts('Exclude'),
950 'Base' => ts('Base'),
955 * Mailing Job Status.
959 public static function getMailingJobStatus() {
961 'Scheduled' => ts('Scheduled'),
962 'Running' => ts('Running'),
963 'Complete' => ts('Complete'),
964 'Paused' => ts('Paused'),
965 'Canceled' => ts('Canceled'),
972 public static function billingMode() {
974 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'form',
975 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'button',
976 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
983 public static function contributeMode() {
985 CRM_Core_Payment
::BILLING_MODE_FORM
=> 'direct',
986 CRM_Core_Payment
::BILLING_MODE_BUTTON
=> 'directIPN',
987 CRM_Core_Payment
::BILLING_MODE_NOTIFY
=> 'notify',
992 * Frequency unit for schedule reminders.
998 public static function getRecurringFrequencyUnits($count = 1) {
999 // @todo this used to refer to the 'recur_frequency_unit' option_values which
1000 // is for recurring payments and probably not good to re-use for recurring entities.
1001 // If something other than a hard-coded list is desired, add a new option_group.
1003 'hour' => ts('hour', ['plural' => 'hours', 'count' => $count]),
1004 'day' => ts('day', ['plural' => 'days', 'count' => $count]),
1005 'week' => ts('week', ['plural' => 'weeks', 'count' => $count]),
1006 'month' => ts('month', ['plural' => 'months', 'count' => $count]),
1007 'year' => ts('year', ['plural' => 'years', 'count' => $count]),
1012 * Relative Date Terms.
1016 public static function getRelativeDateTerms() {
1018 'previous' => ts('Previous'),
1019 'previous_2' => ts('Previous 2'),
1020 'previous_before' => ts('Prior to Previous'),
1021 'before_previous' => ts('All Prior to Previous'),
1022 'earlier' => ts('To End of Previous'),
1023 'greater_previous' => ts('From End of Previous'),
1024 'greater' => ts('From Start Of Current'),
1025 'current' => ts('Current'),
1026 'ending_3' => ts('Last 3'),
1027 'ending_2' => ts('Last 2'),
1028 'ending' => ts('Last'),
1029 'this' => ts('This'),
1030 'starting' => ts('Upcoming'),
1031 'less' => ts('To End of'),
1032 'next' => ts('Next'),
1037 * Relative Date Units.
1041 public static function getRelativeDateUnits() {
1043 'year' => ts('Years'),
1044 'fiscal_year' => ts('Fiscal Years'),
1045 'quarter' => ts('Quarters'),
1046 'month' => ts('Months'),
1047 'week' => ts('Weeks'),
1048 'day' => ts('Days'),
1053 * Exportable document formats.
1057 public static function documentFormat() {
1059 'pdf' => ts('Portable Document Format (.pdf)'),
1060 'docx' => ts('MS Word (.docx)'),
1061 'odt' => ts('Open Office (.odt)'),
1062 'html' => ts('Webpage (.html)'),
1067 * Application type of document.
1071 public static function documentApplicationType() {
1073 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
1074 'odt' => 'application/vnd.oasis.opendocument.text',
1079 * Activity Text options.
1083 public static function activityTextOptions() {
1085 2 => ts('Details Only'),
1086 3 => ts('Subject Only'),
1092 * Relationship permissions
1096 public static function getPermissionedRelationshipOptions() {
1098 CRM_Contact_BAO_Relationship
::NONE
=> ts('None'),
1099 CRM_Contact_BAO_Relationship
::VIEW
=> ts('View only'),
1100 CRM_Contact_BAO_Relationship
::EDIT
=> ts('View and update'),
1105 * Get option values for dashboard entries (used for 'how many events to display on dashboard').
1108 * Dashboard entries options - in practice [-1 => 'Show All', 10 => 10, 20 => 20, ... 100 => 100].
1110 public static function getDashboardEntriesCount() {
1112 $optionValues[-1] = ts('show all');
1113 for ($i = 10; $i <= 100; $i +
= 10) {
1114 $optionValues[$i] = $i;
1116 return $optionValues;
1120 * Dropdown options for quicksearch in the menu
1123 * @throws \CiviCRM_API3_Exception
1125 public static function quicksearchOptions() {
1126 $includeEmail = civicrm_api3('setting', 'getvalue', ['name' => 'includeEmailInName', 'group' => 'Search Preferences']);
1128 'sort_name' => $includeEmail ?
ts('Name/Email') : ts('Name'),
1129 'contact_id' => ts('Contact ID'),
1130 'external_identifier' => ts('External ID'),
1131 'first_name' => ts('First Name'),
1132 'last_name' => ts('Last Name'),
1133 'email' => ts('Email'),
1134 'phone_numeric' => ts('Phone'),
1135 'street_address' => ts('Street Address'),
1136 'city' => ts('City'),
1137 'postal_code' => ts('Postal Code'),
1138 'job_title' => ts('Job Title'),
1140 $custom = civicrm_api3('CustomField', 'get', [
1141 'return' => ['name', 'label', 'custom_group_id.title'],
1142 'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
1143 'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
1144 'custom_group_id.is_active' => 1,
1146 'is_searchable' => 1,
1147 'options' => ['sort' => ['custom_group_id.weight', 'weight'], 'limit' => 0],
1149 foreach ($custom['values'] as $field) {
1150 $options['custom_' . $field['name']] = $field['custom_group_id.title'] . ': ' . $field['label'];
1156 * Get components (translated for display.
1160 * @throws \Exception
1162 public static function getComponentSelectValues() {
1164 $components = CRM_Core_Component
::getComponents();
1165 foreach ($components as $name => $object) {
1166 $ret[$name] = $object->info
['translatedName'];