/** Edit the user details */ public function editAction() { $form = new ProfileForm(); $form->removeElement('password'); $this->view->form = $form; if ($this->getRequest()->isPost() && $form->isValid($this->_request->getPost())) { if ($form->isValid($form->getValues())) { $where = array(); $where[] = $users->getAdapter()->quoteInto('id = ?', $this->getIdentityForForms()); $this->_users->update($form->getValues(), $where); $this->_flashMessenger->addMessage('You updated your profile successfully.'); $this->_redirect('/users/account/'); } else { $form->populate($form->getValues()); $this->_flashMessenger->addMessage('You have some errors with your submission.'); } } else { $id = (int) $this->getIdentityForForms(); if ($id > 0) { $user = $this->_users->fetchRow('id =' . $this->getIdentityForForms())->toArray(); if ($user) { $form->populate($user); } else { throw new Exception('No user account found with that id'); } } } }
/** * Allows the users to update their profiles * * @access public * @return void */ public function editAction() { $this->title = 'Edit your profile'; $form = new ProfileForm(); $userModel = new BackofficeUser(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $userModel->updateProfile($form->getValues()); $this->_helper->FlashMessenger(array('msg-success' => 'Your profile was successfully updated.')); $this->_redirect('/profile/edit/'); } } else { $user = Zend_Auth::getInstance()->getIdentity(); $row = $userModel->findById($user->id); $form->populate($row->toArray()); $this->view->item = $row; } $this->view->form = $form; }
/** * Edit action, Allow the User to update his profil * @author EL GUENNUNI Sohaib s.elguennuni@gmail.com * @param <empty> * @return <empty> */ public function editAction() { $this->title = 'Edit your account'; $form = new ProfileForm(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $data = $form->getValues(); $value_id = $this->_rvCityModel->searchCity($form->getValue('name')); if ($value_id) { $data['rv_city_id'] = $value_id; } else { $data['rv_city_id'] = $this->_rvCityModel->addCity($form->getValue('name')); } $this->_memberModel->updateMember($data); $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'account', 'action' => 'display'), 'default', true)); } } else { $row = $this->_memberModel->getMember($this->_idMember); $form->populate($row->toArray()); $this->view->item = $row; } $this->view->form = $form; }