/** * EditAction for Activitys * * @return void */ public function editAction() { //check if the user select a production $this->production = new Zend_Session_Namespace('production'); if ($this->production->id == null) { return $this->_helper->_redirector->gotoSimple('index', 'production', 'production'); } if ($this->production->activity_id == null) { return $this->_helper->_redirector->gotoSimple('consult', 'production', 'production'); } $this->view->title = "Edit Activitys"; $form = new Production_Form_Activity(); if ($_SESSION["gpms"]["role"] == "Encargado Actividad") { $form->removeElement('contact_own_company_id'); } if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $model = new Production_Model_Activity(); $id = $_SESSION["production"]["activity_id"]; $data = $form->getValues(); $model->update($data, 'id = ' . (int) $id); return $this->_helper->redirector('consult'); } else { $form->populate($this->getRequest()->getPost()); } } else { $model = new Production_Model_Activity(); $form->populate($model->fetchEntry($_SESSION["production"]["activity_id"])); } if ($_SESSION["gpms"]["role"] == "Encargado Actividad") { $form->removeElement('$contact_own_company_id'); } echo $this->view->form; $this->view->form = $form; }