本文整理汇总了PHP中CRM_Core_Form::getButtonName方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form::getButtonName方法的具体用法?PHP CRM_Core_Form::getButtonName怎么用?PHP CRM_Core_Form::getButtonName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form
的用法示例。
在下文中一共展示了CRM_Core_Form::getButtonName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPaypalExpressCode
/**
* Billing mode button is basically synonymous with paypal express.
*
* This is probably a good example of 'odds & sods' code we
* need to find a way for the payment processor to assign.
*
* A tricky aspect is that the payment processor may need to set the order
*
* @param CRM_Core_Form $form
*/
protected function addPaypalExpressCode(&$form)
{
if (empty($form->isBackOffice)) {
$form->_expressButtonName = $form->getButtonName('upload', 'express');
$form->assign('expressButtonName', $form->_expressButtonName);
$form->add('image', $form->_expressButtonName, $this->_paymentProcessor['url_button'], array('class' => 'crm-form-submit'));
}
}
示例2: endPostProcess
/**
* Process the form submission.
*
* @param CRM_Core_Form $form
* @param array $params
*/
public static function endPostProcess(&$form, &$params)
{
if ($form->_context == 'caseActivity') {
return;
}
$xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
$isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients();
if (!$isMultiClient && !$form->_currentlyViewedContactId) {
CRM_Core_Error::fatal('Required parameter missing for OpenCase - end post processing');
}
if (!$form->_currentUserId || !$params['case_id'] || !$params['case_type']) {
CRM_Core_Error::fatal('Required parameter missing for OpenCase - end post processing');
}
// 1. create case-contact
if ($isMultiClient && $form->_context == 'standalone') {
foreach ($params['client_id'] as $cliId) {
if (empty($cliId)) {
CRM_Core_Error::fatal('client_id cannot be empty');
}
$contactParams = array('case_id' => $params['case_id'], 'contact_id' => $cliId);
CRM_Case_BAO_Case::addCaseToContact($contactParams);
}
} else {
$contactParams = array('case_id' => $params['case_id'], 'contact_id' => $form->_currentlyViewedContactId);
CRM_Case_BAO_Case::addCaseToContact($contactParams);
}
// 2. initiate xml processor
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$xmlProcessorParams = array('clientID' => $form->_currentlyViewedContactId, 'creatorID' => $form->_currentUserId, 'standardTimeline' => 1, 'activityTypeName' => 'Open Case', 'caseID' => $params['case_id'], 'subject' => $params['activity_subject'], 'location' => $params['location'], 'activity_date_time' => $params['start_date'], 'duration' => CRM_Utils_Array::value('duration', $params), 'medium_id' => $params['medium_id'], 'details' => $params['activity_details']);
if (array_key_exists('custom', $params) && is_array($params['custom'])) {
$xmlProcessorParams['custom'] = $params['custom'];
}
// Add parameters for attachments
$numAttachments = Civi::settings()->get('max_attachments');
for ($i = 1; $i <= $numAttachments; $i++) {
$attachName = "attachFile_{$i}";
if (isset($params[$attachName]) && !empty($params[$attachName])) {
$xmlProcessorParams[$attachName] = $params[$attachName];
}
}
$xmlProcessor->run($params['case_type'], $xmlProcessorParams);
// status msg
$params['statusMsg'] = ts('Case opened successfully.');
$buttonName = $form->controller->getButtonName();
$session = CRM_Core_Session::singleton();
if ($buttonName == $form->getButtonName('upload', 'new')) {
if ($form->_context == 'standalone') {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/case/add', 'reset=1&action=add&context=standalone'));
} else {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=add&context=case&cid={$form->_contactID}"));
}
}
}