summaryrefslogtreecommitdiffstats
path: root/library/Director/Web/Table/IcingaAppliedServiceTable.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Director/Web/Table/IcingaAppliedServiceTable.php')
-rw-r--r--library/Director/Web/Table/IcingaAppliedServiceTable.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/library/Director/Web/Table/IcingaAppliedServiceTable.php b/library/Director/Web/Table/IcingaAppliedServiceTable.php
new file mode 100644
index 0000000..b669296
--- /dev/null
+++ b/library/Director/Web/Table/IcingaAppliedServiceTable.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Icinga\Module\Director\Web\Table;
+
+use Icinga\Module\Director\Objects\IcingaService;
+use gipfl\IcingaWeb2\Link;
+use gipfl\IcingaWeb2\Table\ZfQueryBasedTable;
+
+class IcingaAppliedServiceTable extends ZfQueryBasedTable
+{
+ protected $service;
+
+ protected $searchColumns = array(
+ 'service',
+ );
+
+ public function setService(IcingaService $service)
+ {
+ $this->service = $service;
+ return $this;
+ }
+
+ public function renderRow($row)
+ {
+ return $this::row([
+ new Link($row->service, 'director/service', ['id' => $row->id])
+ ]);
+ }
+
+ public function getColumnsToBeRendered()
+ {
+ return [$this->translate('Servicename')];
+ }
+
+ public function prepareQuery()
+ {
+ return $this->db()->select()->from(
+ array('s' => 'icinga_service'),
+ array()
+ )->joinLeft(
+ array('si' => 'icinga_service_inheritance'),
+ 's.id = si.service_id',
+ array()
+ )->where(
+ 'si.parent_service_id = ?',
+ $this->service->id
+ )->where('s.object_type = ?', 'apply');
+ }
+}