Source
xxxxxxxxxx
<?php
/*
** Zabbix
** 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 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.
**/
$output = [];
if (($messages = getMessages()) !== null) {
$output['messages'] = $messages->toString();
}
if (array_key_exists('problems', $data)) {
// Show trigger description and URL.
$div = new CDiv();
if ($data['trigger']['comments'] !== '') {
$div->addItem(
(new CDiv())
->addItem(zbx_str2links($data['trigger']['comments']))
->addClass(ZBX_STYLE_OVERLAY_DESCR)
->addStyle('max-width: 500px')
);
}
if ($data['trigger']['url'] !== '') {
$trigger_url = CHtmlUrlValidator::validate($data['trigger']['url'], ['allow_user_macro' => false])
? $data['trigger']['url']
: 'javascript: alert('.json_encode(_s('Provided URL "%1$s" is invalid.', $data['trigger']['url'])).');';
$div->addItem(
(new CDiv())
->addItem(new CLink($data['trigger']['url'], $trigger_url))
->addClass(ZBX_STYLE_OVERLAY_DESCR_URL)
->addStyle('max-width: 500px')
);
}
// sort field indicator
$sort_div = (new CSpan())->addClass(ZBX_STYLE_ARROW_DOWN);
if ($data['show_timeline']) {
$header = [
(new CColHeader([_('Time'), $sort_div]))->addClass(ZBX_STYLE_RIGHT),
(new CColHeader())->addClass(ZBX_STYLE_TIMELINE_TH),
(new CColHeader())->addClass(ZBX_STYLE_TIMELINE_TH)
];
}
else {
$header = [[_('Time'), $sort_div]];
}
// Show events.
$table = (new CTableInfo())
->setHeader(array_merge($header, [
_('Recovery time'),
_('Status'),
_('Duration'),
_('Ack'),
($data['show_tags'] != SHOW_TAGS_NONE) ? _('Tags') : null
]));
$today = strtotime('today');
$last_clock = 0;
if ($data['problems'] && $data['show_tags'] != SHOW_TAGS_NONE) {
$tags = makeTags($data['problems'], true, 'eventid', $data['show_tags'], $data['filter_tags'], null,
$data['tag_name_format'], $data['tag_priority']
);
}
$url_details = $data['allowed_ui_problems']
? (new CUrl('tr_events.php'))
->setArgument('triggerid', $data['trigger']['triggerid'])
->setArgument('eventid', '')
: null;