Source
$name[] = makeGraphTemplatePrefix($graphid, $data['parent_templates'], $flag, $data['allowed_ui_conf_templates']);
<?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/>.
**/
/**
* @var CView $this
* @var array $data
*/
$this->includeJsFile('configuration.graph.list.js.php');
if (!empty($this->data['parent_discoveryid'])) {
$html_page = (new CHtmlPage())
->setTitle(_('Graph prototypes'))
->setDocUrl(CDocHelper::getUrl($data['context'] === 'host'
? CDocHelper::DATA_COLLECTION_HOST_GRAPH_PROTOTYPE_LIST
: CDocHelper::DATA_COLLECTION_TEMPLATES_GRAPH_PROTOTYPE_LIST
))
->setControls(
(new CTag('nav', true,
(new CList())
->addItem(
new CRedirectButton(_('Create graph prototype'),
(new CUrl('graphs.php'))
->setArgument('form', 'create')
->setArgument('parent_discoveryid', $data['parent_discoveryid'])
->setArgument('context', $data['context'])
)
)
))->setAttribute('aria-label', _('Content controls'))
)
->setNavigation(getHostNavigation('graphs', $this->data['hostid'], $this->data['parent_discoveryid']));
}
else {
$html_page = (new CHtmlPage())
->setTitle(_('Graphs'))
->setDocUrl(CDocHelper::getUrl($data['context'] === 'host'
? CDocHelper::DATA_COLLECTION_HOST_GRAPH_LIST
: CDocHelper::DATA_COLLECTION_TEMPLATE_GRAPH_LIST
))
->setControls(
(new CTag('nav', true,
(new CList())
->addItem(
$data['hostid'] != 0
? new CRedirectButton(_('Create graph'),
(new CUrl('graphs.php'))
->setArgument('hostid', $data['hostid'])
->setArgument('form', 'create')
->setArgument('context', $data['context'])
)
: (new CButton('form',
$data['context'] === 'host'
? _('Create graph (select host first)')
: _('Create graph (select template first)')
))->setEnabled(false)
)
))->setAttribute('aria-label', _('Content controls'))
);
if (!empty($this->data['hostid'])) {
$html_page->setNavigation(getHostNavigation('graphs', $this->data['hostid']));
}
// Add filter tab.
$hg_ms_params = $data['context'] === 'host' ? ['with_hosts' => true] : ['with_templates' => true];
$html_page->addItem(
(new CFilter())
->setResetUrl((new CUrl('graphs.php'))->setArgument('context', $data['context']))
->setProfile($data['profileIdx'])
->setActiveTab($data['active_tab'])
->addvar('context', $data['context'])
->addFilterTab(_('Filter'), [
(new CFormList())
->addRow(
new CLabel($data['context'] === 'host' ? _('Host groups') : _('Template groups'),
'filter_groupids__ms'
),