2016-03-24 13:10:49 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Module\Director\Forms;
|
|
|
|
|
|
|
|
use Icinga\Module\Director\Objects\IcingaHost;
|
2016-04-08 00:46:35 +02:00
|
|
|
use Icinga\Module\Director\Objects\IcingaObject;
|
2016-03-24 13:10:49 +01:00
|
|
|
use Icinga\Module\Director\Web\Form\QuickSubForm;
|
|
|
|
|
|
|
|
class AssignmentSubForm extends QuickSubForm
|
|
|
|
{
|
2016-04-08 00:46:35 +02:00
|
|
|
protected $object;
|
|
|
|
|
2016-03-26 16:22:52 +01:00
|
|
|
// @codingStandardsIgnoreStart
|
2016-03-24 13:10:49 +01:00
|
|
|
protected $_disableLoadDefaultDecorators = true;
|
2016-03-26 16:22:52 +01:00
|
|
|
// @codingStandardsIgnoreEnd
|
2016-03-24 13:10:49 +01:00
|
|
|
|
|
|
|
public function setup()
|
|
|
|
{
|
|
|
|
$this->addElement('select', 'assign_type', array(
|
|
|
|
'multiOptions' => array(
|
|
|
|
'assign' => 'assign where',
|
|
|
|
'ignore' => 'ignore where',
|
|
|
|
),
|
|
|
|
'class' => 'assign-type',
|
|
|
|
'value' => 'assign'
|
|
|
|
));
|
|
|
|
|
2016-10-13 11:44:32 +02:00
|
|
|
$this->addElement('dataFilter', 'filter_string', array(
|
|
|
|
'columns' => IcingaHost::enumProperties($this->db)
|
2016-03-24 13:10:49 +01:00
|
|
|
));
|
2016-10-13 11:44:32 +02:00
|
|
|
|
2016-03-24 13:10:49 +01:00
|
|
|
foreach ($this->getElements() as $el) {
|
2016-10-13 11:44:32 +02:00
|
|
|
$el->setDecorators(array('ViewHelper', 'Errors'));
|
2016-03-24 13:10:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-08 00:46:35 +02:00
|
|
|
public function setObject(IcingaObject $object)
|
|
|
|
{
|
|
|
|
$this->object = $object;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2016-03-24 13:10:49 +01:00
|
|
|
public function loadDefaultDecorators()
|
|
|
|
{
|
|
|
|
$this->setDecorators(array(
|
|
|
|
'FormElements',
|
|
|
|
array('HtmlTag', array(
|
|
|
|
'tag' => 'li',
|
|
|
|
)),
|
|
|
|
array('FormErrors'),
|
|
|
|
));
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|