aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
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 /Zotlabs/Lib
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 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Apps.php38
1 files changed, 26 insertions, 12 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index b13658be2..8cf62c01a 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -808,12 +808,14 @@ class Apps {
return($r);
}
- static public function app_order($uid,$apps) {
+ static public function app_order($uid,$apps,$menu) {
if(! $apps)
return $apps;
- $x = (($uid) ? get_pconfig($uid,'system','app_order') : get_config('system','app_order'));
+ $conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
+
+ $x = (($uid) ? get_pconfig($uid,'system',$conf) : get_config('system',$conf));
if(($x) && (! is_array($x))) {
$y = explode(',',$x);
$y = array_map('trim',$y);
@@ -850,19 +852,25 @@ class Apps {
return false;
}
- static function moveup($uid,$guid) {
+ static function moveup($uid,$guid,$menu) {
$syslist = array();
- $list = self::app_list($uid, false, ['nav_featured_app', 'nav_pinned_app']);
+
+ $conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
+
+ $list = self::app_list($uid, false, [ $menu ]);
if($list) {
foreach($list as $li) {
- $syslist[] = self::app_encode($li);
+ $papp = self::app_encode($li);
+ if($menu !== 'nav_pinned_app' && strpos($papp['categories'],'nav_pinned_app') !== false)
+ continue;
+ $syslist[] = $papp;
}
}
self::translate_system_apps($syslist);
usort($syslist,'self::app_name_compare');
- $syslist = self::app_order($uid,$syslist);
+ $syslist = self::app_order($uid,$syslist,$menu);
if(! $syslist)
return;
@@ -887,23 +895,29 @@ class Apps {
$narr[] = $x['name'];
}
- set_pconfig($uid,'system','app_order',implode(',',$narr));
+ set_pconfig($uid,'system',$conf,implode(',',$narr));
}
- static function movedown($uid,$guid) {
+ static function movedown($uid,$guid,$menu) {
$syslist = array();
- $list = self::app_list($uid, false, ['nav_featured_app', 'nav_pinned_app']);
+
+ $conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
+
+ $list = self::app_list($uid, false, [ $menu ]);
if($list) {
foreach($list as $li) {
- $syslist[] = self::app_encode($li);
+ $papp = self::app_encode($li);
+ if($menu !== 'nav_pinned_app' && strpos($papp['categories'],'nav_pinned_app') !== false)
+ continue;
+ $syslist[] = $papp;
}
}
self::translate_system_apps($syslist);
usort($syslist,'self::app_name_compare');
- $syslist = self::app_order($uid,$syslist);
+ $syslist = self::app_order($uid,$syslist,$menu);
if(! $syslist)
return;
@@ -928,7 +942,7 @@ class Apps {
$narr[] = $x['name'];
}
- set_pconfig($uid,'system','app_order',implode(',',$narr));
+ set_pconfig($uid,'system',$conf,implode(',',$narr));
}