Пример #1
0
 /**
  * Add action
  *
  * Add a new user
  *
  * @return void
  */
 public function createAction()
 {
     $form = new Admin_Form_User();
     $elmUserName = $form->getElement('name');
     $elmUserName->addValidators(array(array('UsernameExistsNot', true)));
     $form->onlyCreateActionElements();
     $u = new Model_User();
     $form->setModel($u);
     if ($form->validatePost()) {
         $password = $form->getValue('password');
         $userName = $form->getValue('name');
         $result = $form->create(array('password' => md5($password)));
         if ($result) {
             $this->_redirect('admin/user/open/username/' . $userName);
         }
     }
     $this->view->breadcrumbs['Create User'] = $this->baseUrl . '/admin/user/create';
     $form->setAction($this->baseUrl . '/admin/user/create');
     $this->view->form = $form;
     $this->view->toolbarLinks['Add to my bookmarks'] = $this->baseUrl . '/admin/index/bookmark/url/admin_user_create';
 }