Source
<?php
/*
** 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
*/
$this->includeJsFile('administration.regex.edit.js.php');
$widget = (new CWidget())
->setTitle(_('Regular expressions'))
->setTitleSubmenu(getAdministrationGeneralSubmenu())
->setDocUrl(CDocHelper::getUrl(CDocHelper::ADMINISTRATION_REGEX_EDIT));
$action = (new CUrl('zabbix.php'))->setArgument('action', ($data['regexid'] == 0) ? 'regex.create' : 'regex.update');
if ($data['regexid'] != 0) {
$action->setArgument('regexid', $data['regexid']);
}
$form = (new CForm())
->setId('regex')
->setAction($action->getUrl())
->setAttribute('aria-labeledby', ZBX_STYLE_PAGE_TITLE);
$table = (new CTable())
->setId('tbl_expr')
->setAttribute('style', 'width: 100%;')
->setHeader([
_('Expression type'),
_('Expression'),
_('Delimiter'),
_('Case sensitive'),
_('Action')
]);
foreach ($data['expressions'] as $i => $expression) {
$exp_delimiter = (new CSelect('expressions['.$i.'][exp_delimiter]'))
->setValue($expression['exp_delimiter'])
->setId('expressions_'.$i.'_exp_delimiter')
->addClass('js-expression-delimiter-select')
->addOptions(CSelect::createOptionsFromArray(CRegexHelper::expressionDelimiters()))
->setDisabled($expression['expression_type'] != EXPRESSION_TYPE_ANY_INCLUDED);
if ($expression['expression_type'] != EXPRESSION_TYPE_ANY_INCLUDED) {