icingaweb2-module-director/application/forms/IcingaHostgroupForm.php

44 lines
1.6 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('submit', $this->translate('Store'));
}
}