2014-08-17 20:35:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ownCloud - Tasks
|
|
|
|
*
|
|
|
|
* @author Raimund Schlüßler
|
|
|
|
* @copyright 2014 Raimund Schlüßler raimund.schluessler@googlemail.com
|
|
|
|
*
|
|
|
|
* 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;
|
|
|
|
use \OCA\Tasks\Controller\PageController;
|
|
|
|
use \OCA\Tasks\Controller\CollectionsController;
|
|
|
|
use \OCA\Tasks\Controller\ListsController;
|
|
|
|
use \OCA\Tasks\Controller\SettingsController;
|
|
|
|
use \OCA\Tasks\Controller\TasksController;
|
2015-06-18 13:09:07 +00:00
|
|
|
use \OCA\Tasks\Service\TasksService;
|
2015-06-23 10:08:52 +00:00
|
|
|
use \OCA\Tasks\Service\ListsService;
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
$container->registerService('PageController', function($c) {
|
|
|
|
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'),
|
|
|
|
$c->query('UserId')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('CollectionsController', function($c) {
|
|
|
|
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
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('ListsController', function($c) {
|
|
|
|
return new ListsController(
|
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('ListsService')
|
2014-08-17 20:35:34 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('SettingsController', function($c) {
|
|
|
|
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
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('TasksController', function($c) {
|
|
|
|
return new TasksController(
|
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('TasksService')
|
2015-06-18 13:09:07 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Services
|
|
|
|
*/
|
|
|
|
$container->registerService('TasksService', function($c) {
|
|
|
|
return new TasksService(
|
2014-08-17 20:35:34 +00:00
|
|
|
$c->query('UserId')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2015-06-23 10:08:52 +00:00
|
|
|
$container->registerService('ListsService', function($c) {
|
|
|
|
return new ListsService(
|
|
|
|
$c->query('UserId')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('CollectionsService', function($c) {
|
|
|
|
return new CollectionsService(
|
|
|
|
$c->query('UserId'),
|
|
|
|
$c->query('L10N'),
|
|
|
|
$c->query('Settings'),
|
|
|
|
$c->query('AppName')
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('SettingsService', function($c) {
|
|
|
|
return new SettingsService(
|
|
|
|
$c->query('UserId'),
|
|
|
|
$c->query('Settings'),
|
|
|
|
$c->query('AppName')
|
|
|
|
);
|
|
|
|
});
|
2014-08-17 20:35:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Core
|
|
|
|
*/
|
2015-02-28 20:39:06 +00:00
|
|
|
$container->registerService('UserId', function() {
|
2014-08-17 20:35:34 +00:00
|
|
|
return \OCP\User::getUser();
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('L10N', function($c) {
|
|
|
|
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
|
|
|
|
});
|
|
|
|
|
|
|
|
$container->registerService('Settings', function($c) {
|
|
|
|
return $c->query('ServerContainer')->getConfig();
|
|
|
|
});
|
2015-02-04 21:21:29 +00:00
|
|
|
|
|
|
|
\OC::$server->getSearch()->registerProvider('OCA\Tasks\Controller\SearchController', array('apps' => array('tasks')));
|
2014-08-17 20:35:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-18 13:09:07 +00:00
|
|
|
}
|