Source
xxxxxxxxxx
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 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/>.
**/
/**
* Item history widget view.
*
* @var CView $this
* @var array $data
*/
use Widgets\ItemHistory\Widget;
use Widgets\ItemHistory\Includes\{
WidgetForm,
CWidgetFieldColumnsList
};
$table = (new CTableInfo())->addClass($data['show_thumbnail'] ? 'show-thumbnail' : null);
if ($data['error'] !== null) {
$table->setNoDataMessage($data['error']);
}
else {
$is_layout_vertical = $data['layout'] == WidgetForm::LAYOUT_VERTICAL;
if ($data['show_column_header'] != WidgetForm::COLUMN_HEADER_OFF) {
$table_header = [];
$column_title_class = $data['show_column_header'] == WidgetForm::COLUMN_HEADER_VERTICAL
? ZBX_STYLE_TEXT_VERTICAL
: null;
if ($data['show_timestamp']) {
$table_header[] = (new CColHeader(
(new CSpan(_x('Timestamp', 'compact table header')))->addClass($column_title_class)
))
->addClass(ZBX_STYLE_CELL_WIDTH)
->addClass(ZBX_STYLE_NOWRAP);
}
if ($is_layout_vertical) {
foreach ($data['columns'] as $column) {
$table_header[] = (new CColHeader(
(new CSpan($column['name']))
->addClass($column_title_class)
->setTitle($column['name'])
))->setColSpan(2);
}
}
else {