2015-07-23 11:43:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
|
|
|
use Icinga\Web\Hook;
|
|
|
|
|
|
|
|
class SyncPropertyForm extends DirectorObjectForm
|
|
|
|
{
|
|
|
|
public function setup()
|
|
|
|
{
|
2015-07-24 09:51:31 +02:00
|
|
|
$this->addElement('select', 'rule_id', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Rule Name'),
|
|
|
|
'required' => true,
|
2015-07-23 11:43:41 +02:00
|
|
|
));
|
|
|
|
|
2015-07-24 09:51:31 +02:00
|
|
|
$this->addElement('select', 'source_id', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Source Name'),
|
|
|
|
'required' => true,
|
2015-07-23 11:43:41 +02:00
|
|
|
));
|
|
|
|
|
2015-07-24 09:51:31 +02:00
|
|
|
$this->addElement('text', 'source_expression', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Source Expression'),
|
|
|
|
'required' => true,
|
2015-07-23 11:43:41 +02:00
|
|
|
));
|
|
|
|
|
2015-07-24 09:51:31 +02:00
|
|
|
$this->addElement('text', 'destination_field', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Destination Field'),
|
|
|
|
'required' => true,
|
2015-07-24 09:51:31 +02:00
|
|
|
));
|
2015-07-23 11:43:41 +02:00
|
|
|
|
2015-07-24 09:51:31 +02:00
|
|
|
$this->addElement('text', 'priority', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Priority'),
|
2015-07-24 09:51:31 +02:00
|
|
|
'description' => $this->translate('Priority for the specified source expression'),
|
2015-07-23 11:43:41 +02:00
|
|
|
'required' => true,
|
|
|
|
));
|
2015-07-24 09:51:31 +02:00
|
|
|
|
|
|
|
$this->addElement('text', 'filter_expression', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Filter Expression'),
|
2015-07-24 09:51:31 +02:00
|
|
|
'description' => $this->translate('This allows to filter for specific parts within the given source expression'),
|
|
|
|
'required' => false,
|
|
|
|
));
|
|
|
|
|
|
|
|
$this->addElement('select', 'merge_policy', array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'label' => $this->translate('Merge Policy'),
|
|
|
|
'description' => $this->translate('Whether you want to merge or override the destination field'),
|
|
|
|
'required' => true,
|
2015-07-24 09:51:31 +02:00
|
|
|
'multiOptions' => array(
|
2015-07-28 11:43:40 +02:00
|
|
|
'null' => '- please choose -',
|
|
|
|
'merge' => 'merge',
|
|
|
|
'override' => 'override'
|
2015-07-24 09:51:31 +02:00
|
|
|
)
|
2015-07-23 11:43:41 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loadObject($id)
|
|
|
|
{
|
|
|
|
|
|
|
|
parent::loadObject($id);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-07-24 09:51:31 +02:00
|
|
|
public function setDb($db)
|
|
|
|
{
|
|
|
|
parent::setDb($db);
|
2015-07-28 11:43:08 +02:00
|
|
|
$this->prepareElements();
|
|
|
|
$this->getElement('rule_id')->setMultiOptions($this->optionalEnum($db->enumSyncRule()));
|
|
|
|
$this->getElement('source_id')->setMultiOptions($this->optionalEnum($db->enumImportSource()));
|
|
|
|
return $this;
|
2015-07-24 09:51:31 +02:00
|
|
|
}
|
|
|
|
|
2015-07-23 11:43:41 +02:00
|
|
|
}
|