[icinga-checkins] icinga.org: icingaweb2-module-director/master: notification(s): controllers, table

git at icinga.org git at icinga.org
Sat Feb 27 01:14:57 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Sat Feb 27 01:14:27 2016 +0100

notification(s): controllers, table

---

 application/controllers/NotificationController.php |    9 ++++
 .../controllers/NotificationsController.php        |    9 ++++
 application/tables/IcingaNotificationTable.php     |   50 ++++++++++++++++++++
 3 files changed, 68 insertions(+)

diff --git a/application/controllers/NotificationController.php b/application/controllers/NotificationController.php
new file mode 100644
index 0000000..e98550e
--- /dev/null
+++ b/application/controllers/NotificationController.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Icinga\Module\Director\Controllers;
+
+use Icinga\Module\Director\Web\Controller\ObjectController;
+
+class NotificationController extends ObjectController
+{
+}
diff --git a/application/controllers/NotificationsController.php b/application/controllers/NotificationsController.php
new file mode 100644
index 0000000..ae5c021
--- /dev/null
+++ b/application/controllers/NotificationsController.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Icinga\Module\Director\Controllers;
+
+use Icinga\Module\Director\Web\Controller\ObjectsController;
+
+class NotificationsController extends ObjectsController
+{
+}
diff --git a/application/tables/IcingaNotificationTable.php b/application/tables/IcingaNotificationTable.php
new file mode 100644
index 0000000..d676e7e
--- /dev/null
+++ b/application/tables/IcingaNotificationTable.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Icinga\Module\Director\Tables;
+
+use Icinga\Module\Director\Web\Table\IcingaObjectTable;
+
+class IcingaNotificationTable extends IcingaObjectTable
+{
+    protected $searchColumns = array(
+        'user',
+    );
+
+    public function getColumns()
+    {
+        return array(
+            'id'                    => 'n.id',
+            'object_type'           => 'n.object_type',
+            'notification'          => 'n.object_name',
+        );
+    }
+
+    protected function getActionUrl($row)
+    {
+        return $this->url('director/notification', array('id' => $row->id));
+    }
+
+    public function getTitles()
+    {
+        $view = $this->view();
+        return array(
+            'notification' => $view->translate('Notification'),
+        );
+    }
+
+    public function getUnfilteredQuery()
+    {
+        $db = $this->connection()->getConnection();
+        $query = $db->select()->from(
+            array('n' => 'icinga_notification'),
+            array()
+        );
+
+        return $query;
+    }
+
+    public function getBaseQuery()
+    {
+        return $this->getUnfilteredQuery();
+    }
+}



More information about the icinga-checkins mailing list