blob: ca67b0b239d0251e833276ba44b4ccf725b5611a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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);
}
}
|