示例#1
0
文件: Tab.php 项目: kidaa30/yes
 /**
  * the main function that is called when the page loads, it decides the which action has to be taken for the page.
  *
  * @return null
  */
 public function run()
 {
     $this->preProcess();
     // check if we can process credit card registration
     $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments());
     self::setContext($this);
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->view();
     } elseif ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) {
         $this->edit();
     } elseif ($this->_action & CRM_Core_Action::DETACH) {
         CRM_Pledge_BAO_Pledge::cancel($this->_id);
         $session = CRM_Core_Session::singleton();
         $session->setStatus(ts('Pledge has been Cancelled and all scheduled (not completed) payments have been cancelled.<br />'));
         CRM_Utils_System::redirect($session->popUserContext());
     } else {
         $this->browse();
     }
     return parent::run();
 }