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$checkbox_hash = 'dashboard_'.$data['templateid']; 27 28if ($data['uncheck']) { 29 uncheckTableRows($checkbox_hash); 30} 31 32$form = (new CForm()) 33 ->setName('dashboard_form') 34 ->addVar('templateid', $data['templateid']); 35 36$table = (new CTableInfo()) 37 ->setHeader([ 38 (new CColHeader( 39 (new CCheckBox('all_dashboards')) 40 ->onClick("checkAll('".$form->getName()."', 'all_dashboards', 'dashboardids');") 41 ))->addClass(ZBX_STYLE_CELL_WIDTH), 42 make_sorting_header(_('Name'), 'name', $data['sort'], $data['sortorder'], 43 (new CUrl('zabbix.php')) 44 ->setArgument('action', 'template.dashboard.list') 45 ->setArgument('templateid', $data['templateid']) 46 ->getUrl() 47 ) 48 ]); 49 50foreach ($data['dashboards'] as $dashboardid => $dashboard) { 51 $table->addRow([ 52 new CCheckBox('dashboardids['.$dashboardid.']', $dashboardid), 53 new CLink($dashboard['name'], 54 (new CUrl('zabbix.php')) 55 ->setArgument('action', 'template.dashboard.edit') 56 ->setArgument('dashboardid', $dashboardid) 57 ->getUrl() 58 ) 59 ]); 60} 61 62$form->addItem([ 63 $table, 64 $data['paging'], 65 new CActionButtonList('action', 'dashboardids', [ 66 'template.dashboard.delete' => [ 67 'name' => _('Delete'), 68 'confirm' => _('Delete selected dashboards?') 69 ] 70 ], $checkbox_hash) 71]); 72 73(new CWidget()) 74 ->setTitle(_('Dashboards')) 75 ->setControls( 76 (new CTag('nav', true, new CRedirectButton(_('Create dashboard'), 77 (new CUrl('zabbix.php')) 78 ->setArgument('action', 'template.dashboard.edit') 79 ->setArgument('templateid', $data['templateid']) 80 ->getUrl() 81 )))->setAttribute('aria-label', _('Content controls')) 82 ) 83 ->setNavigation(getHostNavigation('dashboards', $data['templateid'])) 84 ->addItem($form) 85 ->show(); 86