Ejemplo n.º 1
0
 /**
  * @param CategoryForm $form
  */
 public function formSubmitted(CategoryForm $form)
 {
     try {
         $this->categoryManager->update($form->getValues());
         $form->presenter->flashMessage('Category management was successful', 'success');
     } catch (\Nette\InvalidArgumentException $ex) {
         $form->addError($ex->getMessage());
     }
 }
Ejemplo n.º 2
0
 /**
  * @param $id
  */
 public function handleDelete($id)
 {
     if (!$this->getUser()->isAllowed('Admin:Category', 'delete')) {
         $this->flashMessage('Access denied');
     } else {
         try {
             $this->categoryManager->delete($id);
         } catch (\Nette\InvalidArgumentException $ex) {
             $this->presenter->flashMessage($ex->getMessage());
         }
     }
     $this->redirect('this');
 }