/** * (non-PHPdoc) * * @see \Simplify\Controller::indexAction() */ protected function indexAction() { try { $this->Form = new \Simplify\Form('options', __('Opções')); $this->Form->showMenu = false; $this->Form->addAction(new \Simplify\Form\Action\Config('config', __('Gerais'), \Simplify::config()->get('amp:tables:options'), 'option_name', 'option_value')); $this->Form->addElement(new \Simplify\Form\Element\Text('site_name', __('Nome do site')), \Simplify\Form::ACTION_CONFIG); $url = new \Simplify\Form\Element\Text('site_url', __('URL do site')); $this->Form->addElement($url, \Simplify\Form::ACTION_CONFIG); $this->Form->execute(); } catch (\Simplify\ValidationException $e) { \Simplify::session()->warnings(__('Ocorreram erros')); } $this->set('formBody', $this->Form->render()); }
/** * (non-PHPdoc) * * @see \Simplify\Controller::indexAction() */ protected function indexAction() { try { $this->Form->execute(); } catch (\Simplify\ValidationException $e) { \Simplify::session()->warnings(__('Ocorreram erros')); } $this->set('formBody', $this->Form->render()); }
/** * (non-PHPdoc) * * @see \Simplify\Controller::indexAction() */ protected function indexAction() { try { $result = $this->Form->execute(); if ($result == \Simplify\Form::RESULT_SUCCESS) { \Simplify::session()->notices('Success'); return \Simplify::response()->redirect($this->Form->url()->extend()->set('formAction', null)); } } catch (\Simplify\ValidationException $e) { \Simplify::session()->warnings(__('Verifique os erros abaixo')); $errors = (array) $e->getErrors(); foreach ($errors as $key => $errors) { if (is_int($key)) { \Simplify::session()->warnings($errors); } } } catch (\Exception $e) { \Simplify::session()->warnings($e->getMessage()); } $this->set('formBody', $this->Form->render()); }