public function addAction() { $Page = new App_Model_DbTable_Pages(); $Form = new Admin_Form_Pages(); $Form->Submit->setLabel('Add 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)) { $Title = $Form->getValue('Title'); $Text = $Form->getValue('Text'); $URL = $Form->getValue('URL'); $Type = $Form->getValue('Type'); $IDParent = $Form->getValue('IDParent'); $Page->addPage($Title, $URL, $Type, $Text, $IDParent); $this->_helper->redirector('index'); } else { $Form->populate($FormData); } } }