Commit 51bfb4ac authored by Vassilis Kanellopoulos's avatar Vassilis Kanellopoulos

Merge branch 'modular' into develop

Conflicts:
	.gitignore
	composer.json
	composer.lock
	config/.gitignore
	public/.htaccess
	public/css/style.css
	public/index.php
parents 654735e5 e64dc374
This diff is collapsed.
local.php
*.local.php
\ No newline at end of file
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/application/bootstrap.php',
'module/assets_manager/bootstrap.php',
'module/authentication/bootstrap.php',
'module/authorization/bootstrap.php',
'module/sch_ldap/bootstrap.php',
'module/sch_sso/bootstrap.php',
'module/sch_mm/bootstrap.php',
'module/sch_inventory/bootstrap.php',
'module/sch_sync/bootstrap.php',
'module/schools/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 [
'acl' => [
'default_role' => 'guest',
'roles' => [
'guest' => [],
'user' => [],
'school' => ['user'],
'admin' => ['user'],
],
'resoures' => [],
'guards' => [
'resources' => [],
'callables' => [],
'routes' => [
['/', ['guest', 'user'], ['get']],
],
],
],
];
<?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 [
'assets' => [
'web_dir' => 'public',
'paths' => [
'module/schools/public',
],
],
];
<?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 [
'acl' => [
'guards' => [
'routes' => [
['/user/login', ['guest'], ['get', 'post']],
['/user/logout', ['user'], ['get']],
],
],
],
];
<?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 [
'authentication' => [
'bcrypt' => [
'salt' => '',
'cost' => 14,
],
],
];
\ 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 return [
'inventory' => [
'base_uri' => '',
],
];
\ 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 [
'ldap' => [
'host' => '',
'username' => '',
'password' => '',
'baseDn' => '',
'port' => 389,
'useSsl' => false,
'bindRequiresDn' => true,
'accountCanonicalForm' => null,
'accountDomainName' => null,
'accountDomainNameShort' => null,
'accountFilterFormat' => null,
'allowEmptyPassword' => false,
'useStartTls' => false,
'optReferrals' => false,
'tryUsernameSplit' => true,
'networkTimeout' => null,
],
];
\ 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' => [
'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',
// ],
],
],
];
<?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 [
'sch_mm' => [
'api_url' => '',
'api_user' => '',
'api_pass' => '',
]
];
\ 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 [
'acl' => [
'guards' => [
'routes' => [
['/school', ['school'], ['get']],
['/school/labs', ['school'], ['get']],
['/school/staff', ['school'], ['get', 'post']],
['/school/staff/{id:[1-9][0-9]*}', ['school'], ['delete']],
['/school/assets', ['school'], ['get']],
],
],
],
];
<?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 [
'sso' => [
'phpcas' => [
'serverVersion' => 'S1',
'proxy' => false,
'serverHostname' => '',
'serverPort' => 443,
'serverUri' => '/cas',
'changeSessionId' => false,
'handleLogoutRequests' => true,
'allowedClients' => [],
'lang' => 'CAS_Languages_Greek',
'casServerCaCert' => '',
'casServerCnValidate' => '',
'noCasServerValidation' => true,
],
'allowed' => [
[
'physicaldeliveryofficename' => '/^ΕΠΙΣΗΜΟΣ ΛΟΓΑΡΙΑΣΜΟΣ$/i',
'umdobject' => '/^account$/i',
],
],
],
'acl' => [
'guards' => [
'routes' => [
['/user/logout/sso', ['guest'], ['get']],
],
],
],
];
\ 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 [
'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
<?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'];
$events('on', 'app.autoload', function ($stop, $autoloader) {
$autoloader->addPsr4('GrEduLabs\\Application\\', __DIR__ . '/src');
});
$events('on', 'app.services', function ($stop, $container) {
session_name('GrEduLabs');
session_start();
// setup RedbeanPHP
define('REDBEAN_MODEL_PREFIX', '');
RedBeanPHP\R::setup(
$container['settings']['db']['dsn'],
$container['settings']['db']['user'],
$container['settings']['db']['pass']
);
// RedBeanPHP\R::freeze();
$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($c[GrEduLabs\Application\Twig\Extension\Navigation::class]);
$view->addExtension(new Knlv\Slim\Views\TwigMessages(
$c['flash']
));
return $view;
};
$container[GrEduLabs\Application\Twig\Extension\Navigation::class] = function ($c) {
return new GrEduLabs\Application\Twig\Extension\Navigation(
$c['settings']['navigation'],
$c['router'],
$c['request']
);
};
$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['csrf'] = function ($c) {
return new \Slim\Csrf\Guard();
};
$container['GrEduLabs\\Application\\Action\\Index'] = function ($c) {
return new GrEduLabs\Application\Action\Index($c['view']);
};
});
$events('on', 'app.bootstrap', function ($stop, $app, $container) {
foreach ($container['router']->getRoutes() as $route) {
if ('user.login' === $route->getName()) {
$route->add('csrf');
break;
}
}
$app->get('/', 'GrEduLabs\\Application\\Action\\Index')->setName('index');
});
};
<?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,