当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Grant_BAO_Grant::create方法代码示例

本文整理汇总了PHP中CRM_Grant_BAO_Grant::create方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Grant_BAO_Grant::create方法的具体用法?PHP CRM_Grant_BAO_Grant::create怎么用?PHP CRM_Grant_BAO_Grant::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Grant_BAO_Grant的用法示例。


在下文中一共展示了CRM_Grant_BAO_Grant::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 /** 
  * Function to process the form 
  * 
  * @access public 
  * @return None 
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         require_once 'CRM/Grant/BAO/Grant.php';
         CRM_Grant_BAO_Grant::del($this->_id);
         return;
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $ids['grant'] = $this->_id;
     }
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if (!$params['grant_report_received']) {
         $params['grant_report_received'] = "null";
     }
     // set the contact, when contact is selected
     if (CRM_Utils_Array::value('contact_select_id', $params)) {
         $this->_contactID = $params['contact_select_id'][1];
     }
     $params['contact_id'] = $this->_contactID;
     $dates = array('application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
     foreach ($dates as $d) {
         $params[$d] = CRM_Utils_Date::processDate($params[$d], null, true);
     }
     $ids['note'] = array();
     if ($this->_noteId) {
         $ids['note']['id'] = $this->_noteId;
     }
     // process custom data
     $customFields = CRM_Core_BAO_CustomField::getFields('Grant');
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Grant');
     // add attachments as needed
     CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_grant', $this->_id);
     require_once 'CRM/Grant/BAO/Grant.php';
     $grant = CRM_Grant_BAO_Grant::create($params, $ids);
     $buttonName = $this->controller->getButtonName();
     $session = CRM_Core_Session::singleton();
     if ($this->_context == 'standalone') {
         if ($buttonName == $this->getButtonName('upload', 'new')) {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/add', 'reset=1&action=add&context=standalone'));
         } else {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=grant"));
         }
     } else {
         if ($buttonName == $this->getButtonName('upload', 'new')) {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/grant', "reset=1&action=add&context=grant&cid={$this->_contactID}"));
         }
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:55,代码来源:Grant.php

示例2: postProcess

 /**
  * Function to process the form
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Grant_BAO_Grant::del($this->_id);
         return;
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $ids['grant_id'] = $this->_id;
     }
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if (empty($params['grant_report_received'])) {
         $params['grant_report_received'] = "null";
     }
     // set the contact, when contact is selected
     if ($this->_context == 'standalone') {
         $this->_contactID = $params['contact_id'];
     }
     $params['contact_id'] = $this->_contactID;
     $ids['note'] = array();
     if ($this->_noteId) {
         $ids['note']['id'] = $this->_noteId;
     }
     // build custom data getFields array
     $customFieldsGrantType = CRM_Core_BAO_CustomField::getFields('Grant', FALSE, FALSE, CRM_Utils_Array::value('grant_type_id', $params));
     $customFields = CRM_Utils_Array::crmArrayMerge($customFieldsGrantType, CRM_Core_BAO_CustomField::getFields('Grant', FALSE, FALSE, NULL, NULL, TRUE));
     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Grant');
     // add attachments as needed
     CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_grant', $this->_id);
     $grant = CRM_Grant_BAO_Grant::create($params, $ids);
     $buttonName = $this->controller->getButtonName();
     $session = CRM_Core_Session::singleton();
     if ($this->_context == 'standalone') {
         if ($buttonName == $this->getButtonName('upload', 'new')) {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/grant/add', 'reset=1&action=add&context=standalone'));
         } else {
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_contactID}&selectedChild=grant"));
         }
     } elseif ($buttonName == $this->getButtonName('upload', 'new')) {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/contact/view/grant', "reset=1&action=add&context=grant&cid={$this->_contactID}"));
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:49,代码来源:Grant.php


注:本文中的CRM_Grant_BAO_Grant::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。