diff options
author | zotlabs <mike@macgirvin.com> | 2017-05-21 22:23:36 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-05-23 21:44:25 +0200 |
commit | ec7ecc285ec10a7990db09bda436fd498e05245a (patch) | |
tree | 2efd4921738d35175cacdc40ead40da3276f51d0 /Zotlabs/Lib | |
parent | dea0d07b9af9a5927dd524a3e486317690a7e112 (diff) | |
download | volse-hubzilla-ec7ecc285ec10a7990db09bda436fd498e05245a.tar.gz volse-hubzilla-ec7ecc285ec10a7990db09bda436fd498e05245a.tar.bz2 volse-hubzilla-ec7ecc285ec10a7990db09bda436fd498e05245a.zip |
apporder module and all the associated backend stuff to make it work; probably needs a bit of UI cleanup and a link to it from somewhere
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r-- | Zotlabs/Lib/Apps.php | 87 |
1 files changed, 86 insertions, 1 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 102ed8bd1..a655f47b0 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -370,7 +370,8 @@ class Apps { '$deleted' => $papp['deleted'], '$feature' => (($papp['embed']) ? false : true), '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), - '$navapps' => (($mode == 'nav') ? true : false), + '$navapps' => (($mode == 'nav' || $mode='nav-order') ? true : false), + '$order' => (($mode='nav-order') ? true : false), '$add' => t('Add to app-tray'), '$remove' => t('Remove from app-tray') )); @@ -581,6 +582,90 @@ class Apps { return false; } + static function moveup($uid,$guid) { + $syslist = array(); + $list = self::app_list($uid, false, 'nav_featured_app'); + if($list) { + foreach($list as $li) { + $syslist[] = self::app_encode($li); + } + } + self::translate_system_apps($syslist); + + usort($syslist,'self::app_name_compare'); + + $syslist = self::app_order($uid,$syslist); + + if(! $syslist) + return; + + $newlist = []; + + foreach($syslist as $k => $li) { + if($li['guid'] === $guid) { + $position = $k; + break; + } + } + if(! $position) + return; + $dest_position = $position - 1; + $saved = $syslist[$dest_position]; + $syslist[$dest_position] = $syslist[$position]; + $syslist[$position] = $saved; + + $narr = []; + foreach($syslist as $x) { + $narr[] = $x['name']; + } + + set_pconfig($uid,'system','app_order',implode(',',$narr)); + + } + + static function movedown($uid,$guid) { + $syslist = array(); + $list = self::app_list($uid, false, 'nav_featured_app'); + if($list) { + foreach($list as $li) { + $syslist[] = self::app_encode($li); + } + } + self::translate_system_apps($syslist); + + usort($syslist,'self::app_name_compare'); + + $syslist = self::app_order($uid,$syslist); + + if(! $syslist) + return; + + $newlist = []; + + foreach($syslist as $k => $li) { + if($li['guid'] === $guid) { + $position = $k; + break; + } + } + if($position >= count($syslist) - 1) + return; + $dest_position = $position + 1; + $saved = $syslist[$dest_position]; + $syslist[$dest_position] = $syslist[$position]; + $syslist[$position] = $saved; + + $narr = []; + foreach($syslist as $x) { + $narr[] = $x['name']; + } + + set_pconfig($uid,'system','app_order',implode(',',$narr)); + + } + + + |