Commit e6ab5c20 authored by Aspasia Katsi's avatar Aspasia Katsi
Browse files

Merge branch 'master' of gitlab.minedu.gov.gr:itminedu/gredu_labs

parents 73f9de65 d4eb5da9
<?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/)
......@@ -20,6 +20,7 @@ return [
'module/sch_sync/bootstrap.php',
'module/schools/bootstrap.php',
'module/application_form/bootstrap.php',
'module/receive_equip/bootstrap.php',
'module/tpe_survey/bootstrap.php',
'module/in_numbers/bootstrap.php',
'module/in_numbers_mm/bootstrap.php',
......
......@@ -6,21 +6,20 @@
* @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' => [],
'roles' => [
'guest' => [],
'user' => [],
'school' => ['user'],
'admin' => ['user'],
'admin' => ['user'],
],
'resoures' => [],
'guards' => [
'guards' => [
'resources' => [],
'callables' => [],
'routes' => [
'routes' => [
['/', ['guest', 'user'], ['get']],
['/about', ['guest', 'user'], ['get']],
['/school', ['school'], ['get']],
......@@ -32,6 +31,10 @@ return [
['/application-form', ['school'], ['get', 'post']],
['/application-form/submit-success', ['school'], ['get']],
['/application-form/report', ['school'], ['get']],
['/receive-equip', ['school'], ['get', 'post'], GrEduLabs\ReceiveEquip\Acl\Assertion\CanSubmit::class],
['/receive-equip/submit-success', ['school'], ['get']],
['/receive-equip/report', ['school'], ['get']],
['/receive-equip/receive-doc/{fn}', ['school'], ['get']],
['/tpe_survey', ['school'], ['get', 'post']],
['/tpe_survey/total-teachers', ['school'], ['post']],
['/forum', ['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/)
......@@ -51,6 +51,10 @@ return [
'label' => 'Αίτηση',
'route' => 'application_form',
],
'receive-equip' => [
'label' => 'Παραλαβή εξοπλισμού',
'route' => 'receive_equip',
],
'open-data' => [
'label' => 'Ανοικτά δεδομένα',
'route' => 'open_data',
......
<?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 [
'open_data' => [
'pagesize' => 20, // default page size
'maxpagesize' => 200, // maximum page size
],
];
<?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 [
'receive_equip' => [
'file_upload_path' => __DIR__ . '/../../data/uploads', // path to save file
'file_upload_max_size' => 3145728, // Maximum number of bytes allowed(default 3MB)
'file_upload_types_permitted' => ['jpg', 'jpeg', 'pdf', 'png'], // Array of allowed extensions
],
];
......@@ -22,12 +22,16 @@ CREATE TABLE `applicationform` (
`comments` text COLLATE utf8mb4_unicode_ci,
`submitted` int(11) unsigned NOT NULL,
`submitted_by` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`received_ts` timestamp NULL,
`received_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`received_document` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE INDEX `index_applicationform_submitted` ON `applicationform`(`submitted`);
CREATE INDEX `index_applicationform_received_ts` ON `applicationform`(`received_ts`);
--
-- Dumping data for table `applicationform`
--
......@@ -49,6 +53,7 @@ CREATE TABLE `applicationformitem` (
`itemcategory_id` int(11) unsigned NOT NULL,
`qty` int(11) unsigned NOT NULL,
`qtyacquired` int(11) unsigned NOT NULL DEFAULT 0,
`qtyreceived` int(11) unsigned DEFAULT 0,
`reasons` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`applicationform_id` int(11) unsigned NOT NULL,
`lab_id` int(11) unsigned NOT NULL,
......@@ -172,7 +177,7 @@ CREATE TABLE `itemcategory` (
LOCK TABLES `itemcategory` WRITE;
/*!40000 ALTER TABLE `itemcategory` DISABLE KEYS */;
INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
(8,'ACCESS POINT',0,8),
(26,'ΦΟΡΗΤΟΣ Η/Υ (LAPTOP)',0,26),
(6,'MODEM / ROUTER ',0,6),
......@@ -196,7 +201,7 @@ INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
(43,'ΤΡΙΣΔΙΑΣΤΑΤΟΣ ΣΑΡΩΤΗΣ',0,43),
(44,'ΣΕΤ ΡΟΜΠΟΤΙΚΗΣ - ΑΙΣΘΗΤΗΡΩΝ',0,44),
(45,'ΔΟΜΗΜΕΝΗ ΚΑΛΩΔΙΩΣΗ',0,45);
INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
INSERT INTO `itemcategory` (`id`,`name`,`groupflag`,`sort`) VALUES
(101,'ΣΤΑΘΕΡΟΣ ΗΛΕΚΤΡΟΝΙΚΟΣ ΥΠΟΛΟΓΙΣΤΗΣ (DESKTOP)', 1,1),
(102,'ΦΟΡΗΤΟΣ ΗΛΕΚΤΡΟΝΙΚΟΣ ΥΠΟΛΟΓΙΣΤΗΣ (LAPTOP)', 1,2),
(103,'ΕΠΙΤΡΑΠΕΖΙΟΣ ΒΙΝΤΕΟΠΡΟΒΟΛΕΑΣ (SHORT THROW PROJECTOR)', 1,3),
......@@ -280,7 +285,7 @@ CREATE TABLE `lab_lesson` (
UNIQUE KEY `UQ_82ac3a020f1d21984f224331fbd99880f89b2e71` (`lab_id`,`lesson_id`),
KEY `index_foreignkey_lab_lesson_lesson` (`lesson_id`),
KEY `index_foreignkey_lab_lesson_lab` (`lab_id`),
CONSTRAINT `c_fk_lab_lesson_lesson_id` FOREIGN KEY (`lesson_id`) REFERENCES `lesson` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `c_fk_lab_lesson_lesson_id` FOREIGN KEY (`lesson_id`) REFERENCES `lesson` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `c_fk_lab_lesson_lab_id` FOREIGN KEY (`lab_id`) REFERENCES `lab` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
......
ALTER TABLE `applicationformitem`
DROP COLUMN `qtyreceived` ;
ALTER TABLE `applicationform`
DROP COLUMN `received_ts` ;
ALTER TABLE `applicationform`
DROP COLUMN `received_by` ;
ALTER TABLE applicationform DROP INDEX `index_applicationform_submitted`;
ALTER TABLE `applicationformitem`
ADD COLUMN `qtyreceived` int(11) unsigned NOT NULL DEFAULT 0
AFTER `qtyacquired` ;
ALTER TABLE `applicationform`
ADD COLUMN `received_ts` timestamp NULL
AFTER `submitted_by` ;
ALTER TABLE `applicationform`
ADD COLUMN `received_by` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
AFTER `received_ts` ;
CREATE INDEX `index_applicationform_submitted` ON `applicationform`(`submitted`);
CREATE INDEX `index_applicationform_received_ts` ON `applicationform`(`received_ts`);
ALTER TABLE `applicationform`
DROP COLUMN `received_document` ;
ALTER TABLE `applicationform`
ADD COLUMN `received_document` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
AFTER `received_by` ;
......@@ -22,11 +22,16 @@ CREATE TABLE `applicationform` (
`comments` text COLLATE utf8mb4_unicode_ci,
`submitted` int(11) unsigned NOT NULL,
`submitted_by` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`received_ts` timestamp NULL,
`received_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`received_document` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT '',
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
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE INDEX `index_applicationform_submitted` ON `applicationform`(`submitted`);
CREATE INDEX `index_applicationform_received_ts` ON `applicationform`(`received_ts`);
--
-- Dumping data for table `applicationform`
......@@ -49,6 +54,7 @@ CREATE TABLE `applicationformitem` (
`itemcategory_id` int(11) unsigned NOT NULL,
`qty` int(11) unsigned NOT NULL,
`qtyacquired` int(11) unsigned DEFAULT 0,
`qtyreceived` int(11) unsigned DEFAULT 0,
`reasons` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`applicationform_id` int(11) unsigned NOT NULL,
`lab_id` int(11) unsigned NOT NULL,
......@@ -61,7 +67,6 @@ CREATE TABLE `applicationformitem` (
CONSTRAINT `c_fk_applicationformitem_lab_id` FOREIGN KEY (`lab_id`) REFERENCES `lab` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `applicationformitem`
--
......@@ -78,4 +83,4 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
\ No newline at end of file
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
<?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/)
......@@ -42,7 +42,7 @@ class Login
/**
*
*
* @param Twig $view
* @param AuthenticationService $authService
* @param Messages $flash
......
......@@ -43,6 +43,7 @@ return function (App $app) {
'ID',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'Ονομασία χώρου',
'Τύπος χώρου',
'Ειδικότητα υπευθύνου',
......@@ -65,6 +66,7 @@ return function (App $app) {
'Τύπος χώρου',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'Σχόλια - Παρατηρήσεις',
],
],
......@@ -74,6 +76,7 @@ return function (App $app) {
'Τύπος',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'ID χώρου',
'Τύπος χώρου',
'Ονομασία',
......@@ -87,6 +90,7 @@ return function (App $app) {
'ID',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'Ημερομηνία υποβολής',
'Σχόλια - Παρατηρήσεις',
],
......@@ -98,6 +102,7 @@ return function (App $app) {
'ID',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'Ημερομηνία υποβολής',
'Σχόλια - Παρατηρήσεις',
],
......@@ -110,6 +115,7 @@ return function (App $app) {
'ID',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'Ημερομηνία υποβολής',
'ID χώρου',
'Τύπος χώρου',
......@@ -125,9 +131,14 @@ return function (App $app) {
'ID',
'Κωδικός σχολείου',
'Ονομασία σχολείου',
'Περιφερειακή διεύθυνση εκπαίδευσης',
'Ημερομηνία υποβολής',
'ID χώρου',
'Τύπος χώρου',
'Νέος χώρος',
'Είδος',
'Πλήθος Υπαρχόντων που λειτουργούν',
'Πλήθος Αιτουμένων',
'Πλήθος Υπαρχόντων που λειτουργούν',
'Αιτιολογία χρήσης',
],
],
......@@ -198,6 +209,7 @@ return function (App $app) {
$sql = 'SELECT lab.id AS id, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' TRIM(lab.name) AS name, '
. ' TRIM(labtype.name) AS type, '
. ' branch.name AS responsible_branch, '
......@@ -211,6 +223,8 @@ return function (App $app) {
. ' FROM lab '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
. ' LEFT JOIN school ON lab.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN lab_lesson ON lab_lesson.lab_id = lab.id '
. ' LEFT JOIN lesson ON lab_lesson.lesson_id = lesson.id '
. ' LEFT JOIN teacher ON lab.responsible_id = teacher.id '
......@@ -234,10 +248,13 @@ return function (App $app) {
. ' TRIM(labtype.name) AS lab_type, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' schoolasset.comments AS comments '
. ' FROM schoolasset '
. ' LEFT JOIN itemcategory ON schoolasset.itemcategory_id = itemcategory.id '
. ' LEFT JOIN school ON schoolasset.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN lab ON schoolasset.lab_id = lab.id '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
. ' GROUP BY schoolasset.id '
......@@ -249,15 +266,13 @@ return function (App $app) {
};
};
$c['csv_export_software'] = function ($c) {
$c['csv_export_software'] = function ($c) {
return function () {
$sql = 'SELECT softwarecategory.name AS name, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' lab.id AS lab_id, '
. ' TRIM(labtype.name) AS lab_type, '
. ' TRIM(software.title) AS title, '
......@@ -266,6 +281,8 @@ return function (App $app) {
. ' FROM software '
. ' LEFT JOIN softwarecategory ON software.softwarecategory_id = softwarecategory.id '
. ' LEFT JOIN school ON software.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN lab ON software.lab_id = lab.id '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
. ' ORDER BY school_name ';
......@@ -284,17 +301,8 @@ return function (App $app) {
};
};
$c['csv_export_appforms'] = function ($c) {
//return function () {
return function () use ($c) {
$settings = $c->get('settings');
$version = $settings['application_form']['itemcategory']['currentversion'];
......@@ -322,11 +330,14 @@ return function (App $app) {
$sql = 'SELECT applicationform.id AS id, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' FROM_UNIXTIME(applicationform.submitted) AS submitted, '
. ' TRIM(applicationform.comments) AS comments'
. ' FROM applicationformitem '
. ' LEFT JOIN applicationform ON applicationformitem.applicationform_id = applicationform.id '
. ' LEFT JOIN school ON applicationform.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN itemcategory ON applicationformitem.itemcategory_id = itemcategory.id '
. ' LEFT JOIN lab ON applicationformitem.lab_id = lab.id '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
......@@ -337,51 +348,35 @@ return function (App $app) {
return $appForms;
// $sql = 'SELECT applicationform.id AS id, '
// . ' school.registry_no AS school_registry_no, '
// . ' school.name AS school_name, '
// . ' FROM_UNIXTIME(applicationform.submitted) AS submitted, '
// . ' TRIM(applicationform.comments) AS comments '
// . ' FROM applicationform '
// . ' LEFT JOIN school ON applicationform.school_id = school.id '
// . ' GROUP BY school.id '
// . ' HAVING MAX(applicationform.submitted)';
// $appForms = R::getAll($sql);
// return $appForms;
};
};
$c['csv_export_appnewforms'] = function ($c) {
return function () use ($c) {
return function () use ($c) {
$appFormIdsSql = 'SELECT id FROM applicationform WHERE (submitted) IN( SELECT MAX(submitted) FROM applicationform GROUP BY school_id)';
$appFormIds = R::getCol($appFormIdsSql);
if (empty($appFormIds)) {
return [];
}
$in = implode(',', array_fill(0, count($appFormIds), '?'));
$settings = $c->get('settings');
$version = $settings['application_form']['itemcategory']['currentversion'];
$sql = 'SELECT applicationform.id AS id, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' FROM_UNIXTIME(applicationform.submitted) AS submitted, '
. ' TRIM(applicationform.comments) AS comments'
. ' FROM applicationformitem '
. ' LEFT JOIN applicationform ON applicationformitem.applicationform_id = applicationform.id '
. ' LEFT JOIN school ON applicationform.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN itemcategory ON applicationformitem.itemcategory_id = itemcategory.id '
. ' LEFT JOIN lab ON applicationformitem.lab_id = lab.id '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
......@@ -395,8 +390,6 @@ return function (App $app) {
};
};
$c['csv_export_appforms_items'] = function ($c) {
return function () use ($c){
......@@ -413,14 +406,6 @@ return function (App $app) {
. ' WHERE itemcategory.groupflag NOT IN(' . $version . ')'
. ' GROUP BY school.id)';
// $appFormIdsSql = 'SELECT applicationform.id '
// . ' FROM applicationform '
// . ' GROUP BY school_id '
// . ' HAVING MAX(applicationform.submitted)';
$appFormIds = R::getCol($appFormIdsSql);
if (empty($appFormIds)) {
......@@ -431,6 +416,7 @@ return function (App $app) {
$sql = 'SELECT applicationform.id AS id, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' FROM_UNIXTIME(applicationform.submitted) AS submitted, '
. ' lab.id AS lab_id, '
. ' TRIM(labtype.name) AS lab_type, '
......@@ -441,6 +427,8 @@ return function (App $app) {
. ' FROM applicationformitem '
. ' LEFT JOIN applicationform ON applicationformitem.applicationform_id = applicationform.id '
. ' LEFT JOIN school ON applicationform.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN itemcategory ON applicationformitem.itemcategory_id = itemcategory.id '
. ' LEFT JOIN lab ON applicationformitem.lab_id = lab.id '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
......@@ -452,12 +440,10 @@ return function (App $app) {
};
};
$c['csv_export_newapplication'] = function ($c) {
return function () use ($c) {
$appFormIdsSql = 'SELECT id FROM applicationform WHERE (submitted) IN( SELECT MAX(submitted) FROM applicationform GROUP BY school_id)';
$appFormIds = R::getCol($appFormIdsSql);
......@@ -475,6 +461,11 @@ return function (App $app) {
$sql = 'SELECT applicationform.id AS id, '
. ' school.registry_no AS school_registry_no, '
. ' school.name AS school_name, '
. ' regioneduadmin.name AS region_edu_admin, '
. ' FROM_UNIXTIME(applicationform.submitted) AS submitted, '
. ' lab.id AS lab_id, '
. ' TRIM(labtype.name) AS lab_type, '
. ' IF(lab.is_new = 1, "ΝΑΙ", "ΟΧΙ") AS is_new, '
. ' TRIM(itemcategory.name) AS category, '
. ' applicationformitem.qty AS qty, '
. ' applicationformitem.qtyacquired AS qtyacquired, '
......@@ -482,6 +473,8 @@ return function (App $app) {
. ' FROM applicationformitem '
. ' LEFT JOIN applicationform ON applicationformitem.applicationform_id = applicationform.id '
. ' LEFT JOIN school ON applicationform.school_id = school.id '
. ' LEFT JOIN eduadmin ON school.eduadmin_id = eduadmin.id '
. ' LEFT JOIN regioneduadmin ON eduadmin.regioneduadmin_id = regioneduadmin.id '
. ' LEFT JOIN itemcategory ON applicationformitem.itemcategory_id = itemcategory.id '
. ' LEFT JOIN lab ON applicationformitem.lab_id = lab.id '
. ' LEFT JOIN labtype ON lab.labtype_id = labtype.id '
......@@ -494,6 +487,7 @@ return function (App $app) {
return $appForms;
};
};
});
$events('on', 'app.bootstrap', function (App $app, Container $c) {
......
This diff is collapsed.
<?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\OpenData\Action;
/**
* @inheritdoc
*/
class AllSchools extends PagedApiAction
{
}
<?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\OpenData\Action;
use Slim\Container;
use Slim\Http\Request;
use Slim\Http\Response;
use GrEduLabs\OpenData\Service\DataProviderInterface;
use GrEduLabs\OpenData\Service\RedBeanQueryPagedDataProvider;
/**
* Base class implementaing the api action.
* A dataprovider object is used to retrieve data.
*
* @see GrEduLabs\OpenData\Service\DataProviderInterface
*/
class ApiAction
{
/**
* @var GrEduLabs\OpenData\Service\DataProviderInterface
*/
protected $dataProvider;
/**
* @var Slim\Container
*/
protected $container;
/**
* @var boolean Respond with a 404 instead of 200 if data from dataprovider is an empty array.
*/
protected $empty_data_404;
public function __construct(Container $container, DataProviderInterface $dataProvider, $empty_data_404 = false)
{
$this->container = $container;
$this->dataProvider = $dataProvider;
$this->empty_data_404 = $empty_data_404;
}
public function setEmptyData404()
{
$this->empty_data_404 = true;
}
public function setEmptyData200()
{
$this->empty_data_404 = false;
}
public function __invoke(Request $req, Response $res, array $args = [])
{
/**
* Get data from dataprovider.
* If data is null, respond with a 500 status.
* If data is empty, respond with a 404 when $empty_data_404 is true.