set("context", $context); // assign vars to templates $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0); $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); // default to 'browse' // what action to take ? if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::CLOSE | CRM_Core_Action::REOPEN | CRM_Core_Action::EXPORT) ) { $this->edit($action, $id); } // parent run return parent::run(); } /** * Get name of edit form. * * @return string * classname of edit form. */ public function editForm() { return 'CRM_Financial_Form_FinancialBatch'; } /** * Get edit form name. * * @return string * name of this page. */ public function editName() { return 'Accounting Batch'; } /** * Get user context. * * Redirect to civicrm home page when clicked on cancel button * * @param null $mode * * @return string * user context. */ public function userContext($mode = NULL) { $context = $this->get("context"); if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) { return "civicrm/financial/financialbatches"; } return 'civicrm'; } /** * @param null $mode * * @return string */ public function userContextParams($mode = NULL) { $context = $this->get("context"); if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) { return "reset=1&batchStatus={$context}"; } } }