From e89a568fc39d550a37e42598f934758917ea1aed Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Tue, 28 Jul 2015 15:19:37 +0200 Subject: [PATCH] Db: Add enumHostTemplates and enumServiceTemplates --- library/Director/Db.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/library/Director/Db.php b/library/Director/Db.php index 9cc0f057..b6d7e5f8 100644 --- a/library/Director/Db.php +++ b/library/Director/Db.php @@ -234,6 +234,15 @@ class Db extends DbConnection return $this->db()->fetchPairs($select); } + public function enumHostTemplates() + { + $select = $this->db()->select()->from('icinga_host', array( + 'id', + 'object_name', + ))->where('object_type = ?', 'template')->order('object_name ASC'); + return $this->db()->fetchPairs($select); + } + public function enumSyncRule() { $select = $this->db()->select()->from('sync_rule', array( @@ -262,6 +271,15 @@ class Db extends DbConnection return $this->db()->fetchPairs($select); } + public function enumServiceTemplates() + { + $select = $this->db()->select()->from('icinga_service', array( + 'id', + 'object_name', + ))->where('object_type = ?', 'template')->order('object_name ASC'); + return $this->db()->fetchPairs($select); + } + public function enumServicegroups() { $select = $this->db()->select()->from('icinga_servicegroup', array( @@ -298,6 +316,16 @@ class Db extends DbConnection return $this->db()->fetchPairs($select); } + public function enumDatafields() + { + $select = $this->db()->select()->from('director_datafield', array( + 'id', + 'varname', + 'caption', + ))->order('varname ASC'); + return $this->db()->fetchPairs($select); + } + public function enumUsergroups() { $select = $this->db()->select()->from('icinga_usergroup', array(