private function init(HTTPRequestCustom $request) { $id = $request->get_int('id', 0); $this->lang = LangLoader::get('common', 'bugtracker'); try { $this->bug = BugtrackerService::get_bug('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $this->lang['error.e_unexist_bug']); DispatchManager::redirect($error_controller); } $this->view = new StringTemplate('# INCLUDE FORM #'); $this->view->add_lang($this->lang); $this->config = BugtrackerConfig::load(); }
private function init() { $this->current_user = AppContext::get_current_user(); $request = AppContext::get_request(); $id = $request->get_int('id', 0); $this->lang = LangLoader::get('common', 'bugtracker'); try { $this->bug = BugtrackerService::get_bug('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $this->lang['error.e_unexist_bug']); DispatchManager::redirect($error_controller); } $this->view = new FileTemplate('bugtracker/BugtrackerDetailController.tpl'); $this->view->add_lang($this->lang); }
private function get_bug() { if ($this->bug === null) { $request = AppContext::get_request(); $id = $request->get_getint('id', 0); if (!empty($id)) { try { $this->bug = BugtrackerService::get_bug('WHERE id=:id', array('id' => $id)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } } else { $this->is_new_bug = true; $this->bug = new Bug(); $this->bug->init_default_properties(); } } return $this->bug; }