Source
xxxxxxxxxx
(new CSpan($data['hosts_total'][$data['hosts_types'][0]]))->addClass(ZBX_STYLE_TOTALS_LIST_COUNT), _('Total')
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* @var CView $this
*/
$type_field_names = [
INTERFACE_TYPE_AGENT => _('Zabbix agent'),
INTERFACE_TYPE_SNMP => _('SNMP'),
INTERFACE_TYPE_JMX => _('JMX'),
INTERFACE_TYPE_IPMI => _('IPMI')
];
$header = [
STYLE_HORIZONTAL => ['', _('Available'), _('Not available'), _('Unknown'), _('Total')],
STYLE_VERTICAL => ['']
];
foreach ($type_field_names as $key => $value) {
if (!in_array($key, $data['hosts_types'])) {
continue;
}
$header[STYLE_VERTICAL][] = $value;
}
if (count($data['hosts_types']) == 1) {
$counts = $data['hosts_count'][$data['hosts_types'][0]];
$table = (new CDiv())
->addClass(ZBX_STYLE_HOST_AVAIL_WIDGET)
->addClass(ZBX_STYLE_TOTALS_LIST)
->addClass(($data['layout'] == STYLE_HORIZONTAL)
? ZBX_STYLE_TOTALS_LIST_HORIZONTAL
: ZBX_STYLE_TOTALS_LIST_VERTICAL
);
$table->addItem((new CDiv([
(new CSpan($counts[INTERFACE_AVAILABLE_TRUE]))->addClass(ZBX_STYLE_TOTALS_LIST_COUNT), _('Available')
]))->addClass(ZBX_STYLE_HOST_AVAIL_TRUE));
$table->addItem((new CDiv([
(new CSpan($counts[INTERFACE_AVAILABLE_FALSE]))->addClass(ZBX_STYLE_TOTALS_LIST_COUNT), _('Not available')
]))->addClass(ZBX_STYLE_HOST_AVAIL_FALSE));