summaryrefslogtreecommitdiffstats
path: root/lib/app.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-29 19:38:01 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-29 19:43:06 +0200
commitd12d08e2f3553b06df6371535f971c9f193bd388 (patch)
treea5a06b8a522d87a4e2f8934ee46fba3a2cfdbe9b /lib/app.php
parent8b872e326a1ef6776f2f5f09b9c698447146ac6a (diff)
downloadnextcloud-server-d12d08e2f3553b06df6371535f971c9f193bd388.tar.gz
nextcloud-server-d12d08e2f3553b06df6371535f971c9f193bd388.zip
some more changes for navigation subentries
Diffstat (limited to 'lib/app.php')
-rw-r--r--lib/app.php36
1 files changed, 26 insertions, 10 deletions
diff --git a/lib/app.php b/lib/app.php
index bccd0c665fa..b6c2512e79a 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -158,7 +158,10 @@ class OC_APP{
* the navigation. Lower values come first.
*/
public static function addNavigationEntry( $data ){
- // TODO: write function
+ $data['active']=false;
+ if(!isset($data['icon'])){
+ $data['icon']='';
+ }
OC_APP::$navigation[] = $data;
return true;
}
@@ -184,6 +187,10 @@ class OC_APP{
* the navigation. Lower values come first.
*/
public static function addNavigationSubEntry( $parent, $data ){
+ $data['active']=false;
+ if(!isset($data['icon'])){
+ $data['icon']='';
+ }
if( !array_key_exists( $parent, self::$subnavigation )){
self::$subnavigation[$parent] = array();
}
@@ -318,16 +325,25 @@ class OC_APP{
$naventry['subnavigation'] = $subNav;
}
}
- }
-
- // Mark subentry as active
- foreach( $list as &$naventry ){
- if( $naventry['active'] ){
- foreach( $naventry['subnavigation'] as &$subnaventry ){
- $subnaventry['active'] = $subnaventry['id'] == self::$activeapp? true : false;
- } unset( $subnaventry );
+ }else{
+ foreach(self::$subnavigation as $parent=>$entries){
+ $activeParent=false;
+ foreach($entries as &$subNav){
+ $subNav['active']=$subNav['id'] == self::$activeapp;
+ if($subNav['active']){
+ $activeParent=true;
+ }
+ }
+ if($activeParent){
+ foreach( $list as &$naventry ){
+ if( $naventry['id'] == $parent ){
+ $naventry['active'] = true;
+ $naventry['subnavigation'] = $entries;
+ }
+ }
+ }
}
- } unset( $naventry );
+ }
return $list;
}