Source
self::exception(ZBX_API_ERROR_PARAMETERS, _('No permissions to referred object or it does not exist!'));
<?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.
**/
/**
* Class containing methods for operations with graph.
*/
class CGraph extends CGraphGeneral {
protected $tableName = 'graphs';
protected $tableAlias = 'g';
protected $sortColumns = ['graphid', 'name', 'graphtype'];
public function __construct() {
parent::__construct();
$this->errorMessages = array_merge($this->errorMessages, [
self::ERROR_TEMPLATE_HOST_MIX =>
_('Graph "%1$s" with templated items cannot contain items from other hosts.'),
self::ERROR_MISSING_GRAPH_NAME => _('Missing "name" field for graph.'),
self::ERROR_MISSING_GRAPH_ITEMS => _('Missing items for graph "%1$s".'),
self::ERROR_MISSING_REQUIRED_VALUE => _('No "%1$s" given for graph.'),
self::ERROR_GRAPH_SUM => _('Cannot add more than one item with type "Graph sum" on graph "%1$s".')
]);
}
/**
* Get graph data.
*
* @param array $options
*
* @return array
*/
public function get($options = []) {
$result = [];
$sqlParts = [
'select' => ['graphs' => 'g.graphid'],
'from' => ['graphs' => 'graphs g'],
'where' => [],
'group' => [],
'order' => [],
'limit' => null
];
$defOptions = [