1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
3 * Configuration controller used to connect to Hypergraph
4 * http://hypergraph.sf.net
5 * Requires authentication
7 * op5, and the op5 logo are trademarks, servicemarks, registered servicemarks
8 * or registered trademarks of op5 AB.
9 * All other trademarks, servicemarks, registered trademarks, and registered
10 * servicemarks mentioned herein may be the property of their respective owner(s).
11 * The information contained herein is provided AS IS with NO WARRANTY OF ANY
12 * KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR A
15 class Hypermap_Controller
extends Authenticated_Controller
{
18 * Enable links from Ninja to hypermap
19 * @see http://hypergraph.sf.net
21 * Checks are made that hypermap is configured in config file
22 * and that user is authenticated for all hosts and services
24 public function index()
27 $this->template
->disable_refresh
= true;
28 $this->template
->content
= $this->add_view('hypermap/hypermap');
29 $content = $this->template
->content
;
30 $this->template
->js
[] = $this->add_path('/js/iframe-adjust.js');
32 if (Kohana
::config('hypergraph.hyperapplet_path'))
33 $content->hyperapplet_path
= Kohana
::config('config.site_domain')
34 .'application/'. Kohana
::config('hypergraph.hyperapplet_path');
35 $content->nagios_prop
= Kohana
::config('config.site_domain')
36 .'application/'. Kohana
::config('hypergraph.nagios_props');
37 $content->xml_path
= url
::site().'hypermap/createxml';
41 * Create the xml data needed for hyperapplet
43 public function createxml()
45 $this->template
->content
= $this->add_view('hypermap/xml');
46 $content = $this->template
->content
;
47 $content->dtd
= Kohana
::config('config.site_domain')
48 .'application/'.Kohana
::config('hypergraph.hyper_dtd');
50 $ls = Livestatus
::instance();
51 $hosts = $ls->getHosts(array(
60 $host_parents = array();
61 $no_parents = array();
62 $content->hosts
= $hosts;
64 foreach ($hosts as $host) {
65 if ($host['parents']) {
66 foreach ($host['parents'] as $parent) {
67 $host_parents[$host['name']][] = $parent;
70 $no_parents[] = $host['name'];
74 $content->host_parents
= $host_parents;
75 $content->no_parents
= $no_parents;
76 echo $content->render();
78 # prevent ninja from displaying master template etc