Source
xxxxxxxxxx
(new CTextBox('confirmation', $data['confirmation'], false, DB::getFieldLength('scripts', 'confirmation')))
<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* @var CView $this
* @var array $data
*/
$csrf_token = CCsrfTokenHelper::get('script');
$form = (new CForm())
->addItem((new CVar(CCsrfTokenHelper::CSRF_TOKEN_NAME, $csrf_token))->removeId())
->setId('script-form')
->setName('scripts')
->addVar('scriptid', $data['scriptid'])
->addItem((new CInput('submit', null))->addStyle('display: none;'));
$parameters_table = (new CTable())
->setId('parameters-table')
->setHeader([
(new CColHeader(_('Name')))->setWidth('50%'),
(new CColHeader(_('Value')))->setWidth('50%'),
_('Action')
])
->setAttribute('style', 'width: 100%;')
->addItem(
(new CTag('tfoot', true))
->addItem(
(new CCol(
(new CButtonLink(_('Add')))->addClass('js-parameter-add')
))->setColSpan(2)
)
);
$row_template = (new CTemplateTag('script-parameter-template'))
->addItem(
(new CRow([
(new CTextBox('parameters[name][]', '', false, DB::getFieldLength('script_param', 'name')))
->setAttribute('style', 'width: 100%;')
->setAttribute('value', '#{name}')
->removeId(),
(new CTextBox('parameters[value][]', '', false, DB::getFieldLength('script_param', 'value')))
->setAttribute('style', 'width: 100%;')
->setAttribute('value', '#{value}')
->removeId(),
(new CButtonLink(_('Remove')))->addClass('js-remove')
]))->addClass('form_row')
);
$form_grid = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))
->setAsteriskMark(),
(new CFormField(
(new CTextBox('name', $data['name'], false, DB::getFieldLength('scripts', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
))
])
->addItem([
new CLabel(_('Scope'), 'scope'),
new CFormField(
(new CRadioButtonList('scope', (int) $data['scope']))
->addValue(_('Action operation'), ZBX_SCRIPT_SCOPE_ACTION)
->addValue(_('Manual host action'), ZBX_SCRIPT_SCOPE_HOST)
->addValue(_('Manual event action'), ZBX_SCRIPT_SCOPE_EVENT)
->setModern()
->setEnabled(!$data['actions'])
)
])
->addItem([
(new CLabel(_('Menu path'), 'menu_path'))->setId('menu-path-label'),
(new CFormField(