Merge pull request #5449 from pratikshad/fixedWebtest4.6
[civicrm-core.git] / CRM / Core / SelectValues.php
index 2e30aafd67cbb6ad4ec3a99c3432e93a5f873ed7..721ba43ea4b4754f4c68d9c94f1908dff9afd6c0 100644 (file)
  */
 class CRM_Core_SelectValues {
 
+  /**
+   * Yes/No options
+   *
+   * @return array
+   */
+  public static function boolean() {
+    return array(
+      1 => ts('Yes'),
+      0 => ts('No'),
+    );
+  }
+
   /**
    * Preferred mail format.
    *
@@ -231,7 +243,6 @@ class CRM_Core_SelectValues {
    * Styles for displaying the custom data group.
    *
    * @return array
-   *
    */
   public static function customGroupStyle() {
     return array(
@@ -265,7 +276,6 @@ class CRM_Core_SelectValues {
    * The status of a contact within a group.
    *
    * @return array
-   *
    */
   public static function groupContactStatus() {
     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) {
@@ -968,18 +978,21 @@ class CRM_Core_SelectValues {
   /**
    * 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)),
+    );
   }
 
 }