2015-06-30 11:19:31 +02:00
|
|
|
<?php
|
|
|
|
|
2015-10-20 22:34:04 +02:00
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
|
2015-06-30 11:19:31 +02:00
|
|
|
use Icinga\Module\Director\Web\Controller\ObjectController;
|
|
|
|
|
2015-10-20 22:34:04 +02:00
|
|
|
class TimeperiodController extends ObjectController
|
2015-06-30 11:19:31 +02:00
|
|
|
{
|
2016-03-17 04:23:07 +01:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
parent::init();
|
|
|
|
if ($this->object && $this->object->hasBeenLoadedFromDb()) {
|
|
|
|
$this->getTabs()->add('ranges', array(
|
|
|
|
'url' => 'director/timeperiod/ranges',
|
|
|
|
'urlParams' => $this->object->getUrlParams(),
|
|
|
|
'label' => $this->translate('Ranges')
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rangesAction()
|
|
|
|
{
|
|
|
|
$this->getTabs()->activate('ranges');
|
|
|
|
$this->view->form = $form = $this->loadForm('icingaTimePeriodRange');
|
|
|
|
$form
|
|
|
|
->setTimePeriod($this->object)
|
|
|
|
->setDb($this->db());
|
|
|
|
if ($name = $this->params->get('range')) {
|
|
|
|
$this->view->actionLinks = $this->view->qlink(
|
|
|
|
$this->translate('back'),
|
|
|
|
$this->getRequest()->getUrl()->without('range_id'),
|
|
|
|
null,
|
|
|
|
array('class' => 'icon-left-big')
|
|
|
|
);
|
|
|
|
$form->loadObject(array(
|
|
|
|
'timeperiod_id' => $this->object->id,
|
|
|
|
'timeperiod_key' => $name,
|
|
|
|
'range_type' => $this->params->get('range_type')
|
|
|
|
));
|
|
|
|
}
|
|
|
|
$form->handleRequest();
|
|
|
|
|
|
|
|
$this->view->table = $this->loadTable('icingaTimePeriodRange')
|
|
|
|
->setTimePeriod($this->object);
|
|
|
|
$this->view->title = $this->translate('Time period ranges');
|
|
|
|
$this->render('object/fields', null, true); // TODO: render table
|
|
|
|
}
|
2015-06-30 11:19:31 +02:00
|
|
|
}
|