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())
->setName('services_form');
// Enable form submitting on Enter.
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
$controls = (new CForm())
->setName('services_filter_form')
->addVar('title', $data['title'])
->addVar('exclude_serviceids', $data['exclude_serviceids'])
->addVar('multiple', $data['is_multiple'] ? null : 0)
->addItem(
(new CList())
->addClass(ZBX_STYLE_INLINE_FILTER)
->addItem(new CLabel(_('Name'), 'services-filter-name'), ZBX_STYLE_INLINE_FILTER_LABEL)
->addItem(
(new CTextBox('filter_name', $data['filter']['name']))
->setId('services-filter-name')
->setAttribute('autofocus', 'autofocus')
->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)
)
->addItem(new CSubmitButton(_('Filter')))
->addItem(
(new CSimpleButton(_('Reset')))
->setAttribute('type', 'reset')
->addClass(ZBX_STYLE_BTN_ALT)
)
);
$services = (new CTableInfo())
->setHeader([
$data['is_multiple'] ? (new CColHeader(new CCheckBox('serviceid_all')))->addClass(ZBX_STYLE_CELL_WIDTH) : null,
_('Name'),
_('Tags'),
_('Problem tags')
]);
foreach ($data['services'] as $service) {
$services->addRow([
$data['is_multiple'] ? (new CCheckBox('serviceid', $service['serviceid']))->removeId() : null,
(new CCol([
$data['is_multiple'] ? null : (new CVar('serviceid', $service['serviceid']))->removeId(),