本文整理汇总了PHP中CRM_Contact_BAO_Contact::searchQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::searchQuery方法的具体用法?PHP CRM_Contact_BAO_Contact::searchQuery怎么用?PHP CRM_Contact_BAO_Contact::searchQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact::searchQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savedSearch
/**
* where / qill clause for smart groups
*
* @return void
* @access public
*/
function savedSearch()
{
$config =& CRM_Core_Config::singleton();
$ssWhere = array();
$group =& new CRM_Contact_BAO_Group();
foreach (array_keys($this->_params['group']) as $group_id) {
$group->id = $group_id;
$group->find(true);
if (isset($group->saved_search_id)) {
require_once 'CRM/Contact/BAO/SavedSearch.php';
if ($config->mysqlVersion >= 4.1) {
$sfv =& CRM_Contact_BAO_SavedSearch::getFormValues($group->saved_search_id);
$smarts =& CRM_Contact_BAO_Contact::searchQuery($sfv, 0, 0, null, false, false, false, true, true);
$ssWhere[] = " \n (civicrm_contact.id IN ({$smarts}) \n AND civicrm_contact.id NOT IN ( \n SELECT contact_id FROM civicrm_group_contact \n WHERE civicrm_group_contact.group_id = " . CRM_Utils_Type::escape($group_id, 'Integer') . " AND civicrm_group_contact.status = 'Removed'))";
} else {
$ssw = CRM_Contact_BAO_SavedSearch::whereClause($group->saved_search_id, $this->_tables, $this->_whereTables);
/* FIXME: bug with multiple group searches */
$ssWhere[] = "({$ssw} AND\n (civicrm_group_contact.id is null OR\n (civicrm_group_contact.group_id = " . CRM_Utils_Type::escape($group_id, 'Integer') . " AND\n civicrm_group_contact.status = 'Added')))";
}
}
$group->reset();
$group->selectAdd('*');
}
if (!empty($ssWhere)) {
$this->_tables['civicrm_group_contact'] = "civicrm_contact.id = civicrm_group_contact.contact_id AND civicrm_group_contact.group_id IN (" . implode(',', array_keys($this->_params['group'])) . ')';
$this->_whereTables['civicrm_group_contact'] = $this->_tables['civicrm_group_contact'];
return implode(' OR ', $ssWhere);
}
return null;
}