Source
'data' => CArrayHelper::renameObjectsKeys($data['rules']['service_write_list'], ['serviceid' => 'id']),
<?php declare(strict_types = 0);
/*
** Zabbix
** Copyright (C) 2001-2022 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
*/
$this->includeJsFile('administration.userrole.edit.js.php');
$widget = (new CWidget())
->setTitle(_('User roles'))
->setDocUrl(CDocHelper::getUrl(CDocHelper::ADMINISTRATION_USERROLE_EDIT));
$form = (new CForm())
->setId('userrole-form')
->setName('user_role_form')
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE);
if ($data['roleid'] !== null) {
$form->addVar('roleid', $data['roleid']);
}
$form_grid = (new CFormGrid())
->addItem([
(new CLabel(_('Name'), 'name'))->setAsteriskMark(),
new CFormField(
(new CTextBox('name', $data['name'], $data['readonly'], DB::getFieldLength('role', 'name')))
->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)
->setAriaRequired()
->setAttribute('autofocus', 'autofocus')
->setAttribute('maxlength', DB::getFieldLength('role', 'name'))
)
]);
if ($data['readonly'] || $data['is_own_role']) {
$form_grid->addItem([
(new CLabel(_('User type'), 'type')),
new CFormField([
(new CTextBox('type', user_type2str()[$data['type']]))
->setId('type_readonly')
->setAttribute('readonly', true),
new CVar('type', $data['type']),
' ',
$data['is_own_role']