streams/Zotlabs/Module/Apporder.php

53 lines
1.3 KiB
PHP
Raw Normal View History

<?php
namespace Zotlabs\Module;
2019-06-17 06:05:15 +00:00
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Apporder extends \Zotlabs\Web\Controller {
function get() {
2019-06-17 06:05:15 +00:00
if (! local_channel()) {
return;
2019-06-17 06:05:15 +00:00
}
nav_set_selected('Order Apps');
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
}
}
2018-12-13 03:04:14 +00:00
2019-06-17 06:05:15 +00:00
Apps::translate_system_apps($syslist);
2018-12-13 03:04:14 +00:00
usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare');
2019-06-17 06:05:15 +00:00
$syslist = Apps::app_order(local_channel(),$syslist, $l);
2019-06-17 06:05:15 +00:00
foreach ($syslist as $app) {
if ($l === 'nav_pinned_app') {
$navbar_apps[] = Apps::app_render($app,'nav-order-pinned');
2018-12-13 03:04:14 +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
}
}
}
2019-06-17 06:05:15 +00:00
return replace_macros(get_markup_template('apporder.tpl'), [
'$header' => [ t('Change Order of Pinned Navbar Apps'), t('Change Order of App Tray Apps') ],
'$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,
'$navbar_apps' => $navbar_apps
2019-06-17 06:05:15 +00:00
]);
}
}