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
*/
$form = (new CForm('post'))
->addItem((new CVar(CSRF_TOKEN_NAME, CCsrfTokenHelper::get('proxy')))->removeId())
->setId('proxy-form')
->setName('proxy_form')
->addStyle('display: none;')
->addItem(getMessages());
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
// Proxy tab.
$local_address = (new CTable())
->setHeader([_('Address'), _('Port')])
->addRow([
(new CTextBox('local_address', $data['form']['local_address'], false,
DB::getFieldLength('proxy', 'local_address')
))->setWidth(336),
(new CTextBox('local_port', $data['form']['local_port'], false, DB::getFieldLength('proxy', 'local_port')))
->setWidth(ZBX_TEXTAREA_INTERFACE_PORT_WIDTH)
->setAriaRequired()
]);
$interface = (new CTable())
->setHeader([_('Address'), _('Port')])
->addRow([
(new CTextBox('address', $data['form']['address'], false, DB::getFieldLength('proxy', 'address')))
->setWidth(336),
(new CTextBox('port', $data['form']['port'], false, DB::getFieldLength('proxy', 'port')))
->setWidth(ZBX_TEXTAREA_INTERFACE_PORT_WIDTH)
->setAriaRequired()
]);
$proxy_tab = (new CFormGrid())
->addItem([
(new CLabel(_('Proxy name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['form']['name'], false, DB::getFieldLength('proxy', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
)
])