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('js/gtlc.js');
23$this->addJsFile('js/flickerfreescreen.js');
24
25(new CWidget())
26	->setTitle(_('Maps'))
27	->setControls(
28		(new CForm('get'))
29			->cleanItems()
30			->addVar('action', 'map.view')
31			->addVar('sysmapid', $data['map']['sysmapid'])
32			->addVar('fullscreen', $data['fullscreen'])
33			->addItem(
34				(new CList())
35					->addItem([
36						new CLabel(_('Minimum severity'), 'severity_min'),
37						(new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN),
38						$data['pageFilter']->getSeveritiesMinCB()
39					])
40					->addItem($data['map']['editable']
41						? (new CButton('edit', _('Edit map')))
42							->onClick('redirect("sysmap.php?sysmapid='.$data['map']['sysmapid'].'")')
43						: null
44					)
45					->addItem(get_icon('favourite', [
46						'fav' => 'web.favorite.sysmapids',
47						'elname' => 'sysmapid',
48						'elid' => $data['map']['sysmapid']
49					]))
50					->addItem(get_icon('fullscreen', ['fullscreen' => $data['fullscreen']]))
51			)
52	)
53	->addItem(
54		get_header_sysmap_table($data['map']['sysmapid'], $data['map']['name'], $data['fullscreen'],
55			$data['severity_min']
56		)
57	)
58	->addItem(
59		(new CDiv())
60			->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)
61			->addItem(
62				CScreenBuilder::getScreen([
63					'resourcetype' => SCREEN_RESOURCE_MAP,
64					'mode' => SCREEN_MODE_PREVIEW,
65					'dataId' => 'mapimg',
66					'screenitem' => [
67						'screenitemid' => $data['map']['sysmapid'],
68						'screenid' => null,
69						'resourceid' => $data['map']['sysmapid'],
70						'width' => null,
71						'height' => null,
72						'severity_min' => $data['severity_min'],
73						'fullscreen' => $data['fullscreen']
74					]
75				])->get()
76			)
77	)
78	->show();
79