1<?php
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19**/
20
21
22$this->addJsFile('gtlc.js');
23$this->addJsFile('flickerfreescreen.js');
24$this->addJsFile('layout.mode.js');
25$this->addJsFile('multiselect.js');
26
27$widget = (new CWidget())
28	->setTitle(_('Status of discovery'))
29	->setWebLayoutMode(CView::getLayoutMode())
30	->setControls((new CTag('nav', true,
31		(new CList())
32			->addItem(get_icon('fullscreen'))
33		))
34			->setAttribute('aria-label', _('Content controls'))
35	)
36	->addItem((new CFilter((new CUrl('zabbix.php'))->setArgument('action', 'discovery.view')))
37		->setProfile($data['profileIdx'])
38		->setActiveTab($data['active_tab'])
39		->addFilterTab(_('Filter'), [
40			(new CFormList())
41				->addRow(
42					(new CLabel(_('Discovery rule'), 'filter_druleids__ms')),
43					(new CMultiSelect([
44						'name' => 'filter_druleids[]',
45						'object_name' => 'drules',
46						'data' => $data['filter']['drules'],
47						'popup' => [
48							'parameters' => [
49								'srctbl' => 'drules',
50								'srcfld1' => 'druleid',
51								'dstfrm' => 'zbx_filter',
52								'dstfld1' => 'filter_druleids_'
53							]
54						]
55					]))->setWidth(ZBX_TEXTAREA_FILTER_STANDARD_WIDTH)
56				)
57		])
58		->addVar('action', 'discovery.view')
59	);
60
61$discovery_table = CScreenBuilder::getScreen([
62	'resourcetype' => SCREEN_RESOURCE_DISCOVERY,
63	'mode' => SCREEN_MODE_JS,
64	'dataId' => 'discovery',
65	'data' => [
66		'filter_druleids' => $data['filter']['druleids'],
67		'sort' => $data['sort'],
68		'sortorder' => $data['sortorder']
69	]
70])->get();
71
72$widget->addItem($discovery_table)->show();
73