From fe47d51598504dacdfce9b84016f8c1fd1af1755 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jul 2011 19:12:55 +0200 Subject: [PATCH] some refactoring for subnavigation code --- core/templates/layout.user.php | 5 +++++ lib/app.php | 20 ++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index a100eed96b..f8007548fe 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -44,6 +44,11 @@ diff --git a/lib/app.php b/lib/app.php index 475015f677..bccd0c665f 100644 --- a/lib/app.php +++ b/lib/app.php @@ -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; } } }