Source
public static function validateDashboardPages(array $dashboard_pages, string $templateid = null): array {
<?php
/*
** 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/>.
**/
use Zabbix\Core\{
CModule,
CWidget
};
use Zabbix\Widgets\CWidgetField;
class CDashboardHelper {
/**
* Get dashboard owner name.
*/
public static function getOwnerName(string $userid): string {
$users = API::User()->get([
'output' => ['name', 'surname', 'username'],
'userids' => $userid
]);
return $users ? getUserFullname($users[0]) : _('Inaccessible user');
}
/**
* Update editable flag.
*
* @param array $dashboards An associative array of the dashboards.
*/
public static function updateEditableFlag(array &$dashboards): void {
$dashboards_rw = API::Dashboard()->get([
'output' => [],
'dashboardids' => array_keys($dashboards),
'editable' => true,
'preservekeys' => true
]);
foreach ($dashboards as $dashboardid => &$dashboard) {
$dashboard['editable'] = array_key_exists($dashboardid, $dashboards_rw);
}
unset($dashboard);
}
/**
* Prepare dashboard pages and widgets for the presentation.
*
* @param array $pages Dashboard pages with widgets as returned by the dashboard API.
* @param string|null $templateid Template ID, if used.
* @param bool $with_rf_rate Supply refresh rates for widgets, for the current user.
*