Source
<?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/>.
**/
/**
* @var CView $this
* @var array $data
*/
$data['form_name'] = 'host-form';
$popup_url = (new CUrl('zabbix.php'))
->setArgument('action', 'host.edit');
if ($data['hostid'] == 0) {
if (array_key_exists('groupids', $data) && $data['groupids']) {
$popup_url->setArgument('groupids', $data['groupids']);
}
elseif ($data['clone_hostid'] !== null) {
$popup_url->setArgument('hostid', $data['clone_hostid']);
if ($data['clone'] === 1) {
$popup_url->setArgument('clone', 1);
}
}
$buttons = [
[
'title' => _('Add'),
'class' => '',
'keepOpen' => true,
'isSubmit' => true,
'action' => 'host_edit_popup.submit();'
]
];
}
else {
$popup_url->setArgument('hostid', $data['hostid']);
$buttons = [
[
'title' => _('Update'),
'class' => '',
'keepOpen' => true,
'isSubmit' => true,
'action' => 'host_edit_popup.submit();'
],
[
'title' => _('Clone'),
'class' => 'btn-alt',
'keepOpen' => true,
'isSubmit' => false,