当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Contact_BAO_ContactType::retrieve方法代码示例

本文整理汇总了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'];
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:42,代码来源:Utils.php

示例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'];
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:37,代码来源:Utils.php

示例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'];
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:60,代码来源:Utils.php


注:本文中的CRM_Contact_BAO_ContactType::retrieve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。