2017-05-22 05:23:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Module;
|
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
use Zotlabs\Web\Controller;
|
|
|
|
use Zotlabs\Lib\Apps;
|
2017-05-22 05:23:36 +00:00
|
|
|
|
|
|
|
class Apporder extends \Zotlabs\Web\Controller {
|
|
|
|
|
|
|
|
|
|
|
|
function get() {
|
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
if (! local_channel()) {
|
2017-10-11 09:58:09 +00:00
|
|
|
return;
|
2019-06-17 06:05:15 +00:00
|
|
|
}
|
2017-05-22 05:23:36 +00:00
|
|
|
|
2017-10-11 09:58:09 +00:00
|
|
|
nav_set_selected('Order Apps');
|
2017-05-22 05:23:36 +00:00
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
foreach ( [ 'nav_featured_app', 'nav_pinned_app' ] as $l ) {
|
2018-12-13 03:04:14 +00:00
|
|
|
$syslist = [];
|
2019-06-17 06:05:15 +00:00
|
|
|
$list = Apps::app_list(local_channel(), false, [ $l ]);
|
|
|
|
if ($list) {
|
|
|
|
foreach ($list as $li) {
|
|
|
|
$syslist[] = Apps::app_encode($li);
|
2018-12-13 03:04:14 +00:00
|
|
|
}
|
2017-10-11 09:58:09 +00:00
|
|
|
}
|
2018-12-13 03:04:14 +00:00
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
Apps::translate_system_apps($syslist);
|
2017-10-11 09:58:09 +00:00
|
|
|
|
2018-12-13 03:04:14 +00:00
|
|
|
usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare');
|
2017-10-11 09:58:09 +00:00
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
$syslist = Apps::app_order(local_channel(),$syslist, $l);
|
2017-05-22 05:23:36 +00:00
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
foreach ($syslist as $app) {
|
|
|
|
if ($l === 'nav_pinned_app') {
|
2019-10-03 04:38:32 +00:00
|
|
|
$navbar_apps[] = Apps::app_render($app,'nav-order-pinned');
|
2018-12-13 03:04:14 +00:00
|
|
|
}
|
2019-10-03 04:38:32 +00:00
|
|
|
else {
|
2019-06-17 06:05:15 +00:00
|
|
|
$nav_apps[] = Apps::app_render($app,'nav-order');
|
2018-12-13 03:04:14 +00:00
|
|
|
}
|
2017-11-19 21:42:16 +00:00
|
|
|
}
|
2017-05-22 05:23:36 +00:00
|
|
|
}
|
|
|
|
|
2019-06-17 06:05:15 +00:00
|
|
|
return replace_macros(get_markup_template('apporder.tpl'), [
|
2021-10-30 04:40:26 +00:00
|
|
|
'$arrange' => t('Arrange Apps'),
|
|
|
|
'$header' => [ t('Change order of pinned navbar apps'), t('Change order of app tray apps') ],
|
2019-06-17 06:05:15 +00:00
|
|
|
'$desc' => [ t('Use arrows to move the corresponding app left (top) or right (bottom) in the navbar'),
|
|
|
|
t('Use arrows to move the corresponding app up or down in the app tray') ],
|
|
|
|
'$nav_apps' => $nav_apps,
|
2017-11-19 21:42:16 +00:00
|
|
|
'$navbar_apps' => $navbar_apps
|
2019-06-17 06:05:15 +00:00
|
|
|
]);
|
2017-05-22 05:23:36 +00:00
|
|
|
}
|
|
|
|
}
|