link grauphel 0.6.2 download
[grauphel.git] / appinfo / application.php
1 <?php
2 namespace OCA\Grauphel\AppInfo;
3 use \OCP\AppFramework\App;
4 use \OCA\Grauphel\Lib\Dependencies;
5
6 class Application extends App
7 {
8     public function __construct(array $urlParams=array())
9     {
10         parent::__construct('grauphel', $urlParams);
11
12         $container = $this->getContainer();
13
14         $container->registerService(
15             'Session',
16             function($c) {
17                 return $c->query('ServerContainer')->getUserSession();
18             }
19         );
20
21         /**
22          * Controllers
23          */
24         $container->registerService(
25             'ApiController',
26             function($c) {
27                 Dependencies::get()->urlGen
28                     = $c->query('ServerContainer')->getURLGenerator();
29                 return new \OCA\Grauphel\Controller\ApiController(
30                     $c->query('AppName'),
31                     $c->query('Request'),
32                     $c->query('Session')->getUser()
33                 );
34             }
35         );
36         $container->registerService(
37             'OauthController',
38             function($c) {
39                 Dependencies::get()->urlGen
40                     = $c->query('ServerContainer')->getURLGenerator();
41                 return new \OCA\Grauphel\Controller\OauthController(
42                     $c->query('AppName'),
43                     $c->query('Request'),
44                     $c->query('Session')->getUser()
45                 );
46             }
47         );
48         $container->registerService(
49             'GuiController',
50             function($c) {
51                 return new \OCA\Grauphel\Controller\GuiController(
52                     $c->query('AppName'),
53                     $c->query('Request'),
54                     $c->query('Session')->getUser(),
55                     $c->query('ServerContainer')->getURLGenerator()
56                 );
57             }
58         );
59         $container->registerService(
60             'NotesController',
61             function($c) {
62                 return new \OCA\Grauphel\Controller\NotesController(
63                     $c->query('AppName'),
64                     $c->query('Request'),
65                     $c->query('Session')->getUser()
66                 );
67             }
68         );
69         $container->registerService(
70             'TokenController',
71             function($c) {
72                 Dependencies::get()->urlGen
73                     = $c->query('ServerContainer')->getURLGenerator();
74                 return new \OCA\Grauphel\Controller\TokenController(
75                     $c->query('AppName'),
76                     $c->query('Request'),
77                     $c->query('Session')->getUser()
78                 );
79             }
80         );
81     }
82 }
83 ?>