2017-06-27 00:24:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Controllers;
|
|
|
|
|
2017-07-05 05:46:16 +02:00
|
|
|
use Icinga\Module\Director\Forms\IcingaTemplateChoiceForm;
|
2017-06-27 00:24:30 +02:00
|
|
|
use Icinga\Module\Director\Web\Controller\ActionController;
|
2021-10-05 22:56:15 +02:00
|
|
|
use Icinga\Module\Director\Web\Controller\BranchHelper;
|
2017-06-27 00:24:30 +02:00
|
|
|
|
|
|
|
class TemplatechoiceController extends ActionController
|
|
|
|
{
|
2021-10-05 22:56:15 +02:00
|
|
|
use BranchHelper;
|
|
|
|
|
2017-06-27 00:24:30 +02:00
|
|
|
protected function checkDirectorPermissions()
|
|
|
|
{
|
|
|
|
$this->assertPermission('director/admin');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hostAction()
|
|
|
|
{
|
2017-07-05 06:14:58 +02:00
|
|
|
$this->prepare('host', $this->translate('Host template choice'));
|
2017-06-27 00:24:30 +02:00
|
|
|
}
|
2017-06-29 14:06:32 +02:00
|
|
|
|
|
|
|
public function serviceAction()
|
|
|
|
{
|
2017-07-05 06:14:58 +02:00
|
|
|
$this->prepare('service', $this->translate('Service template choice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function prepare($type, $title)
|
|
|
|
{
|
2021-10-05 22:56:15 +02:00
|
|
|
$this->addSingleTab('Choice')
|
|
|
|
->addTitle($title);
|
2017-07-05 06:14:58 +02:00
|
|
|
$form = IcingaTemplateChoiceForm::create($type, $this->db())
|
2017-07-05 05:46:16 +02:00
|
|
|
->optionallyLoad($this->params->get('name'))
|
2017-07-05 06:14:58 +02:00
|
|
|
->setListUrl("director/templatechoices/$type")
|
2017-07-05 05:46:16 +02:00
|
|
|
->handleRequest();
|
2021-10-05 22:56:15 +02:00
|
|
|
if ($this->showNotInBranch($this->translate('Modifying Template Choices'))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$this->content()->add($form);
|
2017-06-29 14:06:32 +02:00
|
|
|
}
|
2017-06-27 00:24:30 +02:00
|
|
|
}
|