diff options
author | Felix A. Epp <work@felixepp.de> | 2017-01-21 17:10:08 +0100 |
---|---|---|
committer | Jan-Christoph Borchardt <hey@jancborchardt.net> | 2017-04-25 00:22:01 +0200 |
commit | 89ac71355df63bbad814d05999cc44d98d75fadf (patch) | |
tree | 7a21e5bc75de41d4c00ecadac4774e2dc2946342 /settings/Controller | |
parent | 91a4676fc0034f63bacc36ea2591599b373e5447 (diff) | |
download | nextcloud-server-89ac71355df63bbad814d05999cc44d98d75fadf.tar.gz nextcloud-server-89ac71355df63bbad814d05999cc44d98d75fadf.zip |
Add apps category 'all installed'
Signed-off-by: Felix A. Epp <work@felixepp.de>
Diffstat (limited to 'settings/Controller')
-rw-r--r-- | settings/Controller/AppSettingsController.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 6a5b5210c0f..89cf5b6b7da 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -49,6 +49,7 @@ use OCP\L10N\IFactory; class AppSettingsController extends Controller { const CAT_ENABLED = 0; const CAT_DISABLED = 1; + const CAT_ALL_INSTALLED = 2; /** @var \OCP\IL10N */ private $l10n; @@ -103,7 +104,7 @@ class AppSettingsController extends Controller { */ public function viewApps($category = '') { if ($category === '') { - $category = 'enabled'; + $category = 'installed'; } $params = []; @@ -128,6 +129,7 @@ class AppSettingsController extends Controller { $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); $formattedCategories = [ + ['id' => self::CAT_ALL_INSTALLED, 'ident' => 'installed', 'displayName' => (string)$this->l10n->t('All installed')], ['id' => self::CAT_ENABLED, 'ident' => 'enabled', 'displayName' => (string)$this->l10n->t('Enabled')], ['id' => self::CAT_DISABLED, 'ident' => 'disabled', 'displayName' => (string)$this->l10n->t('Not enabled')], ]; @@ -270,6 +272,24 @@ class AppSettingsController extends Controller { switch ($category) { // installed apps + case 'installed': + $apps = $appClass->listAllApps(); + + foreach($apps as $key => $app) { + $newVersion = \OC\Installer::isUpdateAvailable($app['id'], $this->appFetcher); + $apps[$key]['update'] = $newVersion; + } + + usort($apps, function ($a, $b) { + $a = (string)$a['name']; + $b = (string)$b['name']; + if ($a === $b) { + return 0; + } + return ($a < $b) ? -1 : 1; + }); + break; + // enabled apps case 'enabled': $apps = $appClass->listAllApps(); $apps = array_filter($apps, function ($app) { |