Source
->setId(($data['expression_type'] === TRIGGER_EXPRESSION) ? 'test-expression' : 'test-recovery-expression')
<?php
/*
** 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/>.
**/
/**
* @var CView $this
* @var array $data
*/
if (array_key_exists('error', $data)) {
$output['error'] = $data['error'];
$output['error']['expression'] = $data['expression'];
}
else {
$expression_table = (new CTable())
->setHeader([
$data['readonly'] ? null : _('Target'),
_('Expression'),
$data['readonly'] ? null : _('Action'),
_('Info')
]);
$allowed_testing = true;
if ($data['expression_tree']) {
foreach ($data['expression_tree'] as $i => $e) {
$info_icons = [];
if (isset($e['expression']['levelErrors'])) {
$allowed_testing = false;
$errors = [];
if (is_array($e['expression']['levelErrors'])) {
foreach ($e['expression']['levelErrors'] as $expVal => $errTxt) {
if ($errors) {
$errors[] = BR();
}
$errors[] = $expVal.': '.$errTxt;
}
}
$info_icons[] = makeErrorIcon($errors);
}
foreach ($e['list'] as &$obj) {
if ($obj instanceof CLinkAction && $obj->getAttribute('class') == ZBX_STYLE_LINK_ACTION) {
// Templated or discovered trigger.
if ($data['readonly']) {
// Make all links inside inactive.
$obj = new CSpan($obj->items);
// Decode HTML entities in trigger expressions.