source: trunk/src/map/inc/node_info.php@ 7828

Last change on this file since 7828 was 7828, checked in by janveeden, 15 years ago

The nodemap is valid HTML now.

  • Property svn:eol-style set to native
File size: 3.1 KB
RevLine 
[7767]1<?php
[7770]2require_once("../../config.php");
3require_once($config['root']."/map/inc/kmlHandler.php");
[7828]4
[7725]5if(isset($_GET['view']))
6{
[7734]7 setcookie("view", $_GET['view']);
[7827]8 header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
[7725]9 $view = $_GET['view'];
10}
11else
12{
[7734]13 if(isset($_COOKIE['view']))
14 {
15 $view = $_COOKIE['view'];
16 }
17 else
18 $view = "gebruiker";
[7725]19}
20
[7756]21if(isset($_GET['sel']))
22{
23 $selected = $_GET['sel'];
24}
25else
26{
27 $selected = "";
28}
29
[7735]30//TYPES of nodes. 'cluster' is a cluster node. 'single' is an individual node.
31if(!isset($_GET['type']))//
[7725]32{
33 echo <<<EOF
[7734]34 <div id="nodeinfo">
[7828]35 <b>Mouse over</b> een node voor meer informatie.<br><br>
36 <b>Klik</b> op een node om deze te selecteren.<br><br>
[7734]37 Gebruik de <b>zoekfunctie</b> om de een specifieke node te zoeken.
38 </div>
39 <div id="timestamp">
[7828]40 Laatste update: 15:42 <br>
[7734]41 Do 25 maart
42 </div>
[7725]43EOF;
[7734]44
[7725]45}
[7735]46elseif($_GET['type'] == "single") //Info for single nodes is stored here
[7725]47{
[7784]48$markers = get_node_array($config['kml_file']);
[7770]49
[7784]50$description;
[7782]51
[7784]52foreach($markers as $marker)
53{
[7823]54 if(!$marker['location'] == null)
[7784]55 {
[7823]56 if($marker['name'] == $_GET['name'])
57 {
58 $name = $marker['name'];
59 $location = $marker['location'];
[7827]60 $status = $marker['status'];
61 $interfaces = $marker['interfaces'];
62 $masterIP = $marker['masterIP'];
63 $nodeType = $marker['nodeType'];
64 $type = $marker['type'];
65 $hostname = $marker['hostname'];
66 $hasBeenChecked = $marker['hasBeenChecked'];
67 $checkExecutionTime = $marker['checkExecutionTime'];
68 $currentState = $marker['currentState'];
69 $problemHasBeenAcknowledged = $marker['problemHasBeenAcknowledged'];
70
71 $lastcheck = $marker['lastCheck'];
72 $lastcheck = date('d-m-Y H:i:s', (int)$lastcheck);
73
[7823]74 }
[7784]75 }
76}
77
[7735]78 if($view == "beheerder")//Display part for beheerder view of a single node
[7784]79 {
[7769]80 echo <<<EOF
[7784]81 <div id='nodeinfo'>
[7827]82 <b>{$name}</b>
83 <div id="information">
84 <p>Locatie: {$location}
85 <p>Status: {$status}
86 <p>Inferfaces: {$interfaces}
87 <p>Master IP: {$masterIP}
88 <p>Node type: {$nodeType}
89 <p>Type: {$type}
90 <p>Hostname: {$hostname}
91 <p>Has been check: {$hasBeenChecked}
92 <p>Check execution time: {$checkExecutionTime}
93 <p>Current state: {$currentState}
94 <p>Problem has been acknowledged: {$problemHasBeenAcknowledged}
[7769]95 </div>
96 <div id="timestamp">
[7827]97 Laatste update: {$lastcheck}
[7769]98 </div>
99EOF;
[7734]100 }
[7735]101 elseif($view == "gebruiker")//Display part for gebruiker view of a single node
[7734]102 {
[7769]103 echo <<<EOF
[7821]104 <div id='nodeinfo'>
[7827]105 <b>{$name}</b>
106 <div id="information">
107 <p>Locatie: {$location}
108 <p>Status: {$status}
109 <p>Type: {$type}
110 <p>Hostname: {$hostname}
[7769]111 </div>
112 <div id="timestamp">
[7828]113 Laatste update: 15:42 <br>
[7769]114 Do 25 maart
115 </div>
116EOF;
[7734]117 }
118}
119elseif($_GET['type'] == "cluster")
120{
[7738]121 $markerTitles = unserialize($_GET['markers']);
122
123 echo <<<EOF
124 <div id="nodeinfo">
[7827]125 <b>Nodes:</b><br/>
126
[7828]127 Lijst met nodes in deze cluster<br>
[7821]128 <div id="clusterlist$selected" >
129 <select multiple onchange='goToMarker(this.options[this.selectedIndex].text)'>
[7738]130EOF;
131 foreach($markerTitles as $marker)
[7734]132 {
[7738]133 echo "<option value='".$marker."'>".$marker."</option>";
[7734]134 }
[7738]135
136 echo <<<EOF
[7827]137 </select>
[7734]138 </div>
[7738]139 </div>
[7734]140EOF;
141}
[7756]142?>
Note: See TracBrowser for help on using the repository browser.