submenu-items korrekt zuordnen
bernd

bernd commited on 2008-04-03 15:57:05
Zeige 1 geänderte Dateien mit 15 Einfügungen und 1 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1015 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -113,6 +113,20 @@ echo '
113 113
 <?php
114 114
 $role = $_SESSION['role'];
115 115
 
116
+function array_key_exists_r($needle, $haystack)
117
+{
118
+    $result = array_key_exists($needle, $haystack);
119
+    if ($result) return $result;
120
+    foreach ($haystack as $v) {
121
+        if (is_array($v)) {
122
+            $result = array_key_exists_r($needle, $v);
123
+        }
124
+        if ($result) return $result;
125
+    }
126
+    return $result;
127
+}
128
+
129
+
116 130
 
117 131
   foreach ($weighted_menuitem as $key => $menuitem)
118 132
         foreach ($menuitem as $key => $item)
... ...
@@ -121,7 +135,7 @@ $role = $_SESSION['role'];
121 135
                         echo '<a href="'.$item['file'].'" class="menuitem active">'.$item['label'].'</a>'."\n";
122 136
                 else
123 137
                         echo '<a href="'.$item['file'].'" class="menuitem">'.$item['label'].'</a>'."\n";
124
-                if ($key == $section || (array_key_exists($key, $submenu) && array_key_exists($section, $submenu[$key])))
138
+                if ($key == $section || (array_key_exists($key, $submenu) && array_key_exists_r($section, $submenu[$key])))
125 139
                 {
126 140
                         if (isset($submenu[$key]))
127 141
                         {
128 142