<?php
$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']));
}
$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'), [