-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathWeathermap.php
More file actions
45 lines (36 loc) · 1.28 KB
/
Weathermap.php
File metadata and controls
45 lines (36 loc) · 1.28 KB
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
37
38
39
40
41
42
43
44
45
<?php
namespace LibreNMS\Plugins;
include_once 'lib/editor.inc.php';
class Weathermap {
public static function menu() {
//Include config
include_once 'config.inc.php';
//Parse config files
$files = list_weathermaps($mapdir);
//Create submenu
$submenu = ' <ul class="dropdown-menu scrollable-menu">';
$count = 0;
//getShortName - might make sense to include this ShortName code into Plugin class somewhere ?
if ($pos = strrpos(get_class(), '\\')) {
$short= substr(get_class(), $pos + 1);
} else {
$short = $pos;
};
foreach ($files as $file=>$data) {
$nicefile = htmlspecialchars($file);
$submenu .= ' <li><a href="/plugins/'.$short.'/'.htmlspecialchars($data['page']).'"><i class="fa fa-map fa-fw fa-lg" aria-hidden="true"></i> '.htmlspecialchars($data['title']).'</a></li>';
$count ++;
}
$submenu .= ' </ul>';
//Display it if not empty
if ($count > 0) {
echo('<li class="dropdown-submenu"><a href="plugin/p='.$short.'">'.$short.'</a>');
echo $submenu;
echo ('</li>');
} else {
//Create menu without submenu
echo('<li><a href="plugin/p='.$short.'">'.$short.'</a></li>');
}
}
}
?>