Source
array $submaps_relations, $severity_min = 0, array &$problems_counted = [], array $triggers_per_hosts = [],
<?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/>.
**/
namespace Widgets\NavTree\Actions;
use API,
CControllerDashboardWidgetView,
CControllerResponseData,
CProfile,
CSeverityHelper;
class WidgetView extends CControllerDashboardWidgetView {
private array $problems_per_severity_tpl;
protected function init(): void {
parent::init();
$this->addValidationRules([
'name' => 'string',
'widgetid' => 'db widget.widgetid',
'fields' => 'array'
]);
}
protected function doAction(): void {
// Get list of sysmapids.
$sysmapids = [];
$navtree_items = [];
foreach ($this->fields_values['navtree'] as $id => $navtree_item) {
$sysmapid = array_key_exists('sysmapid', $navtree_item) ? $navtree_item['sysmapid'] : 0;
if ($sysmapid != 0) {
$sysmapids[$sysmapid] = true;
}
$navtree_items[$id] = [
'parent' => $navtree_item['parent'],
'sysmapid' => $sysmapid,
'child_sysmapids' => []
];
}
// Propagate item mapids to all its parent items.
foreach ($navtree_items as $navtree_item) {
$parent = $navtree_item['parent'];
while (array_key_exists($parent, $navtree_items)) {
if ($navtree_item['sysmapid'] != 0) {