Source
xxxxxxxxxx
$sqlParts = $this->applyQueryOutputOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts);
<?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/>.
**/
/**
* Class containing methods for operations with graph.
*/
class CGraph extends CGraphGeneral {
protected $tableName = 'graphs';
protected $tableAlias = 'g';
protected $sortColumns = ['graphid', 'name', 'graphtype'];
protected const FLAGS = ZBX_FLAG_DISCOVERY_NORMAL;
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 = [
'groupids' => null,
'templateids' => null,
'hostids' => null,