Ejemplo n.º 1
0
 public function edituserAction()
 {
     if ($role != 2) {
         $this->_redirect('/');
     }
     $ID = $this->_getParam('i');
     $db = new Application_Model_Users();
     $user = $db->find(intval($ID))[0];
     $this->view->user = $user;
     $form = new Application_Form_EditUserForm();
     $this->view->form = $form;
     $form->populate(array('email' => $user->email, 'role' => Application_Model_Users::getRole($user->role)));
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $where = $db->getAdapter()->quoteInto('ID = ?', $user->ID);
             $db->update($data, $where);
             $this->_redirect('/pages/dashboard');
             $this->view->message = "Successfully updated";
         }
     }
 }