aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-12-14 10:28:55 +0100
committerMario Vavti <mario@mariovavti.com>2018-12-14 10:28:55 +0100
commitc771d2809fe3ff08e40854f4fe57b19e3440247e (patch)
tree1241d2178cdd2801be485e9f25d710eccf76e2c7 /include
parent6bea3d6bfc984e6f30867f00be5a92b5cd5be925 (diff)
parent6464099364f3d4e800137a57d3b9ff9e8f7601e4 (diff)
downloadvolse-hubzilla-c771d2809fe3ff08e40854f4fe57b19e3440247e.tar.gz
volse-hubzilla-c771d2809fe3ff08e40854f4fe57b19e3440247e.tar.bz2
volse-hubzilla-c771d2809fe3ff08e40854f4fe57b19e3440247e.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'include')
-rw-r--r--include/nav.php60
1 files changed, 45 insertions, 15 deletions
diff --git a/include/nav.php b/include/nav.php
index d405b9f06..58e13dd93 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -222,6 +222,9 @@ function nav($template = 'default') {
if(! $settings_url && isset(App::$nav_sel['settings_url']))
$settings_url = App::$nav_sel['settings_url'];
+ $pinned_list = [];
+ $syslist = [];
+
//app bin
if($is_owner) {
if(get_pconfig(local_channel(), 'system','import_system_apps') !== datetime_convert('UTC','UTC','now','Y-m-d')) {
@@ -234,14 +237,29 @@ function nav($template = 'default') {
set_pconfig(local_channel(), 'system','force_import_system_apps', STD_VERSION);
}
- $syslist = array();
- $list = Apps::app_list(local_channel(), false, ['nav_featured_app', 'nav_pinned_app']);
+ $list = Apps::app_list(local_channel(), false, [ 'nav_pinned_app' ]);
+ if($list) {
+ foreach($list as $li) {
+ $pinned_list[] = Apps::app_encode($li);
+ }
+ }
+ Apps::translate_system_apps($pinned_list);
+
+ usort($pinned_list,'Zotlabs\\Lib\\Apps::app_name_compare');
+
+ $pinned_list = Apps::app_order(local_channel(),$pinned_list, 'nav_pinned_app');
+
+
+ $syslist = [];
+ $list = Apps::app_list(local_channel(), false, [ 'nav_featured_app' ]);
+
if($list) {
foreach($list as $li) {
$syslist[] = Apps::app_encode($li);
}
}
Apps::translate_system_apps($syslist);
+
}
else {
$syslist = Apps::get_system_apps(true);
@@ -249,26 +267,38 @@ function nav($template = 'default') {
usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare');
- $syslist = Apps::app_order(local_channel(),$syslist);
+ $syslist = Apps::app_order(local_channel(),$syslist, 'nav_featured_app');
+
- foreach($syslist as $app) {
- if(\App::$nav_sel['name'] == $app['name'])
- $app['active'] = true;
+ if($pinned_list) {
+ foreach($pinned_list as $app) {
+ if(\App::$nav_sel['name'] == $app['name'])
+ $app['active'] = true;
- if($is_owner) {
- if(strpos($app['categories'],'nav_pinned_app') !== false) {
+ if($is_owner) {
$navbar_apps[] = Apps::app_render($app,'navbar');
}
- else {
- $nav_apps[] = Apps::app_render($app,'nav');
+ elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) {
+ $navbar_apps[] = Apps::app_render($app,'navbar');
}
}
- elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) {
- if(strpos($app['categories'],'nav_pinned_app') !== false) {
- $navbar_apps[] = Apps::app_render($app,'navbar');
+ }
+
+
+ if($syslist) {
+ foreach($syslist as $app) {
+ if(\App::$nav_sel['name'] == $app['name'])
+ $app['active'] = true;
+
+ if($is_owner) {
+ if(strpos($app['categories'],'nav_pinned_app') === false) {
+ $nav_apps[] = Apps::app_render($app,'nav');
+ }
}
- else {
- $nav_apps[] = Apps::app_render($app,'nav');
+ elseif(! $is_owner && strpos($app['requires'], 'local_channel') === false) {
+ if(strpos($app['categories'],'nav_pinned_app') === false) {
+ $nav_apps[] = Apps::app_render($app,'nav');
+ }
}
}
}