public function newAction() { $form = new Admin_Form_Site_New(); if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { $values = $form->getValues(); try { $id = Yadda_Model_Site::create($values); $this->getHelper('FlashMessenger')->addMessage('Site created.'); $this->_redirect($this->getHelper('ReturnUrl')->getUrl('/site/edit/id/' . $id)); } catch (Yadda_Model_Exception $e) { $this->view->flashMessages[] = 'Error: ' . $e->getMessage(); } } } $this->view->form = $form; }
public function __construct($site) { parent::__construct(); $this->setAction('/site/edit/id/' . $site['id']); $this->id->setAttrib('readonly', 'readonly'); }