/** * EditAction for Users * * @return void */ public function editownuserAction() { $this->view->title = "Edit Users"; $form = new User_Form_User(); $form->submit->setLabel('Save'); $form->removeElement('password'); $form->removeElement('company_id'); $id = $_SESSION["gpms"]["storage"]->id; $this->gpms = new Zend_Session_Namespace('gpms'); //TODO pasar el role implementador y administrador sin hardcode //si es un usuario sin permiso solo puede editar su usuario y no su role_id $form->removeElement('role_id'); $id = $this->gpms->storage->id; if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $model = new User_Model_Users(); $id = $this->getRequest()->getPost('id'); $model->update($form->getValues(), 'id = ' . (int) $id); $this->_helper->redirector('index', 'company', 'company'); } else { $form->populate($this->getRequest()->getPost()); } } else { if ($id > 0) { $model = new User_Model_Users(); $data = $model->fetchEntry($id); if ($model->haveContact($id)) { $form->removeElement('add_contact'); } $form->populate($data); } } $this->view->form = $form; }