blob: e681a70523439e80fefbbfa70366182ecf6b6e0c (
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
|
<?php
namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\Forms\IcingaScheduledDowntimeRangeForm;
use Icinga\Module\Director\Objects\IcingaScheduledDowntime;
use Icinga\Module\Director\Web\Controller\ObjectController;
use Icinga\Module\Director\Web\Table\IcingaScheduledDowntimeRangeTable;
class ScheduledDowntimeController extends ObjectController
{
protected $objectBaseUrl = 'director/scheduled-downtime';
protected function checkDirectorPermissions()
{
$this->assertPermission('director/scheduled-downtimes');
}
public function rangesAction()
{
/** @var IcingaScheduledDowntime $object */
$object = $this->object;
$this->tabs()->activate('ranges');
$this->addTitle($this->translate('Time period ranges'));
$form = IcingaScheduledDowntimeRangeForm::load()
->setScheduledDowntime($object);
if (null !== ($name = $this->params->get('range'))) {
$this->addBackLink($this->url()->without('range'));
$form->loadObject([
'scheduled_downtime_id' => $object->get('id'),
'range_key' => $name,
'range_type' => $this->params->get('range_type')
]);
}
$this->content()->add($form->handleRequest());
IcingaScheduledDowntimeRangeTable::load($object)->renderTo($this);
}
public function getType()
{
return 'scheduledDowntime';
}
}
|