當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_Form::getButtonName方法代碼示例

本文整理匯總了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'));
     }
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:18,代碼來源:PayPalImpl.php

示例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}"));
         }
     }
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:59,代碼來源:OpenCase.php


注:本文中的CRM_Core_Form::getButtonName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。