2014-08-17 20:35:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2017-01-15 19:59:31 +00:00
|
|
|
* Nextcloud - Tasks
|
2014-08-17 20:35:34 +00:00
|
|
|
*
|
|
|
|
* @author Raimund Schlüßler
|
2018-08-19 20:33:26 +00:00
|
|
|
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
|
2014-08-17 20:35:34 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\Tasks\AppInfo;
|
|
|
|
|
|
|
|
use \OCP\AppFramework\App;
|
2016-03-08 21:23:27 +00:00
|
|
|
use \OCP\AppFramework\IAppContainer;
|
2014-08-17 20:35:34 +00:00
|
|
|
use \OCA\Tasks\Controller\PageController;
|
|
|
|
use \OCA\Tasks\Controller\CollectionsController;
|
|
|
|
use \OCA\Tasks\Controller\SettingsController;
|
2015-06-23 10:08:52 +00:00
|
|
|
use \OCA\Tasks\Service\CollectionsService;
|
|
|
|
use \OCA\Tasks\Service\SettingsService;
|
2014-08-17 20:35:34 +00:00
|
|
|
|
|
|
|
class Application extends App {
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct (array $urlParams=array()) {
|
|
|
|
parent::__construct('tasks', $urlParams);
|
|
|
|
|
|
|
|
$container = $this->getContainer();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Controllers
|
|
|
|
*/
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('PageController', function(IAppContainer $c) {
|
2014-08-17 20:35:34 +00:00
|
|
|
return new PageController(
|
2015-06-23 10:08:52 +00:00
|
|
|
$c->query('AppName'),
|
2014-08-17 20:35:34 +00:00
|
|
|
$c->query('Request'),
|
2019-01-26 19:21:23 +00:00
|
|
|
$c->query('UserSession'),
|
2016-03-01 20:48:25 +00:00
|
|
|
$c->query('UserId'),
|
|
|
|
$c->query('ServerContainer')->getConfig()
|
2014-08-17 20:35:34 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('CollectionsController', function(IAppContainer $c) {
|
2014-08-17 20:35:34 +00:00
|
|
|
return new CollectionsController(
|
2015-06-23 10:08:52 +00:00
|
|
|
$c->query('AppName'),
|
2014-08-17 20:35:34 +00:00
|
|
|
$c->query('Request'),
|
2015-06-23 10:08:52 +00:00
|
|
|
$c->query('CollectionsService')
|
2014-08-17 20:35:34 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('SettingsController', function(IAppContainer $c) {
|
2014-08-17 20:35:34 +00:00
|
|
|
return new SettingsController(
|
2015-06-23 10:08:52 +00:00
|
|
|
$c->query('AppName'),
|
2014-08-17 20:35:34 +00:00
|
|
|
$c->query('Request'),
|
2015-06-23 10:08:52 +00:00
|
|
|
$c->query('SettingsService')
|
2014-08-17 20:35:34 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2015-06-18 13:09:07 +00:00
|
|
|
/**
|
|
|
|
* Services
|
|
|
|
*/
|
2015-06-23 10:08:52 +00:00
|
|
|
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('CollectionsService', function(IAppContainer $c) {
|
2015-06-23 10:08:52 +00:00
|
|
|
return new CollectionsService(
|
|
|
|
$c->query('UserId'),
|
|
|
|
$c->query('L10N'),
|
|
|
|
$c->query('Settings'),
|
|
|
|
$c->query('AppName')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('SettingsService', function(IAppContainer $c) {
|
2015-06-23 10:08:52 +00:00
|
|
|
return new SettingsService(
|
|
|
|
$c->query('UserId'),
|
|
|
|
$c->query('Settings'),
|
|
|
|
$c->query('AppName')
|
|
|
|
);
|
|
|
|
});
|
2014-08-17 20:35:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Core
|
|
|
|
*/
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('UserId', function(IAppContainer $c) {
|
2015-08-29 13:41:47 +00:00
|
|
|
$user = $c->query('ServerContainer')->getUserSession()->getUser();
|
|
|
|
|
|
|
|
return ($user) ? $user->getUID() : '';
|
2017-01-15 19:59:31 +00:00
|
|
|
});
|
2014-08-17 20:35:34 +00:00
|
|
|
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('L10N', function(IAppContainer $c) {
|
2014-08-17 20:35:34 +00:00
|
|
|
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
|
|
|
|
});
|
|
|
|
|
2016-03-08 21:23:27 +00:00
|
|
|
$container->registerService('Settings', function(IAppContainer $c) {
|
2014-08-17 20:35:34 +00:00
|
|
|
return $c->query('ServerContainer')->getConfig();
|
|
|
|
});
|
|
|
|
}
|
2015-06-18 13:09:07 +00:00
|
|
|
}
|