Auch submenüs sollten gewichtet sein.
bernd

bernd commited on 2008-04-03 10:48:55
Zeige 1 geänderte Dateien mit 12 Einfügungen und 4 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1014 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -33,10 +33,10 @@ foreach ($config['modules'] as $module)
33 33
     $weight = $menu[$key]["weight"];
34 34
     if (isset($menu[$key]['submenu']))
35 35
     {
36
-      if (isset($submenu[$menu[$key]['submenu']]))
37
-        $submenu[$menu[$key]['submenu']] = array_merge($submenu[$menu[$key]['submenu']], array($key => $menu[$key]));
36
+      if (isset($submenu[$menu[$key]['submenu']][$weight]))
37
+        $submenu[$menu[$key]['submenu']][$weight] = array_merge($submenu[$menu[$key]['submenu']][$weight], array($key => $menu[$key]));
38 38
       else
39
-        $submenu[$menu[$key]['submenu']] = array($key => $menu[$key]);
39
+        $submenu[$menu[$key]['submenu']][$weight] = array($key => $menu[$key]);
40 40
     }
41 41
     else
42 42
     {
... ...
@@ -51,6 +51,11 @@ foreach ($config['modules'] as $module)
51 51
 
52 52
 ksort($weighted_menuitem);
53 53
 DEBUG($weighted_menuitem);
54
+
55
+foreach ($submenu AS $weight => $data) {
56
+  ksort($submenu[$weight]);
57
+}
58
+
54 59
 DEBUG($submenu);
55 60
 
56 61
 
... ...
@@ -121,13 +126,16 @@ $role = $_SESSION['role'];
121 126
                         if (isset($submenu[$key]))
122 127
                         {
123 128
                                 echo "\n";
124
-                                foreach ($submenu[$key] as $sec => $item)
129
+				foreach ($submenu[$key] as $weight => $mysub) 
130
+				{
131
+                                  foreach ($mysub as $sec => $item)
125 132
                                   {
126 133
                                           if ($sec == $section)
127 134
                                                   echo '<a href="'.$item['file'].'" class="submenuitem menuitem active">'.$item['label'].'</a>'."\n";
128 135
                                           else
129 136
                                                   echo '<a href="'.$item['file'].'" class="submenuitem menuitem">'.$item['label'].'</a>'."\n";
130 137
                                   }
138
+				}
131 139
                                 echo "\n";
132 140
                         }
133 141
 		}
134 142