|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* ownCloud - Tasks |
|
4
|
|
|
* |
|
5
|
|
|
* @author Raimund Schlüßler |
|
6
|
|
|
* @copyright 2015 Raimund Schlüßler [email protected] |
|
7
|
|
|
* |
|
8
|
|
|
* This library is free software; you can redistribute it and/or |
|
9
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
10
|
|
|
* License as published by the Free Software Foundation; either |
|
11
|
|
|
* version 3 of the License, or any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* This library is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU Affero General Public |
|
19
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
20
|
|
|
* |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace OCA\Tasks\AppInfo; |
|
24
|
|
|
|
|
25
|
|
|
use \OCP\AppFramework\App; |
|
26
|
|
|
use \OCP\AppFramework\IAppContainer; |
|
27
|
|
|
use \OCA\Tasks\Controller\PageController; |
|
28
|
|
|
use \OCA\Tasks\Controller\CollectionsController; |
|
29
|
|
|
use \OCA\Tasks\Controller\SettingsController; |
|
30
|
|
|
use \OCA\Tasks\Service\CollectionsService; |
|
31
|
|
|
use \OCA\Tasks\Service\SettingsService; |
|
32
|
|
|
|
|
33
|
|
|
class Application extends App { |
|
34
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
public function __construct (array $urlParams=array()) { |
|
37
|
|
|
parent::__construct('tasks', $urlParams); |
|
38
|
|
|
|
|
39
|
|
|
$container = $this->getContainer(); |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Controllers |
|
43
|
|
|
*/ |
|
44
|
|
|
$container->registerService('PageController', function(IAppContainer $c) { |
|
45
|
|
|
return new PageController( |
|
46
|
|
|
$c->query('AppName'), |
|
47
|
|
|
$c->query('Request'), |
|
48
|
|
|
$c->query('UserId'), |
|
49
|
|
|
$c->query('ServerContainer')->getConfig() |
|
50
|
|
|
); |
|
51
|
|
|
}); |
|
52
|
|
|
|
|
53
|
|
|
$container->registerService('CollectionsController', function(IAppContainer $c) { |
|
54
|
|
|
return new CollectionsController( |
|
55
|
|
|
$c->query('AppName'), |
|
56
|
|
|
$c->query('Request'), |
|
57
|
|
|
$c->query('CollectionsService') |
|
58
|
|
|
); |
|
59
|
|
|
}); |
|
60
|
|
|
|
|
61
|
|
|
$container->registerService('SettingsController', function(IAppContainer $c) { |
|
62
|
|
|
return new SettingsController( |
|
63
|
|
|
$c->query('AppName'), |
|
64
|
|
|
$c->query('Request'), |
|
65
|
|
|
$c->query('SettingsService') |
|
66
|
|
|
); |
|
67
|
|
|
}); |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Services |
|
71
|
|
|
*/ |
|
72
|
|
|
|
|
73
|
|
|
$container->registerService('CollectionsService', function(IAppContainer $c) { |
|
74
|
|
|
return new CollectionsService( |
|
75
|
|
|
$c->query('UserId'), |
|
76
|
|
|
$c->query('L10N'), |
|
77
|
|
|
$c->query('Settings'), |
|
78
|
|
|
$c->query('AppName') |
|
79
|
|
|
); |
|
80
|
|
|
}); |
|
81
|
|
|
|
|
82
|
|
|
$container->registerService('SettingsService', function(IAppContainer $c) { |
|
83
|
|
|
return new SettingsService( |
|
84
|
|
|
$c->query('UserId'), |
|
85
|
|
|
$c->query('Settings'), |
|
86
|
|
|
$c->query('AppName') |
|
87
|
|
|
); |
|
88
|
|
|
}); |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Core |
|
92
|
|
|
*/ |
|
93
|
|
|
$container->registerService('UserId', function(IAppContainer $c) { |
|
94
|
|
|
$user = $c->query('ServerContainer')->getUserSession()->getUser(); |
|
95
|
|
|
|
|
96
|
|
|
return ($user) ? $user->getUID() : ''; |
|
97
|
|
|
}); |
|
98
|
|
|
|
|
99
|
|
|
$container->registerService('L10N', function(IAppContainer $c) { |
|
100
|
|
|
return $c->query('ServerContainer')->getL10N($c->query('AppName')); |
|
101
|
|
|
}); |
|
102
|
|
|
|
|
103
|
|
|
$container->registerService('Settings', function(IAppContainer $c) { |
|
104
|
|
|
return $c->query('ServerContainer')->getConfig(); |
|
105
|
|
|
}); |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|