diff --git a/application/views/helpers/FormNumber.php b/application/views/helpers/FormNumber.php new file mode 100644 index 000000000..558c1f24c --- /dev/null +++ b/application/views/helpers/FormNumber.php @@ -0,0 +1,30 @@ +view->escape($name) . '"' + . ' value="' . $this->view->escape($value) . '"' + . ' id="' . $this->view->escape($name) . '"' + . $this->_htmlAttribs($attribs) + . $this->getClosingBracket(); + } +} + +?> diff --git a/library/Icinga/Form/Elements/Date.php b/library/Icinga/Form/Elements/Date.php index 59c05b9f7..47dfe68f7 100644 --- a/library/Icinga/Form/Elements/Date.php +++ b/library/Icinga/Form/Elements/Date.php @@ -3,6 +3,8 @@ namespace Icinga\Form\Elements; /** * Date form element + * + * @TODO: The given label for this element is not displayed. (Reason unknown) */ class Date extends \Zend_Form_Element_Xhtml { diff --git a/library/Icinga/Form/Elements/Number.php b/library/Icinga/Form/Elements/Number.php new file mode 100644 index 000000000..758fc80e1 --- /dev/null +++ b/library/Icinga/Form/Elements/Number.php @@ -0,0 +1,18 @@ + diff --git a/library/Icinga/Form/Elements/Time.php b/library/Icinga/Form/Elements/Time.php index 62bdd00fe..b8f055835 100644 --- a/library/Icinga/Form/Elements/Time.php +++ b/library/Icinga/Form/Elements/Time.php @@ -3,6 +3,8 @@ namespace Icinga\Form\Elements; /** * Time form element + * + * @TODO: The given label for this element is not displayed. (Reason unknown) */ class Time extends \Zend_Form_Element_Xhtml { diff --git a/library/Icinga/Form/SendCommand.php b/library/Icinga/Form/SendCommand.php index 0536c6476..b3f66701a 100644 --- a/library/Icinga/Form/SendCommand.php +++ b/library/Icinga/Form/SendCommand.php @@ -4,6 +4,7 @@ namespace Icinga\Form; use Icinga\Form\Builder; use Icinga\Form\Elements\Date; use Icinga\Form\Elements\Time; +use Icinga\Form\Elements\Number; class SendCommand extends Builder { @@ -125,6 +126,27 @@ class SendCommand extends Builder { return $this->getElement($id)->options[$_POST[$id]]; } + + /** + * @TODO: "min", "max" and "step" seem to have no effect :( + */ + public function addNumberBox($id, $label, $value = "", $min = 0, $max = -1, $step = "any") + { + $number = new Number($id); + $number->setValue($value); + $this->addElement($number, $id, array( + 'label' => $label, + 'step' => $step, + 'min' => $min, + 'max' => $max + ) + ); + } + + public function getNumber($id) + { + return $this->getValue($id); + } } ?> \ No newline at end of file