Пример #1
0
 public function editarAction()
 {
     $this->assecoAction();
     $this->_helper->layout->setLayout('administrator');
     $form = new Application_Form_Categoria();
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $id = (int) $form->getValue('id');
             $descricao = $form->getValue('descricao');
             $this->categoria->updates($id, $descricao);
             if ($this->categoria) {
                 $this->_helper->flashMessenger->addMessage(array('successo' => 'Registro alterado com sucesso'));
                 $this->_helper->redirector('sucesso');
             }
         } else {
             $form->populate($formData);
         }
     } else {
         $id = $this->_getParam('id', 0);
         if ($id > 0) {
             //$deejay = new Application_Model_DbTable_Deejay();
             $form->populate($this->categoria->getId($id));
         }
     }
 }