本文整理汇总了PHP中CRM_Core_BAO_CustomField::getDisplayValueCommon方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomField::getDisplayValueCommon方法的具体用法?PHP CRM_Core_BAO_CustomField::getDisplayValueCommon怎么用?PHP CRM_Core_BAO_CustomField::getDisplayValueCommon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomField
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomField::getDisplayValueCommon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptionLabel
/**
* 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
* @pram $value string the value (typically from the DB) of this custom field
* @param $htmlType string the html type of the field (optional)
* @param $dataType string the data type of the field (optional)
*
* @return string the label to display for this custom field
* @static
* @access public
*/
static function getOptionLabel($fieldId, $value, $htmlType = NULL, $dataType = NULL)
{
if (!$fieldId) {
return NULL;
}
if (!$htmlType || !$dataType) {
$sql = "\nSELECT html_type, data_type\nFROM civicrm_custom_field\nWHERE id = %1\n";
$params = array(1 => array($fieldId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if ($dao->fetch()) {
$htmlType = $dao->html_type;
$dataType = $dao->data_type;
} else {
CRM_Core_Error::fatal();
}
}
$options = NULL;
switch ($htmlType) {
case 'CheckBox':
case 'Multi-Select':
case 'AdvMulti-Select':
case 'Select':
case 'Radio':
case 'Autocomplete-Select':
if (!in_array($dataType, array('Boolean', 'ContactReference'))) {
$options = self::valuesByID($fieldId);
}
}
return CRM_Core_BAO_CustomField::getDisplayValueCommon($value, $options, $htmlType, $dataType);
}
示例2: getOptionLabel
static function getOptionLabel($fieldId, $value, $htmlType = null, $dataType = null)
{
if (!$fieldId) {
return null;
}
if (!$htmlType || !$dataType) {
$sql = "\nSELECT html_type, data_type\nFROM civicrm_custom_field\nWHERE id = %1\n";
$params = array(1 => array($fieldId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if ($dao->fetch()) {
$htmlType = $dao->html_type;
$dataType = $dao->data_type;
} else {
CRM_Core_Error::fatal();
}
}
$options = null;
switch ($htmlType) {
case 'CheckBox':
case 'Multi-Select':
case 'AdvMulti-Select':
case 'Select':
case 'Radio':
if ($dataType != 'Boolean') {
$options =& self::valuesByID($fieldId);
}
}
require_once 'CRM/Core/BAO/CustomField.php';
return CRM_Core_BAO_CustomField::getDisplayValueCommon($value, $options, $htmlType, $dataType);
}