From ea0f58f61138d3a53e005d4f94194b0bf623a996 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 28 Feb 2016 17:02:57 +0100 Subject: [PATCH] IcingaUserForm: state/filter prototype, dummy... ...and still subject to changes --- application/forms/IcingaUserForm.php | 15 +++++++++++++++ library/Director/Objects/IcingaUser.php | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/application/forms/IcingaUserForm.php b/application/forms/IcingaUserForm.php index 38342d58..f2ab57d5 100644 --- a/application/forms/IcingaUserForm.php +++ b/application/forms/IcingaUserForm.php @@ -48,6 +48,21 @@ class IcingaUserForm extends DirectorObjectForm $this->translate('Send notifications'), $this->translate('Whether to send notifications for this user') ); + + $this->addElement('multiselect', 'states', array( + 'label' => $this->translate('States'), + 'description' => $this->translate('The host/service states you want to get notifications for'), + 'multiOptions' => $this->enumStateFilters(), + 'size' => 6, + )); + + $this->addElement('multiselect', 'types', array( + 'label' => $this->translate('Event types'), + 'description' => $this->translate('The event types you want to get notifications for'), + 'multiOptions' => $this->enumTypeFilters(), + 'size' => 6, + )); + /* $this->addElement('text', 'groups', array( 'label' => $this->translate('Usergroups'), diff --git a/library/Director/Objects/IcingaUser.php b/library/Director/Objects/IcingaUser.php index 9812a153..a416c485 100644 --- a/library/Director/Objects/IcingaUser.php +++ b/library/Director/Objects/IcingaUser.php @@ -28,4 +28,16 @@ class IcingaUser extends IcingaObject protected $booleans = array( 'enable_notifications' => 'enable_notifications' ); + + protected $states = array(); + + protected function setStates($value) + { + $states = $value; + sort($states); + if ($this->states !== $states) { + $this->states = $states; + $this->hasBeenModified = true; + } + } }