Source
->addTab('graphTab', ($data['parent_discoveryid'] === null) ? _('Graph') : _('Graph prototype'), $graphFormList);
<?php
/*
** Zabbix
** 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 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.
**/
/**
* @var CView $this
* @var array $data
*/
$widget = new CWidget();
if ($data['parent_discoveryid'] === null) {
$widget
->setTitle(_('Graphs'))
->setNavigation(getHostNavigation('graphs', $data['hostid']));
}
else {
$widget
->setTitle(_('Graph prototypes'))
->setNavigation(getHostNavigation('graphs', $data['hostid'], $data['parent_discoveryid']));
}
$url = (new CUrl('graphs.php'))
->setArgument('parent_discoveryid', $data['parent_discoveryid'])
->setArgument('context', $data['context'])
->getUrl();
// Create form.
$graphForm = (new CForm('post', $url))
->addItem((new CVar('form_refresh', $data['form_refresh'] + 1))->removeId())
->setName('graphForm')
->setAttribute('aria-labelledby', ZBX_STYLE_PAGE_TITLE)
->addVar('form', $data['form'])
->addVar('hostid', $data['hostid']);
if ($data['parent_discoveryid'] !== null) {
$graphForm->addItem((new CVar('parent_discoveryid', $data['parent_discoveryid']))->removeId());
}
if ($data['graphid'] != 0) {
$graphForm->addVar('graphid', $data['graphid']);
}
// Create form list.
$graphFormList = new CFormList('graphFormList');