Debian Codegraph @

application/controllers/IndexController.php

raw
1 <?php
2 /* Copyright (C) 2017 Icinga Development Team <[email protected]> */
3
4 namespace Icinga\Module\Toplevelview\Controllers;
5
6 use Icinga\Module\Toplevelview\ViewConfig;
7 use Icinga\Module\Toplevelview\Web\Controller;
8
9 use Icinga\Application\Icinga;
10
11 /**
12 * IndexController loads all existing Views from their YAML files.
13 */
14 class IndexController extends Controller
15 {
16 public function indexAction()
17 {
18 $this->getTabs()->add('index', [
19 'title' => 'Top Level View',
20 'url' => 'toplevelview',
21 ])->activate('index');
22
23 // Load add views from the existing YAML files
24 $config_dir_module = Icinga::app()
25 ->getModuleManager()
26 ->getModule('toplevelview')
27 ->getConfigDir();
28
29 $c = new ViewConfig($config_dir_module);
30 $views = $c->loadAll();
31
32 $this->view->views = $views;
33
34 $this->setAutorefreshInterval(30);
35 }
36 }