Approved school applications handling

parent ee625109
......@@ -31,6 +31,7 @@ return [
['/application-form', ['school'], ['get', 'post']],
['/application-form/submit-success', ['school'], ['get']],
['/application-form/report', ['school'], ['get']],
['/application-form/approved', ['guest'], ['get']],
['/receive-equip', ['school'], ['get', 'post'], GrEduLabs\ReceiveEquip\Acl\Assertion\CanSubmit::class],
['/receive-equip/submit-success', ['school'], ['get']],
['/receive-equip/report', ['school'], ['get']],
......
......@@ -7,7 +7,6 @@
* @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' => [
......@@ -23,27 +22,27 @@ return [
'info' => [
'label' => 'Πληροφορίες',
'route' => 'school',
'icon' => 'info',
'icon' => 'info',
],
'staff' => [
'label' => 'Εκπαιδευτικοί',
'route' => 'school.staff',
'icon' => 'users',
'icon' => 'users',
],
'labs' => [
'label' => 'Χώροι',
'route' => 'school.labs',
'icon' => 'building-o',
'icon' => 'building-o',
],
'assets' => [
'label' => 'Εξοπλισμός',
'route' => 'school.assets',
'icon' => 'tv',
'icon' => 'tv',
],
'software' => [
'label' => 'Λογισμικό',
'route' => 'school.software',
'icon' => 'th',
'icon' => 'th',
],
],
],
......@@ -59,7 +58,7 @@ return [
'label' => 'Ανοικτά δεδομένα',
'route' => 'open_data',
],
'university_form' => [
'university_form' => [
'label' => 'Ιδρύματα',
'route' => 'university_form',
],
......@@ -67,17 +66,20 @@ return [
'label' => 'Εκπαιδευτικοί',
'route' => 'teacher_form',
],
'approved-applications' => [
'label' => 'Αιτήσεις που εγκρίθηκαν',
'route' => 'application_form.approved',
],
'about' => [
'label' => 'Σχετικά με τη δράση',
'route' => 'about',
],
'forum' => [
'label' => 'Φόρουμ βοήθειας',
'href' => '/#forum',
'label' => 'Φόρουμ βοήθειας',
'href' => '/#forum',
'external' => true,
'target' => '_blank',
'target' => '_blank',
],
],
'admin' => [
'adminhome' => [
......
......@@ -25,6 +25,8 @@ CREATE TABLE `applicationform` (
`received_ts` timestamp NULL,
`received_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`received_document` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
`approved` int(11) unsigned NOT NULL DEFAULT 0,
`approved_date` int(11) unsigned NULL,
PRIMARY KEY (`id`),
KEY `index_foreignkey_applicationform_school` (`school_id`),
CONSTRAINT `c_fk_applicationform_school_id` FOREIGN KEY (`school_id`) REFERENCES `school` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
......
......@@ -83,6 +83,13 @@
<a class="btn btn-primary" href="{{ base_url() }}/files/prodiagrafes_edulabs.pdf">ΑΝΑΛΥΤΙΚΕΣ ΠΡΟΔΙΑΓΡΑΦΕΣ ΕΞΟΠΛΙΣΜΟΥ</a>
<a class="btn btn-primary" href="{{ base_url() }}/files/psifiakos.pdf">ΔΙΑΔΙΚΑΣΙΕΣ ΕΞΟΠΛΙΣΜΟΥ ΣΧΟΛΕΙΩΝ</a>
</p>
<h2>Tεύχος του διαγωνισμού προμήθειας (Α' φάση)</h2>
<p>Στο παρακάτω αρχείο μπορείτε να βρείτε τη διακήρυξη του διαγωνισμού για την "Προμήθεια, εγκατάσταση εξοπλισμού
για την αναβάθμιση ψηφιακών υποδομών Τεχνολογίας Πληροφορικής και Επικοινωνιών σε επιλεγμένες σχολικές μονάδες Πρωτοβάθμιας και Δευτεροβάθμιας Εκπαίδευσης"</p>
<p class="text-center">
<a class="btn btn-primary" href="{{ base_url() }}/files/DIAKHRYJH-F478.6_155_223143_A2 ">ΑΡΧΕΙΟ ΔΙΑΚΗΡΥΞΗΣ</a>
</p>
</div>
</div>
<div class="row">
......
......@@ -87,6 +87,16 @@ return function (Slim\App $app) {
$c
);
};
$container[GrEduLabs\ApplicationForm\Action\Approved::class] = function ($c) {
return new GrEduLabs\ApplicationForm\Action\Approved(
$c->get('view'),
$c->get(GrEduLabs\Schools\Service\AssetServiceInterface::class),
$c->get(GrEduLabs\Schools\Service\LabServiceInterface::class),
$c->get(GrEduLabs\ApplicationForm\Service\ApplicationFormServiceInterface::class)
);
};
});
$events('on', 'app.bootstrap', function ($app, $container) {
......@@ -104,5 +114,8 @@ return function (Slim\App $app) {
$this->get('/report', GrEduLabs\ApplicationForm\Action\ApplicationFormPdf::class)
->setName('application_form.report');
})->add(GrEduLabs\Schools\Middleware\FetchSchoolFromIdentity::class);
$app->get('/application-form/approved', GrEduLabs\ApplicationForm\Action\Approved::class)
->setName('application_form.approved');
});
};
......@@ -25,6 +25,8 @@ CREATE TABLE `applicationform` (
`received_ts` timestamp NULL,
`received_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`received_document` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
`approved` int(11) unsigned NOT NULL DEFAULT 0,
`approved_date` int(11) unsigned NULL,
PRIMARY KEY (`id`),
KEY `index_foreignkey_applicationform_school` (`school_id`),
CONSTRAINT `c_fk_applicationform_school_id` FOREIGN KEY (`school_id`) REFERENCES `school` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
......
<?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\ApplicationForm\Action;
use GrEduLabs\ApplicationForm\Service\ApplicationFormServiceInterface;
use GrEduLabs\Schools\Service\AssetServiceInterface;
use GrEduLabs\Schools\Service\LabServiceInterface;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Views\Twig;
class Approved {
/**
* @var Twig
*/
protected $view;
/**
* @var AssetServiceInterface
*/
protected $assetsService;
/**
* @var LabServiceInterface
*/
protected $labService;
/**
* @var ApplicationFormServiceInterface
*/
protected $appFormService;
public function __construct(
Twig $view, AssetServiceInterface $assetsService, LabServiceInterface $labService, ApplicationFormServiceInterface $appFormService
) {
$this->view = $view;
$this->assetsService = $assetsService;
$this->labService = $labService;
$this->appFormService = $appFormService;
}
public function __invoke(Request $req, Response $res) {
$appForms = $this->appFormService->findApprovedSchoolApplicationForms();
return $this->view->render($res, 'application_form/approved.twig', [
'approved_forms' => $appForms
]);
}
}
......@@ -51,10 +51,21 @@ class ApplicationFormService implements ApplicationFormServiceInterface
return $this->exportApplicationForm($appForm);
}
private function exportApplicationForm(OODBBean $bean)
/**
*
* @param OODBBean $bean the application form bean
* @param boolean $with_school_info if true, the name, eduadmin and regionadmin properties of the school are provided with the exported bean info
* @return array
*/
private function exportApplicationForm(OODBBean $bean, $with_school_info = false)
{
$appForm = $bean->export();
$appForm['items'] = array_map(function ($itemBean) {
if ($with_school_info === true) {
$appForm['school'] = $bean->school->name;
$appForm['eduadmin'] = $bean->school->eduadmin->name;
$appForm['regioneduadmin'] = $bean->school->eduadmin->regioneduadmin->name;
}
$appForm['items'] = array_map(function ($itemBean) use ($with_school_info) {
return array_merge($itemBean->export(), [
'lab' => $itemBean->lab->name,
'itemcategory' => $itemBean->itemcategory->name,
......@@ -64,4 +75,28 @@ class ApplicationFormService implements ApplicationFormServiceInterface
return $appForm;
}
/**
* Get all the approved applications
*
* @return array The exported bean info from retrieved data
*/
public function findApprovedSchoolApplicationForms()
{
$selectedAppForms = R::getAll('SELECT applicationform.* '
. 'FROM applicationform '
. 'JOIN school ON applicationform.school_id=school.id '
. 'JOIN eduadmin ON school.eduadmin_id=eduadmin.id '
. 'JOIN regioneduadmin ON eduadmin.regioneduadmin_id=regioneduadmin.id '
. 'WHERE applicationform.approved=1 '
. 'ORDER BY regioneduadmin.name, eduadmin.name, school.name');
$appForms = R::convertToBeans('applicationform', $selectedAppForms);
return array_map(function ($c) {
return $this->exportApplicationForm($c, true);
},
$appForms
);
}
}
{% extends "layout.twig" %}
{% block content %}
<div id="approved_applications">
<h1>Αιτήσεις που εγκρίθηκαν</h1>
<p>Στο παρακάτω αρχείο μπορείτε να βρείτε τη διακήρυξη του διαγωνισμού για την "Προμήθεια, εγκατάσταση εξοπλισμού
για την αναβάθμιση ψηφιακών υποδομών Τεχνολογίας Πληροφορικής και Επικοινωνιών σε επιλεγμένες σχολικές μονάδες Πρωτοβάθμιας και Δευτεροβάθμιας Εκπαίδευσης"</p>
<p class="text-center">
<a class="btn btn-primary" href="{{ base_url() }}/files/DIAKHRYJH-F478.6_155_223143_A2 ">ΑΡΧΕΙΟ ΔΙΑΚΗΡΥΞΗΣ</a>
</p>
<p>Ακολουθεί κατάλογος των αιτήσεων οι οποίες εγκρίθηκαν στην πρώτη φάση διεξαγωγής του προγράμματος.</p>
{% if approved_forms %}
<div class="table-responsive">
<table class="table table-condensed table-hover">
<caption>Συνολικά {{ approved_forms | length }} εγκεκριμένες αιτήσεις.</caption>
<thead>
<tr>
<th class="text-center">#</th>
<th>Σχολείο</th>
<th>Διεύθυνση όπου ανήκει</th>
</tr>
</thead>
<tbody>
{% for form in approved_forms %}
<tr>
<td class="text-center col-xs-1"><span class="text-muted">{{ loop.index }}</span></td>
<td class="col-xs-5"><strong>{{ form.school }}</strong> <span class="text-muted"></td>
<td class="col-xs-4">{{ form.eduadmin }}<br/>{{ form.regioneduadmin }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info" role="alert">Δεν υπάρχουν διαθέσιμα στοιχεία</div>
{% endif %}
</div>
{% endblock %}
......@@ -130,6 +130,7 @@ return function (App $app) {
'Αιτιολογία χρήσης',
],
],
'newapplication' => [
'data_callback' => 'csv_export_newapplication',
'headers' => [
......@@ -147,6 +148,7 @@ return function (App $app) {
'Αιτιολογία χρήσης',
],
],
'volunteer_teachers' => [
'data_callback' => 'csv_export_volunteer_teachers',
'headers' => [
......@@ -204,6 +206,15 @@ return function (App $app) {
'Έργο 10',
],
],
'sch_approved' => [
'data_callback' => 'csv_export_sch_approved',
'headers' => [
'ID',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
],
]
];
};
......@@ -620,6 +631,26 @@ return function (App $app) {
return $appForms;
};
};
$c['csv_export_sch_approved'] = function ($c) {
return function () {
$sql = 'SELECT applicationform.id AS id, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name '
. ' FROM applicationform'
. ' LEFT JOIN school ON applicationform.school_id = school.id '
. ' WHERE applicationform.approved = 1';
$sch_appr = R::getAll($sql);
return $sch_appr;
};
};
});
$events('on', 'app.bootstrap', function (App $app, Container $c) {
......
......@@ -85,6 +85,15 @@
</a>
</td>
</tr>
<tr>
<td>Σχολεία των οποίων οι αιτήσεις εγκρίθηκαν</td>
<td>
<a href="{{ path_for('export.csv', {type: 'sch_approved'}) }}">
<i class="fa fa-download"></i>
Αρχείο .csv
</a>
</td>
</tr>
</tbody>
<tfoot>
<tr><th colspan="2"></th><tr>
......
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