Source
(new CCheckBox('status', ZBX_AUTH_TOKEN_ENABLED))->setChecked($data['status'] == ZBX_AUTH_TOKEN_ENABLED)
<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2021 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
*/
$url = (new CUrl('zabbix.php'))
->setArgument('action', ($data['tokenid'] == 0) ? 'token.create' : 'token.update')
->getUrl();
$token_form = (new CForm('post', $url))
->setId('token_form')
->setName('token')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE)
->addVar('admin_mode', $data['admin_mode'])
->addVar('tokenid', $data['tokenid'])
->addItem((new CInput('submit', null))->addStyle('display: none;'));
if ($data['admin_mode'] === '0') {
$token_form->addVar('userid', CWebUser::$data['userid']);
}
$token_from_grid = (new CFormGrid())->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox(
'name',
$data['name'],
false,
DB::getFieldLength('token', 'name'
)))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAttribute('autofocus', 'autofocus')
->setAriaRequired()
)
]);
if ($data['admin_mode'] === '1') {
$token_from_grid->addItem([
(new CLabel(_('User'), 'userid_ms'))->setAsteriskMark(),
new CFormField(
(new CMultiSelect([
'disabled' => ($data['tokenid'] != 0),