forked from axelhahn/pimped-apache-status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inc_menu.php
119 lines (108 loc) · 4.54 KB
/
inc_menu.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/*
* PIMPED APACHE-STATUS
* GENERATE ARRAYS FOR MENUS
*/
// ------------------------------------------------------------
// servergroups and servers
// ------------------------------------------------------------
foreach ($aServergroups as $sGroup => $aServers) {
foreach ($aServers['servers'] as $sServer => $aData) {
if (!array_key_exists("disabled", $aData)) {
if ($sGroup == $aEnv["active"]["group"]) {
if (count($aServers2Collect) == 1 && $aServers2Collect[0] == $sServer) {
$aEnv["links"]["servers"][$sGroup]["subitems"][$sServer]["active"] = true;
}
}
$aEnv["links"]["servers"][$sGroup]["subitems"][$sServer]["url"] = getNewQs(array("servers" => $sServer, "group" => $sGroup, "url" => ""));
$sLabel = array_key_exists("label", $aData) ? $aData['label'] : $sServer;
$aEnv["links"]["servers"][$sGroup]["subitems"][$sServer]["label"] = $aCfg['icons']['server'].' '.$sLabel;
}
}
// if (count($aServers['servers'])==1) unset ($aEnv["links"]["servers"][$sGroup]["subitems"][$sServer]["active"]);
if ($sGroup == $aEnv["active"]["group"]
// && count($aServers2Collect) <> 1
) {
$aEnv["links"]["servers"][$sGroup]["active"] = true;
}
$aEnv["links"]["servers"][$sGroup]["label"] = $aCfg['icons']['group'].' '.$aLangTxt['menuGroup'] . ' ' . $sGroup;
$aEnv["links"]["servers"][$sGroup]["class"] = "group";
$aEnv["links"]["servers"][$sGroup]["url"] = getNewQs(array("servers" => "", "group" => $sGroup, "url" => ""));
}
// ------------------------------------------------------------
// available views
// ------------------------------------------------------------
/*
$aEnv["links"]["views"]['admin'] = array(
"label" => $aCfg['icons']['admin'] . $aLangTxt['menuAdmin'],
"url" => './admin/'.getNewQs(),
"class" => 'adminlink',
"active" => false,
);
*/
if (isset($aUserCfg)){
foreach ($aCfg['views'] as $s) {
$sLabel = '';
if (array_key_exists($s, $aCfg['icons'])) {
$sLabel.=$aCfg['icons'][$s] . ' ';
}
$sLabel .= '<span>'.($aLangTxt['view_' . $s . '_label'] ? $aLangTxt['view_' . $s . '_label'] : $s).'</span>';
$aEnv["links"]["views"][$s] = array(
"label" => $sLabel,
"url" => $sSelfURL . '/'. getNewQs(array("view" => $s, 'action'=>'')),
"active" => ($s == $aEnv["active"]["view"]),
);
}
foreach ($aCfg['viewsadmin'] as $s) {
$sLabel = '';
if (array_key_exists('admin'.$s, $aCfg['icons'])) {
$sLabel.=$aCfg['icons']['admin'.$s] . ' ';
}
$sLabel .= '<span>'.(array_key_exists('AdminMenu' . $s . '', $aLangTxt) ? $aLangTxt['AdminMenu' . $s . ''] : $s).'</span>';
$aEnv["links"]["viewsadmin"][$s] = array(
'url' => getNewQs(array('action'=>'update')),
"label" => $sLabel,
"url" => $sSelfURL . '/admin/'.getNewQs(array('action'=>$s, 'view'=>'')),
"active" => ($s == $aEnv["active"]["view"]),
);
}
// ------------------------------------------------------------
// available skins
// ------------------------------------------------------------
if ($aCfg['selectSkin']) {
foreach ($aCfg['selectSkin'] as $s) {
$aEnv["links"]["skins"][$s] = array(
"label" => $s,
"url" => getNewQs(array("skin" => $s)),
"active" => ($s == $aEnv["active"]["skin"]),
);
}
}
// ------------------------------------------------------------
// autoreload page
// ------------------------------------------------------------
if ($aCfg['autoreload']) {
foreach ($aCfg['autoreload'] as $iTime) {
$s = $iTime . " s";
if ($s == " s")
$s = "---";
$aEnv["links"]["reload"][$s] = array(
"label" => $s,
"url" => getNewQs(array("reload" => $iTime)),
"active" => ($iTime == $aEnv["active"]["reload"]),
);
}
}
}
// ------------------------------------------------------------
// available languages
// ------------------------------------------------------------
if ($aCfg['selectLang']) {
foreach ($aCfg['selectLang'] as $s) {
$aEnv["links"]["lang"][$s] = array(
"label" => $s,
"url" => getNewQs(array("lang" => $s)),
"active" => ($s == $aEnv["active"]["lang"]),
);
}
}