private static $cache;
/**
- * location type
- * @var array
- * @static
- */
- private static $locationType;
-
- /**
- * location vCard name
- * @var array
- * @static
- */
- private static $locationVcardName;
-
- /**
- * location display name
- * @var array
- * @static
- */
- private static $locationDisplayName;
-
- /**
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
+ *
* activity type
* @var array
* @static
*/
private static $activityType;
- /**
- * payment processor billing modes
- * @var array
- * @static
- */
- private static $billingMode;
-
- /**
- * component
- * @var array
- * @static
- */
- private static $component;
-
- /**
- * im protocols
- * @var array
- * @static
- */
- private static $imProvider;
-
- /**
- * website protocols
- * @var array
- * @static
- */
- private static $websiteType;
-
- /**
- * im protocols
- * @var array
- * @static
- */
- private static $fromEmailAddress;
-
/**
* states, provinces
* @var array
private static $countryIsoCode;
/**
- * tag
- * @var array
- * @static
- */
- private static $tag;
-
- /**
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
+ *
* group
* @var array
* @static
*/
private static $staticGroup;
- /**
- * user framework groups
- * @var array
- * @static
- */
- private static $ufGroup;
-
- /**
- * custom groups
- * @var array
- * @static
- */
- private static $customGroup;
-
/**
* currency codes
* @var array
*/
private static $currencyCode;
- /**
- * currency Symbols
- * @var array
- * @static
- */
- private static $currencySymbols;
-
- /**
- * preferred communication methods
- * @var array
- * @static
- */
- private static $pcm;
-
/**
* payment processor
* @var array
private static $worldRegions;
/**
- * honorType
- * @var array
- * @static
- */
- private static $honorType;
-
- /**
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
+ *
* activity status
* @var array
* @static
*/
private static $activityStatus;
- /**
- * priority
- * @var array
- * @static
- */
- private static $priority;
-
- /**
- * wysiwyg Editor
- * @var array
- * @static
- */
- private static $wysiwygEditor;
-
- /**
- * Mapping Types
- * @var array
- * @static
- */
- private static $mappingType;
-
- /**
- * Phone Types
- * @var array
- * @static
- */
- private static $phoneType;
-
/**
* Visibility
* @var array
*/
private static $visibility;
- /**
- * Mail Protocols
- * @var array
- * @static
- */
- private static $mailProtocol;
-
/**
* Greetings
* @var array
private static $extensions;
/**
- * activity contacts
- * @var array
- * @static
- */
- private static $activityContacts;
-
- /**
- * event contacts
- * @var array
- * @static
- */
- private static $eventContacts;
-
- /**
- * auto renew options
- * @var array
- * @static
- */
- private static $autoRenew;
-
- /**
- * batch mode options
- * @var array
- * @static
- */
- private static $batchModes;
-
- /**
- * batch type options
- * @var array
- * @static
- */
- private static $batchTypes;
-
- /**
- * batch status options
- * @var array
- * @static
- */
- private static $batchStatues;
-
- /**
- * contact Type
- * @var array
- * @static
- */
- private static $contactType;
-
- /**
- * Financial Account Type
- * @var array
- * @static
- */
- private static $accountOptionValues;
-
- /**
- * Get options for a given field.
+ * Low-level option getter, rarely accessed directly.
+ * NOTE: Rather than calling this function directly use CRM_*_BAO_*::buildOptions()
+ *
* @param String $daoName
* @param String $fieldName
* @param Array $params
+ * - name string name of the option group
+ * - flip boolean results are return in id => label format if false
+ * if true, the results are reversed
+ * - grouping boolean if true, return the value in 'grouping' column (currently unsupported for tables other than option_value)
+ * - localize boolean if true, localize the results before returning
+ * - condition string|array add condition(s) to the sql query
+ * - keyColumn string the column to use for 'id'
+ * - labelColumn string the column to use for 'label'
+ * - orderColumn string the column to use for sorting, defaults to 'weight' column if one exists, else defaults to labelColumn
+ * - onlyActive boolean return only the action option values
+ * - fresh boolean ignore cache entries and go back to DB
*
* @return Array on success, FALSE on error.
- *
+ *
* @static
*/
public static function get($daoName, $fieldName, $params = array()) {
+ $flip = !empty($params['flip']);
+
+ // Custom fields are not in the schema
+ if (strpos($fieldName, 'custom') === 0) {
+ $dao = new CRM_Core_DAO_CustomField;
+ $dao->id = (int) substr($fieldName, 7);
+ $dao->find(TRUE);
+ $customField = (array) $dao;
+ $dao->free();
+ $output = array();
+ CRM_Core_BAO_CustomField::buildOption($customField, $output);
+ return $flip ? array_flip($output) : $output;
+ }
+
+ // Core field: load schema
$dao = new $daoName;
$fields = $dao->fields();
- if (empty($fields[$fieldName])) {
+ $fieldKeys = $dao->fieldKeys();
+ $fieldKey = $fieldKeys[$fieldName];
+ $dao->free();
+ if (empty($fields[$fieldKey])) {
return FALSE;
}
- $fieldSpec = $fields[$fieldName];
+ $fieldSpec = $fields[$fieldKey];
- // If the field is an enum, use explode the enum definition and return the array.
- if (array_key_exists('enumValues', $fieldSpec)) {
+ // If the field is an enum, explode the enum definition and return the array.
+ if (isset($fieldSpec['enumValues'])) {
// use of a space after the comma is inconsistent in xml
$enumStr = str_replace(', ', ',', $fieldSpec['enumValues']);
- return explode(',', $enumStr);
+ $output = explode(',', $enumStr);
+ return $flip ? array_flip($output) : $output;
}
+
elseif (!empty($fieldSpec['pseudoconstant'])) {
$pseudoconstant = $fieldSpec['pseudoconstant'];
+ // Merge params with defaults
+ $params += array(
+ 'grouping' => FALSE,
+ 'localize' => FALSE,
+ 'condition' => CRM_Utils_Array::value('condition', $pseudoconstant),
+ 'keyColumn' => CRM_Utils_Array::value('keyColumn', $pseudoconstant),
+ 'labelColumn' => CRM_Utils_Array::value('labelColumn', $pseudoconstant),
+ 'onlyActive' => TRUE,
+ 'fresh' => FALSE,
+ );
+
+ // Fetch option group from option_value table
if(!empty($pseudoconstant['optionGroupName'])) {
- // Translate $params array into function arguments;
- // populate default function params if not supplied in the array.
- $ret = CRM_Core_OptionGroup::values(
+ // Call our generic fn for retrieving from the option_value table
+ return CRM_Core_OptionGroup::values(
$pseudoconstant['optionGroupName'],
- CRM_Utils_Array::value('flip', $params, FALSE),
- CRM_Utils_Array::value('grouping', $params, FALSE),
- CRM_Utils_Array::value('localize', $params, FALSE),
- CRM_Utils_Array::value('condition', $params, NULL),
- CRM_Utils_Array::value('labelColumnName', $params, 'label'),
- CRM_Utils_Array::value('onlyActive', $params, TRUE),
- CRM_Utils_Array::value('fresh', $params, FALSE)
+ $flip,
+ $params['grouping'],
+ $params['localize'],
+ $params['condition'],
+ $params['labelColumn'] ? $params['labelColumn'] : 'label',
+ $params['onlyActive'],
+ $params['fresh'],
+ $params['keyColumn'] ? $params['keyColumn'] : 'value'
);
- return $ret;
}
+
+ // Fetch options from other tables
if (!empty($pseudoconstant['table'])) {
- // Sort params so the serialized string will be consistent.
+ // Normalize params so the serialized cache string will be consistent.
+ CRM_Utils_Array::remove($params, 'flip', 'fresh');
ksort($params);
- $cacheKey = "{$daoName}{$fieldName}" . serialize($params);
+ $cacheKey = $daoName . $fieldName . serialize($params);
- if (isset(self::$cache[$cacheKey])) {
- return self::$cache[$cacheKey];
+ // Retrieve cached options
+ if (isset(self::$cache[$cacheKey]) && empty($params['fresh'])) {
+ $output = self::$cache[$cacheKey];
}
+ else {
+ $daoName = CRM_Core_AllCoreTables::getClassForTable($pseudoconstant['table']);
+ if (!class_exists($daoName)) {
+ return FALSE;
+ }
+ // Get list of fields for the option table
+ $dao = new $daoName;
+ $availableFields = array_keys($dao->fieldKeys());
+ if (in_array('is_active', $availableFields)) {
+ $wheres[] = 'is_active = 1';
+ }
+ $dao->free();
+
+ $select = "SELECT %1 AS id, %2 AS label";
+ $from = "FROM %3";
+ $wheres = array();
+ $order = "ORDER BY %2";
+ // Condition param can be passed as an sql clause string or an array of clauses
+ if (!empty($params['condition'])) {
+ $wheres[] = implode(' AND ', (array) $params['condition']);
+ }
+ // onlyActive param will automatically filter on common flags
+ if (!empty($params['onlyActive'])) {
+ foreach (array('is_active' => 1, 'is_deleted' => 0, 'is_test' => 0) as $flag => $val) {
+ if (in_array($flag, $availableFields)) {
+ $wheres[] = "$flag = $val";
+ }
+ }
+ }
+ // Filter domain specific options
+ if (in_array('domain_id', $availableFields)) {
+ $wheres[] = 'domain_id = ' . CRM_Core_Config::domainID();
+ }
+ $queryParams = array(
+ 1 => array($params['keyColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
+ 2 => array($params['labelColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
+ 3 => array($pseudoconstant['table'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
+ );
+ // Add orderColumn param
+ if (!empty($params['orderColumn'])) {
+ $queryParams[4] = array($params['orderColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES);
+ $order = "ORDER BY %4";
+ }
+ // Support no sorting if $params[orderColumn] is FALSE
+ elseif (isset($params['orderColumn']) && $params['orderColumn'] === FALSE) {
+ $order = '';
+ }
+ // Default to 'weight' if that column exists
+ elseif (in_array('weight', $availableFields)) {
+ $order = "ORDER BY weight";
+ }
- $query = "
- SELECT
- %1 AS id, %2 AS label
- FROM
- %3
- ";
- if (!empty($pseudoconstant['condition'])) {
- $query .= " WHERE {$pseudoconstant['condition']}";
- }
- $query .= " ORDER BY %2";
- $queryParams = array(
- 1 => array($pseudoconstant['keyColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
- 2 => array($pseudoconstant['labelColumn'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
- 3 => array($pseudoconstant['table'], 'String', CRM_Core_DAO::QUERY_FORMAT_NO_QUOTES),
- );
-
- self::$cache[$cacheKey] = array();
- $dao = CRM_Core_DAO::executeQuery($query, $queryParams);
- while ($dao->fetch()) {
- self::$cache[$cacheKey][$dao->id] = $dao->label;
- }
- if (CRM_Utils_Array::value('localize', $params)) {
- $i18n = CRM_Core_I18n::singleton();
- $i18n->localizeArray(self::$cache[$cacheKey]);
+ $output = array();
+ $query = "$select $from";
+ if ($wheres) {
+ $query .= " WHERE " . implode($wheres, ' AND ');
+ }
+ $query .= ' ' . $order;
+ $dao = CRM_Core_DAO::executeQuery($query, $queryParams);
+ while ($dao->fetch()) {
+ $output[$dao->id] = $dao->label;
+ }
+ $dao->free();
+ if (!empty($params['localize'])) {
+ $i18n = CRM_Core_I18n::singleton();
+ $i18n->localizeArray($output);
+ // Maintain sort by label
+ if ($order == "ORDER BY %2") {
+ CRM_Utils_Array::asort($output);
+ }
+ }
+ self::$cache[$cacheKey] = $output;
}
- return self::$cache[$cacheKey];
+ return $flip ? array_flip($output) : $output;
}
}
// If we're still here, it's an error. Return FALSE.
}
/**
- * populate the object from the database. generic populate
- * method
+ * Fetch the label (or other value) for a field given its key
+ *
+ * @param String $daoName
+ * @param String $fieldName
+ * @param String|Int $key
+ * @param Array $params will be passed into self::get
+ *
+ * @return string
+ */
+ function getValue($daoName, $fieldName, $key, $params = array()) {
+ $values = self::get($daoName, $fieldName, $params);
+ return CRM_Utils_Array::value($key, $values);
+ }
+
+ /**
+ * Fetch the key for a field option given its label/name
+ *
+ * @param String $daoName
+ * @param String $fieldName
+ * @param String|Int $value
+ * @param Array $params will be passed into self::get
+ *
+ * @return string
+ */
+ function getKey($daoName, $fieldName, $value, $params = array()) {
+ $values = self::get($daoName, $fieldName, $params);
+ return CRM_Utils_Array::key($value, $values);
+ }
+
+ /**
+ * DEPRECATED generic populate method
+ * All pseudoconstant functions that use this method are also deprecated.
*
* The static array $var is populated from the db
* using the <b>$name DAO</b>.
* @param boolean $name pseudoconstant to be flushed
*
*/
- public static function flush($name) {
- if (isset(self::$$name)) {
+ public static function flush($name = 'cache') {
+ if (property_exists(self, $name)) {
self::$$name = NULL;
}
}
/**
- * Get all location types.
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
- * The static array locationType is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All location types - default is to get only active ones.
- *
- * @return array - array reference of all location types.
- *
- */
- public static function &locationType($all = FALSE) {
- if (!self::$locationType) {
- self::populate(self::$locationType, 'CRM_Core_DAO_LocationType', $all);
- }
- return self::$locationType;
- }
-
- /**
- * Get all location vCard names.
- *
- * The static array locationVcardName is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All location vCard names - default is to get only active ones.
- *
- * @return array - array reference of all location vCard names.
- *
- */
- public static function &locationVcardName($all = FALSE) {
- if (!self::$locationVcardName) {
- self::populate(self::$locationVcardName, 'CRM_Core_DAO_LocationType', $all, 'vcard_name');
- }
- return self::$locationVcardName;
- }
-
- /**
- * Get all location Display names.
- *
- * The static array locationDisplayName is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All location display names - default is to get only active ones.
- *
- * @return array - array reference of all location display names.
- *
- */
- public static function &locationDisplayName($all = FALSE) {
- if (!self::$locationDisplayName) {
- self::populate(self::$locationDisplayName, 'CRM_Core_DAO_LocationType', $all, 'display_name');
- }
- return self::$locationDisplayName;
- }
-
- /**
* Get all Activty types.
*
* The static array activityType is returned
}
return self::$activityType[$index];
}
-
- /**
- * Get all payment-processor billing modes
- *
- * @access public
- * @static
- *
- * @return array ($id => $name)
- */
- public static function billingMode() {
- if (!self::$billingMode) {
- self::$billingMode = array(
- CRM_Core_Payment::BILLING_MODE_FORM => 'form',
- CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
- CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify',
- );
- }
- return self::$billingMode;
- }
-
- /**
- * Get all component names
- *
- * @access public
- * @static
- *
- * @return array - array reference of all location display names.
- *
- */
- public static function &component() {
- if (!self::$component) {
- self::populate(self::$component, 'CRM_Core_DAO_Component', TRUE, 'name');
- }
- return self::$component;
- }
-
- /**
- * Get all phone type
- * The static array phoneType is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All phone type - default is to get
- * only active ones.
- *
- * @return array - array reference of all phone types.
- *
- */
- public static function &phoneType() {
- if (!self::$phoneType) {
- self::$phoneType = CRM_Core_OptionGroup::values('phone_type');
- }
- return self::$phoneType;
- }
-
- /**
- * Get all the IM Providers from database.
- *
- * The static array imProvider is returned, and if it's
- * called the first time, the <b>IM DAO</b> is used
- * to get all the IM Providers.
- *
- * Note: any database errors will be trapped by the DAO.
- *
- * @access public
- * @static
- *
- * @return array - array reference of all IM providers.
- *
- */
- public static function &IMProvider($localize = FALSE) {
- if (!self::$imProvider) {
- self::$imProvider = CRM_Core_OptionGroup::values('instant_messenger_service', FALSE, FALSE, $localize);
- }
- return self::$imProvider;
- }
-
- /**
- * Get all the website types from database.
- *
- * The static array websiteType is returned, and if it's
- * called the first time, the <b>Website DAO</b> is used
- * to get all the Website Types.
- *
- * Note: any database errors will be trapped by the DAO.
- *
- * @access public
- * @static
- *
- * @return array - array reference of all Website types.
- *
- */
- public static function &websiteType() {
- if (!self::$websiteType) {
- self::$websiteType = CRM_Core_OptionGroup::values('website_type');
- }
- return self::$websiteType;
- }
-
- /**
- * Get the all From Email Address from database.
- *
- * The static array $fromEmailAddress is returned, and if it's
- * called the first time, DAO is used
- * to get all the From Email Address
- *
- * Note: any database errors will be trapped by the DAO.
- *
- * @access public
- * @static
- *
- * @return array - array reference of all From Email Address.
- */
- public static function &fromEmailAddress() {
- if (!self::$fromEmailAddress) {
- self::$fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address');
- }
- return self::$fromEmailAddress;
- }
-
- /**
- * Get the all Mail Protocols from database.
- *
- * The static array mailProtocol is returned, and if it's
- * called the first time, the DAO is used
- * to get all the Mail Protocol.
- *
- * Note: any database errors will be trapped by the DAO.
- *
- * @access public
- * @static
- *
- * @return array - array reference of all Mail Protocols.
- */
- public static function &mailProtocol() {
- if (!self::$mailProtocol) {
- self::$mailProtocol = CRM_Core_OptionGroup::values('mail_protocol');
- }
- return self::$mailProtocol;
- }
-
+
/**
* Get all the State/Province from database.
*
}
/**
- * Get all the categories from database.
- *
- * The static array tag is returned, and if it's
- * called the first time, the <b>Tag DAO</b> is used
- * to get all the categories.
- *
- * Note: any database errors will be trapped by the DAO.
- *
- * @access public
- * @static
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
- * @return array - array reference of all categories.
- *
- */
- public static function &tag() {
- if (!self::$tag) {
- self::populate(self::$tag, 'CRM_Core_DAO_Tag', TRUE);
- }
- return self::$tag;
- }
-
- /**
* Get all groups from database
*
* The static array group is returned, and if it's
}
/**
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
+ *
* Get all permissioned groups from database
*
* The static array group is returned, and if it's
return self::$staticGroup;
}
- /**
- * Get all the custom groups
- *
- * @access public
- *
- * @return array - array reference of all groups.
- * @static
- */
- public static function &customGroup($reset = FALSE) {
- if (!self::$customGroup || $reset) {
- self::populate(self::$customGroup, 'CRM_Core_DAO_CustomGroup', FALSE, 'title', 'is_active', NULL, 'title');
- }
- return self::$customGroup;
- }
-
- /**
- * Get all the user framework groups
- *
- * @access public
- *
- * @return array - array reference of all groups.
- * @static
- */
- public static function &ufGroup() {
- if (!self::$ufGroup) {
- self::populate(self::$ufGroup, 'CRM_Core_DAO_UFGroup', FALSE, 'title', 'is_active', NULL, 'title');
- }
- return self::$ufGroup;
- }
-
/**
* Get all Relationship Types from database.
*
return self::$relationshipType[$valueColumnName];
}
- /**
- * Get all the Currency Symbols from Database
- *
- * @access public
- *
- * @return array - array reference of all Currency Symbols
- * @static
- */
- public static function ¤cySymbols($name = 'symbol', $key = 'id') {
- $cacheKey = "{$name}_{$key}";
- if (!isset(self::$currencySymbols[$cacheKey])) {
- self::populate(self::$currencySymbols[$cacheKey], 'CRM_Financial_DAO_Currency', TRUE, $name, NULL, NULL, 'name', $key);
- }
-
- return self::$currencySymbols[$cacheKey];
- }
-
/**
* get all the ISO 4217 currency codes
*
}
/**
- * Get all the Preferred Communication Methods from database.
- *
- * @access public
- * @static
- *
- * @return array self::pcm - array reference of all preferred communication methods.
- *
- */
- public static function &pcm($localize = FALSE) {
- if (!self::$pcm) {
- self::$pcm = CRM_Core_OptionGroup::values('preferred_communication_method', FALSE, FALSE, $localize);
- }
- return self::$pcm;
- }
-
- /**
- * Alias of pcm
- */
- public static function preferredCommunicationMethod($localize = FALSE) {
- return self::pcm($localize);
- }
-
- /**
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
* Get all active payment processors
*
* The static array paymentProcessor is returned
}
/**
- * Get all active payment processors
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
* The static array paymentProcessorType is returned
*
}
/**
- * Get all Honor Type.
- *
- * The static array honorType is returned
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
- * @access public
- * @static
- *
- * @param boolean $all - get All Honor Type.
- *
- * @return array - array reference of all Honor Types.
- *
- */
- public static function &honor() {
- if (!self::$honorType) {
- self::$honorType = CRM_Core_OptionGroup::values('honor_type');
- }
- return self::$honorType;
- }
-
- /**
* Get all Activity Statuses.
*
* The static array activityStatus is returned
}
/**
- * Get all Priorities
+ * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
- * The static array Priority is returned
- *
- * @access public
- * @static
- *
- * @return array - array reference of all Priority
- */
- public static function &priority() {
- if (!self::$priority) {
- self::$priority = CRM_Core_OptionGroup::values('priority');
- }
-
- return self::$priority;
- }
-
- /**
- * Get all WYSIWYG Editors.
- *
- * The static array wysiwygEditor is returned
- *
- * @access public
- * @static
- *
- * @return array - array reference of all wysiwygEditors
- */
- public static function &wysiwygEditor() {
- if (!self::$wysiwygEditor) {
- self::$wysiwygEditor = CRM_Core_OptionGroup::values('wysiwyg_editor');
- }
- return self::$wysiwygEditor;
- }
-
- /**
* Get all Visibility levels.
*
* The static array visibility is returned
return self::$visibility[$column];
}
- /**
- * Get all mapping types
- *
- * @return array - array reference of all mapping types
- * @access public
- * @static
- */
- public static function &mappingTypes() {
- if (!self::$mappingType) {
- self::$mappingType = CRM_Core_OptionGroup::values('mapping_type');
- }
- return self::$mappingType;
- }
-
public static function &stateProvinceForCountry($countryID, $field = 'name') {
static $_cache = NULL;
public static function &greetingDefaults() {
if (!self::$greetingDefaults) {
$defaultGreetings = array();
- $contactTypes = array(
- 'Individual' => 1,
- 'Household' => 2,
- 'Organization' => 3,
- );
+ $contactTypes = self::get('CRM_Contact_DAO_Contact', 'contact_type', array('keyColumn' => 'id', 'labelColumn' => 'name'));
- foreach ($contactTypes as $contactType => $filter) {
+ foreach ($contactTypes as $filter => $contactType) {
$filterCondition = " AND (v.filter = 0 OR v.filter = $filter) AND v.is_default = 1 ";
foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
return self::$greetingDefaults;
}
- /**
- * Get all the Languages from database.
- *
- * @access public
- * @static
- *
- * @return array self::languages - array reference of all languages
- *
- */
- public static function &languages() {
- return CRM_Core_I18n_PseudoConstant::languages();
- }
-
- /**
- * Alias of above
- */
- public static function &preferredLanguage() {
- return CRM_Core_I18n_PseudoConstant::languages();
- }
-
/**
* Get all extensions
*
public static function getModuleExtensions($fresh = FALSE) {
return CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles($fresh);
}
-
- /**
- * Get all Activity Contacts
- *
- * The static array activityContacts is returned
- *
- * @access public
- * @static
- *
- * @param string $column db column name/label.
- *
- * @return array - array reference of all activity Contacts
- *
- */
- public static function &activityContacts($column = 'label') {
- if (!self::$activityContacts) {
- self::$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, $column);
- }
- return self::$activityContacts;
- }
-
- /**
- * Get all Event Contacts
- *
- * The static array eventContacts is returned
- *
- * @access public
- * @static
- *
- * @param string $column db column name/label.
- *
- * @return array - array reference of all event Contacts
- *
- */
- public static function &eventContacts($column = 'label') {
- if (!self::$eventContacts) {
- self::$eventContacts = CRM_Core_OptionGroup::values('event_contacts', FALSE, FALSE, FALSE, NULL, $column);
- }
- return self::$eventContacts;
- }
-
- /**
- * Get all options values
- *
- * The static array option values is returned
- *
- * @access public
- * @static
- *
- * @param boolean $optionGroupName - get All Option Group values- default is to get only active ones.
- *
- * @return array - array reference of all Option Group Name
- *
- */
- public static function accountOptionValues($optionGroupName, $id = null, $condition = null) {
- $cacheKey = $optionGroupName . '_' . $condition;
- if (empty(self::$accountOptionValues[$cacheKey])) {
- self::$accountOptionValues[$cacheKey] = CRM_Core_OptionGroup::values($optionGroupName, false, false, false, $condition);
- }
- if ($id) {
- return CRM_Utils_Array::value($id, self::$accountOptionValues[$cacheKey]);
- }
-
- return self::$accountOptionValues[$cacheKey];
- }
-
- /**
- * Get all batch modes
- *
- * The static array batchModes
- *
- * @access public
- * @static
- *
- * @return array - array reference of all batch modes
- */
- public static function &getBatchMode($columnName = 'label') {
- if (!self::$batchModes) {
- self::$batchModes = CRM_Core_OptionGroup::values('batch_mode', false, false, false, null, $columnName);
- }
-
- return self::$batchModes;
- }
-
- /**
- * Get all batch types
- *
- * The static array batchTypes
- *
- * @access public
- * @static
- *
- * @return array - array reference of all batch types
- */
- public static function &getBatchType() {
- if (!self::$batchTypes) {
- self::$batchTypes = CRM_Core_OptionGroup::values('batch_type');
- }
-
- return self::$batchTypes;
- }
-
- /**
- * Get all batch statuses
- *
- * The static array batchStatues
- *
- * @access public
- * @static
- *
- * @return array - array reference of all batch statuses
- */
- public static function &getBatchStatus() {
- if (!self::$batchStatues) {
- self::$batchStatues = CRM_Core_OptionGroup::values('batch_status');
- }
-
- return self::$batchStatues;
- }
-
- /*
- * The static array contactType is returned
- *
- * @access public
- * @static
- * @param string $column db column name/label.
- *
- * @return array - array reference of all Types
- *
- */
-
- public static function &contactType($column = 'label') {
- if (!self::$contactType) {
- self::$contactType = CRM_Contact_BAO_ContactType::basicTypePairs(TRUE);
- }
- return self::$contactType;
- }
-
- /**
- * Get all the auto renew options
- *
- * @access public
- * @static
- *
- * @return array self::autoRenew - array reference of all autoRenew
- *
- */
- public static function &autoRenew() {
- if (!self::$autoRenew) {
- self::$autoRenew = CRM_Core_OptionGroup::values('auto_renew_options', FALSE, FALSE);
- }
- return self::$autoRenew;
- }
}