]> source.dussan.org Git - nextcloud-server.git/commitdiff
some refactoring for subnavigation code
authorRobin Appelman <icewind1991@gmail.com>
Fri, 29 Jul 2011 17:12:55 +0000 (19:12 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Fri, 29 Jul 2011 17:12:55 +0000 (19:12 +0200)
core/templates/layout.user.php
lib/app.php

index a100eed96b15eabd90a692eb52b8419ff958fb17..f8007548fe2ace573180b4fa699cafc52b71b823 100644 (file)
                                <ul>
                                        <?php foreach($_['navigation'] as $entry): ?>
                                                <li><a style="background-image:url(<?php echo $entry['icon']; ?>)" href="<?php echo $entry['href']; ?>" title="" <?php if( $entry['active'] ): ?> class="active"<?php endif; ?>><?php echo $entry['name']; ?></a></li>
+                                               <?php if( sizeof( $entry["subnavigation"] )): ?>
+                                                       <?php foreach($entry["subnavigation"] as $subentry):?>
+                                                               <li><a href="<?php echo $subentry['href']; ?>" title="" <?php if( $subentry['active'] ): ?>class="active"<?php endif; ?>><?php echo $subentry['name'] ?></a></li>
+                                                       <?php endforeach; ?>
+                                               <?php endif; ?>
                                        <?php endforeach; ?>
                                </ul>
                        </div>
index 475015f67792fc08c22ea295f525e1c3c7452754..bccd0c665fa3c3d25c8053bb47f121d1a9b0c9da 100644 (file)
@@ -310,20 +310,12 @@ class OC_APP{
 
        /// Private foo
        private static function addSubNavigation( $list ){
-               $found = false;
-               foreach( self::$subnavigation as $parent => $selection ){
-                       foreach( $selection as $subentry ){
-                               if( $subentry['id'] == self::$activeapp ){
-                                       foreach( $list as &$naventry ){
-                                               if( $naventry['id'] == $parent ){
-                                                       $naventry['active'] = true;
-                                                       $naventry['subnavigation'] = $selection;
-                                               }
-                                               else{
-                                                       $naventry['active'] = false;
-                                               }
-                                       } unset( $naventry );
-                                       $found = true;
+               if(isset(self::$subnavigation[self::$activeapp])){
+                       $subNav=self::$subnavigation[self::$activeapp];
+                       foreach( $list as &$naventry ){
+                               if( $naventry['id'] == self::$activeapp ){
+                                       $naventry['active'] = true;
+                                       $naventry['subnavigation'] = $subNav;
                                }
                        }
                }