[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaUserForm: state/ filter prototype, dummy...

git at icinga.org git at icinga.org
Sun Feb 28 17:12:41 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: ea0f58f61138d3a53e005d4f94194b0bf623a996
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=ea0f58f61138d3a53e005d4f94194b0bf623a996

Author: Thomas Gelf <thomas at gelf.net>
Date:   Sun Feb 28 17:02:57 2016 +0100

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 38342d5..f2ab57d 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 9812a15..a416c48 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;
+        }
+    }
 }



More information about the icinga-checkins mailing list