icingaweb2-module-director/application/controllers/ScheduledDowntimeController.php
2019-04-11 02:34:14 +02:00

39 lines
1.2 KiB
PHP

<?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\IcingaScheduledDowntimeTable;
class ScheduledDowntimeController extends ObjectController
{
public function rangesAction()
{
/** @var IcingaScheduledDowntime $object */
$object = $this->object;
$this->tabs()->activate('ranges');
$this->addTitle($this->translate('Time period ranges'));
$form = IcingaScheduledDowntimeRangeForm::load()
->setTimePeriod($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());
IcingaScheduledDowntimeTable::load($object)->renderTo($this);
}
public function getType()
{
return 'scheduledDowntime';
}
}