本文整理汇总了PHP中CRM_Event_Form_Registration::preProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_Form_Registration::preProcess方法的具体用法?PHP CRM_Event_Form_Registration::preProcess怎么用?PHP CRM_Event_Form_Registration::preProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_Form_Registration
的用法示例。
在下文中一共展示了CRM_Event_Form_Registration::preProcess方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
parent::preProcess();
$participantNo = substr($this->_name, 12);
//lets process in-queue participants.
if ($this->_participantId && $this->_additionalParticipantIds) {
$this->_additionalParticipantId = CRM_Utils_Array::value($participantNo, $this->_additionalParticipantIds);
}
$participantCnt = $participantNo + 1;
$this->assign('formId', $participantNo);
$this->_params = array();
$this->_params = $this->get('params');
$participantTot = $this->_params[0]['additional_participants'] + 1;
$skipCount = count(array_keys($this->_params, "skip"));
if ($skipCount) {
$this->assign('skipCount', $skipCount);
}
CRM_Utils_System::setTitle(ts('Register Participant %1 of %2', array(1 => $participantCnt, 2 => $participantTot)));
//CRM-4320, hack to check last participant.
$this->_lastParticipant = FALSE;
if ($participantTot == $participantCnt) {
$this->_lastParticipant = TRUE;
}
$this->assign('lastParticipant', $this->_lastParticipant);
}
示例2: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
//CRM-4320.
//here we can't use parent $this->_allowWaitlist as user might
//walk back and we maight set this value in this postProcess.
//(we set when spaces < group count and want to allow become part of waiting )
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']));
// Get payment processors if appropriate for this event
// We hide the payment fields if the event is full or requires approval,
// and the current user has not yet been approved CRM-12279
$this->_noFees = ($eventFull || $this->_requireApproval) && !$this->_allowConfirmation;
CRM_Contribute_Form_Contribution_Main::preProcessPaymentOptions($this, $this->_noFees);
if ($this->_snippet) {
return;
}
$this->_allowWaitlist = FALSE;
if ($eventFull && !$this->_allowConfirmation && CRM_Utils_Array::value('has_waitlist', $this->_values['event'])) {
$this->_allowWaitlist = TRUE;
$this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']);
if (!$this->_waitlistMsg) {
$this->_waitlistMsg = ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
}
}
$this->set('allowWaitlist', $this->_allowWaitlist);
//To check if the user is already registered for the event(CRM-2426)
if (!$this->_skipDupeRegistrationCheck) {
self::checkRegistration(NULL, $this);
}
$this->assign('availableRegistrations', $this->_availableRegistrations);
// get the participant values from EventFees.php, CRM-4320
if ($this->_allowConfirmation) {
CRM_Event_Form_EventFees::preProcess($this);
}
}
示例3: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
//CRM-4320.
//here we can't use parent $this->_allowWaitlist as user might
//walk back and we maight set this value in this postProcess.
//(we set when spaces < group count and want to allow become part of waiting )
require_once 'CRM/Event/BAO/Participant.php';
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId);
$this->_allowWaitlist = false;
if ($eventFull && !$this->_allowConfirmation && CRM_Utils_Array::value('has_waitlist', $this->_values['event'])) {
$this->_allowWaitlist = true;
$this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']);
if (!$this->_waitlistMsg) {
$this->_waitlistMsg = ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
}
}
$this->set('allowWaitlist', $this->_allowWaitlist);
//To check if the user is already registered for the event(CRM-2426)
self::checkRegistration(null, $this);
$this->assign('availableRegistrations', $this->_availableRegistrations);
// get the participant values from EventFees.php, CRM-4320
if ($this->_allowConfirmation) {
require_once 'CRM/Event/Form/EventFees.php';
CRM_Event_Form_EventFees::preProcess($this);
}
// Assign pageTitle
$this->assign('pageTitle', ts('Event Registration'));
}
示例4: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
$this->_ppType = CRM_Utils_Array::value('type', $_GET);
$this->assign('ppType', FALSE);
if ($this->_ppType) {
$this->assign('ppType', TRUE);
return CRM_Core_Payment_ProcessorForm::preProcess($this);
}
//get payPal express id and make it available to template
$paymentProcessors = $this->get('paymentProcessors');
$this->assign('payPalExpressId', 0);
if (!empty($paymentProcessors)) {
foreach ($paymentProcessors as $ppId => $values) {
$payPalExpressId = $values['payment_processor_type'] == 'PayPal_Express' ? $values['id'] : 0;
$this->assign('payPalExpressId', $payPalExpressId);
if ($payPalExpressId) {
break;
}
}
}
//CRM-4320.
//here we can't use parent $this->_allowWaitlist as user might
//walk back and we maight set this value in this postProcess.
//(we set when spaces < group count and want to allow become part of waiting )
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']));
$this->_allowWaitlist = FALSE;
if ($eventFull && !$this->_allowConfirmation && CRM_Utils_Array::value('has_waitlist', $this->_values['event'])) {
$this->_allowWaitlist = TRUE;
$this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']);
if (!$this->_waitlistMsg) {
$this->_waitlistMsg = ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
}
}
$this->set('allowWaitlist', $this->_allowWaitlist);
//To check if the user is already registered for the event(CRM-2426)
if (!$this->_skipDupeRegistrationCheck) {
self::checkRegistration(NULL, $this);
}
$this->assign('availableRegistrations', $this->_availableRegistrations);
// get the participant values from EventFees.php, CRM-4320
if ($this->_allowConfirmation) {
CRM_Event_Form_EventFees::preProcess($this);
}
if (CRM_Utils_Array::value('hidden_processor', $_POST)) {
$this->set('type', CRM_Utils_Array::value('payment_processor', $_POST));
$this->set('mode', $this->_mode);
$this->set('paymentProcessor', $this->_paymentProcessor);
CRM_Core_Payment_ProcessorForm::preProcess($this);
CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
}
}
示例5: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
$this->_params = $this->get('params');
$this->_lineItem = $this->get('lineItem');
$this->_totalAmount = $this->get('totalAmount');
$this->_receiveDate = $this->get('receiveDate');
$this->_trxnId = $this->get('trxnId');
$finalAmount = $this->get('finalAmount');
$this->assign('finalAmount', $finalAmount);
$participantInfo = $this->get('participantInfo');
$this->assign('participantInfo', $participantInfo);
$customGroup = $this->get('customProfile');
$this->assign('customProfile', $customGroup);
CRM_Utils_System::setTitle(CRM_Utils_Array::value('thankyou_title', $this->_values['event']));
}
示例6: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
parent::preProcess();
// lineItem isn't set until Register postProcess
$this->_lineItem = $this->get('lineItem');
$this->_params = $this->get('params');
$this->_params[0]['tax_amount'] = $this->get('tax_amount');
$this->_params[0]['is_pay_later'] = $this->get('is_pay_later');
$this->assign('is_pay_later', $this->_params[0]['is_pay_later']);
if ($this->_params[0]['is_pay_later']) {
$this->assign('pay_later_receipt', $this->_values['event']['pay_later_receipt']);
}
CRM_Utils_Hook::eventDiscount($this, $this->_params);
if (!empty($this->_params[0]['discount']) && !empty($this->_params[0]['discount']['applied'])) {
$this->set('hookDiscount', $this->_params[0]['discount']);
$this->assign('hookDiscount', $this->_params[0]['discount']);
}
// The concept of contributeMode is deprecated.
if ($this->_contributeMode == 'express') {
$params = array();
// rfp == redirect from paypal
// rfp is probably not required - the getPreApprovalDetails should deal with any payment-processor specific 'stuff'
$rfp = CRM_Utils_Request::retrieve('rfp', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET');
//we lost rfp in case of additional participant. So set it explicitly.
if ($rfp || CRM_Utils_Array::value('additional_participants', $this->_params[0], FALSE)) {
if (!empty($this->_paymentProcessor) && $this->_paymentProcessor['object']->supports('preApproval')) {
$preApprovalParams = $this->_paymentProcessor['object']->getPreApprovalDetails($this->get('pre_approval_parameters'));
$params = array_merge($this->_params, $preApprovalParams);
}
CRM_Core_Payment_Form::mapParams($this->_bltID, $params, $params, FALSE);
// set a few other parameters that are not really specific to this method because we don't know what
// will break if we change this.
$params['amount'] = $this->_params[0]['amount'];
if (!empty($this->_params[0]['discount'])) {
$params['discount'] = $this->_params[0]['discount'];
$params['discountAmount'] = $this->_params[0]['discountAmount'];
$params['discountMessage'] = $this->_params[0]['discountMessage'];
}
$params['amount_level'] = $this->_params[0]['amount_level'];
$params['currencyID'] = $this->_params[0]['currencyID'];
// also merge all the other values from the profile fields
$values = $this->controller->exportValues('Register');
$skipFields = array('amount', "street_address-{$this->_bltID}", "city-{$this->_bltID}", "state_province_id-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}");
foreach ($values as $name => $value) {
// skip amount field
if (!in_array($name, $skipFields)) {
$params[$name] = $value;
}
if (substr($name, 0, 6) == 'price_') {
$params[$name] = $this->_params[0][$name];
}
}
$this->set('getExpressCheckoutDetails', $params);
}
$this->_params[0] = array_merge($this->_params[0], $params);
$this->_params[0]['is_primary'] = 1;
} else {
//process only primary participant params.
$registerParams = $this->_params[0];
if (isset($registerParams["billing_state_province_id-{$this->_bltID}"]) && $registerParams["billing_state_province_id-{$this->_bltID}"]) {
$registerParams["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($registerParams["billing_state_province_id-{$this->_bltID}"]);
}
if (isset($registerParams["billing_country_id-{$this->_bltID}"]) && $registerParams["billing_country_id-{$this->_bltID}"]) {
$registerParams["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($registerParams["billing_country_id-{$this->_bltID}"]);
}
if (isset($registerParams['credit_card_exp_date'])) {
$registerParams['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($registerParams);
$registerParams['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($registerParams);
}
if ($this->_values['event']['is_monetary']) {
$registerParams['ip_address'] = CRM_Utils_System::ipAddress();
$registerParams['currencyID'] = $this->_params[0]['currencyID'];
}
//assign back primary participant params.
$this->_params[0] = $registerParams;
}
if ($this->_values['event']['is_monetary']) {
$this->_params[0]['invoiceID'] = $this->get('invoiceID');
}
$this->assign('defaultRole', FALSE);
if (CRM_Utils_Array::value('defaultRole', $this->_params[0]) == 1) {
$this->assign('defaultRole', TRUE);
}
if (empty($this->_params[0]['participant_role_id']) && $this->_values['event']['default_role_id']) {
$this->_params[0]['participant_role_id'] = $this->_values['event']['default_role_id'];
}
if (isset($this->_values['event']['confirm_title'])) {
CRM_Utils_System::setTitle($this->_values['event']['confirm_title']);
}
if ($this->_pcpId) {
$params = CRM_Contribute_Form_Contribution_Confirm::processPcp($this, $this->_params[0]);
$this->_params[0] = $params;
}
$this->set('params', $this->_params);
}
示例7: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
parent::preProcess();
// lineItem isn't set until Register postProcess
$this->_lineItem = $this->get('lineItem');
$this->_params = $this->get('params');
$this->_params[0]['tax_amount'] = $this->get('tax_amount');
$this->_params[0]['is_pay_later'] = $this->get('is_pay_later');
$this->assign('is_pay_later', $this->_params[0]['is_pay_later']);
if ($this->_params[0]['is_pay_later']) {
$this->assign('pay_later_receipt', $this->_values['event']['pay_later_receipt']);
}
CRM_Utils_Hook::eventDiscount($this, $this->_params);
if (!empty($this->_params[0]['discount']) && !empty($this->_params[0]['discount']['applied'])) {
$this->set('hookDiscount', $this->_params[0]['discount']);
$this->assign('hookDiscount', $this->_params[0]['discount']);
}
if ($this->_contributeMode == 'express') {
$params = array();
// rfp == redirect from paypal
$rfp = CRM_Utils_Request::retrieve('rfp', 'Boolean', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET');
//we lost rfp in case of additional participant. So set it explicitly.
if ($rfp || CRM_Utils_Array::value('additional_participants', $this->_params[0], FALSE)) {
$payment = $this->_paymentProcessor['object'];
$paymentObjError = ts('The system did not record payment details for this payment and so could not process the transaction. Please report this error to the site administrator.');
if (is_object($payment)) {
$expressParams = $payment->getExpressCheckoutDetails($this->get('token'));
} else {
CRM_Core_Error::fatal($paymentObjError);
}
$params['payer'] = CRM_Utils_Array::value('payer', $expressParams);
$params['payer_id'] = $expressParams['payer_id'];
$params['payer_status'] = $expressParams['payer_status'];
CRM_Core_Payment_Form::mapParams($this->_bltID, $expressParams, $params, FALSE);
// fix state and country id if present
if (isset($params["billing_state_province_id-{$this->_bltID}"])) {
$params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($params["billing_state_province_id-{$this->_bltID}"]);
}
if (isset($params['billing_country_id'])) {
$params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($params["billing_country_id-{$this->_bltID}"]);
}
// set a few other parameters for PayPal
$params['token'] = $this->get('token');
$params['amount'] = $this->_params[0]['amount'];
if (!empty($this->_params[0]['discount'])) {
$params['discount'] = $this->_params[0]['discount'];
$params['discountAmount'] = $this->_params[0]['discountAmount'];
$params['discountMessage'] = $this->_params[0]['discountMessage'];
}
if (!empty($this->_params[0]['amount_priceset_level_radio'])) {
$params['amount_priceset_level_radio'] = $this->_params[0]['amount_priceset_level_radio'];
}
$params['amount_level'] = $this->_params[0]['amount_level'];
$params['currencyID'] = $this->_params[0]['currencyID'];
// also merge all the other values from the profile fields
$values = $this->controller->exportValues('Register');
$skipFields = array('amount', "street_address-{$this->_bltID}", "city-{$this->_bltID}", "state_province_id-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}");
foreach ($values as $name => $value) {
// skip amount field
if (!in_array($name, $skipFields)) {
$params[$name] = $value;
}
if (substr($name, 0, 6) == 'price_') {
$params[$name] = $this->_params[0][$name];
}
}
$this->set('getExpressCheckoutDetails', $params);
} else {
$params = $this->get('getExpressCheckoutDetails');
}
$this->_params[0] = $params;
$this->_params[0]['is_primary'] = 1;
} else {
//process only primary participant params.
$registerParams = $this->_params[0];
if (isset($registerParams["billing_state_province_id-{$this->_bltID}"]) && $registerParams["billing_state_province_id-{$this->_bltID}"]) {
$registerParams["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($registerParams["billing_state_province_id-{$this->_bltID}"]);
}
if (isset($registerParams["billing_country_id-{$this->_bltID}"]) && $registerParams["billing_country_id-{$this->_bltID}"]) {
$registerParams["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($registerParams["billing_country_id-{$this->_bltID}"]);
}
if (isset($registerParams['credit_card_exp_date'])) {
$registerParams['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($registerParams);
$registerParams['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($registerParams);
}
if ($this->_values['event']['is_monetary']) {
$registerParams['ip_address'] = CRM_Utils_System::ipAddress();
$registerParams['currencyID'] = $this->_params[0]['currencyID'];
}
//assign back primary participant params.
$this->_params[0] = $registerParams;
}
if ($this->_values['event']['is_monetary']) {
$this->_params[0]['invoiceID'] = $this->get('invoiceID');
}
//.........这里部分代码省略.........
示例8: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
parent::preProcess();
// lineItem isn't set until Register postProcess
$this->_lineItem = $this->get('lineItem');
$this->_params = $this->get('params');
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::eventDiscount($this, $this->_params);
if (CRM_Utils_Array::value('discount', $this->_params[0]) && CRM_Utils_Array::value('applied', $this->_params[0]['discount'])) {
$this->set('hookDiscount', $this->_params[0]['discount']);
$this->assign('hookDiscount', $this->_params[0]['discount']);
}
$config =& CRM_Core_Config::singleton();
if ($this->_contributeMode == 'express') {
$params = array();
// rfp == redirect from paypal
$rfp = CRM_Utils_Request::retrieve('rfp', 'Boolean', CRM_Core_DAO::$_nullObject, false, null, 'GET');
//we lost rfp in case of additional participant. So set it explicitly.
if ($rfp || CRM_Utils_Array::value('additional_participants', $this->_params[0], false)) {
require_once 'CRM/Core/Payment.php';
$payment =& CRM_Core_Payment::singleton($this->_mode, 'Event', $this->_paymentProcessor, $this);
$expressParams = $payment->getExpressCheckoutDetails($this->get('token'));
$params['payer'] = $expressParams['payer'];
$params['payer_id'] = $expressParams['payer_id'];
$params['payer_status'] = $expressParams['payer_status'];
require_once 'CRM/Core/Payment/Form.php';
CRM_Core_Payment_Form::mapParams($this->_bltID, $expressParams, $params, false);
// fix state and country id if present
if (isset($params["billing_state_province_id-{$this->_bltID}"])) {
$params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($params["billing_state_province_id-{$this->_bltID}"]);
}
if (isset($params['billing_country_id'])) {
$params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($params["billing_country_id-{$this->_bltID}"]);
}
// set a few other parameters for PayPal
$params['token'] = $this->get('token');
$params['amount'] = $this->_params[0]['amount'];
if (CRM_Utils_Array::value('discount', $this->_params[0])) {
$params['discount'] = $this->_params[0]['discount'];
$params['discountAmount'] = $this->_params[0]['discountAmount'];
$params['discountMessage'] = $this->_params[0]['discountMessage'];
}
$params['amount_level'] = $this->_params[0]['amount_level'];
$params['currencyID'] = $this->_params[0]['currencyID'];
$params['payment_action'] = 'Sale';
// also merge all the other values from the profile fields
$values = $this->controller->exportValues('Register');
$skipFields = array('amount', "street_address-{$this->_bltID}", "city-{$this->_bltID}", "state_province_id-{$this->_bltID}", "postal_code-{$this->_bltID}", "country_id-{$this->_bltID}");
foreach ($values as $name => $value) {
// skip amount field
if (!in_array($name, $skipFields)) {
$params[$name] = $value;
}
}
$this->set('getExpressCheckoutDetails', $params);
} else {
$params = $this->get('getExpressCheckoutDetails');
}
$this->_params[0] = $params;
$this->_params[0]['is_primary'] = 1;
} else {
//process only primary participant params.
$registerParams = $this->_params[0];
if (isset($registerParams["billing_state_province_id-{$this->_bltID}"]) && $registerParams["billing_state_province_id-{$this->_bltID}"]) {
$registerParams["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($registerParams["billing_state_province_id-{$this->_bltID}"]);
}
if (isset($registerParams["billing_country_id-{$this->_bltID}"]) && $registerParams["billing_country_id-{$this->_bltID}"]) {
$registerParams["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($registerParams["billing_country_id-{$this->_bltID}"]);
}
if (isset($registerParams['credit_card_exp_date'])) {
$registerParams['year'] = $registerParams['credit_card_exp_date']['Y'];
$registerParams['month'] = $registerParams['credit_card_exp_date']['M'];
}
if ($this->_values['event']['is_monetary']) {
$registerParams['ip_address'] = CRM_Utils_System::ipAddress();
$registerParams['currencyID'] = $this->_params[0]['currencyID'];
$registerParams['payment_action'] = 'Sale';
}
//assign back primary participant params.
$this->_params[0] = $registerParams;
}
if ($this->_values['event']['is_monetary']) {
$this->_params[0]['invoiceID'] = $this->get('invoiceID');
}
$this->assign('defaultRole', false);
if (CRM_Utils_Array::value('defaultRole', $this->_params[0]) == 1) {
$this->assign('defaultRole', true);
}
if (!CRM_Utils_Array::value('participant_role_id', $this->_params[0]) && $this->_values['event']['default_role_id']) {
$this->_params[0]['participant_role_id'] = $this->_values['event']['default_role_id'];
}
if (isset($this->_values['event']['confirm_title'])) {
CRM_Utils_System::setTitle($this->_values['event']['confirm_title']);
}
//.........这里部分代码省略.........