| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
class CRM_Core_BAO_CustomOption {
/**
- * Fetch object based on array of properties
+ * Fetch object based on array of properties.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
- * @return CRM_Core_BAO_CustomOption object
- * @static
+ * @return CRM_Core_BAO_CustomOption
*/
public static function retrieve(&$params, &$defaults) {
$customOption = new CRM_Core_DAO_OptionValue();
}
/**
- * Returns all active options ordered by weight for a given field
+ * Returns all active options ordered by weight for a given field.
*
* @param int $fieldID
* Field whose options are needed.
- * @param boolean $inactiveNeeded
+ * @param bool $inactiveNeeded Do we need inactive options ?.
* Do we need inactive options ?.
*
- * @return array $customOption all active options for fieldId
- * @static
+ * @return array
+ * all active options for fieldId
*/
- static function getCustomOption(
+ public static function getCustomOption(
$fieldID,
$inactiveNeeded = FALSE
) {
* Returns the option label for a custom field with a specific value. Handles all
* custom field data and html types
*
- * @param $fieldId
- * Int the custom field ID.
+ * @param int $fieldId
+ * the custom field ID.
* @pram $value string the value (typically from the DB) of this custom field
* @param $value
- * @param $htmlType
- * String the html type of the field (optional).
- * @param $dataType
- * String the data type of the field (optional).
+ * @param string $htmlType
+ * the html type of the field (optional).
+ * @param string $dataType
+ * the data type of the field (optional).
*
- * @return string the label to display for this custom field
- * @static
+ * @return string
+ * the label to display for this custom field
*/
public static function getOptionLabel($fieldId, $value, $htmlType = NULL, $dataType = NULL) {
if (!$fieldId) {
case 'Radio':
case 'Autocomplete-Select':
if (!in_array($dataType, array(
- 'Boolean', 'ContactReference'))) {
+ 'Boolean',
+ 'ContactReference',
+ ))
+ ) {
$options = self::valuesByID($fieldId);
}
}
}
/**
- * Delete Option
+ * Delete Option.
*
- * param $optionId integer option id
+ * @param $optionId integer
+ * option id
*
- * @static
*/
public static function del($optionId) {
// get the customFieldID
$dao = CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
if (in_array($dao->dataType,
- array('Int', 'Float', 'Money', 'Boolean')
- )) {
+ array('Int', 'Float', 'Money', 'Boolean')
+ )) {
$value = 0;
}
else {
$dataType = $dao->dataType;
}
$queryParams = array(
- 1 => array($params['value'],
+ 1 => array(
+ $params['value'],
$dataType,
),
2 => array(
case 'CheckBox':
$oldString = CRM_Core_DAO::VALUE_SEPARATOR . $oldValue . CRM_Core_DAO::VALUE_SEPARATOR;
$newString = CRM_Core_DAO::VALUE_SEPARATOR . $params['value'] . CRM_Core_DAO::VALUE_SEPARATOR;
- $query = "
+ $query = "
UPDATE {$dao->tableName}
SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
- $queryParams = array(1 => array($oldString, 'String'),
+ $queryParams = array(
+ 1 => array($oldString, 'String'),
2 => array($newString, 'String'),
);
break;
return $options;
}
+
}