<?php declare(strict_types = 0);
$this->addJsFile('layout.mode.js');
$this->addJsFile('class.tagfilteritem.js');
$this->addJsFile('class.calendar.js');
$this->addJsFile('class.form.fieldset.collapsible.js');
$this->includeJsFile('service.list.js.php');
$breadcrumbs = [];
$filter = null;
if (count($data['breadcrumbs']) > 1) {
foreach ($data['breadcrumbs'] as $index => $path_item) {
$breadcrumbs[] = (new CSpan())
->addItem(array_key_exists('curl', $path_item)
? new CLink($path_item['name'], $path_item['curl'])
: $path_item['name']
)
->addClass($index == count($data['breadcrumbs']) - 1 ? ZBX_STYLE_SELECTED : null);
}
}
$filter = (new CFilter())
->addVar('action', 'service.list.edit')
->addVar('serviceid', $data['service'] !== null ? $data['service']['serviceid'] : null)
->setResetUrl($data['reset_curl'])
->setProfile('web.service.filter')
->setActiveTab($data['active_tab']);
if ($data['service'] !== null && !$data['is_filtered']) {
$filter
->addTab(
(new CLink(_('Info'), '#tab_info'))
->addClass(ZBX_STYLE_BTN)
->addClass(ZBX_ICON_CIRCLE_INFO),
(new CDiv())
->setId('tab_info')
->addClass(ZBX_STYLE_FILTER_CONTAINER)
->addItem(new CPartial('service.info', $data + ['is_editable' => true]))
);
}
$filter->addFilterTab(_('Filter'), [
(new CFormGrid())
->addClass(CFormGrid::ZBX_STYLE_FORM_GRID_LABEL_WIDTH_TRUE)
->addItem([
new CLabel(_('Name'), 'filter_name'),
new CFormField(
(new CTextBox('filter_name', $data['filter']['name']))
->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)
)
])
->addItem([
new CLabel(_('Status')),
new CFormField(
(new CRadioButtonList('filter_status', (int) $data['filter']['status']))
->addValue(_('Any'), SERVICE_STATUS_ANY)
->addValue(_('OK'), SERVICE_STATUS_OK)
->addValue(_('Problem'), SERVICE_STATUS_PROBLEM)
->setModern(true)
)
])
->addItem([
new CLabel(_('Only services without children'), 'filter_without_children'),
new CFormField(
(new CCheckBox('filter_without_children'))
->setUncheckedValue(0)
->setChecked($data['filter']['without_children'])
)
])
->addItem([