<?php declare(strict_types = 0);
->setId('popup-operation')
->setName('popup_operation')
->addVar('operation[eventsource]', $data['eventsource'])
->addVar('operation[recovery]', $data['recovery']);
$form->addItem((new CSubmitButton())->addClass(ZBX_STYLE_FORM_SUBMIT_HIDDEN));
$form_grid = (new CFormGrid());
$operation = $data['operation'];
$operationtype_value = $operation['opcommand']['scriptid'] != 0
? 'scriptid['.$operation['opcommand']['scriptid'].']'
: 'cmd['. $operation['operationtype'].']';
if (count($data['operation_types']) > 1) {
$select_operationtype = (new CFormField(
(new CSelect('operation[operationtype]'))
->setFocusableElementId('operationtype')
->addOptions(CSelect::createOptionsFromArray($data['operation_types']))
->setValue($operationtype_value ?? 0)
->setId('operation-type-select')
))->setId('operation-type');
$select_operationtype = (new CFormField([
new CLabel($data['operation_types']),
(new CInput('hidden', 'operation[operationtype]', $operationtype_value))
->setId('operation-type-select')
]))->setId('operation-type');
if ($data['scripts_with_warning']) {
$select_operationtype->addItem(
makeWarningIcon(_('Global script execution on Zabbix server is disabled by server configuration.'))
->addClass('js-script-warning-icon')
->addStyle('display: none;')
(new CLabel(_('Operation'), 'operationtype'))->setId('operation-type-label'),
if (($data['eventsource'] == EVENT_SOURCE_TRIGGERS || $data['eventsource'] == EVENT_SOURCE_INTERNAL
|| $data['eventsource'] == EVENT_SOURCE_SERVICE) && $data['recovery'] == ACTION_OPERATION) {
$step_from = (new CNumericBox('operation[esc_step_from]', $operation['esc_step_from'] ?? 1, 5))
->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH)
->setId('operation_esc_step_from');
$step_from->onChange($step_from->getAttribute('onchange').' if (this.value < 1) this.value = 1;');
$step_to = (new CNumericBox('operation[esc_step_to]', 0, 5, false, false, false))
->setAttribute('value', $operation['esc_step_to'] ?? 0)
->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH);
(new CLabel(_('Steps'), 'operation_esc_step_from'))->setId('operation-step-range-label'),
(new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), '-',
(new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN),
(new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), _('(0 - infinitely)')
]))->setId('operation-step-range')