X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FSelectValues.php;h=721ba43ea4b4754f4c68d9c94f1908dff9afd6c0;hb=7fce4915eecc80f9f693a490548d579c1ca6aec6;hp=089bbb9150c1d617fca0bf625de24a99eee0b1f1;hpb=76e7a76c36e82fca4901e87abf8f1afddf2384ef;p=civicrm-core.git diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 089bbb9150..721ba43ea4 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * One place to store frequently used values in Select Elements. Note that @@ -38,8 +38,20 @@ class CRM_Core_SelectValues { /** - * Preferred mail format - * + * Yes/No options + * + * @return array + */ + public static function boolean() { + return array( + 1 => ts('Yes'), + 0 => ts('No'), + ); + } + + /** + * Preferred mail format. + * * @return array */ public static function pmf() { @@ -51,7 +63,7 @@ class CRM_Core_SelectValues { } /** - * Privacy options + * Privacy options. * * @return array */ @@ -67,7 +79,7 @@ class CRM_Core_SelectValues { } /** - * Various pre defined contact super types + * Various pre defined contact super types. * * @return array */ @@ -80,8 +92,8 @@ class CRM_Core_SelectValues { } /** - * Various pre defined unit list - * + * Various pre defined unit list. + * * @param string $unitType * @return array */ @@ -98,7 +110,7 @@ class CRM_Core_SelectValues { } /** - * Membership type unit + * Membership type unit. * * @return array */ @@ -107,7 +119,7 @@ class CRM_Core_SelectValues { } /** - * Various pre defined period types + * Various pre defined period types. * * @return array */ @@ -119,7 +131,7 @@ class CRM_Core_SelectValues { } /** - * Various pre defined email selection methods + * Various pre defined email selection methods. * * @return array */ @@ -133,7 +145,7 @@ class CRM_Core_SelectValues { } /** - * Various pre defined member visibility options + * Various pre defined member visibility options. * * @return array */ @@ -158,7 +170,7 @@ class CRM_Core_SelectValues { } /** - * Various pre defined event dates + * Various pre defined event dates. * * @return array */ @@ -171,7 +183,7 @@ class CRM_Core_SelectValues { } /** - * Custom form field types + * Custom form field types. * * @return array */ @@ -198,7 +210,7 @@ class CRM_Core_SelectValues { } /** - * Various pre defined extensions for dynamic properties and groups + * Various pre defined extensions for dynamic properties and groups. * * @return array * @@ -228,10 +240,9 @@ class CRM_Core_SelectValues { } /** - * Styles for displaying the custom data group + * Styles for displaying the custom data group. * * @return array - * */ public static function customGroupStyle() { return array( @@ -242,7 +253,7 @@ class CRM_Core_SelectValues { } /** - * For displaying the uf group types + * For displaying the uf group types. * * @return array */ @@ -262,10 +273,9 @@ class CRM_Core_SelectValues { } /** - * The status of a contact within a group + * The status of a contact within a group. * * @return array - * */ public static function groupContactStatus() { return array( @@ -276,7 +286,7 @@ class CRM_Core_SelectValues { } /** - * List of Group Types + * List of Group Types. * * @return array */ @@ -288,7 +298,7 @@ class CRM_Core_SelectValues { } /** - * Compose the parameters for a date select object + * Compose the parameters for a date select object. * * @param string|NULL $type * the type of date @@ -340,7 +350,7 @@ class CRM_Core_SelectValues { } /** - * Values for UF form visibility options + * Values for UF form visibility options. * * @return array */ @@ -353,7 +363,7 @@ class CRM_Core_SelectValues { } /** - * Values for group form visibility options + * Values for group form visibility options. * * @return array */ @@ -365,7 +375,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Mailing Components + * Different type of Mailing Components. * * @return array */ @@ -383,7 +393,7 @@ class CRM_Core_SelectValues { } /** - * Get hours + * Get hours. * * @return array */ @@ -396,7 +406,7 @@ class CRM_Core_SelectValues { } /** - * Get minutes + * Get minutes. * * @return array */ @@ -409,7 +419,7 @@ class CRM_Core_SelectValues { } /** - * Get the Map Provider + * Get the Map Provider. * * @return array * array of map providers @@ -423,7 +433,7 @@ class CRM_Core_SelectValues { } /** - * Get the Geocoding Providers from available plugins + * Get the Geocoding Providers from available plugins. * * @return array * array of geocoder providers @@ -437,7 +447,7 @@ class CRM_Core_SelectValues { } /** - * Get the Address Standardization Providers from available plugins + * Get the Address Standardization Providers from available plugins. * * @return array * array of address standardization providers @@ -451,7 +461,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Mailing Tokens + * Different type of Mailing Tokens. * * @return array */ @@ -477,7 +487,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Activity Tokens + * Different type of Activity Tokens. * * @return array */ @@ -491,7 +501,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Membership Tokens + * Different type of Membership Tokens. * * @return array */ @@ -508,7 +518,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Event Tokens + * Different type of Event Tokens. * * @return array */ @@ -532,7 +542,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Event Tokens + * Different type of Event Tokens. * * @return array */ @@ -565,7 +575,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Contact Tokens + * Different type of Contact Tokens. * * @return array */ @@ -617,7 +627,7 @@ class CRM_Core_SelectValues { } } - // might as well get all the hook tokens to + // Get all the hook tokens too $hookTokens = array(); CRM_Utils_Hook::tokens($hookTokens); foreach ($hookTokens as $tokenValues) { @@ -640,7 +650,7 @@ class CRM_Core_SelectValues { } /** - * Different type of Participant Tokens + * Different type of Participant Tokens. * * @return array */ @@ -683,7 +693,7 @@ class CRM_Core_SelectValues { } /** - * CiviCRM supported date input formats + * CiviCRM supported date input formats. * * @return array */ @@ -707,23 +717,23 @@ class CRM_Core_SelectValues { ); /* - Year greater than 2000 get wrong result for following format - echo date( 'Y-m-d', strtotime( '7 Nov, 2001') ); - echo date( 'Y-m-d', strtotime( '7 November, 2001') ); - Return current year - expected :: 2001-11-07 - output :: 2009-11-07 - However - echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') ); - echo date( 'Y-m-d', strtotime( 'November 7, 2001') ); - gives proper result + Year greater than 2000 get wrong result for following format + echo date( 'Y-m-d', strtotime( '7 Nov, 2001') ); + echo date( 'Y-m-d', strtotime( '7 November, 2001') ); + Return current year + expected :: 2001-11-07 + output :: 2009-11-07 + However + echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') ); + echo date( 'Y-m-d', strtotime( 'November 7, 2001') ); + gives proper result */ return $dateInputFormats; } /** - * Map date plugin and actual format that is used by PHP + * Map date plugin and actual format that is used by PHP. * * @return array */ @@ -749,7 +759,7 @@ class CRM_Core_SelectValues { } /** - * Time formats + * Time formats. * * @return array */ @@ -761,8 +771,8 @@ class CRM_Core_SelectValues { } /** - * Get numeric options - * + * Get numeric options. + * * @param int $start * @param int $end * @@ -777,7 +787,7 @@ class CRM_Core_SelectValues { } /** - * Barcode types + * Barcode types. * * @return array */ @@ -789,7 +799,7 @@ class CRM_Core_SelectValues { } /** - * Dedupe rule types + * Dedupe rule types. * * @return array */ @@ -802,7 +812,7 @@ class CRM_Core_SelectValues { } /** - * Campaign group types + * Campaign group types. * * @return array */ @@ -814,7 +824,7 @@ class CRM_Core_SelectValues { } /** - * Subscription history method + * Subscription history method. * * @return array */ @@ -828,7 +838,7 @@ class CRM_Core_SelectValues { } /** - * Premium units + * Premium units. * * @return array */ @@ -842,7 +852,7 @@ class CRM_Core_SelectValues { } /** - * Extension types + * Extension types. * * @return array */ @@ -857,7 +867,7 @@ class CRM_Core_SelectValues { } /** - * Job frequency + * Job frequency. * * @return array */ @@ -870,7 +880,7 @@ class CRM_Core_SelectValues { } /** - * Search builder operators + * Search builder operators. * * @return array */ @@ -895,7 +905,7 @@ class CRM_Core_SelectValues { } /** - * Profile group types + * Profile group types. * * @return array */ @@ -915,7 +925,7 @@ class CRM_Core_SelectValues { /** - * Word replacement match type + * Word replacement match type. * * @return array */ @@ -927,7 +937,7 @@ class CRM_Core_SelectValues { } /** - * Mailing group types + * Mailing group types. * * @return array */ @@ -940,7 +950,7 @@ class CRM_Core_SelectValues { } /** - * Mailing Job Status + * Mailing Job Status. * * @return array */ @@ -966,19 +976,23 @@ class CRM_Core_SelectValues { } /** - * Frequency unit for schedule reminders + * Frequency unit for schedule reminders. * + * @param int $count + * For pluralization * @return array */ - 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'); - } - - return $scheduleReminderFrequencyUnits; + public static function getRecurringFrequencyUnits($count = 1) { + // @todo this used to refer to the 'recur_frequency_unit' option_values which + // is for recurring payments and probably not good to re-use for recurring entities. + // If something other than a hard-coded list is desired, add a new option_group. + return array( + 'hour' => ts('hour', array('plural' => 'hours', 'count' => $count)), + 'day' => ts('day', array('plural' => 'days', 'count' => $count)), + 'week' => ts('week', array('plural' => 'weeks', 'count' => $count)), + 'month' => ts('month', array('plural' => 'months', 'count' => $count)), + 'year' => ts('year', array('plural' => 'years', 'count' => $count)), + ); } + }