本文整理汇总了PHP中CRM_Core_Session::setstatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Session::setstatus方法的具体用法?PHP CRM_Core_Session::setstatus怎么用?PHP CRM_Core_Session::setstatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Session
的用法示例。
在下文中一共展示了CRM_Core_Session::setstatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$config =& CRM_Core_Config::singleton();
$button = substr($this->controller->getButtonName(), -4);
$this->add('hidden', 'scriptFee', null);
$this->add('hidden', 'scriptArray', null);
if ($this->_values['event']['is_monetary']) {
require_once 'CRM/Event/Form/Registration/Register.php';
CRM_Event_Form_Registration_Register::buildAmount($this);
}
$first_name = $last_name = null;
foreach (array('pre', 'post') as $keys) {
if (isset($this->_values['additional_custom_' . $keys . '_id'])) {
$this->buildCustom($this->_values['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys), true);
${$keys} = CRM_Core_BAO_UFGroup::getFields($this->_values['additional_custom_' . $keys . '_id']);
}
foreach (array('first_name', 'last_name') as $name) {
if (CRM_Utils_Array::value($name, ${$keys}) && CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, ${$keys}))) {
${$name} = 1;
}
}
}
$required = $button == 'skip' || $this->_values['event']['allow_same_participant_emails'] == 1 && ($first_name && $last_name) ? false : true;
$this->add('text', "email-{$this->_bltID}", ts('Email Address'), array('size' => 30, 'maxlength' => 60), $required);
//add buttons
$js = null;
if ($this->isLastParticipant(true) && !CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
$js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
}
//handle case where user might sart with waiting by group
//registration and skip some people and now group fit to
//become registered so need to take payment from user.
//this case only occurs at dynamic waiting status, CRM-4320
$statusMessage = null;
$allowToProceed = true;
$includeSkipButton = true;
$this->_resetAllowWaitlist = false;
if ($this->_lastParticipant && !$this->_allowConfirmation && CRM_Utils_Array::value('bypass_payment', $this->_params[0])) {
require_once 'CRM/Event/BAO/Participant.php';
$spaces = CRM_Event_BAO_Participant::eventFull($this->_values['event']['id'], true);
$processedCnt = 0;
//need to check current participant present in params.
$currentParticipantNum = substr($this->_name, 12);
foreach ($this->_params as $key => $value) {
if ($value == 'skip' || $key == $currentParticipantNum) {
continue;
}
$processedCnt++;
}
//we might did reset allow waiting in case of dynamic calculation
if (CRM_Utils_Array::value('bypass_payment', $this->_params[0]) && is_numeric($spaces) && CRM_Utils_Array::value('additional_participants', $this->_params[0]) >= $spaces) {
$this->_allowWaitlist = true;
$this->set('allowWaitlist', true);
}
//lets allow to become a part of runtime waiting list, if primary selected pay later.
$realPayLater = false;
if (CRM_Utils_Array::value('is_monetary', $this->_values['event']) && CRM_Utils_Array::value('is_pay_later', $this->_values['event'])) {
$realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]);
}
//truly spaces are greater than required.
if (is_numeric($spaces) && $spaces >= $processedCnt + 1) {
if (CRM_Utils_Array::value('amount', $this->_params[0], 0) == 0 || $this->_requireApproval) {
$this->_allowWaitlist = false;
$this->set('allowWaitlist', $this->_allowWaitlist);
if ($this->_requireApproval) {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(1 => ++$processedCnt, 2 => $spaces));
} else {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(1 => ++$processedCnt, 2 => $spaces));
}
} else {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(1 => ++$processedCnt, 2 => $spaces));
$allowToProceed = false;
}
CRM_Core_Session::setstatus($status);
} else {
if ($processedCnt == $spaces) {
if (CRM_Utils_Array::value('amount', $this->_params[0], 0) == 0 || $realPayLater || $this->_requireApproval) {
$this->_resetAllowWaitlist = true;
if ($this->_requireApproval) {
$statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.");
} else {
$statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed).");
}
} else {
//hey there is enough space and we require payment.
$statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.");
$includeSkipButton = false;
}
}
}
}
$this->assign('statusMessage', $statusMessage);
$buttons = array(array('type' => 'back', 'name' => ts('<< Go Back'), 'spacing' => '  '));
//CRM-4320
//.........这里部分代码省略.........
示例2: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$config = CRM_Core_Config::singleton();
$button = substr($this->controller->getButtonName(), -4);
$this->add('hidden', 'scriptFee', NULL);
$this->add('hidden', 'scriptArray', NULL);
if ($this->_values['event']['is_monetary']) {
CRM_Event_Form_Registration_Register::buildAmount($this);
}
$first_name = $last_name = NULL;
$pre = $post = array();
foreach (array('pre', 'post') as $keys) {
if (isset($this->_values['additional_custom_' . $keys . '_id'])) {
$this->buildCustom($this->_values['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys), TRUE);
${$keys} = CRM_Core_BAO_UFGroup::getFields($this->_values['additional_custom_' . $keys . '_id']);
}
foreach (array('first_name', 'last_name') as $name) {
if (CRM_Utils_Array::value($name, ${$keys}) && CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, ${$keys}))) {
${$name} = 1;
}
}
}
$required = $button == 'skip' || $this->_values['event']['allow_same_participant_emails'] == 1 && ($first_name && $last_name) ? FALSE : TRUE;
//add buttons
$js = NULL;
if ($this->isLastParticipant(TRUE) && !CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
$js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
}
//handle case where user might sart with waiting by group
//registration and skip some people and now group fit to
//become registered so need to take payment from user.
//this case only occurs at dynamic waiting status, CRM-4320
$statusMessage = NULL;
$allowToProceed = TRUE;
$includeSkipButton = TRUE;
$this->_resetAllowWaitlist = FALSE;
$pricesetFieldsCount = CRM_Price_BAO_Set::getPricesetCount($this->_priceSetId);
if ($this->_lastParticipant || $pricesetFieldsCount) {
//get the participant total.
$processedCnt = self::getParticipantCount($this, $this->_params, TRUE);
}
if (!$this->_allowConfirmation && CRM_Utils_Array::value('bypass_payment', $this->_params[0]) && $this->_lastParticipant) {
//get the event spaces.
$spaces = $this->_availableRegistrations;
$currentPageMaxCount = 1;
if ($pricesetFieldsCount) {
$currentPageMaxCount = $pricesetFieldsCount;
}
//we might did reset allow waiting in case of dynamic calculation
if (CRM_Utils_Array::value('bypass_payment', $this->_params[0]) && is_numeric($spaces) && $processedCnt > $spaces) {
$this->_allowWaitlist = TRUE;
$this->set('allowWaitlist', TRUE);
}
//lets allow to become a part of runtime waiting list, if primary selected pay later.
$realPayLater = FALSE;
if (CRM_Utils_Array::value('is_monetary', $this->_values['event']) && CRM_Utils_Array::value('is_pay_later', $this->_values['event'])) {
$realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]);
}
//truly spaces are greater than required.
if (is_numeric($spaces) && $spaces >= $processedCnt + $currentPageMaxCount) {
if (CRM_Utils_Array::value('amount', $this->_params[0], 0) == 0 || $this->_requireApproval) {
$this->_allowWaitlist = FALSE;
$this->set('allowWaitlist', $this->_allowWaitlist);
if ($this->_requireApproval) {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(1 => ++$processedCnt, 2 => $spaces));
} else {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(1 => ++$processedCnt, 2 => $spaces));
}
} else {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(1 => ++$processedCnt, 2 => $spaces));
$allowToProceed = FALSE;
}
CRM_Core_Session::setstatus($status);
} elseif ($processedCnt == $spaces) {
if (CRM_Utils_Array::value('amount', $this->_params[0], 0) == 0 || $realPayLater || $this->_requireApproval) {
$this->_resetAllowWaitlist = TRUE;
if ($this->_requireApproval) {
$statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.");
} else {
$statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed).");
}
} else {
//hey there is enough space and we require payment.
$statusMessage = ts("If you skip this participant there will be enough spaces in the event for your group (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.");
$includeSkipButton = FALSE;
}
}
}
// for priceset with count
if ($pricesetFieldsCount && CRM_Utils_Array::value('has_waitlist', $this->_values['event']) && !$this->_allowConfirmation) {
if ($this->_isEventFull) {
$statusMessage = ts('This event is currently full. You are registering for the waiting list. You will be notified if spaces become available.');
} elseif ($this->_allowWaitlist || !$this->_allowWaitlist && $processedCnt + $pricesetFieldsCount > $this->_availableRegistrations) {
$waitingMsg = ts('It looks like you are registering more participants then there are spaces available. All participants will be added to the waiting list. You will be notified if spaces become available.');
//.........这里部分代码省略.........