1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* ownCloud - Documents App |
4
|
|
|
* |
5
|
|
|
* @author Victor Dubiniuk |
6
|
|
|
* @copyright 2014 Victor Dubiniuk [email protected] |
7
|
|
|
* |
8
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
9
|
|
|
* later. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace OCA\Documents\AppInfo; |
13
|
|
|
|
14
|
|
|
use \OCP\AppFramework\App; |
15
|
|
|
|
16
|
|
|
use \OCA\Documents\Controller\UserController; |
17
|
|
|
use \OCA\Documents\Controller\SessionController; |
18
|
|
|
use \OCA\Documents\Controller\DocumentController; |
19
|
|
|
use \OCA\Documents\Controller\SettingsController; |
20
|
|
|
use \OCA\Documents\AppConfig; |
21
|
|
|
|
22
|
|
|
class Application extends App { |
23
|
|
|
public function __construct (array $urlParams = array()) { |
24
|
|
|
parent::__construct('documents', $urlParams); |
25
|
|
|
|
26
|
|
|
$container = $this->getContainer(); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Controllers |
30
|
|
|
*/ |
31
|
|
|
$container->registerService('UserController', function($c) { |
32
|
|
|
return new UserController( |
33
|
|
|
$c->query('AppName'), |
34
|
|
|
$c->query('Request') |
35
|
|
|
); |
36
|
|
|
}); |
37
|
|
|
$container->registerService('SessionController', function($c) { |
38
|
|
|
return new SessionController( |
39
|
|
|
$c->query('AppName'), |
40
|
|
|
$c->query('Request'), |
41
|
|
|
$c->query('Logger'), |
42
|
|
|
$c->query('UserId') |
43
|
|
|
); |
44
|
|
|
}); |
45
|
|
|
$container->registerService('DocumentController', function($c) { |
46
|
|
|
return new DocumentController( |
47
|
|
|
$c->query('AppName'), |
48
|
|
|
$c->query('Request'), |
49
|
|
|
$c->query('CoreConfig'), |
50
|
|
|
$c->query('L10N'), |
51
|
|
|
$c->query('UserId') |
52
|
|
|
); |
53
|
|
|
}); |
54
|
|
|
$container->registerService('SettingsController', function($c) { |
55
|
|
|
return new SettingsController( |
56
|
|
|
$c->query('AppName'), |
57
|
|
|
$c->query('Request'), |
58
|
|
|
$c->query('L10N'), |
59
|
|
|
$c->query('AppConfig'), |
60
|
|
|
$c->query('UserId') |
61
|
|
|
); |
62
|
|
|
}); |
63
|
|
|
|
64
|
|
|
$container->registerService('AppConfig', function($c) { |
65
|
|
|
return new AppConfig( |
66
|
|
|
$c->query('CoreConfig') |
67
|
|
|
); |
68
|
|
|
}); |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Core |
72
|
|
|
*/ |
73
|
|
|
$container->registerService('Logger', function($c) { |
74
|
|
|
return $c->query('ServerContainer')->getLogger(); |
75
|
|
|
}); |
76
|
|
|
$container->registerService('CoreConfig', function($c) { |
77
|
|
|
return $c->query('ServerContainer')->getConfig(); |
78
|
|
|
}); |
79
|
|
|
$container->registerService('L10N', function($c) { |
80
|
|
|
return $c->query('ServerContainer')->getL10N($c->query('AppName')); |
81
|
|
|
}); |
82
|
|
|
$container->registerService('UserId', function($c) { |
83
|
|
|
$user = $c->query('ServerContainer')->getUserSession()->getUser(); |
84
|
|
|
$uid = is_null($user) ? '' : $user->getUID(); |
85
|
|
|
return $uid; |
86
|
|
|
}); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|