star modular application

parent e7ac07b9
.phpintel
vendor
\ No newline at end of file
{
"name": "eellak/gredu_labs",
"type": "application",
"description": "",
"license": "GNU GPLv3",
"authors": [
{
"name": "Vassilis Kanellopoulos",
"email": "contact@kanellov.com",
"homepage": "http://kanellov.com"
},
{
"name": "Giorgos Tsakalos"
},
{
"name": "Nontas Aggelou"
}
],
"require": {
"php": ">=5.5",
"gabordemooij/redbean": "^4.3.1",
"guzzlehttp/guzzle": "^6.1",
"jasig/phpcas": "1.3.4",
"kanellov/config-merge": "dev-master",
"kanellov/php-events": "^1.0.0",
"kanellov/slim-twig-flash": "^0.1",
"monolog/monolog": "^1.13",
"slim/csrf": "^0.6.0",
"slim/flash": "^0.1.0",
"slim/slim": "^3.0",
"slim/twig-view": "^2.0",
"zendframework/zend-authentication": "^2.0",
"zendframework/zend-eventmanager": "^3.0",
"zendframework/zend-ldap": "^2.0",
"zendframework/zend-permissions-acl": "^2.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.*",
"phpunit/phpcov": "2.*",
"phpunit/PHPUnit": "4.*",
"satooshi/php-coveralls": "dev-master"
},
"autoload": {
"psr-4": {
"GrEduLabs\\": "app/src"
}
},
"autoload-dev": {
"psr-4": {
"GrEduLabsTest\\": "test/src"
}
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
File added
dev.config.php
<?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 [
'modules' => [
'module/authentication/bootstrap.php',
'module/authorization/bootstrap.php',
'module/sch_sso/bootstrap.php',
'module/application/bootstrap.php',
],
'cache_config' => 'data/cache/config/settings.php',
];
<?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 [
'modules' => [
'module/debug/bootstrap.php',
],
'cache_config' => false,
];
local.php
*.local.php
\ No newline at end of file
<?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 [
'phpcas' => [
'serverVersion' => 'S1',
'proxy' => false,
'serverHostname' => '',
'serverPort' => 443,
'serverUri' => '/cas',
'changeSessionId' => false,
'handleLogoutRequests' => true,
'allowedClients' => [],
'lang' => 'CAS_Languages_Greek',
'casServerCaCert' => '',
'casServerCnValidate' => '',
'noCasServerValidation' => true,
],
];
\ No newline at end of file
<?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 [
'db' => [
'dsn' => '',
'user' => null,
'pass' => null,
'options' => [
],
],
];
\ No newline at end of file
<?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 [
'logger' => [
'debug_path' => 'data/log/debug.log',
],
];
<?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 [
// Slim Settings
'determineRouteBeforeAppMiddleware' => false,
'displayErrorDetails' => false,
];
<?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 [
'logger' => [
'name' => 'app',
'path' => 'data/log/app.log',
'max_files' => 30,
],
];
<?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 [
'navigation' => [
'main' => [
'index' => [
'label' => 'Αρχική',
'route' => 'index',
'class' => 'hidden',
],
'school' => [
'label' => 'Το σχολείο',
'route' => 'school',
'pages' => [
'info' => [
'label' => 'Πληροφορίες',
'route' => 'school',
'icon' => 'info'
],
'staff' => [
'label' => 'Εκπαιδευτικοί',
'route' => 'school.staff',
'icon' => 'users'
],
'labs' => [
'label' => 'Χώροι',
'route' => 'school.labs',
'icon' => 'building-o'
],
'assets' => [
'label' => 'Εξοπλισμός',
'route' => 'school.assets',
'icon' => 'tv'
],
],
],
// 'app-form' => [
// 'label' => 'Αίτηση',
// 'route' => 'app-form',
// ],
],
'main-right' => [
'login' => [
'label' => 'Σύνδεση',
'route' => 'user.login',
'icon' => 'unlock',
],
'logout' => [
'label' => 'Αποσύνδεση',
'route' => 'user.logout',
'id' => 'nav-logout',
'icon' => 'lock',
],
],
],
];
<?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 [
'view' => [
'template_path' => 'module/application/templates',
'twig' => [
'cache' => 'data/cache/templates',
'debug' => false,
'auto_reload' => true,
],
],
];
*
!.gitignore
\ No newline at end of file
*
!.gitignore
\ No newline at end of file
*
!.gitignore
\ No newline at end of file
*
!.gitignore
\ No newline at end of file
<?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\\Application\\', __DIR__ . '/src');
$container['view'] = function($c) {
$settings = $c['settings'];
$view = new Slim\Views\Twig(
$settings['view']['template_path'],
$settings['view']['twig']
);
$view->addExtension(new Slim\Views\TwigExtension(
$c['router'],
$c['request']->getUri()
));
$view->addExtension(new GrEduLabs\Application\Twig\Extension\Navigation(
$settings['navigation'],
$c->get('router'),
$c->get('request')
));
$view->addExtension(new Knlv\Slim\Views\TwigMessages(
$c['flash']
));
return $view;
};
$container['flash'] = function ($c) {
return new \Slim\Flash\Messages();
};
$container['logger'] = function ($c) {
$settings = $c['settings'];
$logger = new Monolog\Logger($settings['logger']['name']);
$logger->pushProcessor(new Monolog\Processor\UidProcessor());
$logger->pushHandler(new Monolog\Handler\RotatingFileHandler(
$settings['logger']['path'],
$settings['logger']['max_files'],
Monolog\Logger::INFO
));
return $logger;
};
$container['authenticate_redbean_listener'] = function ($c) {
return new GrEduLabs\Application\Authentication\RedbeanListener();
};
$events = $container['events'];
$events('on', 'bootstrap', function () use ($container) {
session_name('GrEduLabs');
session_start();
// setup RedbeanPHP
RedBeanPHP\R::setup(
$container['settings']['db']['dsn'],
$container['settings']['db']['user'],
$container['settings']['db']['pass']
);
}, 1000000);
$events('on', 'authenticate', $container['authenticate_redbean_listener']);
$container['csrf'] = function ($c) {
return new \Slim\Csrf\Guard();
};
$container['GrEduLabs\\Application\\Action\\Index'] = function ($c) {
return new GrEduLabs\Application\Action\Index($c['view']);
};
$container['GrEduLabs\\Application\\Action\\School\\Index'] = function ($c) {
return new GrEduLabs\Application\Action\School\Index($c->get('view'));
};
$container['GrEduLabs\\Application\\Action\\School\\Staff'] = function ($c) {
return new GrEduLabs\Application\Action\School\Staff($c->get('view'));
};
$container['GrEduLabs\\Application\\Action\\School\\Labs'] = function ($c) {
return new GrEduLabs\Application\Action\School\Labs($c->get('view'));
};
$container['GrEduLabs\\Application\\Action\\School\\Assets'] = function ($c) {
return new GrEduLabs\Application\Action\School\Assets($c->get('view'));
};
$app->get('/', 'GrEduLabs\\Application\\Action\\Index')->setName('index');
$app->group('/school', function () {
$this->get('', 'GrEduLabs\\Application\\Action\\School\\Index')->setName('school');
$this->get('/staff', 'GrEduLabs\\Application\\Action\\School\\Staff')->setName('school.staff');
$this->get('/labs', 'GrEduLabs\\Application\\Action\\School\\Labs')->setName('school.labs');
$this->get('/assets', 'GrEduLabs\\Application\\Action\\School\\Assets')->setName('school.assets');
});
};
<?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
*/
namespace GrEduLabs\Action\AppForm;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Twig;
class Index
{
protected $view;
public function __construct(Twig $view)
{
$this->view = $view;
}
public function __invoke(Request $req, Response $res, array $args = [])
{
return $this->view->render($res, 'app-form/index.twig', [
'assets' => [
[
'typeName' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
'quantity' => 2,
],
[
'typeName' => 'LAPTOP',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 1,
],
[
'typeName' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 10,
],
],
'for_choices' => [
[
'label' => 'ΠΛΗΡΕΣ ΕΡΓΑΣΤΗΡΙΟ',
'value' => 'ΠΛΗΡΕΣ ΕΡΓΑΣΤΗΡΙΟ',
],
[
'label' => 'ΑΝΑΒΑΘΜΙΣΗ ΕΡΓΑΣΤΗΡΙΟΥ',
'value' => 'ΑΝΑΒΑΘΜΙΣΗ ΕΡΓΑΣΤΗΡΙΟΥ',
],
[
'label' => 'ΚΙΝΗΤΟ ΕΡΓΑΣΤΗΡΙΟ',
'value' => 'ΚΙΝΗΤΟ ΕΡΓΑΣΤΗΡΙΟ',
],
],
'lab_choices' => [
[
'value' => 1,
'label' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
],
[
'value' => 2,
'label' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
],
],
'type_choices' => [
[
'value' => 1,
'label' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
],
[
'value' => 3,
'label' => 'LAPTOP',
],
[
'value' => 2,
'label' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
],
],
]);
}
}
<?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
*/
namespace GrEduLabs\Action\AppForm;
use Slim\Http\Request;
use Slim\Http\Response;
class SubmitAppForm
{
public function __invoke(Request $req, Response $res, array $args = [])
{
$params = $req->getParams();
var_dump($params);
die();
}
}
<?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
*/
namespace GrEduLabs\Application\Action;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Twig;
class Index
{
/**
* @var Twig
*/
protected $view;
/**
* Constructor
* @param Twig $view
*/
public function __construct(Twig $view)
{
$this->view = $view;
}
public function __invoke(Request $req, Response $res)
{
return $this->view->render($res, 'index.twig');
}
}
<?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
*/
namespace GrEduLabs\Application\Action\School;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Twig;
class Assets
{
protected $view;
public function __construct(Twig $view)
{
$this->view = $view;
}
public function __invoke(Request $req, Response $res, array $args = [])
{
return $this->view->render($res, 'school/assets.twig', [
'assets' => [
[
'id' => 1,
'type' => 1,
'typeName' => 'ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ',
'lab' => 1,
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
'quantity' => 2,
'acquisitionYear' => '2001',
'comments' => 'test',
],
[
'id' => 2,
'type' => 3,
'typeName' => 'LAPTOP',
'lab' => 2,
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 1,
'acquisitionYear' => '2003',
'comments' => 'test',
],
[
'id' => 3,
'type' => 2,
'typeName' => 'ΠΛΗΚΤΡΟΛΟΓΙΟ',
'lab' => 2,
'labName' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'quantity' => 10,
'acquisitionYear' => '2008',
'comments' => 'test',
],
],
]);
}
}
<?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
*/
namespace GrEduLabs\Application\Action\School;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Twig;
class Index
{
protected $view;
public function __construct(Twig $view)
{
$this->view = $view;
}
public function __invoke(Request $req, Response $res, array $args = [])
{
return $this->view->render($res, 'school/index.twig');
}
}
<?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
*/
namespace GrEduLabs\Application\Action\School;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Twig;
class Labs
{
protected $view;
public function __construct(Twig $view)
{
$this->view = $view;
}
public function __invoke(Request $req, Response $res, array $args = [])
{
return $this->view->render($res, 'school/labs.twig', [
'labs' => [
[
'id' => 1,
'name' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 1',
'type' => 1,
'typeName' => 'ΕΡΓΑΣΤΗΡΙΟ',
'responsible' => 1,
'responsibleName' => 'Γιώργος Τάδε',
'area' => 24,
],
[
'id' => 2,
'name' => 'ΕΡΓΑΣΤΗΡΙΟ ΠΛΗΡΟΦ/ΚΗΣ 2',
'type' => 2,
'typeName' => 'ΑΙΘΟΥΣΑ',
'responsible' => 2,
'responsibleName' => 'Νίκος Τάδε',
'area' => 50,
],
],
'staff' => [
[
'value' => 1,
'label' => 'Γιώργος Τάδε',
</