<?php declare(strict_types = 0);
$form = (new CForm())
->setId('massupdate-form')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE)
->addVar('action', 'popup.massupdate.template')
->addVar('update', '1')
->addVar('ids', $data['ids'])
->addVar('location_url', $data['location_url'])
->disablePasswordAutofill();
$template_tab = new CFormList('template-form-list');
$link_templates = (new CTable())
->addRow(
(new CRadioButtonList('mass_action_tpls', ZBX_ACTION_ADD))
->addValue(_('Link'), ZBX_ACTION_ADD)
->addValue(_('Replace'), ZBX_ACTION_REPLACE)
->addValue(_('Unlink'), ZBX_ACTION_REMOVE)
->setModern(true)
)
->addRow([
(new CMultiSelect([
'name' => 'linked_templates[]',
'object_name' => 'templates',
'data' => [],
'popup' => [
'parameters' => [
'srctbl' => 'templates',
'srcfld1' => 'hostid',
'srcfld2' => 'host',
'dstfrm' => $form->getName(),
'dstfld1' => 'linked_templates_'
]
]
]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
])
->addRow([
(new CList())
->addClass(ZBX_STYLE_LIST_CHECK_RADIO)
->addItem((new CCheckBox('mass_clear_tpls'))
->setLabel(_('Clear when unlinking'))
)
]);
$template_tab->addRow(
(new CVisibilityBox('visible[linked_templates]', 'linked-templates-div', _('Original')))
->setLabel(_('Link templates')),
(new CDiv($link_templates))
->setId('linked-templates-div')
->addStyle('min-width: '.ZBX_TEXTAREA_BIG_WIDTH.'px;')
);
$template_tab
->addRow(
(new CVisibilityBox('visible[groups]', 'groups-div', _('Original')))
->setLabel(_('Host groups'))
->setAttribute('autofocus', 'autofocus'),
(new CDiv([
(new CRadioButtonList('mass_update_groups', ZBX_ACTION_ADD))
->addValue(_('Add'), ZBX_ACTION_ADD)
->addValue(_('Replace'), ZBX_ACTION_REPLACE)
->addValue(_('Remove'), ZBX_ACTION_REMOVE)
->setModern(true)