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

58 lines
2.2 KiB
PHP
Raw Normal View History

<?php
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
2015-06-09 10:35:02 +02:00
class IcingaTimePeriodForm 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' => 'Timeperiod object',
'template' => 'Timeperiod template',
)
));
if ($isTemplate) {
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Timeperiod template name'),
'required' => true,
'description' => $this->translate('Name for the Icinga timperiod template you are going to create')
));
} else {
$this->addElement('text', 'object_name', array(
'label' => $this->translate('Timeperiod'),
'required' => true,
'description' => $this->translate('Name for the Icinga timeperiod you are going to create')
));
}
$this->addElement('text', 'display_name', array(
'label' => $this->translate('Display Name'),
'description' => $this->translate('the display name')
));
$this->addElement('text', 'update_method', array(
'label' => $this->translate('Update Method'),
'description' => $this->translate('the update method'),
));
$this->addElement('select', 'zone_id', array(
'label' => $this->translate('Cluster Zone'),
'description' => $this->translate('Check this host in this specific Icinga cluster zone'),
'required' => true
));
2015-06-26 16:45:44 +02:00
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited timperiods template names')
));
}
}