summaryrefslogtreecommitdiffstats
path: root/application/controllers/GraphController.php
blob: 312b80297bfefa42558c92a7a7e46d6a64742555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/* Icinga Web 2 | (c) 2013-2017 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Pnp\Controllers;

use Icinga\Module\Pnp\Web\Controller;

class GraphController extends Controller
{
    public function indexAction()
    {
        $url = $this->getRequest()->getUrl();
        $queryString = $url->getQueryString();

        $this->view->url = sprintf(
            '%s/graph?%s',
            $this->getBaseUrl(),
            $queryString
        );

        $host = $this->getParam('host');
        $service = $this->getParam('srv');

        $serviceTitle = '';
        if ($service && $service !== '_HOST_') {
            $serviceTitle = sprintf(' | %s: %s', $this->translate('Service'), $service);
        }
        $this->view->title = $title = sprintf('%s: %s%s',
            $this->translate('Host'),
            $host,
            $serviceTitle
        );

        $this->getTabs()->add('graph', array(
            'label' => $title,
            'url'   => $url,
        ))->activate('graph');

        $this->setViewScript('index/iframe');
    }
}