bootstrap.php 1.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
<?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();
14
    $events    = $container['events'];
15

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

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

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

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

33 34 35 36
        $container[GrEduLabs\Schools\Action\Assets::class] = function ($c) {
            return new GrEduLabs\Schools\Action\Assets($c->get('view'));
        };
    });
37

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

41 42 43 44 45 46
        $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');
        });
47
    });
48 49


50
};