diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2014-10-24 00:08:55 +0400 |
---|---|---|
committer | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2014-10-25 18:18:00 +0400 |
commit | 595b2fbf962b20c71b2ece67c46add57973fd18d (patch) | |
tree | 6e5637992db2bb5845570118c5d76aac590d246b /appinfo/application.php | |
parent | 128b8454cc9e8c13f7ca4c921f3be4477ea87ae1 (diff) |
Migrate major controllers to appframework
Diffstat (limited to 'appinfo/application.php')
-rw-r--r-- | appinfo/application.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/appinfo/application.php b/appinfo/application.php new file mode 100644 index 00000000..25cb3c1c --- /dev/null +++ b/appinfo/application.php @@ -0,0 +1,66 @@ +<?php +/** + * ownCloud - Documents App + * + * @author Victor Dubiniuk + * @copyright 2014 Victor Dubiniuk victor.dubiniuk@gmail.com + * + * This file is licensed under the Affero General Public License version 3 or + * later. + */ + +namespace OCA\Documents\AppInfo; + +use \OCP\AppFramework\App; + +use \OCA\Documents\Controller\UserController; +use \OCA\Documents\Controller\SessionController; +use \OCA\Documents\Controller\DocumentController; + +class Application extends App { + public function __construct (array $urlParams = array()) { + parent::__construct('documents', $urlParams); + + $container = $this->getContainer(); + + /** + * Controllers + */ + $container->registerService('UserController', function($c) { + return new UserController( + $c->query('AppName'), + $c->query('Request') + ); + }); + $container->registerService('SessionController', function($c) { + return new SessionController( + $c->query('AppName'), + $c->query('Request'), + $c->query('UserId') + ); + }); + $container->registerService('DocumentController', function($c) { + return new DocumentController( + $c->query('AppName'), + $c->query('Request'), + $c->query('CoreConfig'), + $c->query('L10N'), + $c->query('UserId') + ); + }); + + /** + * Core + */ + + $container->registerService('CoreConfig', function($c) { + return $c->query('ServerContainer')->getConfig(); + }); + $container->registerService('L10N', function($c) { + return $c->query('ServerContainer')->getL10N($c->query('AppName')); + }); + $container->registerService('UserId', function() { + return \OCP\User::getUser(); + }); + } +} |