Ejemplo n.º 1
0
 /**
  * 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;
 }