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/** 23 * @var CView $this 24 */ 25 26$this->addJsFile('multiselect.js'); 27$this->addJsFile('layout.mode.js'); 28$this->addJsFile('menupopup.js'); 29$this->addJsFile('gtlc.js'); 30$this->addJsFile('class.calendar.js'); 31$this->addJsFile('class.tabfilter.js'); 32$this->addJsFile('class.tabfilteritem.js'); 33$this->addJsFile('class.tagfilteritem.js'); 34 35$this->enableLayoutModes(); 36$web_layout_mode = $this->getLayoutMode(); 37 38$widget = (new CWidget()) 39 ->setTitle(_('Hosts')) 40 ->setWebLayoutMode($web_layout_mode) 41 ->setControls( 42 (new CTag('nav', true, (new CList())->addItem(get_icon('kioskmode', ['mode' => $web_layout_mode])))) 43 ->setAttribute('aria-label', _('Content controls')) 44 ); 45 46if ($web_layout_mode == ZBX_LAYOUT_NORMAL) { 47 $filter = (new CTabFilter()) 48 ->setId('monitoring_hosts_filter') 49 ->setOptions($data['tabfilter_options']) 50 ->addTemplate(new CPartial($data['filter_view'], $data['filter_defaults'])); 51 52 foreach ($data['filter_tabs'] as $tab) { 53 $tab['tab_view'] = $data['filter_view']; 54 $filter->addTemplatedTab($tab['filter_name'], $tab); 55 } 56 57 // Set javascript options for tab filter initialization in monitoring.host.view.js.php file. 58 $data['filter_options'] = $filter->options; 59 $widget->addItem($filter); 60} 61else { 62 $data['filter_options'] = null; 63} 64 65$widget->addItem((new CForm())->setName('host_view')->addClass('is-loading')); 66$widget->show(); 67$this->includeJsFile('monitoring.host.view.js.php', $data); 68 69(new CScriptTag('host_page.start();')) 70 ->setOnDocumentReady() 71 ->show(); 72