diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-25 20:17:52 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-04-26 20:07:49 +0200 |
commit | 4b1ac3fef204b9ac252766fb7496b3ec5fbed731 (patch) | |
tree | d453b978d5fa54ef1224fe59101137fafb423b9c /settings/Controller/AppSettingsController.php | |
parent | 47cd9760350baaf24bdf92c7a77129e59ec2f8f3 (diff) | |
download | nextcloud-server-4b1ac3fef204b9ac252766fb7496b3ec5fbed731.tar.gz nextcloud-server-4b1ac3fef204b9ac252766fb7496b3ec5fbed731.zip |
Add titles
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'settings/Controller/AppSettingsController.php')
-rw-r--r-- | settings/Controller/AppSettingsController.php | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/settings/Controller/AppSettingsController.php b/settings/Controller/AppSettingsController.php index 0d204bd47ab..a8b6d8b242d 100644 --- a/settings/Controller/AppSettingsController.php +++ b/settings/Controller/AppSettingsController.php @@ -127,12 +127,7 @@ class AppSettingsController extends Controller { return $templateResponse; } - /** - * Get all available categories - * - * @return JSONResponse - */ - public function listCategories() { + private function getAllCategories() { $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); $formattedCategories = [ @@ -150,7 +145,16 @@ class AppSettingsController extends Controller { ]; } - return new JSONResponse($formattedCategories); + return $formattedCategories; + } + + /** + * Get all available categories + * + * @return JSONResponse + */ + public function listCategories() { + return new JSONResponse($this->getAllCategories()); } /** @@ -346,17 +350,34 @@ class AppSettingsController extends Controller { $bundles = $this->bundleFetcher->getBundles(); $apps = []; foreach($bundles as $bundle) { - $apps[] = [ - 'id' => $bundle->getIdentifier(), - 'author' => 'Nextcloud', - 'name' => $bundle->getName() . ' (' . $bundle->getDescription() .')', - 'description' => '', - 'internal' => true, - 'active' => false, - 'removable' => false, - 'groups' => [], - 'apps' => $bundle->getAppIdentifiers(), - ]; + $newCategory = true; + $allApps = $appClass->listAllApps(); + $categories = $this->getAllCategories(); + foreach($categories as $singleCategory) { + $newApps = $this->getAppsForCategory($singleCategory['id']); + foreach($allApps as $app) { + foreach($newApps as $key => $newApp) { + if($app['id'] === $newApp['id']) { + unset($newApps[$key]); + } + } + } + $allApps = array_merge($allApps, $newApps); + } + + foreach($bundle->getAppIdentifiers() as $identifier) { + foreach($allApps as $app) { + if($app['id'] === $identifier) { + if($newCategory) { + $app['newCategory'] = true; + $app['categoryName'] = $bundle->getName(); + } + $newCategory = false; + $apps[] = $app; + continue; + } + } + } } break; default: |