Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function editAction() {
- // action body
- $this->view->title = "Edit User";
- $this->view->headTitle($this->view->title, 'PREPEND');
- $form = new Application_Form_Admin();
- $form->submit->setLabel('Save');
- $this->view->form = $form;
- if ($this->getRequest()->isPost()) {
- $formData = $this->getRequest()->getPost();
- if ($form->isValid($formData)) {
- $id = (int) $form->getValue('id');
- $username = $form->getValue('username');
- $password = $form->getValue('password');
- $real_name = $form->getValue('real_name');
- $admin = $form->getValue('admin');
- $users = new Application_Model_DbTable_Users();
- $users->updateUser($id, $username, $password, $real_name, $admin);
- $this->_helper->redirector('index');
- } else {
- $form->populate($formData);
- }
- } else {
- $id = $this->_getParam('id', 0);
- if ($id > 0) {
- $users = new Application_Model_DbTable_Users();
- $form->populate($users->getUser($id)->toArray());
- }
- }
- }
Add Comment
Please, Sign In to add comment