diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php deleted file mode 100644 index 37fb63f13..000000000 --- a/library/Icinga/Web/Form.php +++ /dev/null @@ -1,109 +0,0 @@ - - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - */ -// {{{ICINGA_LICENSE_HEADER}}} - -namespace Icinga\Web; - -use Zend_Form; -use Zend_Controller_Front as Front; // TODO: Get from App -use Zend_Controller_Action_HelperBroker as ZfActionHelper; - -/** - * Class Form - * @package Icinga\Web - */ -class Form extends Zend_Form -{ - protected $request; - - /** - * @param array $options[optional] - * @internal param \Icinga\Web\Zend_Controller_Request_Abstract $request - */ - public function __construct($options = null) - { - /* - if (isset($options['prefill'])) { - $this->_prefill = $options['prefill']; - unset($options['prefill']); - } - */ - $this->request = Front::getInstance()->getRequest(); - // $this->handleRequest(); - foreach ($this->elements() as $key => $values) { - $this->addElement($values[0], $key, $values[1]); // do it better! - } - - // Should be replaced with button check: - $this->addElement('hidden', '__submitted'); - $this->setDefaults(array('__submitted' => 'true')); - - parent::__construct($options); - if ($this->getAttrib('action') === null) { - $this->setAction($this->request->getRequestUri()); - } - if ($this->getAttrib('method') === null) { - $this->setMethod('post'); - } - if ($this->hasBeenSubmitted()) { - $this->handleRequest(); - } - } - - public function redirectNow($url) - { - ZfActionHelper::getStaticHelper('redirector') - ->gotoUrlAndExit($url); - } - - public function handleRequest() - { - if ($this->isValid($this->request->getPost())) { - $this->onSuccess(); - } else { - $this->onFailure(); - } - } - - public function onSuccess() - { - } - - public function onFailure() - { - } - - public function hasBeenSubmitted() - { - return $this->request->getPost('__submitted', 'false') === 'true'; - } - - public function elements() - { - return array(); - } -}