/** * EditAction for Users * * @return void */ public function editAction() { $this->view->title = "Edit Productions"; $form = new Production_Form_Production(); // $form->submit->setLabel('Save'); // $form->removeElement('password'); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $model = new Production_Model_Productions(); $id = $this->getRequest()->getPost('id'); $model->update($form->getValues(), 'id = ' . (int) $id); return $this->_helper->redirector('index'); } else { $form->populate($this->getRequest()->getPost()); } } else { $id = $this->_getParam('id', 0); if ($id > 0) { $model = new Production_Model_Productions(); $form->populate($model->fetchEntry($id)); } } $this->view->form = $form; }
/** * EditAction for Productions * * @return void */ public function editAction() { $this->production = new Zend_Session_Namespace('production'); //check if its in one production if ($this->production->id == null) { return $this->_helper->_redirector->gotoSimple('index', 'production', 'production'); } // $model= new User_Model_Permissions(); // // if (!$model->isUserAllowed($this->gpms->storage->role_production, 'production:production', 'edit')) // { // echo ("no tiene permiso"); // } // // die("holaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); $id = $_SESSION['production']['id']; $this->view->title = "Edit Productions"; $form = new Production_Form_Production(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $model = new Production_Model_Production(); $data = $form->getValues(); unset($data["client_companies_id"]); $model->update($data, 'id = ' . (int) $id); return $this->_helper->_redirector->gotoSimple('consult', 'production', 'production'); } else { $form->populate($this->getRequest()->getPost()); } } else { if ($id > 0) { $model = new Production_Model_Production(); $data = $model->fetchEntry($id); // Zend_Debug::dump($data); // die(); $form->populate($data); } } $form->removeElement('client_companies_id'); $this->view->form = $form; }