1<?php
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19**/
20
21
22/**
23 * @var CPartial $this
24 */
25$table = (new CTableInfo())
26	->makeVerticalRotation()
27	->setHeadingColumn(0);
28
29$headings[] = _('Hosts');
30foreach ($data['triggers_by_name'] as $trigname => $host_to_trig) {
31	$headings[] = (new CColHeader($trigname))
32		->addClass('vertical_rotation')
33		->setTitle($trigname);
34}
35
36$table->setHeader($headings);
37
38foreach ($data['hosts_by_name'] as $hostname => $hostid) {
39	$name = (new CLinkAction($data['db_hosts'][$hostid]['name']))->setMenuPopup(CMenuPopupHelper::getHost($hostid));
40	$row = [(new CColHeader($name))->addClass(ZBX_STYLE_NOWRAP)];
41
42	foreach ($data['triggers_by_name'] as $trigname => $host_to_trig) {
43		$trigger = null;
44		if (array_key_exists($hostid, $host_to_trig)) {
45			$triggerid = $host_to_trig[$hostid];
46			$trigger = $data['db_triggers'][$triggerid];
47		}
48
49		if ($trigger) {
50			$row[] = getTriggerOverviewCell($trigger, $data['dependencies']);
51		}
52		else {
53			$row[] = new CCol();
54		}
55	}
56
57	$table->addRow($row);
58}
59
60if ($data['exceeded_limit']) {
61	$table->setFooter([
62		(new CCol(_('Not all results are displayed. Please provide more specific search criteria.')))
63			->setColSpan($table->getNumCols())
64			->addClass(ZBX_STYLE_LIST_TABLE_FOOTER)
65	]);
66}
67
68echo $table;
69