Source
function makeTableCellViewsTrigger(array $cell, array $trigger, $formatted_value, bool $is_view_value): array {
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2024 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* Top items widget view.
*
* @var CView $this
* @var array $data
*/
use Widgets\TopItems\Includes\{
CWidgetFieldColumnsList,
WidgetForm
};
use Widgets\TopItems\Widget;
$table = new CTableInfo();
if ($data['error'] !== null) {
$table->setNoDataMessage($data['error']);
}
else {
if ($data['show_column_header'] != WidgetForm::COLUMN_HEADER_OFF) {
$column_title_class = $data['show_column_header'] == WidgetForm::COLUMN_HEADER_VERTICAL
? ZBX_STYLE_TEXT_VERTICAL
: null;
$header = [];
if ($data['layout'] == WidgetForm::LAYOUT_VERTICAL) {
$header[] = new CColHeader(_('Items'));
foreach ($data['rows'][0] as $cell) {
$hostid = $cell[Widget::CELL_HOSTID];
$title = $data['db_hosts'][$hostid]['name'];
['is_view_value_in_row' => $is_view_value] = $cell[Widget::CELL_METADATA];
$header[] = (new CColHeader(
(new CSpan($title))
->addClass($column_title_class)
->setTitle($title)
))->setColSpan($is_view_value ? 2 : 1);
}
}
else {
$header[] = new CColHeader(_('Hosts'));
foreach ($data['rows'][0] as $cell) {
['name' => $title, 'is_view_value_in_column' => $is_view_value] = $cell[Widget::CELL_METADATA];
$header[] = (new CColHeader(
(new CSpan($title))