icingaweb2-module-director/library/Director/Web/Table/IcingaAppliedServiceTable.php

50 lines
1.1 KiB
PHP
Raw Normal View History

2017-07-26 09:22:41 +02:00
<?php
namespace Icinga\Module\Director\Web\Table;
use Icinga\Module\Director\Objects\IcingaService;
2017-10-09 15:23:27 +02:00
use dipl\Html\Link;
use dipl\Web\Table\ZfQueryBasedTable;
2017-07-26 09:22:41 +02:00
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([
2017-07-26 09:22:41 +02:00
new Link($row->service, 'director/service', ['id' => $row->id])
]);
2017-07-26 09:22:41 +02:00
}
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');
}
}