Source
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 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.
**/
/**
* @var CView $this
*/
require_once dirname(__FILE__).'/js/configuration.discovery.edit.js.php';
$widget = (new CWidget())
->setTitle(_('Discovery rules'))
->setDocUrl(CDocHelper::getUrl(CDocHelper::CONFIGURATION_DISCOVERY_EDIT));
// Create form.
$discoveryForm = (new CForm())
->setId('discoveryForm')
->setName('discoveryForm')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE);
if (!empty($this->data['druleid'])) {
$discoveryForm->addVar('druleid', $this->data['druleid']);
}
// Create form list.
$discoveryFormList = (new CFormList())
->addRow(
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
(new CTextBox('name', $this->data['drule']['name']))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
);
// Append proxy to form list.
$proxy_select = (new CSelect('proxy_hostid'))
->setValue($this->data['drule']['proxy_hostid'])
->setFocusableElementId('label-proxy')
->addOption(new CSelectOption(0, _('No proxy')));
foreach ($this->data['proxies'] as $proxy) {
$proxy_select->addOption(new CSelectOption($proxy['proxyid'], $proxy['host']));
}
$discoveryFormList
->addRow(new CLabel(_('Discovery by proxy'), $proxy_select->getFocusableElementId()), $proxy_select)