public function execute(HTTPRequestCustom $request)
 {
     AppContext::get_session()->csrf_get_protect();
     $config = BugtrackerConfig::load();
     $parameter = $request->get_string('parameter', '');
     if (in_array($parameter, array('type', 'category', 'severity', 'priority', 'version'))) {
         switch ($parameter) {
             case 'type':
                 $config->set_default_type(0);
                 break;
             case 'category':
                 $config->set_default_category(0);
                 break;
             case 'severity':
                 $config->set_default_severity(0);
                 break;
             case 'priority':
                 $config->set_default_priority(0);
                 break;
             case 'version':
                 $config->set_default_version(0);
                 break;
         }
         BugtrackerConfig::save();
         AppContext::get_response()->redirect(BugtrackerUrlBuilder::configuration());
     } else {
         $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), LangLoader::get_message('error.e_unexist_parameter', 'common', 'bugtracker'));
         $controller->set_response_classname(UserErrorController::ADMIN_RESPONSE);
         DispatchManager::redirect($controller);
     }
 }
 public function execute(HTTPRequestCustom $request)
 {
     try {
         $this->try_execute();
     } catch (ObjectNotFoundException $exception) {
         $error_controller = new UserErrorController('Menu configuration does not exists', 'The requested menu configuration ' . $request->get_value('menu_config_id') . ' does not exists', UserErrorController::FATAL);
         $error_controller->set_correction_link('Menu configuration list', MenuUrlBuilder::menu_configuration_list()->rel());
         $error_controller->set_response_classname('AdminMenusDisplayResponse');
         return $error_controller->execute($request);
     } catch (UnexistingHTTPParameterException $exception) {
         $error_controller = ClassLoader::new_instance('/admin/menus/controllers/MenuControllerError');
         return $error_controller->execute($request);
     }
     return $this->response;
 }
 private function init(HTTPRequestCustom $request)
 {
     $this->lang = LangLoader::get('common', 'bugtracker');
     $this->config = BugtrackerConfig::load();
     //Get the parameter to delete
     $this->parameter = $request->get_string('parameter', '');
     //Get the id of the parameter to delete
     $this->id = $request->get_int('id', '');
     if (!in_array($this->parameter, array('type', 'category', 'version')) || empty($this->id)) {
         $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $this->lang['error.e_unexist_parameter']);
         $controller->set_response_classname(UserErrorController::ADMIN_RESPONSE);
         DispatchManager::redirect($controller);
     }
     $types = $this->config->get_types();
     $categories = $this->config->get_categories();
     $versions = $this->config->get_versions();
     switch ($this->parameter) {
         case 'type':
             if (!isset($types[$this->id])) {
                 //Error : unexist type
                 $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $this->lang['error.e_unexist_type']);
                 $controller->set_response_classname(UserErrorController::ADMIN_RESPONSE);
                 DispatchManager::redirect($controller);
             }
             break;
         case 'category':
             if (!isset($categories[$this->id])) {
                 //Error : unexist category
                 $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $this->lang['error.e_unexist_category']);
                 $controller->set_response_classname(UserErrorController::ADMIN_RESPONSE);
                 DispatchManager::redirect($controller);
             }
             break;
         case 'version':
             if (!isset($versions[$this->id])) {
                 //Error : unexist version
                 $controller = new UserErrorController(LangLoader::get_message('error', 'status-messages-common'), $this->lang['error.e_unexist_version']);
                 $controller->set_response_classname(UserErrorController::ADMIN_RESPONSE);
                 DispatchManager::redirect($controller);
             }
             break;
     }
 }