add panel with number of schools and number of sumbitted application form in home page

parent 355eeb72
......@@ -21,6 +21,7 @@ return [
'module/schools/bootstrap.php',
'module/application_form/bootstrap.php',
'module/tpe_survey/bootstrap.php',
'module/in_numbers/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 function (\Slim\App $app) {
$container = $app->getContainer();
$events = $container['events'];
$events('on', 'app.bootstrap', function ($app, $c) {
$router = $c['router'];
$route = $router->getNamedRoute('index');
$route->add(function (Slim\Http\Request $req, Slim\Http\Response $res, callable $next) use ($c) {
$view = $c->get('view');
try {
$view['total_schools'] = RedBeanPHP\R::count('school');
$view['total_app_forms'] = (int) RedBeanPHP\R::getCell(
'SELECT COUNT(*) FROM (SELECT id FROM applicationform GROUP BY school_id) AS cnt'
);
$view->getEnvironment()->getLoader()->prependPath(__DIR__ . '/../application/templates', 'application');
$view->getEnvironment()->getLoader()->prependPath(__DIR__ . '/templates');
} catch (\Exception $ex) {
$c->get('logger')->error(sprintf('Exception: %s', $ex->getMessage()), ['file' => __FILE__, 'line' => __LINE__]);
}
return $next($req, $res);
});
}, -10);
};
{% extends '@application/index.twig' %}
{% block content %}
<div class="row in-numbers">
<div class="col-md-9">{{ parent() }}</div>
<div class="col-md-3">
<div class="panel panel-default panel-in-numbers">
<div class="panel-heading">
<h3 class="panel-title">EduLabs σε αριθμούς</h3>
</div>
<div class="panel-body">
<p>
<span class="number">{{ total_schools }}</span> Σχολεία που έχουν καταχωρηθεί
</p>
<div class="clearfix"></div>
<hr>
<p>
<span class="number">{{ total_app_forms }}</span> Αιτήσεις που έχουν υποβληθεί
</p>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
{% endblock %}
......@@ -131,4 +131,21 @@ body {
.select2-container {
width: auto!important;
}
.in-numbers .home.jumbotron {
padding-left: 0;
padding-right: 0;
}
.panel-in-numbers {
margin-top: 48px;
}
.panel-in-numbers .number {
font-size: 24px;
font-weight: bold;
display: block;
float: right;
padding-left:10px;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment