From a5990d4de861b8cb1e53891f5b09a45978cdbba5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 3 Jul 2017 15:03:26 +0200 Subject: [PATCH] Add date and time form elements --- application/views/helpers/FormDate.php | 46 ++++++++++++++++++++++++ application/views/helpers/FormTime.php | 46 ++++++++++++++++++++++++ library/Icinga/Web/Form/Element/Date.php | 19 ++++++++++ library/Icinga/Web/Form/Element/Time.php | 19 ++++++++++ 4 files changed, 130 insertions(+) create mode 100644 application/views/helpers/FormDate.php create mode 100644 application/views/helpers/FormTime.php create mode 100644 library/Icinga/Web/Form/Element/Date.php create mode 100644 library/Icinga/Web/Form/Element/Time.php diff --git a/application/views/helpers/FormDate.php b/application/views/helpers/FormDate.php new file mode 100644 index 000000000..39e6d940e --- /dev/null +++ b/application/views/helpers/FormDate.php @@ -0,0 +1,46 @@ +_getInfo($name, $value, $attribs); + + extract($info); // name, id, value, attribs, options, listsep, disable + /** @var string $id */ + /** @var bool $disable */ + + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + /** @var \Icinga\Web\View $view */ + $view = $this->view; + + $html5 = sprintf( + 'escape($name), + $view->escape($id), + $view->escape($value), + $disabled, + $this->_htmlAttribs($attribs), + $this->getClosingBracket() + ); + + return $html5; + } +} diff --git a/application/views/helpers/FormTime.php b/application/views/helpers/FormTime.php new file mode 100644 index 000000000..39d1b836b --- /dev/null +++ b/application/views/helpers/FormTime.php @@ -0,0 +1,46 @@ +_getInfo($name, $value, $attribs); + + extract($info); // name, id, value, attribs, options, listsep, disable + /** @var string $id */ + /** @var bool $disable */ + + $disabled = ''; + if ($disable) { + $disabled = ' disabled="disabled"'; + } + + /** @var \Icinga\Web\View $view */ + $view = $this->view; + + $html5 = sprintf( + 'escape($name), + $view->escape($id), + $view->escape($value), + $disabled, + $this->_htmlAttribs($attribs), + $this->getClosingBracket() + ); + + return $html5; + } +} diff --git a/library/Icinga/Web/Form/Element/Date.php b/library/Icinga/Web/Form/Element/Date.php new file mode 100644 index 000000000..8e0985c97 --- /dev/null +++ b/library/Icinga/Web/Form/Element/Date.php @@ -0,0 +1,19 @@ +