コード例 #1
0
 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     $deletedGrants = 0;
     foreach ($this->_grantIds as $grantId) {
         if (CRM_Grant_BAO_Grant::del($grantId)) {
             $deletedGrants++;
         }
     }
     CRM_Core_Session::setStatus(ts('Deleted Grant(s): %1', array(1 => $deletedGrants)), '', 'info');
     CRM_Core_Session::setStatus(ts('Total Selected Grant(s): %1', array(1 => count($this->_grantIds))), '', 'info');
 }
コード例 #2
0
ファイル: Delete.php プロジェクト: bhirsch/voipdev
 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $deletedGrants = 0;
     require_once 'CRM/Grant/BAO/Grant.php';
     foreach ($this->_grantIds as $grantId) {
         if (CRM_Grant_BAO_Grant::del($grantId)) {
             $deletedGrants++;
         }
     }
     $status = array(ts('Deleted Grant(s): %1', array(1 => $deletedGrants)), ts('Total Selected Grant(s): %1', array(1 => count($this->_grantIds))));
     CRM_Core_Session::setStatus($status);
 }
コード例 #3
0
ファイル: Delete.php プロジェクト: FundingWorks/civicrm-core
 /**
  * Process the form after the input has been submitted and validated.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     $deleted = $failed = 0;
     foreach ($this->_grantIds as $grantId) {
         if (CRM_Grant_BAO_Grant::del($grantId)) {
             $deleted++;
         } else {
             $failed++;
         }
     }
     if ($deleted) {
         $msg = ts('%count grant deleted.', array('plural' => '%count grants deleted.', 'count' => $deleted));
         CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
     }
     if ($failed) {
         CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
     }
 }
コード例 #4
0
ファイル: Grant.php プロジェクト: hampelm/Ginsberg-CiviDemo
 /** 
  * 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}"));
         }
     }
 }
コード例 #5
0
ファイル: Tab.php プロジェクト: prashantgajare/civicrm-core
 function setContext()
 {
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
     $session = CRM_Core_Session::singleton();
     $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
     //validate the qfKey
     if (!CRM_Utils_Rule::qfKey($qfKey)) {
         $qfKey = NULL;
     }
     switch ($context) {
         case 'search':
             $urlParams = 'force=1';
             if ($qfKey) {
                 $urlParams .= "&qfKey={$qfKey}";
             }
             $this->assign('searchKey', $qfKey);
             $url = CRM_Utils_System::url('civicrm/grant/search', $urlParams);
             break;
         case 'dashboard':
             $url = CRM_Utils_System::url('civicrm/grant', 'reset=1');
             break;
         case 'edit':
             $url = CRM_utils_System::url('civicrm/contact/view/grant', 'reset=1&id=' . $this->_id . '&cid=' . $this->_contactId . '&action=view&context=grant&selectedChild=grant');
             break;
         case 'grant':
             $url = CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=grant&cid=' . $this->_contactId);
             break;
         case 'standalone':
             $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
             break;
         default:
             $cid = NULL;
             if ($this->_contactId) {
                 $cid = '&cid=' . $this->_contactId;
             }
             $url = CRM_Utils_System::url('civicrm/grant/search', 'reset=1&force=1' . $cid);
             break;
     }
     $session->pushUserContext($url);
     if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         CRM_Grant_BAO_Grant::del($this->_id);
         CRM_Utils_System::redirect($url);
     }
 }
コード例 #6
0
ファイル: Tab.php プロジェクト: bhirsch/voipdev
 function setContext()
 {
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
     $session =& CRM_Core_Session::singleton();
     switch ($context) {
         case 'search':
             $url = CRM_Utils_System::url('civicrm/grant/search', 'force=1');
             break;
         case 'dashboard':
             $url = CRM_Utils_System::url('civicrm/grant', 'reset=1');
             break;
         case 'edit':
             $url = CRM_utils_System::url('civicrm/contact/view/grant', 'reset=1&id=' . $this->_id . '&cid=' . $this->_contactId . '&action=view&context=grant&selectedChild=grant');
             break;
         case 'grant':
             $url = CRM_Utils_System::url('civicrm/contact/view', 'action=browse&selectedChild=grant&cid=' . $this->_contactId);
             break;
         case 'standalone':
             $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
             break;
         default:
             $cid = null;
             if ($this->_contactId) {
                 $cid = '&cid=' . $this->_contactId;
             }
             $url = CRM_Utils_System::url('civicrm/grant/search', 'reset=1&force=1' . $cid);
             break;
     }
     $session->pushUserContext($url);
     if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject)) {
         require_once 'CRM/Grant/BAO/Grant.php';
         CRM_Grant_BAO_Grant::del($this->_id);
         CRM_Utils_System::redirect($url);
     }
 }
コード例 #7
0
ファイル: Grant.php プロジェクト: prashantgajare/civicrm-core
 /**
  * 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}"));
     }
 }