bootstrap.php.orig 4.31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
 * gredu_labs.
 * 
 * @link https://github.com/eellak/gredu_labs for the canonical source repository
 *
 * @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/)
 * @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html
 */

return function (Slim\App $app) {

    $container = $app->getContainer();
    $events    = $container['events'];

<<<<<<< HEAD
    $events('on', 'app.autoload', function ($stop, $autoloader) {
        $autoloader->addPsr4('GrEduLabs\\Schools\\', __DIR__ . '/src/');
    });

    $events('on', 'app.services', function ($stop, $container) {
        $container[GrEduLabs\Schools\Action\Index::class] = function ($c) {
            return new GrEduLabs\Schools\Action\Index($c->get('view'));
        };

        $container[GrEduLabs\Schools\Action\Staff::class] = function ($c) {
            return new GrEduLabs\Schools\Action\Staff($c->get('view'));
        };
=======
    $container['autoloader']->addPsr4('GrEduLabs\\Schools\\', __DIR__ . '/src/');

    $container[GrEduLabs\Schools\Action\Index::class] = function ($c) {
        return new GrEduLabs\Schools\Action\Index(
            $c->get('view'),
            $c->get('schoolservice')
        );
    };

    $container[GrEduLabs\Schools\Action\Staff::class] = function ($c) {
        return new GrEduLabs\Schools\Action\Staff(
            $c->get('view'),
            $c->get('staffservice')
            );
    };

    $container[GrEduLabs\Schools\Action\StaffCreate::class] = function ($c) {
        return new GrEduLabs\Schools\Action\StaffCreate(
            $c->get('staffservice')
            );
    };

    $container[GrEduLabs\Schools\Action\Labs::class] = function ($c) {
        return new GrEduLabs\Schools\Action\Labs(
            $c->get('view')
            );
    };

    $container[GrEduLabs\Schools\Action\LabCreate::class] = function ($c) {
        return new GrEduLabs\Schools\Action\LabCreate(
            $c->get('labservice')
            );
    };
>>>>>>> gtsakalos/modular

        $container[GrEduLabs\Schools\Action\Labs::class] = function ($c) {
            return new GrEduLabs\Schools\Action\Labs($c->get('view'));
        };

<<<<<<< HEAD
        $container[GrEduLabs\Schools\Action\Assets::class] = function ($c) {
            return new GrEduLabs\Schools\Action\Assets($c->get('view'));
        };
    });
=======
    $container['schoolservice'] = function($c){
        return new GrEduLabs\Schools\Service\SchoolService();
    };

    $container['staffservice'] = function($c){
        return new GrEduLabs\Schools\Service\StaffService(
            $c->get('schoolservice')
        );
    };

    $container['labservice'] = function($c){
        return new GrEduLabs\Schools\Service\LabService(
            $c->get('schoolservice'),
            $c->get('staffservice')
        );
    };

    $container['assetservice'] = function($c){
        return new GrEduLabs\Schools\Service\AssetService(
            $c->get('schoolservice'),
            $c->get('labservice')
        );
    };


    $events = $container['events'];
>>>>>>> gtsakalos/modular

    $events('on', 'app.bootstrap', function ($stop, $app, $container) {
        $container['view']->getEnvironment()->getLoader()->prependPath(__DIR__ . '/templates');

<<<<<<< HEAD
        $app->group('/school', function () {
            $this->get('', GrEduLabs\Schools\Action\Index::class)->setName('school');
            $this->get('/staff', GrEduLabs\Schools\Action\Staff::class)->setName('school.staff');
            $this->get('/labs', GrEduLabs\Schools\Action\Labs::class)->setName('school.labs');
            $this->get('/assets', GrEduLabs\Schools\Action\Assets::class)->setName('school.assets');
        });
=======
    $app->group('/school', function () {
        $this->get('', GrEduLabs\Schools\Action\Index::class)->setName('school');
        $this->get('/staff', GrEduLabs\Schools\Action\Staff::class)->setName('school.staff');
        $this->post('/staff', GrEduLabs\Schools\Action\StaffCreate::class)->setName('school.staffcreate');
        $this->get('/labs', GrEduLabs\Schools\Action\Labs::class)->setName('school.labs');
        $this->post('/labs', GrEduLabs\Schools\Action\LabCreate::class)->setName('school.labcreate');
        $this->get('/assets', GrEduLabs\Schools\Action\Assets::class)->setName('school.assets');
>>>>>>> gtsakalos/modular
    });


};