本文整理汇总了PHP中CRM_Core_Controller_Simple::setSkipRedirection方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Controller_Simple::setSkipRedirection方法的具体用法?PHP CRM_Core_Controller_Simple::setSkipRedirection怎么用?PHP CRM_Core_Controller_Simple::setSkipRedirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Controller_Simple
的用法示例。
在下文中一共展示了CRM_Core_Controller_Simple::setSkipRedirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 bool $register
* Is this the registration form.
* @param bool $reset
* Should we reset the form?.
* @param int $profileID
* Do we have the profile ID?.
*
* @param bool $doNotProcess
* @param null $ctype
*
* @return string
* 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);
}
}
//.........这里部分代码省略.........
示例2: 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
*/
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';
//.........这里部分代码省略.........