Пример #1
0
 public function performaddAction()
 {
     $typeSelected = $this->params()->fromPost('TIPO');
     $request = $this->getRequest();
     $form = new UserForm();
     if ($request->isPost()) {
         $user = new GUser();
         echo $typeSelected;
         $subUser = LocalUserFactory::getUser($typeSelected);
         //$form->setInputFilter($user->getInputFilter());
         //$form->setInputFilter($subUser->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $user->exchangeArray($form->getData());
             $subUser->exchangeArray($request->getPost('subForm'));
             // Hash password
             $this->hashUserPassword($user);
             $this->startTransactionAddUser($user, $subUser, true);
             // Redirect to list of users
             $this->addInfoMessage(GeneralMessages::USER_ADD_OK);
             return $this->redirect()->toRoute('user');
         } else {
             $this->addErrorMessage(GeneralMessages::FORM_ERROR);
             return $this->redirect()->toRoute('user', array('action' => 'add'));
         }
     }
 }