1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
namespace Icinga\Module\Director\Web\Table;
use Icinga\Module\Director\Objects\IcingaServiceSet;
use gipfl\IcingaWeb2\Link;
use gipfl\IcingaWeb2\Table\ZfQueryBasedTable;
class IcingaServiceSetHostTable extends ZfQueryBasedTable
{
protected $set;
protected $searchColumns = array(
'host',
);
public static function load(IcingaServiceSet $set)
{
$table = new static($set->getConnection());
$table->set = $set;
return $table;
}
public function renderRow($row)
{
return $this::row([
Link::create(
$row->host,
'director/host',
['name' => $row->host]
)
]);
}
public function getColumnsToBeRendered()
{
return [
$this->translate('Hostname'),
];
}
public function prepareQuery()
{
return $this->db()->select()->from(
['h' => 'icinga_host'],
[
'id' => 'h.id',
'host' => 'h.object_name',
'object_type' => 'h.object_type',
]
)->joinLeft(
['ssh' => 'icinga_service_set'],
'ssh.host_id = h.id',
[]
)->joinLeft(
['ssih' => 'icinga_service_set_inheritance'],
'ssih.service_set_id = ssh.id',
[]
)->where(
'ssih.parent_service_set_id = ?',
$this->set->id
)->order('h.object_name');
}
}
|