bootstrap.php 2.71 KB
Newer Older
Aspasia Katsi's avatar
Aspasia Katsi committed
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
<?php

use Slim\App;
use Slim\Container;
use Slim\Http\Request;
use Slim\Http\Response;

/**
 * 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 (App $app) {
    $container = $app->getContainer();
    $events    = $container['events'];

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

$events('on', 'app.services', function ($container) {

        $container[GrEduLabs\UniversityForm\Service\UniversityFormServiceInterface::class] = function ($c) {
            return new GrEduLabs\UniversityForm\Service\UniversityFormService();
        };

        $container[GrEduLabs\UniversityForm\InputFilter\UniversityForm::class] = function ($c) {
            return new GrEduLabs\UniversityForm\InputFilter\UniversityForm();
        };

Aspasia Katsi's avatar
rebase  
Aspasia Katsi committed
35 36 37 38
        $container[GrEduLabs\UniversityForm\InputFilter\UniversityForm1::class] = function ($c) {
            return new GrEduLabs\UniversityForm\InputFilter\UniversityForm1();
        };

Aspasia Katsi's avatar
Aspasia Katsi committed
39 40 41 42 43
	    $container[GrEduLabs\UniversityForm\Action\UniversityForm::class] = function ($c) {
               return new GrEduLabs\UniversityForm\Action\UniversityForm(
                $c->get('view'),
                $c->get(GrEduLabs\UniversityForm\Service\UniversityFormServiceInterface::class),
                $c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm::class),
Aspasia Katsi's avatar
rebase  
Aspasia Katsi committed
44
                $c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm1::class),
Aspasia Katsi's avatar
Aspasia Katsi committed
45 46 47 48
                $c->get('router')->pathFor('university_form.submit_success'),
                $c);
        };

Aspasia Katsi's avatar
rebase  
Aspasia Katsi committed
49 50 51



Aspasia Katsi's avatar
Aspasia Katsi committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
        $container[GrEduLabs\UniversityForm\Action\SubmitSuccess::class] = function ($c) {
            return new GrEduLabs\UniversityForm\Action\SubmitSuccess(
                $c->get('view'),
                $c->get('router')->pathFor('university_form')
            );
        };

});

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

      $app->group('/university-form', function () {
            $this->map(['get', 'post'], '', GrEduLabs\UniversityForm\Action\UniversityForm::class)
                ->add(GrEduLabs\Application\Middleware\AddCsrfToView::class)
                ->add('csrf')
                ->setName('university_form');
            $this->get('/submit-success', GrEduLabs\UniversityForm\Action\SubmitSuccess::class)
                ->setName('university_form.submit_success');
  
     });
    });

};