47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
class IcingaHostGroupForm extends DirectorObjectForm
|
|
{
|
|
public function setup()
|
|
{
|
|
$isTemplate = isset($_POST['object_type']) && $_POST['object_type'] === 'template';
|
|
$this->addElement('select', 'object_type', array(
|
|
'label' => $this->translate('Object type'),
|
|
'description' => $this->translate('Whether this should be a template'),
|
|
'multiOptions' => array(
|
|
null => '- please choose -',
|
|
'object' => 'Hostgroup object',
|
|
'template' => 'Hostgroup template',
|
|
)
|
|
));
|
|
|
|
if ($isTemplate) {
|
|
$this->addElement('text', 'object_name', array(
|
|
'label' => $this->translate('Hostgroup template name'),
|
|
'required' => true,
|
|
'description' => $this->translate('Hostgroup for the Icinga hostgroup template you are going to create')
|
|
));
|
|
} else {
|
|
$this->addElement('text', 'object_name', array(
|
|
'label' => $this->translate('Hostgroup'),
|
|
'required' => true,
|
|
'description' => $this->translate('Hostgroup for the Icinga hostgroup you are going to create')
|
|
));
|
|
}
|
|
|
|
$this->addElement('text', 'display_name', array(
|
|
'label' => $this->translate('Display Name'),
|
|
'description' => $this->translate('The name which should displayed.')
|
|
));
|
|
|
|
$this->addElement('text', 'imports', array(
|
|
'label' => $this->translate('Imports'),
|
|
'description' => $this->translate('The inherited hostgroup template names')
|
|
));
|
|
}
|
|
}
|