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

Last change on this file since 7829 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
Line 
1<?php
2require_once("../../config.php");
3require_once($config['root']."/map/inc/kmlHandler.php");
4
5if(isset($_GET['view']))
6{
7 setcookie("view", $_GET['view']);
8 header('P3P: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"');
9 $view = $_GET['view'];
10}
11else
12{
13 if(isset($_COOKIE['view']))
14 {
15 $view = $_COOKIE['view'];
16 }
17 else
18 $view = "gebruiker";
19}
20
21if(isset($_GET['sel']))
22{
23 $selected = $_GET['sel'];
24}
25else
26{
27 $selected = "";
28}
29
30//TYPES of nodes. 'cluster' is a cluster node. 'single' is an individual node.
31if(!isset($_GET['type']))//
32{
33 echo <<<EOF
34 <div id="nodeinfo">
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>
37 Gebruik de <b>zoekfunctie</b> om de een specifieke node te zoeken.
38 </div>
39 <div id="timestamp">
40 Laatste update: 15:42 <br>
41 Do 25 maart
42 </div>
43EOF;
44
45}
46elseif($_GET['type'] == "single") //Info for single nodes is stored here
47{
48$markers = get_node_array($config['kml_file']);
49
50$description;
51
52foreach($markers as $marker)
53{
54 if(!$marker['location'] == null)
55 {
56 if($marker['name'] == $_GET['name'])
57 {
58 $name = $marker['name'];
59 $location = $marker['location'];
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
74 }
75 }
76}
77
78 if($view == "beheerder")//Display part for beheerder view of a single node
79 {
80 echo <<<EOF
81 <div id='nodeinfo'>
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}
95 </div>
96 <div id="timestamp">
97 Laatste update: {$lastcheck}
98 </div>
99EOF;
100 }
101 elseif($view == "gebruiker")//Display part for gebruiker view of a single node
102 {
103 echo <<<EOF
104 <div id='nodeinfo'>
105 <b>{$name}</b>
106 <div id="information">
107 <p>Locatie: {$location}
108 <p>Status: {$status}
109 <p>Type: {$type}
110 <p>Hostname: {$hostname}
111 </div>
112 <div id="timestamp">
113 Laatste update: 15:42 <br>
114 Do 25 maart
115 </div>
116EOF;
117 }
118}
119elseif($_GET['type'] == "cluster")
120{
121 $markerTitles = unserialize($_GET['markers']);
122
123 echo <<<EOF
124 <div id="nodeinfo">
125 <b>Nodes:</b><br/>
126
127 Lijst met nodes in deze cluster<br>
128 <div id="clusterlist$selected" >
129 <select multiple onchange='goToMarker(this.options[this.selectedIndex].text)'>
130EOF;
131 foreach($markerTitles as $marker)
132 {
133 echo "<option value='".$marker."'>".$marker."</option>";
134 }
135
136 echo <<<EOF
137 </select>
138 </div>
139 </div>
140EOF;
141}
142?>
Note: See TracBrowser for help on using the repository browser.