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


PHP CRM_Contact_BAO_Contact::getImage方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_Contact::getImage方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::getImage方法的具体用法?PHP CRM_Contact_BAO_Contact::getImage怎么用?PHP CRM_Contact_BAO_Contact::getImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_Contact的用法示例。


在下文中一共展示了CRM_Contact_BAO_Contact::getImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 /**
  * returns all the rows in the given offset and rowCount
  *
  * @param enum   $action   the action being performed
  * @param int    $offset   the row number to start from
  * @param int    $rowCount the number of rows to return
  * @param string $sort     the sql string that describes the sort order
  * @param enum   $output   what should the result set include (web/email/csv)
  *
  * @return int   the total number of rows for this action
  */
 function &getRows($action, $offset, $rowCount, $sort, $output = null)
 {
     //$sort object processing for location fields
     if ($sort) {
         $vars = $sort->_vars;
         $varArray = array();
         foreach ($vars as $key => $field) {
             $field = $vars[$key];
             $fieldArray = explode('-', $field['name']);
             if (is_numeric($fieldArray[1])) {
                 $locationType =& new CRM_Core_DAO_LocationType();
                 $locationType->id = $fieldArray[1];
                 $locationType->find(true);
                 if ($fieldArray[0] == 'email' || $fieldArray[0] == 'im' || $fieldArray[0] == 'phone') {
                     $field['name'] = "`" . $locationType->name . "-" . $fieldArray[0] . "-1`";
                 } else {
                     $field['name'] = "`" . $locationType->name . "-" . $fieldArray[0] . "`";
                 }
             }
             $varArray[$key] = $field;
         }
     }
     $sort->_vars = $varArray;
     $result = $this->_query->searchQuery($offset, $rowCount, $sort, null, null, null, null, null);
     // process the result of the query
     $rows = array();
     $mask = CRM_Core_Action::mask(CRM_Core_Permission::getPermission());
     require_once 'CRM/Core/PseudoConstant.php';
     $locationTypes = CRM_Core_PseudoConstant::locationType();
     $links =& CRM_Profile_Selector_Listings::links();
     $names = array();
     foreach ($this->_fields as $key => $field) {
         if ($field['in_selector'] && !in_array($key, $GLOBALS['_CRM_PROFILE_SELECTOR_LISTINGS']['skipFields'])) {
             if (strpos($key, '-') !== false) {
                 list($fieldName, $id, $type) = explode('-', $key);
                 $locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
                 if (!$locationTypeName) {
                     continue;
                 }
                 if (in_array($fieldName, array('phone', 'im', 'email'))) {
                     if ($type) {
                         $names[] = "{$locationTypeName}-{$fieldName}-{$type}";
                     } else {
                         $names[] = "{$locationTypeName}-{$fieldName}-1";
                     }
                 } else {
                     $names[] = "{$locationTypeName}-{$fieldName}";
                 }
             } else {
                 $names[] = $field['name'];
             }
         }
     }
     while ($result->fetch()) {
         if (isset($result->country)) {
             // the query returns the untranslated country name
             $i18n =& CRM_Core_I18n::singleton();
             $result->country = $i18n->translate($result->country);
         }
         $row = array();
         $empty = true;
         $row[] = CRM_Contact_BAO_Contact::getImage($result->contact_type);
         $row['sort_name'] = $result->sort_name;
         foreach ($names as $name) {
             if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
                 $row[] = CRM_Core_BAO_CustomField::getDisplayValue($result->{$name}, $cfID, $this->_options);
             } else {
                 $row[] = $result->{$name};
             }
             if (!empty($result->{$name})) {
                 $empty = false;
             }
         }
         $row[] = CRM_Core_Action::formLink(CRM_Profile_Selector_Listings::links(), $mask, array('id' => $result->contact_id, 'gid' => $this->_gid));
         if (!$empty) {
             $rows[] = $row;
         }
     }
     return $rows;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:91,代码来源:Listings.php

示例2: getDisplayAndImage

 /**
  * Get the display name and image of a contact
  *
  * @param int $id the contactId
  *
  * @return array the displayName and contactImage for this contact
  * @access public
  * @static
  */
 function getDisplayAndImage($id)
 {
     $sql = "\nSELECT    civicrm_contact.display_name as display_name,\n          civicrm_contact.contact_type as contact_type,\n          civicrm_email.email          as email       \nFROM      civicrm_contact\nLEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND\n                               civicrm_contact.id = civicrm_location.entity_id AND\n                               civicrm_location.is_primary = 1)\nLEFT JOIN civicrm_email ON (civicrm_location.id = civicrm_email.location_id AND civicrm_email.is_primary = 1)\nWHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
     $dao =& new CRM_Core_DAO();
     $dao->query($sql);
     if ($dao->fetch()) {
         $image = CRM_Contact_BAO_Contact::getImage($dao->contact_type);
         // use email if display_name is empty
         if (empty($dao->display_name)) {
             $dao->display_name = $dao->email;
         }
         return array($dao->display_name, $image);
     }
     return null;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:24,代码来源:Contact.php


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