69d15722c18f301f1ca2c66c455846507c1c0a7c
[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     }
49 }
50 ?>