IcingaServiceField: Implement the field assignment

refs #9752
This commit is contained in:
Alexander Fuhr 2015-07-28 15:21:44 +02:00
parent 6005913bbd
commit 31e2b23d82
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace Icinga\Module\Director\Forms;
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
class IcingaServiceFieldForm extends DirectorObjectForm
{
public function setup()
{
$this->addElement('select', 'service_id', array(
'label' => 'Service Tpl',
'description' => 'Service Template',
'multiOptions' => $this->optionalEnum($this->getDb()->enumServiceTemplates())
));
$this->addElement('select', 'datafield_id', array(
'label' => 'Field',
'description' => 'Field to assign',
'multiOptions' => $this->optionalEnum($this->getDb()->enumDatafields())
));
$this->optionalBoolean(
'is_required',
$this->translate('Required'),
$this->translate('Whether this filed is required or not.')
);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Icinga\Module\Director\Objects;
use Icinga\Module\Director\Data\Db\DbObject;
class IcingaServiceField extends DbObject
{
protected $keyName = array('service_id', 'datafield_id');
protected $table = 'icinga_service_field';
protected $defaultProperties = array(
'service_id' => null,
'datafield_id' => null,
'is_required' => null
);
}