Example #1
0
 public function addAction()
 {
     //$this->view->page_title = "Add";
     $authorization = Zend_Auth::getInstance();
     $identity = $authorization->getIdentity();
     if ($identity->user_type == "admin") {
         $form = new Application_Form_Registeration();
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($_POST)) {
                 $model = new Application_Model_Users();
                 $this->view->success = $model->addUser($form->getValues());
                 $form->reset();
                 $this->redirect("categories/list");
             }
         }
         $this->view->form = $form;
     } else {
         $form = new Application_Form_Registeration();
         if ($this->getRequest()->isPost()) {
             if ($form->isValid($_POST)) {
                 $model = new Application_Model_Users();
                 $this->view->success = $model->addUser($form->getValues());
                 $form->reset();
                 $this->redirect("categories/list");
             }
         }
         $this->view->form = $form;
     }
 }