Source
<?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']
];
}
else {
$buttons = [];
if ($data['diff']) {
$buttons[] = [
'title' => _('Import'),
'class' => 'js-import',
'keepOpen' => true,
'isSubmit' => true,
'focused' => true,
'action' => 'popup_import_compare.submitImportComparePopup('.(bool) $data['with_removed_entities'].');'
];
}
$buttons[] = [
'title' => $data['diff'] ? _('Cancel') : _('Close'),
'cancel' => true,
'class' => ZBX_STYLE_BTN_ALT,
'action' => ''
];
$output = [
'header' => $data['title'],
'script_inline' => trim($this->readJsFile('popup.import.compare.js.php')),
'body' => !$data['diff']
? (new CTableInfo())
->setNoDataMessage(_('No changes.'))
->toString()
: (new CForm())
->addClass('import-compare')
->addItem(drawToc($data['diff_toc']))
->addItem(drawDiff($data['diff']))
->addItem(
(new CScriptTag('popup_import_compare.init();'))->setOnDocumentReady()
)
->toString(),
'buttons' => $buttons,