Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[civicrm-core.git] / CRM / Core / SelectValues.php
index 83c177e3de5b49b56287a68968e2d911e564a02b..c15c14f66283e3bbb3046c7f74efe8c246eab26b 100644 (file)
@@ -410,7 +410,7 @@ class CRM_Core_SelectValues {
   public static function mapProvider() {
     static $map = NULL;
     if (!$map) {
-      $map = ['' => '- select -'] + CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
+      $map = ['' => ts('- select -')] + CRM_Utils_System::getPluginList('templates/CRM/Contact/Form/Task/Map', ".tpl");
     }
     return $map;
   }
@@ -424,7 +424,7 @@ class CRM_Core_SelectValues {
   public static function geoProvider() {
     static $geo = NULL;
     if (!$geo) {
-      $geo = ['' => '- select -'] + CRM_Utils_System::getPluginList('CRM/Utils/Geocode');
+      $geo = ['' => ts('- select -')] + CRM_Utils_System::getPluginList('CRM/Utils/Geocode');
     }
     return $geo;
   }
@@ -459,7 +459,7 @@ class CRM_Core_SelectValues {
   public static function addressProvider() {
     static $addr = NULL;
     if (!$addr) {
-      $addr = array_merge(['' => '- select -'], CRM_Utils_System::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
+      $addr = array_merge(['' => ts('- select -')], CRM_Utils_System::getPluginList('CRM/Utils/Address', '.php', ['BatchUpdate']));
     }
     return $addr;
   }
@@ -1037,7 +1037,7 @@ class CRM_Core_SelectValues {
     ];
     $custom = civicrm_api3('CustomField', 'get', [
       'return' => ['name', 'label', 'custom_group_id.title'],
-      'custom_group_id.extends' => ['IN' => ['Contact', 'Individual', 'Organization', 'Household']],
+      'custom_group_id.extends' => ['IN' => array_merge(['Contact'], CRM_Contact_BAO_ContactType::basicTypes())],
       'data_type' => ['NOT IN' => ['ContactReference', 'Date', 'File']],
       'custom_group_id.is_active' => 1,
       'is_active' => 1,
@@ -1101,4 +1101,32 @@ class CRM_Core_SelectValues {
     ];
   }
 
+  /**
+   * @return array
+   */
+  public static function andOr() {
+    return [
+      'AND' => ts('And'),
+      'OR' => ts('Or'),
+    ];
+  }
+
+  public static function timezone() {
+    $tzlist = &Civi::$statics[__CLASS__]['tzlist'];
+
+    if (is_null($tzlist)) {
+      $tzlist = [];
+      foreach (timezone_identifiers_list() as $tz) {
+        // Actual timezone keys for PHP are mapped to human parts.
+        $tzlist[$tz] = str_replace('_', ' ', $tz);
+      }
+
+      // Add 'Etc/UTC' specially, as timezone_identifiers_list() does
+      // not include it, but it is the IANA long name for 'UTC'
+      $tzlist['Etc/UTC'] = ts('Etc/UTC');
+    }
+
+    return $tzlist;
+  }
+
 }