Exemplo n.º 1
0
 /**
  * @param UserAddForm $form
  */
 public function formSubmitted(UserAddForm $form)
 {
     try {
         $this->userManager->create($form->getValues());
         $form->presenter->flashMessage('User was created', 'success');
     } catch (\Nette\InvalidArgumentException $ex) {
         $form->addError($ex->getMessage());
     }
 }
 /**
  * Allows users to add new users in the application
  * (should be reserved for administrators)
  *
  * @access public
  * @return void
  */
 public function addAction()
 {
     $this->title = 'Add a new user';
     $form = new UserAddForm();
     $userModel = new BackofficeUser();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getPost())) {
             $userModel->save($form->getValues());
             $this->_helper->FlashMessenger(array('msg-success' => 'The user was successfully added'));
             App_FlagFlippers_Manager::save();
             $this->_redirect('/users/');
         }
     }
     $this->view->form = $form;
 }