Source
xxxxxxxxxx
if (array_key_exists('table_records', $data) && ($data['multiselect'] || in_array($data['popup_type'], $types))) {
<?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
* @var array $data
*/
$output = [
'header' => $data['title'],
'body' => '',
'controls' => '',
'script_inline' => '',
'buttons' => null
];
$options = $data['options'];
$controls = [];
$form = null;
$script_inline = '';
// Construct table header.
$header_form = ($data['popup_type'] === 'help_items') ? (new CForm())->cleanItems() : new CDiv();
$header_form->setId('generic-popup-form');
// Add host group multiselect control.
if (array_key_exists('groups', $data['filter'])) {
$multiselect_options = $data['filter']['groups'];
$multiselect_options['popup']['parameters']['dstfrm'] = $header_form->getId();
$hostgroup_ms = (new CMultiSelect($multiselect_options))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH);
$controls[] = (new CFormList())->addRow(new CLabel(_('Host group'), 'popup_host_group_ms'), $hostgroup_ms);
$script_inline .= $hostgroup_ms->getPostJS(). 'popup_generic.initGroupsFilter();';
}
// Add host multiselect.
if (array_key_exists('hosts', $data['filter'])) {
$multiselect_options = $data['filter']['hosts'];
$multiselect_options['popup']['parameters']['dstfrm'] = $header_form->getId();
$host_ms = (new CMultiSelect($multiselect_options))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH);
if ($multiselect_options['disabled']) {
$host_ms->setTitle(_('You cannot switch hosts for current selection.'));
}