bootstrap.php 1.63 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
<?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();

    $container['autoloader']->addPsr4('GrEduLabs\\Schools\\', __DIR__ . '/src/');

    $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[GrEduLabs\Schools\Action\Labs::class] = function ($c) {
        return new GrEduLabs\Schools\Action\Labs($c->get('view'));
    };

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

    $events = $container['events'];

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

    $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');
    });
};