public function editAction() { $Page = new App_Model_DbTable_Pages(); $Form = new Admin_Form_Pages(); $Form->Submit->setLabel('Edit page'); $Form->IDParent->addMultiOptions($this->view->printSelectPages($Page->getTreePages())); $this->view->form = $Form; if ($this->getRequest()->isPost()) { $FormData = $this->getRequest()->getPost(); if ($Form->isValid($FormData)) { $IDPage = (int) $Form->getValue('IDPage'); $Title = $Form->getValue('Title'); $Text = $Form->getValue('Text'); $URL = $Form->getValue('URL'); $Type = $Form->getValue('Type'); $IDParent = $Form->getValue('IDParent'); $Page->updatePage($IDPage, $Title, $URL, $Type, $Text, $IDParent); $this->_helper->redirector('index'); } else { $Form->populate($FormData); } } else { $IDPage = (int) $this->_getParam('IDPage', 0); if ($IDPage) { $Form->populate($Page->getPage($IDPage)); } } }
public function editAction() { $Gallery = new App_Model_DbTable_Gallery(); $Pages = new App_Model_DbTable_Pages(); $Form = new Admin_Form_Album(); $Form->Submit->setLabel('Edit'); $Form->IDPage->addMultiOptions($this->view->printSelectPages($Pages->getTreePages())); $this->view->form = $Form; if ($this->getRequest()->isPost()) { $FormData = $this->getRequest()->getPost(); if ($Form->isValid($FormData)) { $IDAlbum = $Form->getValue('IDAlbum'); $IDPage = $Form->getValue('IDPage'); $Title = $Form->getValue('Title'); $Description = $Form->getValue('Description'); $Gallery->updateAlbum($IDAlbum, $Title, $Description, $IDPage); $this->_helper->redirector('index'); } else { $Form->populate($FormData); } } else { $IDAlbum = (int) $this->_getParam('IDAlbum', 0); if ($IDAlbum) { $Form->populate($Gallery->getAlbum($IDAlbum)); } } }