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

67 lines
2.5 KiB
PHP
Raw Normal View History

2015-07-23 16:40:32 +02:00
<?php
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
class SyncRuleForm extends DirectorObjectForm
{
public function setup()
{
2015-12-03 16:13:49 +01:00
$availableTypes = array(
2015-12-08 10:58:05 +01:00
'command' => $this->translate('Command'),
2015-12-03 16:13:49 +01:00
'endpoint' => $this->translate('Endpoint'),
'host' => $this->translate('Host'),
'service' => $this->translate('Service'),
'user' => $this->translate('User'),
'hostgroup' => $this->translate('Hostgroup'),
'servicegroup' => $this->translate('Servicegroup'),
'usergroup' => $this->translate('Usergroup'),
'datalistEntry' => $this->translate('Datalist entry'),
'zone' => $this->translate('Zone'),
);
asort($availableTypes);
2015-07-23 16:40:32 +02:00
$this->addElement('text', 'rule_name', array(
2015-11-02 10:36:10 +01:00
'label' => $this->translate('Rule name'),
'description' => $this->translate('Please provide a rule name'),
2015-07-23 16:40:32 +02:00
'required' => true,
));
$this->addElement('select', 'object_type', array(
2015-11-02 10:36:10 +01:00
'label' => $this->translate('Object Type'),
'description' => $this->translate('Choose a object type'),
'required' => true,
2015-12-03 16:13:49 +01:00
'multiOptions' => $this->optionalEnum($availableTypes)
2015-07-23 16:40:32 +02:00
));
$this->addElement('select', 'update_policy', array(
2015-11-02 10:36:10 +01:00
'label' => $this->translate('Update Policity'),
'description' => $this->translate('Whether the field should be merged, replaced or ignored'),
2015-11-02 10:36:10 +01:00
'required' => true,
'multiOptions' => $this->optionalEnum(array(
2015-07-23 16:40:32 +02:00
'merge' => 'merge',
'override' => 'replace',
2015-07-23 16:40:32 +02:00
'ignore' => 'ignore'
2015-11-02 10:36:10 +01:00
))
2015-07-23 16:40:32 +02:00
));
$this->addElement('select', 'purge_existing', array(
'label' => $this->translate('Purge'),
'description' => $this->translate('Purge existing values.'),
2015-07-23 16:40:32 +02:00
'required' => true,
2015-11-02 10:36:10 +01:00
'multiOptions' => $this->optionalEnum(array(
'y' => 'yes',
'n' => 'no'
))
2015-07-23 16:40:32 +02:00
));
$this->addElement('text', 'filter_expression', array(
2015-11-02 10:36:10 +01:00
'label' => $this->translate('Filter Expression'),
'description' => $this->translate('This allows to filter for specific parts'),
2015-07-23 16:40:32 +02:00
));
$this->setButtons();
2015-07-23 16:40:32 +02:00
}
}