本文整理汇总了PHP中CRM_Contact_BAO_Contact::retrieveValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::retrieveValue方法的具体用法?PHP CRM_Contact_BAO_Contact::retrieveValue怎么用?PHP CRM_Contact_BAO_Contact::retrieveValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact::retrieveValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_keys
/**
* Replace all the contact-level tokens in $str with information from
* $contact.
*
* @param string $str The string with tokens to be replaced
* @param array $contact Associative array of contact properties
* @param boolean $html Replace tokens with HTML or plain text
* @return string The processed string
* @access public
* @static
*/
function &replaceContactTokens($str, &$contact, $html = false)
{
if ($GLOBALS['_CRM_UTILS_TOKEN']['_tokens']['contact'] == null) {
/* This should come from UF */
($GLOBALS['_CRM_UTILS_TOKEN']['_tokens']['contact'] =& array_keys(CRM_Contact_BAO_Contact::importableFields())) + array('display_name');
}
$cv =& CRM_Core_BAO_CustomValue::getContactValues($contact['id']);
foreach ($GLOBALS['_CRM_UTILS_TOKEN']['_tokens']['contact'] as $token) {
if ($token == '') {
continue;
}
/* If the string doesn't contain this token, skip it. */
if (!CRM_Utils_Token::token_match('contact', $token, $str)) {
continue;
}
/* Construct value from $token and $contact */
$value = null;
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($token)) {
foreach ($cv as $customValue) {
if ($customValue->custom_field_id == $cfID) {
$value = $customValue->getValue();
break;
}
}
} else {
$value = CRM_Contact_BAO_Contact::retrieveValue($contact, $token);
}
CRM_Utils_Token::token_replace('contact', $token, $value, $str);
}
return $str;
}
示例2: retrieveValue
/**
* Given a parameter array from CRM_Contact_BAO_Contact::retrieve() and a
* key to search for, search recursively for that key's value.
*
* @param array $values The parameter array
* @param string $key The key to search for
* @return mixed The value of the key, or null.
* @access public
* @static
*/
function retrieveValue(&$params, $key)
{
if (!is_array($params)) {
return null;
} else {
if ($value = CRM_Utils_Array::value($key, $params)) {
return $value;
} else {
foreach ($params as $subParam) {
if ($value = CRM_Contact_BAO_Contact::retrieveValue($subParam, $key)) {
return $value;
}
}
}
}
return null;
}