本文整理汇总了PHP中CRM_Contact_BAO_ContactType::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_ContactType::retrieve方法的具体用法?PHP CRM_Contact_BAO_ContactType::retrieve怎么用?PHP CRM_Contact_BAO_ContactType::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_ContactType
的用法示例。
在下文中一共展示了CRM_Contact_BAO_ContactType::retrieve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImage
/**
* given a contact type, get the contact image
*
* @param string $contact_type
*
* @return string
* @access public
* @static
*/
static function getImage($contactType, $urlOnly = false, $contactId = null)
{
static $imageInfo = array();
if (!array_key_exists($contactType, $imageInfo)) {
$imageInfo[$contactType] = array();
$typeInfo = array();
$params = array('name' => $contactType);
require_once 'CRM/Contact/BAO/ContactType.php';
CRM_Contact_BAO_ContactType::retrieve($params, $typeInfo);
if (CRM_Utils_Array::value('image_URL', $typeInfo)) {
$imageUrl = $typeInfo['image_URL'];
$config = CRM_Core_Config::singleton();
if (!preg_match("/^(\\/|(http(s)?:)).+\$/i", $imageUrl)) {
$imageUrl = $config->resourceBase . $imageUrl;
}
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$typeInfo['name']}-icon\" style=\"background: url('{$imageUrl}')\" title=\"{$contactType}\"></div>";
$imageInfo[$contactType]['url'] = $imageUrl;
} else {
$isSubtype = array_key_exists('parent_id', $typeInfo) && $typeInfo['parent_id'] ? true : false;
if ($isSubtype) {
$type = CRM_Contact_BAO_ContactType::getBasicType($typeInfo['name']) . "-subtype";
} else {
$type = $typeInfo['name'];
}
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$type}-icon\" title=\"{$contactType}\"></div>";
$imageInfo[$contactType]['url'] = null;
}
}
$summaryOvelayProfileId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', 'summary_overlay', 'id', 'name');
$profileURL = CRM_Utils_System::url('civicrm/profile/view', "reset=1&gid={$summaryOvelayProfileId}&id={$contactId}&snippet=4");
$imageInfo[$contactType]['summary-link'] = '<a href="' . $profileURL . '" class="crm-summary-link">' . $imageInfo[$contactType]["image"] . '</a>';
return $urlOnly ? $imageInfo[$contactType]['url'] : $imageInfo[$contactType]['summary-link'];
}
示例2: getImage
/**
* given a contact type, get the contact image
*
* @param string $contact_type
*
* @return string
* @access public
* @static
*/
static function getImage($contactType, $urlOnly = false)
{
static $imageInfo = array();
if (!array_key_exists($contactType, $imageInfo)) {
$imageInfo[$contactType] = array();
$params = array('name' => $contactType);
CRM_Contact_BAO_ContactType::retrieve($params, $typeInfo);
if ($typeInfo['image_URL']) {
$imageUrl = $typeInfo['image_URL'];
$config =& CRM_Core_Config::singleton();
if (!preg_match("/^(\\/|(http(s)?:)).+\$/i", $imageUrl)) {
$imageUrl = $config->resourceBase . $imageUrl;
}
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$typeInfo['name']}-icon\" style=\"background: url('{$imageUrl}')\"></div>";
$imageInfo[$contactType]['url'] = $imageUrl;
} else {
$isSubtype = array_key_exists('parent_id', $typeInfo) && $typeInfo['parent_id'] ? true : false;
if ($isSubtype) {
$type = CRM_Contact_BAO_ContactType::getBasicType($typeInfo['name']) . "-subtype";
} else {
$type = $typeInfo['name'];
}
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$type}-icon\"></div>";
$imageInfo[$contactType]['url'] = null;
}
}
return $urlOnly ? $imageInfo[$contactType]['url'] : $imageInfo[$contactType]['image'];
}
示例3: getImage
/**
* Given a contact type, get the contact image.
*
* @param string $contactType
* Contact type.
* @param bool $urlOnly
* If we need to return only image url.
* @param int $contactId
* Contact id.
* @param bool $addProfileOverlay
* If profile overlay class should be added.
*
* @return string
*/
public static function getImage($contactType, $urlOnly = FALSE, $contactId = NULL, $addProfileOverlay = TRUE)
{
static $imageInfo = array();
$contactType = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($contactType, CRM_Core_DAO::VALUE_SEPARATOR));
$contactType = $contactType[0];
if (!array_key_exists($contactType, $imageInfo)) {
$imageInfo[$contactType] = array();
$typeInfo = array();
$params = array('name' => $contactType);
CRM_Contact_BAO_ContactType::retrieve($params, $typeInfo);
if (!empty($typeInfo['image_URL'])) {
$imageUrl = $typeInfo['image_URL'];
$config = CRM_Core_Config::singleton();
if (!preg_match("/^(\\/|(http(s)?:)).+\$/i", $imageUrl)) {
$imageUrl = $config->resourceBase . $imageUrl;
}
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$typeInfo['name']}-icon\" style=\"background: url('{$imageUrl}')\" title=\"{$contactType}\"></div>";
$imageInfo[$contactType]['url'] = $imageUrl;
} else {
$isSubtype = array_key_exists('parent_id', $typeInfo) && $typeInfo['parent_id'] ? TRUE : FALSE;
if ($isSubtype) {
$type = CRM_Contact_BAO_ContactType::getBasicType($typeInfo['name']) . '-subtype';
} else {
$type = CRM_Utils_Array::value('name', $typeInfo);
}
// do not add title since it hides contact name
if ($addProfileOverlay) {
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$type}-icon\"></div>";
} else {
$imageInfo[$contactType]['image'] = "<div class=\"icon crm-icon {$type}-icon\" title=\"{$contactType}\"></div>";
}
$imageInfo[$contactType]['url'] = NULL;
}
}
if ($addProfileOverlay) {
static $summaryOverlayProfileId = NULL;
if (!$summaryOverlayProfileId) {
$summaryOverlayProfileId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', 'summary_overlay', 'id', 'name');
}
$profileURL = CRM_Utils_System::url('civicrm/profile/view', "reset=1&gid={$summaryOverlayProfileId}&id={$contactId}&snippet=4");
$imageInfo[$contactType]['summary-link'] = '<a href="' . $profileURL . '" class="crm-summary-link">' . $imageInfo[$contactType]['image'] . '</a>';
} else {
$imageInfo[$contactType]['summary-link'] = $imageInfo[$contactType]['image'];
}
return $urlOnly ? $imageInfo[$contactType]['url'] : $imageInfo[$contactType]['summary-link'];
}