Source
if (array_key_exists('units', $cell_data['parts']) && $cell_data['units_pos'] == Widget::POSITION_BEFORE) {
<?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 value widget view.
*
* @var CView $this
* @var array $data
*/
use Widgets\Item\Widget;
if (array_key_exists('error', $data)) {
$body = (new CTableInfo())->setNoDataMessage($data['error']);
}
else {
$classes_vertical = [
Widget::POSITION_TOP => 'top',
Widget::POSITION_MIDDLE => 'middle',
Widget::POSITION_BOTTOM => 'bottom'
];
$classes_horizontal = [
Widget::POSITION_LEFT => 'left',
Widget::POSITION_CENTER => 'center',
Widget::POSITION_RIGHT => 'right'
];
$rows = [];
foreach ($classes_vertical as $row_key => $row_class) {
$cols = [];
foreach ($classes_horizontal as $column_key => $column_class) {
if (!array_key_exists($row_key, $data['cells'])
|| !array_key_exists($column_key, $data['cells'][$row_key])) {
continue;
}
$div = new CDiv();
$cell = $data['cells'][$row_key][$column_key];
$cell_type = array_keys($cell)[0];
$cell_data = array_values($cell)[0];
$div->addClass($row_class);
$div->addClass($column_class);
switch ($cell_type) {
case 'item_description':
$div->addClass('item-description');