<?php declare(strict_types = 0);
$form = (new CForm())
->setId('massupdate-form')
->setName('massupdate-form')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE)
->addVar('ids', $data['ids'])
->addVar('action', $data['action'])
->addVar('prototype', $data['prototype'])
->addVar('update', '1')
->addVar('location_url', $data['location_url'])
->addVar('context', $data['context'], uniqid('context_'))
->disablePasswordAutofill();
$item_form_list = (new CFormList('item-form-list'))
->addRow(
(new CVisibilityBox('visible[type]', 'type', _('Original')))
->setLabel(_('Type'))
->setAttribute('autofocus', 'autofocus'),
(new CSelect('type'))
->setId('type')
->setValue(ITEM_TYPE_ZABBIX)
->addOptions(CSelect::createOptionsFromArray($data['item_types']))
);
if ($data['single_host_selected'] && $data['context'] === 'host') {
$item_form_list->addRow(
(new CVisibilityBox('visible[interfaceid]', 'interfaceDiv', _('Original')))
->setLabel(_('Host interface'))
->setAttribute('data-multiple-interface-types', $data['multiple_interface_types']),
(new CDiv([
getInterfaceSelect($data['interfaces'])
->setId('interface-select')
->setValue('0')
->addClass(ZBX_STYLE_ZSELECT_HOST_INTERFACE),
(new CSpan(_('No interface found')))
->addClass(ZBX_STYLE_RED)
->setId('interface_not_defined')
->addStyle('display: none;')
]))->setId('interfaceDiv'),
'interface_row'
);
}
$item_form_list
->addRow(
(new CVisibilityBox('visible[jmx_endpoint]', 'jmx_endpoint', _('Original')))->setLabel(_('JMX endpoint')),
(new CTextBox('jmx_endpoint', ZBX_DEFAULT_JMX_ENDPOINT))->setAdaptiveWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
)
->addRow(
(new CVisibilityBox('visible[url]', 'url', _('Original')))->setLabel(_('URL')),
(new CTextBox('url', '', false, DB::getFieldLength('items', 'url')))
->setAdaptiveWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
)
->addRow(
(new CVisibilityBox('visible[post_type]', 'post_type_container', _('Original')))
->setLabel(_('Request body type')),
(new CDiv(
(new CRadioButtonList('post_type', (int) DB::getDefault('items', 'post_type')))
->addValue(_('Raw data'), ZBX_POSTTYPE_RAW)
->addValue(_('JSON data'), ZBX_POSTTYPE_JSON)