IcingaUserForm: use new elements for state/type

This commit is contained in:
Thomas Gelf 2016-03-05 16:23:41 +01:00
parent 41ff1fed62
commit 0999a8401c

View File

@ -60,18 +60,16 @@ class IcingaUserForm extends DirectorObjectForm
$this->translate('Whether to send notifications for this user') $this->translate('Whether to send notifications for this user')
); );
$this->addElement('multiselect', 'states', array( $this->addElement('extensibleSet', 'states', array(
'label' => $this->translate('States'), 'label' => $this->translate('States'),
'multiOptions' => $this->optionallyAddFromEnum($this->enumStates()),
'description' => $this->translate('The host/service states you want to get notifications for'), 'description' => $this->translate('The host/service states you want to get notifications for'),
'multiOptions' => $this->enumStateFilters(),
'size' => 6,
)); ));
$this->addElement('multiselect', 'types', array( $this->addElement('extensibleSet', 'types', array(
'label' => $this->translate('Event types'), 'label' => $this->translate('Event types'),
'multiOptions' => $this->optionallyAddFromEnum($this->enumTypes()),
'description' => $this->translate('The event types you want to get notifications for'), 'description' => $this->translate('The event types you want to get notifications for'),
'multiOptions' => $this->enumTypeFilters(),
'size' => 6,
)); ));
$this->addImportsElement(); $this->addImportsElement();
@ -79,6 +77,18 @@ class IcingaUserForm extends DirectorObjectForm
$this->setButtons(); $this->setButtons();
} }
protected function enumStates()
{
$set = new \Icinga\Module\Director\IcingaConfig\StateFilterSet();
return $set->enumAllowedValues();
}
protected function enumTypes()
{
$set = new \Icinga\Module\Director\IcingaConfig\TypeFilterSet();
return $set->enumAllowedValues();
}
protected function enumUsergroups() protected function enumUsergroups()
{ {
$db = $this->db->getDbAdapter(); $db = $this->db->getDbAdapter();