本文整理汇总了PHP中CRM_Contact_BAO_Query::getCachedContacts方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Query::getCachedContacts方法的具体用法?PHP CRM_Contact_BAO_Query::getCachedContacts怎么用?PHP CRM_Contact_BAO_Query::getCachedContacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Query
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Query::getCachedContacts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Returns all the rows in the given offset and rowCount.
*
* @param string $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 string $output
* What should the result set include (web/email/csv).
*
* @return int
* the total number of rows for this action
*/
public function &getRows($action, $offset, $rowCount, $sort, $output = NULL)
{
$config = CRM_Core_Config::singleton();
if (($output == CRM_Core_Selector_Controller::EXPORT || $output == CRM_Core_Selector_Controller::SCREEN) && $this->_formValues['radio_ts'] == 'ts_sel') {
$includeContactIds = TRUE;
} else {
$includeContactIds = FALSE;
}
// note the formvalues were given by CRM_Contact_Form_Search to us
// and contain the search criteria (parameters)
// note that the default action is basic
if ($rowCount) {
$cacheKey = $this->buildPrevNextCache($sort);
$result = $this->_query->getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds);
} else {
$result = $this->_query->searchQuery($offset, $rowCount, $sort, FALSE, $includeContactIds);
}
// process the result of the query
$rows = array();
$permissions = array(CRM_Core_Permission::getPermission());
if (CRM_Core_Permission::check('delete contacts')) {
$permissions[] = CRM_Core_Permission::DELETE;
}
$mask = CRM_Core_Action::mask($permissions);
// mask value to hide map link if there are not lat/long
$mapMask = $mask & 4095;
if ($this->_searchContext == 'smog') {
$gc = CRM_Core_SelectValues::groupContactStatus();
}
if ($this->_ufGroupID) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
$names = array();
static $skipFields = array('group', 'tag');
foreach ($this->_fields as $key => $field) {
if (!empty($field['in_selector']) && !in_array($key, $skipFields)) {
if (strpos($key, '-') !== FALSE) {
list($fieldName, $id, $type) = CRM_Utils_System::explode('-', $key, 3);
if ($id == 'Primary') {
$locationTypeName = 1;
} elseif ($fieldName == 'url') {
$locationTypeName = "website-{$id}";
} else {
$locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
if (!$locationTypeName) {
continue;
}
}
$locationTypeName = str_replace(' ', '_', $locationTypeName);
if (in_array($fieldName, array('phone', 'im', 'email'))) {
if ($type) {
$names[] = "{$locationTypeName}-{$fieldName}-{$type}";
} else {
$names[] = "{$locationTypeName}-{$fieldName}";
}
} else {
$names[] = "{$locationTypeName}-{$fieldName}";
}
} else {
$names[] = $field['name'];
}
}
}
$names[] = "status";
} elseif (!empty($this->_returnProperties)) {
$names = self::makeProperties($this->_returnProperties);
} else {
$names = self::$_properties;
}
$multipleSelectFields = array('preferred_communication_method' => 1);
$links = self::links($this->_context, $this->_contextMenu, $this->_key);
//check explicitly added contact to a Smart Group.
$groupID = CRM_Utils_Array::value('group', $this->_formValues);
$pseudoconstants = array();
// for CRM-3157 purposes
if (in_array('world_region', $names)) {
$pseudoconstants['world_region'] = array('dbName' => 'worldregion_id', 'values' => CRM_Core_PseudoConstant::worldRegion());
}
$seenIDs = array();
while ($result->fetch()) {
$row = array();
$this->_query->convertToPseudoNames($result);
// the columns we are interested in
foreach ($names as $property) {
//.........这里部分代码省略.........