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$widget = (new CWidget()) 23 ->setTitle(_('Modules')) 24 ->setTitleSubmenu(getAdministrationGeneralSubmenu()); 25 26// create form 27$form = (new CForm()) 28 ->setName('module-form') 29 ->setAction((new CUrl('zabbix.php')) 30 ->setArgument('action', 'module.update') 31 ->setArgument('moduleids[]', $data['moduleid']) 32 ->getUrl() 33 ) 34 ->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE); 35 36// create module tab 37$module_tab = (new CFormList()) 38 ->addRow(_('Name'), $data['name']) 39 ->addRow(_('Version'), $data['version']) 40 ->addRow(_('Author'), $data['author'] === '' ? '-' : $data['author']) 41 ->addRow(_('Description'), $data['description'] === '' ? '-' : $data['description']) 42 ->addRow(_('Directory'), $data['relative_path']) 43 ->addRow(_('Namespace'), $data['namespace']) 44 ->addRow(_('Homepage'), $data['url'] === '' ? '-' : $data['url']) 45 ->addRow(_('Enabled'), 46 (new CCheckBox('status', MODULE_STATUS_ENABLED)) 47 ->setChecked($data['status'] == MODULE_STATUS_ENABLED) 48 ); 49 50// create tabs 51$tabs = (new CTabView()) 52 ->addTab('moduleTab', _('Module'), $module_tab); 53 54if (!hasRequest('form_refresh')) { 55 $tabs->setSelected(0); 56} 57 58$tabs->setFooter(makeFormFooter( 59 (new CSubmitButton(_('Update')))->setId('update'), 60 [ 61 (new CRedirectButton(_('Cancel'), (new CUrl('zabbix.php')) 62 ->setArgument('action', 'module.list') 63 ->setArgument('page', CPagerHelper::loadPage('module.list', null)) 64 ))->setId('cancel') 65 ] 66)); 67 68// append tabs to form 69$form->addItem($tabs); 70 71// append form to widget 72$widget->addItem($form); 73 74$widget->show(); 75