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
* @var array $data
*/
if ($data['eventsource'] == EVENT_SOURCE_SERVICE) {
$title = _('Service actions');
$submenu = null;
}
else {
$submenu_source = [
EVENT_SOURCE_TRIGGERS => _('Trigger actions'),
EVENT_SOURCE_DISCOVERY => _('Discovery actions'),
EVENT_SOURCE_AUTOREGISTRATION => _('Autoregistration actions'),
EVENT_SOURCE_INTERNAL => _('Internal actions')
];
$title = array_key_exists($data['eventsource'], $submenu_source) ? $submenu_source[$data['eventsource']] : null;
$submenu = [];
foreach ($submenu_source as $value => $label) {
$url = (new CUrl('actionconf.php'))
->setArgument('eventsource', $value)
->getUrl();
$submenu[$url] = $label;
}
}
$current_url = (new CUrl('actionconf.php'))->setArgument('eventsource', $data['eventsource']);
$widget = (new CWidget())
->setTitle($title)
->setTitleSubmenu($submenu ? ['main_section' => ['items' => $submenu]] : null)
->setControls((new CTag('nav', true,
(new CForm('get'))
->cleanItems()
->addItem(new CInput('hidden', 'eventsource', $data['eventsource']))
->addItem((new CList())
->addItem(new CSubmit('form', _('Create action')))
)
))