/** * */ protected function addCategory() { if (!$this->isCRUDContext()) { $this->{$this->getDefaultCommand()}(); return; } $this->initUnitCategoryForm(); if ($this->unit_cat_form->checkInput()) { try { $category = new assFormulaQuestionUnitCategory(); $category->setCategory($this->unit_cat_form->getInput('category_name')); $this->repository->saveNewUnitCategory($category); ilUtil::sendSuccess($this->lng->txt('saved_successfully')); $this->{$this->getUnitCategoryOverviewCommand()}(); return; } catch (ilException $e) { $this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage())); ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); } } $this->unit_cat_form->setValuesByPost(); $this->tpl->setContent($this->unit_cat_form->getHtml()); }