本文整理汇总了PHP中CRM_Utils_Array::valueByRegexKey方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Array::valueByRegexKey方法的具体用法?PHP CRM_Utils_Array::valueByRegexKey怎么用?PHP CRM_Utils_Array::valueByRegexKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Array
的用法示例。
在下文中一共展示了CRM_Utils_Array::valueByRegexKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
//.........这里部分代码省略.........
$waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
if ($this->_allowWaitlist) {
$value['participant_status_id'] = $value['participant_status'] = array_search('On waitlist', $waitingStatuses);
} else {
$value['participant_status_id'] = $value['participant_status'] = array_search('Awaiting approval', $waitingStatuses);
}
//there might be case user seleted pay later and
//now becomes part of run time waiting list.
$value['is_pay_later'] = FALSE;
}
// required only if paid event
if ($this->_values['event']['is_monetary'] && !($this->_allowWaitlist || $this->_requireApproval)) {
if (is_array($this->_paymentProcessor)) {
$payment = $this->_paymentProcessor['object'];
}
if (!empty($this->_paymentProcessor) && $this->_paymentProcessor['object']->supports('preApproval')) {
$preApprovalParams = $this->_paymentProcessor['object']->getPreApprovalDetails($this->get('pre_approval_parameters'));
$value = array_merge($value, $preApprovalParams);
}
$result = NULL;
if (!empty($value['is_pay_later']) || $value['amount'] == 0 || $this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') {
if ($value['amount'] != 0) {
$pending = TRUE;
//get the participant statuses.
$pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
$status = !empty($value['is_pay_later']) ? 'Pending from pay later' : 'Pending from incomplete transaction';
$value['participant_status_id'] = $value['participant_status'] = array_search($status, $pendingStatuses);
}
} elseif (!empty($value['is_primary'])) {
CRM_Core_Payment_Form::mapParams($this->_bltID, $value, $value, TRUE);
// payment email param can be empty for _bltID mapping
// thus provide mapping for it with a different email value
if (empty($value['email'])) {
$value['email'] = CRM_Utils_Array::valueByRegexKey('/^email-/', $value);
}
if (is_object($payment)) {
try {
$result = $payment->doPayment($value);
$value = array_merge($value, $result);
} catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
CRM_Core_Session::singleton()->setStatus($e->getMessage());
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/register', "id={$this->_eventId}"));
}
} else {
CRM_Core_Error::fatal($paymentObjError);
}
}
$value['receive_date'] = $now;
if ($this->_allowConfirmation) {
$value['participant_register_date'] = $this->_values['participant']['register_date'];
}
$createContrib = $value['amount'] != 0 ? TRUE : FALSE;
// force to create zero amount contribution, CRM-5095
if (!$createContrib && $value['amount'] == 0 && $this->_priceSetId && $this->_lineItem) {
$createContrib = TRUE;
}
if ($createContrib && !empty($value['is_primary']) && !$this->_allowWaitlist && !$this->_requireApproval) {
// if paid event add a contribution record
//if primary participant contributing additional amount
//append (multiple participants) to its fee level. CRM-4196.
$isAdditionalAmount = FALSE;
if (count($params) > 1) {
$isAdditionalAmount = TRUE;
}
//passing contribution id is already registered.
$contribution = self::processContribution($this, $value, $result, $contactID, $pending, $isAdditionalAmount);