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

65 lines
2.5 KiB
PHP

<?php
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
use Icinga\Web\Hook;
class SyncRuleForm extends DirectorObjectForm
{
public function setup()
{
$this->addElement('text', 'rule_name', array(
'label' => $this->translate('Rule name'),
'description' => $this->translate('Please provide a rule name'),
'required' => true,
));
$this->addElement('select', 'object_type', array(
'label' => $this->translate('Object Type'),
'description' => $this->translate('Choose a object type'),
'required' => true,
'multiOptions' => $this->optionalEnum(array(
'host' => $this->translate('Host'),
'host_template' => $this->translate('Host Template'),
'service' => $this->translate('Service'),
'service_template' => $this->translate('Service Template'),
'user' => $this->translate('User'),
'user_template' => $this->translate('User Template'),
'hostgroup' => $this->translate('Hostgroup'),
'servicegroup' => $this->translate('Servicegroup'),
'usergroup' => $this->translate('Usergroup'),
'datalistEntry' => $this->translate('Datalist entry'),
))
));
$this->addElement('select', 'update_policy', array(
'label' => $this->translate('Update Policity'),
'description' => $this->translate('Whether the field should be merged, replaced or ignored'),
'required' => true,
'multiOptions' => $this->optionalEnum(array(
'merge' => 'merge',
'override' => 'replace',
'ignore' => 'ignore'
))
));
$this->addElement('select', 'purge_existing', array(
'label' => $this->translate('Purge'),
'description' => $this->translate('Purge existing values.'),
'required' => true,
'multiOptions' => $this->optionalEnum(array(
'y' => 'yes',
'n' => 'no'
))
));
$this->addElement('text', 'filter_expression', array(
'label' => $this->translate('Filter Expression'),
'description' => $this->translate('This allows to filter for specific parts'),
));
$this->setButtons();
}
}