本文整理匯總了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;
}