本文整理汇总了PHP中CRM_Core_BAO_Domain::getContactList方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Domain::getContactList方法的具体用法?PHP CRM_Core_BAO_Domain::getContactList怎么用?PHP CRM_Core_BAO_Domain::getContactList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Domain
的用法示例。
在下文中一共展示了CRM_Core_BAO_Domain::getContactList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CRM_Core_DAO_UFMatch
/**
* Synchronize the object with the UF Match entry. Can be called stand-alone from
* the drupalUsers script
*
* @param Object $user
* The drupal user object.
* @param string $userKey
* The id of the user from the uf object.
* @param string $uniqId
* The OpenID of the user.
* @param string $uf
* The name of the user framework.
* @param int $status
* Returns the status if user created or already exits (used for CMS sync).
* @param string $ctype
* contact type
* @param bool $isLogin
*
* @return CRM_Core_DAO_UFMatch|bool
*/
public static function &synchronizeUFMatch(&$user, $userKey, $uniqId, $uf, $status = NULL, $ctype = NULL, $isLogin = FALSE)
{
$config = CRM_Core_Config::singleton();
if (!CRM_Utils_Rule::email($uniqId)) {
$retVal = $status ? NULL : FALSE;
return $retVal;
}
$newContact = FALSE;
// make sure that a contact id exists for this user id
$ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->domain_id = CRM_Core_Config::domainID();
$ufmatch->uf_id = $userKey;
if (!$ufmatch->find(TRUE)) {
$transaction = new CRM_Core_Transaction();
$dao = NULL;
if (!empty($_POST) && !$isLogin) {
$params = $_POST;
$params['email'] = $uniqId;
$dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual');
$dedupeParams['check_permission'] = FALSE;
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
if (!empty($ids) && Civi::settings()->get('uniq_email_per_site')) {
// restrict dupeIds to ones that belong to current domain/site.
$siteContacts = CRM_Core_BAO_Domain::getContactList();
foreach ($ids as $index => $dupeId) {
if (!in_array($dupeId, $siteContacts)) {
unset($ids[$index]);
}
}
// re-index the array
$ids = array_values($ids);
}
if (!empty($ids)) {
$dao = new CRM_Core_DAO();
$dao->contact_id = $ids[0];
}
} else {
$dao = CRM_Contact_BAO_Contact::matchContactOnEmail($uniqId, $ctype);
}
$found = FALSE;
if ($dao) {
// ensure there does not exists a contact_id / uf_id pair
// in the DB. This might be due to multiple emails per contact
// CRM-9091
$sql = "\nSELECT id\nFROM civicrm_uf_match\nWHERE contact_id = %1\nAND domain_id = %2\n";
$params = array(1 => array($dao->contact_id, 'Integer'), 2 => array(CRM_Core_Config::domainID(), 'Integer'));
$conflict = CRM_Core_DAO::singleValueQuery($sql, $params);
if (!$conflict) {
$found = TRUE;
$ufmatch->contact_id = $dao->contact_id;
$ufmatch->uf_name = $uniqId;
}
}
if (!$found) {
if ($config->userSystem->is_drupal) {
$mail = 'mail';
} elseif ($uf == 'WordPress') {
$mail = 'user_email';
} else {
$mail = 'email';
}
if (is_object($user)) {
$params = array('email-Primary' => $user->{$mail});
}
if ($ctype == 'Organization') {
$params['organization_name'] = $uniqId;
} elseif ($ctype == 'Household') {
$params['household_name'] = $uniqId;
}
if (!$ctype) {
$ctype = "Individual";
}
$params['contact_type'] = $ctype;
// extract first / middle / last name
// for joomla
if ($uf == 'Joomla' && $user->name) {
CRM_Utils_String::extractName($user->name, $params);
}
if ($uf == 'WordPress') {
if ($user->first_name) {
//.........这里部分代码省略.........
示例2: CRM_Core_DAO_UFMatch
/**
* Synchronize the object with the UF Match entry. Can be called stand-alone from
* the drupalUsers script
*
* @param Object $user the drupal user object
* @param string $userKey the id of the user from the uf object
* @param string $uniqId the OpenID of the user
* @param string $uf the name of the user framework
* @param integer $status returns the status if user created or already exits (used for CMS sync)
*
* @return the ufmatch object that was found or created
* @access public
* @static
*/
static function &synchronizeUFMatch(&$user, $userKey, $uniqId, $uf, $status = null, $ctype = null, $isLogin = false)
{
// validate that uniqId is a valid url. it will either be
// an OpenID (which should always be a valid url) or a
// http://uf_username/ construction (so that it can
// be used as an OpenID in the future)
require_once 'CRM/Utils/Rule.php';
if ($uf == 'Standalone') {
if (!CRM_Utils_Rule::url($uniqId)) {
return $status ? null : false;
}
} else {
if (!CRM_Utils_Rule::email($uniqId)) {
return $status ? null : false;
}
}
$newContact = false;
// make sure that a contact id exists for this user id
$ufmatch =& new CRM_Core_DAO_UFMatch();
if (CRM_Core_DAO::checkFieldExists('civicrm_uf_match', 'domain_id')) {
// FIXME: if() condition check was required especially for upgrade cases (2.2.x -> 3.0.x),
// where folks if happen to logout, would encounter a column not found fatal error
$ufmatch->domain_id = CRM_Core_Config::domainID();
}
$ufmatch->uf_id = $userKey;
if (!$ufmatch->find(true)) {
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
if (!empty($_POST) && !$isLogin) {
$params = $_POST;
$params['email'] = $uniqId;
require_once 'CRM/Dedupe/Finder.php';
$dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual');
$ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual');
if (!empty($ids) && defined('CIVICRM_UNIQ_EMAIL_PER_SITE') && CIVICRM_UNIQ_EMAIL_PER_SITE) {
// restrict dupeIds to ones that belong to current domain/site.
require_once 'CRM/Core/BAO/Domain.php';
$siteContacts = CRM_Core_BAO_Domain::getContactList();
foreach ($ids as $index => $dupeId) {
if (!in_array($dupeId, $siteContacts)) {
unset($ids[$index]);
}
}
$ids = array_values($ids);
//re-index the array
}
if (!empty($ids)) {
$dao = new CRM_Core_DAO();
$dao->contact_id = $ids[0];
}
} else {
require_once 'CRM/Contact/BAO/Contact.php';
if ($uf == 'Standalone') {
$dao =& CRM_Contact_BAO_Contact::matchContactOnOpenId($uniqId, $ctype);
} else {
$dao =& CRM_Contact_BAO_Contact::matchContactOnEmail($uniqId, $ctype);
}
}
if ($dao) {
//print "Found contact with uniqId $uniqId<br/>";
$ufmatch->contact_id = $dao->contact_id;
$ufmatch->uf_name = $uniqId;
} else {
if ($uf == 'Drupal') {
$mail = 'mail';
} else {
$mail = 'email';
}
if (is_Object($user)) {
$params = array('email-Primary' => $user->{$mail});
}
if ($ctype == 'Organization') {
$params['organization_name'] = $uniqId;
} else {
if ($ctype == 'Household') {
$params['household_name'] = $uniqId;
}
}
if (!$ctype) {
$ctype = "Individual";
}
$params['contact_type'] = $ctype;
// extract first / middle / last name
// for joomla
if ($uf == 'Joomla' && $user->name) {
require_once 'CRM/Utils/String.php';
//.........这里部分代码省略.........