X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSelectValues.php;h=f08f5fb8f031fdffe8a55f4d2dfaea3aad28eb83;hb=afa0b07c805cd8e256b931ef1a0048de4c533125;hp=35e7b0a05477acafb3df43b2399faf9d4109287d;hpb=45dff925845496499b5c426f53f875ec2e3a219d;p=civicrm-core.git diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 35e7b0a054..f08f5fb8f0 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1,7 +1,7 @@ ts('Both'), 'HTML' => ts('HTML'), @@ -53,7 +53,7 @@ class CRM_Core_SelectValues { * Privacy options * @static */ - static function privacy() { + public static function privacy() { return array( 'do_not_phone' => ts('Do not phone'), 'do_not_email' => ts('Do not email'), @@ -68,7 +68,7 @@ class CRM_Core_SelectValues { * Various pre defined contact super types * @static */ - static function contactType() { + public static function contactType() { static $contactType = NULL; if (!$contactType) { $contactType = CRM_Contact_BAO_ContactType::basicTypePairs(); @@ -80,7 +80,7 @@ class CRM_Core_SelectValues { * Various pre defined unit list * @static */ - static function unitList($unitType = NULL) { + public static function unitList($unitType = NULL) { $unitList = array( 'day' => ts('day'), 'month' => ts('month'), @@ -96,7 +96,7 @@ class CRM_Core_SelectValues { * Membership type unit * @static */ - static function membershipTypeUnitList( ) { + public static function membershipTypeUnitList() { return self::unitList('duration'); } @@ -104,7 +104,7 @@ class CRM_Core_SelectValues { * Various pre defined period types * @static */ - static function periodType() { + public static function periodType() { return array( 'rolling' => ts('Rolling'), 'fixed' => ts('Fixed'), @@ -115,12 +115,12 @@ class CRM_Core_SelectValues { * Various pre defined email selection methods * @static */ - static function emailSelectMethods() { + public static function emailSelectMethods() { return array( 'automatic' => ts("Automatic"), 'location-only' => ts("Only send to email addresses assigned to the specified location"), 'location-prefer' => ts("Prefer email addresses assigned to the specified location"), - 'location-exclude' => ts("Exclude email addresses assigned to the specified location") + 'location-exclude' => ts("Exclude email addresses assigned to the specified location"), ); } @@ -128,18 +128,30 @@ class CRM_Core_SelectValues { * Various pre defined member visibility options * @static */ - static function memberVisibility() { + public static function memberVisibility() { return array( 'Public' => ts('Public'), 'Admin' => ts('Admin'), ); } + /** + * Member auto-renew options + * @static + */ + public static function memberAutoRenew() { + return array( + ts('No auto-renew option'), + ts('Give option, but not required'), + ts('Auto-renew required'), + ); + } + /** * Various pre defined event dates * @static */ - static function eventDate() { + public static function eventDate() { return array( 'start_date' => ts('start date'), 'end_date' => ts('end date'), @@ -151,7 +163,7 @@ class CRM_Core_SelectValues { * Custom form field types * @static */ - static function customHtmlType() { + public static function customHtmlType() { return array( 'Text' => ts('Single-line input field (text or numeric)'), 'TextArea' => ts('Multi-line text box (textarea)'), @@ -178,7 +190,7 @@ class CRM_Core_SelectValues { * * @static */ - static function customGroupExtends() { + public static function customGroupExtends() { $customGroupExtends = array( 'Activity' => ts('Activities'), 'Relationship' => ts('Relationships'), @@ -207,7 +219,7 @@ class CRM_Core_SelectValues { * * @static */ - static function customGroupStyle() { + public static function customGroupStyle() { return array( 'Tab' => ts('Tab'), 'Inline' => ts('Inline'), @@ -220,7 +232,7 @@ class CRM_Core_SelectValues { * * @static */ - static function ufGroupTypes() { + public static function ufGroupTypes() { $ufGroupType = array( 'Profile' => ts('Standalone Form or Directory'), 'Search Profile' => ts('Search Views'), @@ -240,7 +252,7 @@ class CRM_Core_SelectValues { * * @static */ - static function groupContactStatus() { + public static function groupContactStatus() { return array( 'Added' => ts('Added'), 'Removed' => ts('Removed'), @@ -252,7 +264,7 @@ class CRM_Core_SelectValues { * List of Group Types * @static */ - static function groupType() { + public static function groupType() { return array( 'query' => ts('Dynamic'), 'static' => ts('Static'), @@ -262,16 +274,17 @@ class CRM_Core_SelectValues { /** * Compose the parameters for a date select object * - * @param string|NULL $type the type of date - * @param string|NULL $format date format ( QF format) + * @param string|NULL $type the type of date + * @param string|NULL $format date format ( QF format) * * @param null $minOffset * @param null $maxOffset * - * @return array the date array + * @return array + * the date array * @static */ - static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) { + public static function date($type = NULL, $format = NULL, $minOffset = NULL, $maxOffset = NULL) { $date = array( 'addEmptyOption' => TRUE, @@ -316,7 +329,7 @@ class CRM_Core_SelectValues { * * @static */ - static function ufVisibility() { + public static function ufVisibility() { return array( 'User and User Admin Only' => ts('User and User Admin Only'), 'Public Pages' => ts('Public Pages'), @@ -329,7 +342,7 @@ class CRM_Core_SelectValues { * * @static */ - static function groupVisibility() { + public static function groupVisibility() { return array( 'User and User Admin Only' => ts('User and User Admin Only'), 'Public Pages' => ts('Public Pages'), @@ -342,8 +355,9 @@ class CRM_Core_SelectValues { * @static * return array */ - static function mailingComponents() { - return array('Header' => ts('Header'), + public static function mailingComponents() { + return array( + 'Header' => ts('Header'), 'Footer' => ts('Footer'), 'Reply' => ts('Reply Auto-responder'), 'OptOut' => ts('Opt-out Message'), @@ -360,7 +374,7 @@ class CRM_Core_SelectValues { * * @static */ - function getHours() { + public function getHours() { $hours = array(); for ($i = 0; $i <= 6; $i++) { $hours[$i] = $i; @@ -374,7 +388,7 @@ class CRM_Core_SelectValues { * * @static */ - function getMinutes() { + public function getMinutes() { $minutes = array(); for ($i = 0; $i < 60; $i = $i + 15) { $minutes[$i] = $i; @@ -385,10 +399,11 @@ class CRM_Core_SelectValues { /** * Get the Map Provider * - * @return array $map array of map providers + * @return array + * array of map providers * @static */ - static function mapProvider() { + public static function mapProvider() { static $map = NULL; if (!$map) { $map = CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl"); @@ -399,10 +414,11 @@ class CRM_Core_SelectValues { /** * Get the Geocoding Providers from available plugins * - * @return array $geo array of geocoder providers + * @return array + * array of geocoder providers * @static */ - static function geoProvider() { + public static function geoProvider() { static $geo = NULL; if (!$geo) { $geo = CRM_Utils_System::getPluginList('CRM/Utils/Geocode'); @@ -414,10 +430,11 @@ class CRM_Core_SelectValues { * Get the Address Standardization Providers from available * plugins * - * @return array $addr array of address standardization providers + * @return array + * array of address standardization providers * @static */ - static function addressProvider() { + public static function addressProvider() { static $addr = NULL; if (!$addr) { $addr = CRM_Utils_System::getPluginList('CRM/Utils/Address', '.php', array('BatchUpdate')); @@ -431,7 +448,7 @@ class CRM_Core_SelectValues { * @static * return array */ - static function mailingTokens() { + public static function mailingTokens() { return array( '{action.unsubscribe}' => ts('Unsubscribe via email'), '{action.unsubscribeUrl}' => ts('Unsubscribe via web page'), @@ -458,7 +475,7 @@ class CRM_Core_SelectValues { * @static * return array */ - static function activityTokens() { + public static function activityTokens() { return array( '{activity.activity_id}' => ts('Activity ID'), '{activity.subject}' => ts('Activity Subject'), @@ -473,7 +490,7 @@ class CRM_Core_SelectValues { * @static * return array */ - static function membershipTokens() { + public static function membershipTokens() { return array( '{membership.id}' => ts('Membership ID'), '{membership.status}' => ts('Membership Status'), @@ -491,7 +508,7 @@ class CRM_Core_SelectValues { * @static * return array */ - static function eventTokens() { + public static function eventTokens() { return array( '{event.event_id}' => ts('Event ID'), '{event.title}' => ts('Event Title'), @@ -506,7 +523,7 @@ class CRM_Core_SelectValues { '{event.fee_amount}' => ts('Event Fees'), '{event.info_url}' => ts('Event Info URL'), '{event.registration_url}' => ts('Event Registration URL'), - '{event.balance}' => ts('Event Balance') + '{event.balance}' => ts('Event Balance'), ); } @@ -516,7 +533,7 @@ class CRM_Core_SelectValues { * @static * return array */ - static function contributionTokens() { + public static function contributionTokens() { return array( '{contribution.contribution_id}' => ts('Contribution ID'), '{contribution.total_amount}' => ts('Total Amount'), @@ -550,10 +567,11 @@ class CRM_Core_SelectValues { * @static * return array */ - static function contactTokens() { + public static function contactTokens() { static $tokens = NULL; if (!$tokens) { - $additionalFields = array('checksum' => array('title' => ts('Checksum')), + $additionalFields = array( + 'checksum' => array('title' => ts('Checksum')), 'contact_id' => array('title' => ts('Internal Contact ID')), ); $exportFields = array_merge(CRM_Contact_BAO_Contact::exportableFields(), $additionalFields); @@ -563,8 +581,16 @@ class CRM_Core_SelectValues { //FIXME:skipping some tokens for time being. $skipTokens = array( - 'is_bulkmail', 'group', 'tag', 'contact_sub_type', 'note', - 'is_deceased', 'deceased_date', 'legal_identifier', 'contact_sub_type', 'user_unique_id', + 'is_bulkmail', + 'group', + 'tag', + 'contact_sub_type', + 'note', + 'is_deceased', + 'deceased_date', + 'legal_identifier', + 'contact_sub_type', + 'user_unique_id', ); $customFields = CRM_Core_BAO_CustomField::getFields(array('Individual', 'Address')); @@ -617,7 +643,7 @@ class CRM_Core_SelectValues { * @static * return array */ - static function participantTokens() { + public static function participantTokens() { static $tokens = NULL; if (!$tokens) { $exportFields = CRM_Event_BAO_Participant::exportableFields(); @@ -627,8 +653,14 @@ class CRM_Core_SelectValues { // skipping some tokens for time being. $skipTokens = array( - 'event_id', 'participant_is_pay_later', 'participant_is_test', 'participant_contact_id', - 'participant_fee_currency', 'participant_campaign_id', 'participant_status', 'participant_discount_name', + 'event_id', + 'participant_is_pay_later', + 'participant_is_test', + 'participant_contact_id', + 'participant_fee_currency', + 'participant_campaign_id', + 'participant_status', + 'participant_discount_name', ); $customFields = CRM_Core_BAO_CustomField::getFields('Participant'); @@ -652,7 +684,7 @@ class CRM_Core_SelectValues { /** * CiviCRM supported date input formats */ - static function getDatePluginInputFormats() { + public static function getDatePluginInputFormats() { $dateInputFormats = array( "mm/dd/yy" => ts('mm/dd/yyyy (12/31/2009)'), "dd/mm/yy" => ts('dd/mm/yyyy (31/12/2009)'), @@ -684,14 +716,13 @@ class CRM_Core_SelectValues { gives proper result */ - return $dateInputFormats; } /** * Map date plugin and actual format that is used by PHP */ - static function datePluginToPHPFormats() { + public static function datePluginToPHPFormats() { $dateInputFormats = array( "mm/dd/yy" => 'm/d/Y', "dd/mm/yy" => 'd/m/Y', @@ -715,7 +746,7 @@ class CRM_Core_SelectValues { /** * Time formats */ - static function getTimeFormats() { + public static function getTimeFormats() { return array( '1' => ts('12 Hours'), '2' => ts('24 Hours'), @@ -731,7 +762,7 @@ class CRM_Core_SelectValues { public static function getNumericOptions($start = 0, $end = 10) { $numericOptions = array(); for ($i = $start; $i <= $end; $i++) { - $numericOptions[$i] = $i; + $numericOptions[$i] = $i; } return $numericOptions; } @@ -740,7 +771,7 @@ class CRM_Core_SelectValues { * Barcode types * @static */ - static function getBarcodeTypes() { + public static function getBarcodeTypes() { return array( 'barcode' => ts('Linear (1D)'), 'qrcode' => ts('QR code'), @@ -750,7 +781,7 @@ class CRM_Core_SelectValues { /** * Dedupe rule types */ - static function getDedupeRuleTypes() { + public static function getDedupeRuleTypes() { return array( 'Unsupervised' => ts('Unsupervised'), 'Supervised' => ts('Supervised'), @@ -761,7 +792,7 @@ class CRM_Core_SelectValues { /** * Campaign group types */ - static function getCampaignGroupTypes() { + public static function getCampaignGroupTypes() { return array( 'Include' => ts('Include'), 'Exclude' => ts('Exclude'), @@ -771,7 +802,7 @@ class CRM_Core_SelectValues { /** * Subscription history method */ - static function getSubscriptionHistoryMethods() { + public static function getSubscriptionHistoryMethods() { return array( 'Admin' => ts('Admin'), 'Email' => ts('Email'), @@ -783,7 +814,7 @@ class CRM_Core_SelectValues { /** * Premium units */ - static function getPremiumUnits() { + public static function getPremiumUnits() { return array( 'day' => ts('Day'), 'week' => ts('Week'), @@ -795,8 +826,8 @@ class CRM_Core_SelectValues { /** * Extension types */ - static function getExtensionTypes() { - return array( + public static function getExtensionTypes() { + return array( 'payment' => ts('Payment'), 'search' => ts('Search'), 'report' => ts('Report'), @@ -808,7 +839,7 @@ class CRM_Core_SelectValues { /** * Job frequency */ - static function getJobFrequency() { + public static function getJobFrequency() { return array( 'Daily' => ts('Daily'), 'Hourly' => ts('Hourly'), @@ -819,7 +850,7 @@ class CRM_Core_SelectValues { /** * Search builder operators */ - static function getSearchBuilderOperators() { + public static function getSearchBuilderOperators() { return array( '=' => '=', '!=' => '≠', @@ -828,7 +859,9 @@ class CRM_Core_SelectValues { '>=' => '≥', '<=' => '≤', 'IN' => ts('In'), + 'NOT IN' => ts('Not In'), 'LIKE' => ts('Like'), + 'NOT LIKE' => ts('Not Like'), 'RLIKE' => ts('Regex'), 'IS EMPTY' => ts('Is Empty'), 'IS NOT EMPTY' => ts('Not Empty'), @@ -842,7 +875,7 @@ class CRM_Core_SelectValues { * * @static */ - static function getProfileGroupType() { + public static function getProfileGroupType() { $profileGroupType = array( 'Activity' => ts('Activities'), 'Contribution' => ts('Contributions'), @@ -851,7 +884,7 @@ class CRM_Core_SelectValues { ); $contactTypes = self::contactType(); $contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array(); - $profileGroupType = array_merge($contactTypes, $profileGroupType ); + $profileGroupType = array_merge($contactTypes, $profileGroupType); return $profileGroupType; } @@ -860,17 +893,17 @@ class CRM_Core_SelectValues { /** * Word replacement match type */ - static function getWordReplacementMatchType() { + public static function getWordReplacementMatchType() { return array( - 'exactMatch' => ts('Exact Match'), - 'wildcardMatch' => ts('Wildcard Match'), - ); + 'exactMatch' => ts('Exact Match'), + 'wildcardMatch' => ts('Wildcard Match'), + ); } /** * Mailing group types */ - static function getMailingGroupTypes() { + public static function getMailingGroupTypes() { return array( 'Include' => ts('Include'), 'Exclude' => ts('Exclude'), @@ -881,7 +914,7 @@ class CRM_Core_SelectValues { /** * Mailing Job Status */ - static function getMailingJobStatus() { + public static function getMailingJobStatus() { return array( 'Scheduled' => ts('Scheduled'), 'Running' => ts('Running'), @@ -891,7 +924,7 @@ class CRM_Core_SelectValues { ); } - static function billingMode() { + public static function billingMode() { return array( CRM_Core_Payment::BILLING_MODE_FORM => 'form', CRM_Core_Payment::BILLING_MODE_BUTTON => 'button', @@ -902,12 +935,13 @@ class CRM_Core_SelectValues { /** * Frequency unit for schedule reminders */ - static function getScheduleReminderFrequencyUnits() { + public static function getScheduleReminderFrequencyUnits() { //@todo update schema to refer to option group direct & remove this static $scheduleReminderFrequencyUnits = NULL; if (!$scheduleReminderFrequencyUnits) { $scheduleReminderFrequencyUnits = array( - 'hour' => ts('hour')) + CRM_Core_OptionGroup::values('recur_frequency_units'); + 'hour' => ts('hour') + ) + CRM_Core_OptionGroup::values('recur_frequency_units'); } return $scheduleReminderFrequencyUnits;