Source
foreach (CCorrelationHelper::getOperatorsByConditionType(ZBX_CORR_CONDITION_NEW_EVENT_HOSTGROUP) as $value) {
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/**
* @var CView $this
* @var array $data
*/
$inline_js = getPagePostJs().$this->readJsFile('correlation.condition.edit.js.php');
$form = (new CForm())
->setId('correlation-condition-form')
->setName('conditions')
->setAttribute('aria-labelledby', CHtmlPage::PAGE_TITLE_ID)
->addVar('conditiontype', $data['conditiontype'])
->addItem((new CInput('submit', null))->addStyle('display: none;'));
$condition_type = (int) $data['last_type'];
// Type select.
$form_grid = (new CFormGrid())
->addItem([
new CLabel(_('Type'), 'label-condition-type'),
new CFormField((new CSelect('conditiontype'))
->setFocusableElementId('label-condition-type')
->setValue($condition_type)
->setId('condition-type')
->addOptions(CSelect::createOptionsFromArray(CCorrelationHelper::getConditionTypes()))
)
]);
switch ($condition_type) {
// Old|New event tag form elements.
case ZBX_CORR_CONDITION_OLD_EVENT_TAG:
case ZBX_CORR_CONDITION_NEW_EVENT_TAG:
$operator = (new CRadioButtonList('', CONDITION_OPERATOR_EQUAL))
->setModern(true)
->addValue(CCorrelationHelper::getLabelByOperator(
CCorrelationHelper::getOperatorsByConditionType(ZBX_CORR_CONDITION_OLD_EVENT_TAG)[0]
), CCorrelationHelper::getOperatorsByConditionType(ZBX_CORR_CONDITION_OLD_EVENT_TAG)[0]);
$new_condition_tag = (new CTextAreaFlexible('tag'))
->setId('tag')
->setWidth(ZBX_TEXTAREA_MEDIUM_WIDTH);
$form_grid
->addItem([
new CLabel(_('Operator')),
new CFormField([$operator, new CVar('operator', CONDITION_OPERATOR_EQUAL)])
])