File: IndexController.php

package info (click to toggle)
icingaweb2-module-toplevelview 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,496 kB
  • sloc: javascript: 9,646; php: 2,358; sh: 54; xml: 51; makefile: 25
file content (36 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (2)
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
<?php
/* Copyright (C) 2017 Icinga Development Team <info@icinga.com> */

namespace Icinga\Module\Toplevelview\Controllers;

use Icinga\Module\Toplevelview\ViewConfig;
use Icinga\Module\Toplevelview\Web\Controller;

use Icinga\Application\Icinga;

/**
 * IndexController loads all existing Views from their YAML files.
 */
class IndexController extends Controller
{
    public function indexAction()
    {
        $this->getTabs()->add('index', [
            'title' => 'Top Level View',
            'url'   => 'toplevelview',
        ])->activate('index');

        // Load add views from the existing YAML files
        $config_dir_module = Icinga::app()
                           ->getModuleManager()
                           ->getModule('toplevelview')
                           ->getConfigDir();

        $c = new ViewConfig($config_dir_module);
        $views = $c->loadAll();

        $this->view->views = $views;

        $this->setAutorefreshInterval(30);
    }
}