Example #1
0
 public function addAction()
 {
     if ($this->_request->isPost()) {
         $user_data = $this->_request->getParams();
         $user = new Application_Model_User();
         $user->addUser($user_data);
         //$this->view->user_data=$user_data;
         //$this->render();
     }
 }
Example #2
0
 public function addAction()
 {
     $form = new Application_Form_User();
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getParams())) {
             $user_info = $form->getValues();
             $user_model = new Application_Model_User();
             $user_model->addUser($user_info);
         }
         if (Zend_Auth::getInstance()->getStorage()->read()->type == "admin") {
             $this->redirect("user/list");
         } else {
             $this->redirect("user/login");
         }
     }
     $this->view->form = $form;
 }
Example #3
0
 public function registerAction()
 {
     // action body
     $this->view->page_title = "Registration Form";
     $user_form = new Application_Form_Register();
     if ($this->getRequest()->isPost()) {
         if ($user_form->isValid($_POST)) {
             $user_model = new Application_Model_User();
             $this->view->success = $user_model->addUser($user_form->getValues());
             $auth = Zend_Auth::getInstance();
             $namespace = new Zend_Session_Namespace();
             $namespace->username = $user_form->getValue('username');
             $namespace->password = $user_form->getValue('password');
             $namespace->id = $user_model->getID($namespace->username);
             $this->view->username = $namespace->username;
             $this->_redirect('/users/index');
         }
     }
     $this->view->form = $user_form;
 }