/** * */ public function indexAction() { $formSiteCadastro = new Form_Site_Cadastro(); $this->view->formSiteCadastro = $formSiteCadastro; if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($formSiteCadastro->isValid($data)) { $data = $formSiteCadastro->getValues(); try { $modelEmpresa = new Model_DbTable_Empresa(); $modelEmpresa->insert($data); $this->setServicos($data['empresa_servico']); $this->_redirect("/index"); } catch (Exception $ex) { die($ex->getMessage()); } } else { Zend_Debug::dump($formSiteCadastro->getErrorMessages()); } } }
public function cadastroAction() { $formSiteCadastro = new Form_Site_Cadastro(); $formSiteCadastro->addElement("checkbox", "empresa_ativo", array('label' => 'Ativo?', 'order' => 12)); $this->view->formSiteCadastro = $formSiteCadastro; if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); if ($formSiteCadastro->isValid($data)) { $data = $formSiteCadastro->getValues(); try { $modelEmpresa = new Model_DbTable_Empresa(); $modelEmpresa->insert($data); $this->setServicos($data['empresa_servico']); $this->_redirect("admin/empresa/cadastro"); } catch (Exception $ex) { die($ex->getMessage()); } } else { Zend_Debug::dump($formSiteCadastro->getErrorMessages()); } } }