summaryrefslogtreecommitdiffstats
path: root/application/controllers/TimeframeController.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:46:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:46:47 +0000
commit4ada86876033fa171e2896d7e3d3c5645d8062db (patch)
treef0d1fee61877df200ccfb1c0af58a39cd551fb46 /application/controllers/TimeframeController.php
parentInitial commit. (diff)
downloadicingaweb2-module-reporting-4ada86876033fa171e2896d7e3d3c5645d8062db.tar.xz
icingaweb2-module-reporting-4ada86876033fa171e2896d7e3d3c5645d8062db.zip
Adding upstream version 0.10.0.upstream/0.10.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'application/controllers/TimeframeController.php')
-rw-r--r--application/controllers/TimeframeController.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/application/controllers/TimeframeController.php b/application/controllers/TimeframeController.php
new file mode 100644
index 0000000..ca67b0b
--- /dev/null
+++ b/application/controllers/TimeframeController.php
@@ -0,0 +1,47 @@
+<?php
+// Icinga Reporting | (c) 2019 Icinga GmbH | GPLv2
+
+namespace Icinga\Module\Reporting\Controllers;
+
+use GuzzleHttp\Psr7\ServerRequest;
+use Icinga\Module\Reporting\Database;
+use Icinga\Module\Reporting\Timeframe;
+use Icinga\Module\Reporting\Web\Controller;
+use Icinga\Module\Reporting\Web\Forms\TimeframeForm;
+
+class TimeframeController extends Controller
+{
+ use Database;
+
+ /** @var Timeframe */
+ protected $timeframe;
+
+ public function init()
+ {
+ $this->timeframe = Timeframe::fromDb($this->params->getRequired('id'));
+ }
+
+ public function editAction()
+ {
+ $this->assertPermission('reporting/timeframes');
+ $this->addTitleTab($this->translate('Edit Time Frame'));
+
+ $values = [
+ 'name' => $this->timeframe->getName(),
+ 'start' => $this->timeframe->getStart(),
+ 'end' => $this->timeframe->getEnd()
+ ];
+
+
+ $form = (new TimeframeForm())
+ ->setId($this->timeframe->getId());
+
+ $form->populate($values);
+
+ $form->handleRequest(ServerRequest::fromGlobals());
+
+ $this->redirectForm($form, 'reporting/timeframes');
+
+ $this->addContent($form);
+ }
+}