本文整理汇总了PHP中CRM_Core_BAO_UFMatch::updateContactEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFMatch::updateContactEmail方法的具体用法?PHP CRM_Core_BAO_UFMatch::updateContactEmail怎么用?PHP CRM_Core_BAO_UFMatch::updateContactEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFMatch
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFMatch::updateContactEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEditHTML
//.........这里部分代码省略.........
* @param boolean $reset should we reset the form?
* @param int $profileID do we have the profile ID?
*
* @return string the html for the form on success, otherwise empty string
* @static
* @access public
*/
static function getEditHTML($userID, $title, $action = null, $register = false, $reset = false, $profileID = null, $doNotProcess = false, $ctype = null)
{
require_once "CRM/Core/Controller/Simple.php";
$session =& CRM_Core_Session::singleton();
if ($register) {
$controller =& new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
if ($reset || $doNotProcess) {
// hack to make sure we do not process this form
$oldQFDefault = CRM_Utils_Array::value('_qf_default', $_POST);
unset($_POST['_qf_default']);
unset($_REQUEST['_qf_default']);
if ($reset) {
$controller->reset();
}
}
$controller->set('id', $userID);
$controller->set('register', 1);
$controller->set('skipPermission', 1);
$controller->set('ctype', $ctype);
$controller->process();
if ($doNotProcess) {
$controller->validate();
}
$controller->setEmbedded(true);
//CRM-5839 - though we want to process form, get the control back.
$controller->setSkipRedirection($doNotProcess ? false : true);
$controller->run();
// we are done processing so restore the POST/REQUEST vars
if (($reset || $doNotProcess) && $oldQFDefault) {
$_POST['_qf_default'] = $_REQUEST['_qf_default'] = $oldQFDefault;
}
$template =& CRM_Core_Smarty::singleton();
return trim($template->fetch('CRM/Profile/Form/Dynamic.tpl'));
} else {
if (!$profileID) {
// make sure we have a valid group
$group =& new CRM_Core_DAO_UFGroup();
$group->title = $title;
if ($group->find(true)) {
$profileID = $group->id;
}
}
if ($profileID) {
// make sure profileID and ctype match if ctype exists
if ($ctype) {
require_once 'CRM/Core/BAO/UFField.php';
$profileType = CRM_Core_BAO_UFField::getProfileType($profileID);
if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
$profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
}
if ($profileType != 'Contact' && $profileType != $ctype) {
return null;
}
}
$controller =& new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
if ($reset) {
$controller->reset();
}
$controller->set('gid', $profileID);
$controller->set('id', $userID);
$controller->set('register', 0);
$controller->set('skipPermission', 1);
if ($ctype) {
$controller->set('ctype', $ctype);
}
$controller->process();
$controller->setEmbedded(true);
//CRM-5846 - give the control back to drupal.
$controller->setSkipRedirection($doNotProcess ? false : true);
$controller->run();
$template =& CRM_Core_Smarty::singleton();
$templateFile = "CRM/Profile/Form/{$profileID}/Dynamic.tpl";
if (!$template->template_exists($templateFile)) {
$templateFile = "CRM/Profile/Form/Dynamic.tpl";
}
return trim($template->fetch($templateFile));
} else {
require_once 'CRM/Contact/BAO/Contact/Location.php';
$userEmail = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
// if post not empty then only proceed
if (!empty($_POST)) {
// get the new email
$config =& CRM_Core_Config::singleton();
$email = CRM_Utils_Array::value('mail', $_POST);
if (CRM_Utils_Rule::email($email) && $email != $userEmail[1]) {
require_once 'CRM/Core/BAO/UFMatch.php';
CRM_Core_BAO_UFMatch::updateContactEmail($userID, $email);
}
}
}
}
return '';
}
示例2: getEditHTML
//.........这里部分代码省略.........
* the html for the form on success, otherwise empty string
*/
public static function getEditHTML($userID, $title, $action = NULL, $register = FALSE, $reset = FALSE, $profileID = NULL, $doNotProcess = FALSE, $ctype = NULL)
{
if ($register) {
$controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
if ($reset || $doNotProcess) {
// hack to make sure we do not process this form
$oldQFDefault = CRM_Utils_Array::value('_qf_default', $_POST);
unset($_POST['_qf_default']);
unset($_REQUEST['_qf_default']);
if ($reset) {
$controller->reset();
}
}
$controller->set('id', $userID);
$controller->set('register', 1);
$controller->set('skipPermission', 1);
$controller->set('ctype', $ctype);
$controller->process();
if ($doNotProcess || !empty($_POST)) {
$controller->validate();
}
$controller->setEmbedded(TRUE);
//CRM-5839 - though we want to process form, get the control back.
$controller->setSkipRedirection($doNotProcess ? FALSE : TRUE);
$controller->run();
// we are done processing so restore the POST/REQUEST vars
if (($reset || $doNotProcess) && $oldQFDefault) {
$_POST['_qf_default'] = $_REQUEST['_qf_default'] = $oldQFDefault;
}
$template = CRM_Core_Smarty::singleton();
// Hide CRM error messages if they are displayed using drupal form_set_error.
if (!empty($_POST)) {
$template->assign('suppressForm', TRUE);
}
return trim($template->fetch('CRM/Profile/Form/Dynamic.tpl'));
} else {
if (!$profileID) {
// make sure we have a valid group
$group = new CRM_Core_DAO_UFGroup();
$group->title = $title;
if ($group->find(TRUE)) {
$profileID = $group->id;
}
}
if ($profileID) {
// make sure profileID and ctype match if ctype exists
if ($ctype) {
$profileType = CRM_Core_BAO_UFField::getProfileType($profileID);
if (CRM_Contact_BAO_ContactType::isaSubType($profileType)) {
$profileType = CRM_Contact_BAO_ContactType::getBasicType($profileType);
}
if ($profileType != 'Contact' && $profileType != $ctype) {
return NULL;
}
}
$controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
if ($reset) {
$controller->reset();
}
$controller->set('gid', $profileID);
$controller->set('id', $userID);
$controller->set('register', 0);
$controller->set('skipPermission', 1);
if ($ctype) {
$controller->set('ctype', $ctype);
}
$controller->process();
$controller->setEmbedded(TRUE);
//CRM-5846 - give the control back to drupal.
$controller->setSkipRedirection($doNotProcess ? FALSE : TRUE);
$controller->run();
$template = CRM_Core_Smarty::singleton();
// Hide CRM error messages if they are displayed using drupal form_set_error.
if (!empty($_POST) && CRM_Core_Config::singleton()->userFramework == 'Drupal') {
if (arg(0) == 'user' || arg(0) == 'admin' && arg(1) == 'people') {
$template->assign('suppressForm', TRUE);
}
}
$templateFile = "CRM/Profile/Form/{$profileID}/Dynamic.tpl";
if (!$template->template_exists($templateFile)) {
$templateFile = 'CRM/Profile/Form/Dynamic.tpl';
}
return trim($template->fetch($templateFile));
} else {
$userEmail = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
// if post not empty then only proceed
if (!empty($_POST)) {
// get the new email
$config = CRM_Core_Config::singleton();
$email = CRM_Utils_Array::value('mail', $_POST);
if (CRM_Utils_Rule::email($email) && $email != $userEmail[1]) {
CRM_Core_BAO_UFMatch::updateContactEmail($userID, $email);
}
}
}
}
return '';
}
示例3: getEditHTML
/**
* get the html for the form that represents this particular group
*
* @param int $userID the user id that we are actually editing
* @param string $title the title of the group we are interested in
* @param int $action the action of the form
* @param boolean $register is this the registration form
* @param boolean $reset should we reset the form?
* @param int $profileID do we have the profile ID?
*
* @return string the html for the form on success, otherwise empty string
* @static
* @access public
*/
function getEditHTML($userID, $title, $action = null, $register = false, $reset = false, $profileID = null)
{
$session =& CRM_Core_Session::singleton();
if ($register) {
$controller =& new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
if ($reset) {
// hack to make sure we do not process this form
$oldQFDefault = $_POST['_qf_default'];
unset($_POST['_qf_default']);
unset($_REQUEST['_qf_default']);
$controller->reset();
}
$controller->set('id', $userID);
$controller->set('register', 1);
$controller->process();
$controller->setEmbedded(true);
$controller->run();
// we are done processing so restore the POST/REQUEST vars
if ($reset) {
$_POST['_qf_default'] = $_REQUEST['_qf_default'] = $oldQFDefault;
}
$template =& CRM_Core_Smarty::singleton();
return trim($template->fetch('CRM/Profile/Form/Dynamic.tpl'));
} else {
if (!$profileID) {
// make sure we have a valid group
$group =& new CRM_Core_DAO_UFGroup();
$group->title = $title;
$group->domain_id = CRM_Core_Config::domainID();
if ($group->find(true)) {
$profileID = $group->id;
}
}
if ($profileID) {
require_once 'CRM/Core/Controller/Simple.php';
$controller =& new CRM_Core_Controller_Simple('CRM_Profile_Form_Dynamic', ts('Dynamic Form Creator'), $action);
if ($reset) {
$controller->reset();
}
$controller->set('gid', $profileID);
$controller->set('id', $userID);
$controller->set('register', 0);
$controller->process();
$controller->setEmbedded(true);
$controller->run();
$template =& CRM_Core_Smarty::singleton();
return trim($template->fetch('CRM/Profile/Form/Dynamic.tpl'));
} else {
// fix for CRM 701
require_once 'CRM/Contact/BAO/Contact.php';
$userEmail = CRM_Contact_BAO_Contact::getEmailDetails($userID);
// if post not empty then only proceed
if (!empty($_POST)) {
if (CRM_Utils_Rule::email($_POST['edit']['mail']) && $_POST['edit']['mail'] != $userEmail[1]) {
require_once 'CRM/Core/BAO/UFMatch.php';
CRM_Core_BAO_UFMatch::updateContactEmail($userID, $_POST['edit']['mail']);
}
}
}
}
return '';
}