Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gredu_labs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Σταύρος Παπαδάκης
gredu_labs
Commits
9a4e9ac8
Commit
9a4e9ac8
authored
Nov 29, 2016
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'app-form-receive-confirm' into 'master'
Form to receive equipment and confirm See merge request !16
parents
658d9c20
027f4aea
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
1545 additions
and
11 deletions
+1545
-11
config/app.config.php
config/app.config.php
+2
-1
config/settings/acl.global.php
config/settings/acl.global.php
+6
-1
config/settings/nav.global.php
config/settings/nav.global.php
+5
-1
config/settings/receive_equip.local.php.dist
config/settings/receive_equip.local.php.dist
+16
-0
data/db/schema.mysql.sql
data/db/schema.mysql.sql
+9
-4
module/application_form/data/migration-161013-01-down.mysql.sql
.../application_form/data/migration-161013-01-down.mysql.sql
+10
-0
module/application_form/data/migration-161013-01-up.mysql.sql
...le/application_form/data/migration-161013-01-up.mysql.sql
+14
-0
module/application_form/data/migration-161024-01-down.mysql.sql
.../application_form/data/migration-161024-01-down.mysql.sql
+2
-0
module/application_form/data/migration-161024-01-up.mysql.sql
...le/application_form/data/migration-161024-01-up.mysql.sql
+3
-0
module/application_form/data/schema.mysql.sql
module/application_form/data/schema.mysql.sql
+7
-2
module/authentication/src/Action/User/Login.php
module/authentication/src/Action/User/Login.php
+2
-2
module/receive_equip/bootstrap.php
module/receive_equip/bootstrap.php
+139
-0
module/receive_equip/public/css/receive_equip/pdf.css
module/receive_equip/public/css/receive_equip/pdf.css
+100
-0
module/receive_equip/public/img/receive_equip/minedu_logo.jpg
...le/receive_equip/public/img/receive_equip/minedu_logo.jpg
+0
-0
module/receive_equip/public/js/receive_equip/index.js
module/receive_equip/public/js/receive_equip/index.js
+43
-0
module/receive_equip/src/Acl/Assertion/CanSubmit.php
module/receive_equip/src/Acl/Assertion/CanSubmit.php
+53
-0
module/receive_equip/src/Action/ReceiveEquip.php
module/receive_equip/src/Action/ReceiveEquip.php
+252
-0
module/receive_equip/src/Action/ReceiveEquipPdf.php
module/receive_equip/src/Action/ReceiveEquipPdf.php
+72
-0
module/receive_equip/src/Action/SubmitSuccess.php
module/receive_equip/src/Action/SubmitSuccess.php
+48
-0
module/receive_equip/src/InputFilter/ReceiveEquip.php
module/receive_equip/src/InputFilter/ReceiveEquip.php
+50
-0
module/receive_equip/src/InputFilter/ReceiveEquipItem.php
module/receive_equip/src/InputFilter/ReceiveEquipItem.php
+41
-0
module/receive_equip/src/InputFilter/ReceiveEquipItemCollection.php
...eive_equip/src/InputFilter/ReceiveEquipItemCollection.php
+21
-0
module/receive_equip/src/Middleware/HandleEmptyPosts.php
module/receive_equip/src/Middleware/HandleEmptyPosts.php
+67
-0
module/receive_equip/src/Service/ReceiveEquipService.php
module/receive_equip/src/Service/ReceiveEquipService.php
+86
-0
module/receive_equip/src/Service/ReceiveEquipServiceInterface.php
...eceive_equip/src/Service/ReceiveEquipServiceInterface.php
+20
-0
module/receive_equip/templates/receive_equip/form.twig
module/receive_equip/templates/receive_equip/form.twig
+184
-0
module/receive_equip/templates/receive_equip/pdf.twig
module/receive_equip/templates/receive_equip/pdf.twig
+20
-0
module/receive_equip/templates/receive_equip/result.twig
module/receive_equip/templates/receive_equip/result.twig
+56
-0
module/receive_equip/templates/receive_equip/submit_success.twig
...receive_equip/templates/receive_equip/submit_success.twig
+24
-0
public/_doc/help/HELP_RECEIVE_EQUIP.html
public/_doc/help/HELP_RECEIVE_EQUIP.html
+128
-0
public/_doc/help/img/edulabs-rcpt-01-menu.png
public/_doc/help/img/edulabs-rcpt-01-menu.png
+0
-0
public/_doc/help/img/edulabs-rcpt-02-form.png
public/_doc/help/img/edulabs-rcpt-02-form.png
+0
-0
public/_doc/help/img/edulabs-rcpt-03-error.png
public/_doc/help/img/edulabs-rcpt-03-error.png
+0
-0
public/_doc/help/img/edulabs-rcpt-04-success.png
public/_doc/help/img/edulabs-rcpt-04-success.png
+0
-0
public/_doc/help/img/edulabs-rcpt-05-report.png
public/_doc/help/img/edulabs-rcpt-05-report.png
+0
-0
public/js/receive_equip/index.js
public/js/receive_equip/index.js
+65
-0
No files found.
config/app.config.php
View file @
9a4e9ac8
<?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'
,
...
...
config/settings/acl.global.php
View file @
9a4e9ac8
<?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
...
...
@@ -32,6 +32,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'
]],
...
...
@@ -39,6 +43,7 @@ return [
[
'/in_numbers'
,
[
'guest'
,
'user'
],
[
'get'
]],
[
'/export/csv/edulabs_{type}.csv'
,
[
'guest'
,
'user'
],
[
'get'
]],
[
'/open-data'
,
[
'guest'
,
'user'
],
[
'get'
]],
[
'/receive-equip/undo-submit/{applicationform_id}'
,
[
'school'
],
[
'get'
]],
// only for tests. Must be removed
],
],
],
...
...
config/settings/nav.global.php
View file @
9a4e9ac8
<?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'
,
...
...
config/settings/receive_equip.local.php.dist
0 → 100644
View file @
9a4e9ac8
<?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
],
];
data/db/schema.mysql.sql
View file @
9a4e9ac8
...
...
@@ -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 */
;
...
...
module/application_form/data/migration-161013-01-down.mysql.sql
0 → 100644
View file @
9a4e9ac8
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`
;
module/application_form/data/migration-161013-01-up.mysql.sql
0 → 100644
View file @
9a4e9ac8
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`
);
module/application_form/data/migration-161024-01-down.mysql.sql
0 → 100644
View file @
9a4e9ac8
ALTER
TABLE
`applicationform`
DROP
COLUMN
`received_document`
;
module/application_form/data/migration-161024-01-up.mysql.sql
0 → 100644
View file @
9a4e9ac8
ALTER
TABLE
`applicationform`
ADD
COLUMN
`received_document`
varchar
(
255
)
COLLATE
utf8mb4_unicode_ci
NOT
NULL
DEFAULT
''
AFTER
`received_by`
;
module/application_form/data/schema.mysql.sql
View file @
9a4e9ac8
...
...
@@ -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 */
;
module/authentication/src/Action/User/Login.php
View file @
9a4e9ac8
<?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
...
...
module/receive_equip/bootstrap.php
0 → 100644
View file @
9a4e9ac8
<?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
*/
use
Slim\Http\Request
;
use
Slim\Http\Response
;
use
RedBeanPHP\R
;
return
function
(
Slim
\
App
$app
)
{
$container
=
$app
->
getContainer
();
$events
=
$container
[
'events'
];
$events
(
'on'
,
'app.autoload'
,
function
(
$autoloader
)
{
$autoloader
->
addPsr4
(
'GrEduLabs\\ReceiveEquip\\'
,
__DIR__
.
'/src/'
);
});
$events
(
'on'
,
'app.services'
,
function
(
$container
)
{
$container
[
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\Service\ReceiveEquipService
(
$c
[
'logger'
]);
};
$container
[
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquip
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquip
(
$c
->
get
(
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquipItemCollection
::
class
)
);
};
$container
[
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquipItem
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquipItem
(
);
};
$container
[
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquipItemCollection
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquipItemCollection
(
$c
->
get
(
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquipItem
::
class
)
);
};
$container
[
GrEduLabs\ReceiveEquip\Action\ReceiveEquip
::
class
]
=
function
(
$c
)
{
$settings
=
$c
->
get
(
'settings'
);
return
new
GrEduLabs\ReceiveEquip\Action\ReceiveEquip
(
$c
->
get
(
'view'
),
$c
->
get
(
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
::
class
),
$c
->
get
(
GrEduLabs\ReceiveEquip\InputFilter\ReceiveEquip
::
class
),
$c
->
get
(
'authentication_service'
),
$c
->
get
(
'router'
)
->
pathFor
(
'receive_equip.submit_success'
),
$c
);
};
$container
[
GrEduLabs\ReceiveEquip\Action\SubmitSuccess
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\Action\SubmitSuccess
(
$c
->
get
(
'view'
),
$c
->
get
(
'router'
)
->
pathFor
(
'receive_equip'
)
);
};
$container
[
GrEduLabs\ReceiveEquip\Action\ReceiveEquipPdf
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\Action\ReceiveEquipPdf
(
$c
->
get
(
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
::
class
),
$c
->
get
(
'view'
)
);
};
$container
[
GrEduLabs\ReceiveEquip\Acl\Assertion\CanSubmit
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\Acl\Assertion\CanSubmit
(
$c
->
get
(
'authentication_service'
),
$c
->
get
(
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
::
class
)
);
};
});
$events
(
'on'
,
'app.services'
,
function
(
$container
)
{
$container
[
GrEduLabs\ReceiveEquip\Middleware\HandleEmptyPosts
::
class
]
=
function
(
$c
)
{
return
new
GrEduLabs\ReceiveEquip\Middleware\HandleEmptyPosts
(
$c
->
get
(
'view'
),
$c
->
get
(
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
::
class
),
$c
[
'flash'
],
$c
);
};
},
-
100000
);
$events
(
'on'
,
'app.bootstrap'
,
function
(
$app
,
$container
)
{
$container
[
'view'
]
->
getEnvironment
()
->
getLoader
()
->
prependPath
(
__DIR__
.
'/templates'
);
$app
->
group
(
'/receive-equip'
,
function
()
{
$this
->
map
([
'get'
,
'post'
],
''
,
GrEduLabs\ReceiveEquip\Action\ReceiveEquip
::
class
)
->
add
(
GrEduLabs\Application\Middleware\AddCsrfToView
::
class
)
->
add
(
'csrf'
)
->
add
(
GrEduLabs\ReceiveEquip\Middleware\HandleEmptyPosts
::
class
)
->
setName
(
'receive_equip'
);
$this
->
get
(
'/submit-success'
,
GrEduLabs\ReceiveEquip\Action\SubmitSuccess
::
class
)
->
setName
(
'receive_equip.submit_success'
);
$this
->
get
(
'/report'
,
GrEduLabs\ReceiveEquip\Action\ReceiveEquipPdf
::
class
)
->
setName
(
'receive_equip.report'
);
})
->
add
(
GrEduLabs\Schools\Middleware\FetchSchoolFromIdentity
::
class
);
$app
->
get
(
'/receive-equip/receive-doc/{fn}'
,
function
(
Request
$req
,
Response
$res
)
use
(
$container
)
{
$route
=
$req
->
getAttribute
(
'route'
);
$fn
=
$route
->
getArgument
(
'fn'
);
/* $container["logger"]->info(sprintf('filename = %s url=%s', $fn, path_for('receive_equip.receive_doc', [
'fn' => form.values.received_document,])
)); */
$file
=
$container
[
'settings'
][
'receive_equip'
][
'file_upload_path'
]
.
"/"
.
$fn
;
$response
=
$res
->
withHeader
(
'Content-Description'
,
'File Transfer'
)
->
withHeader
(
'Content-Type'
,
'application/octet-stream'
)
->
withHeader
(
'Content-Disposition'
,
'attachment;filename="'
.
basename
(
$file
)
.
'"'
)
->
withHeader
(
'Expires'
,
'0'
)
->
withHeader
(
'Cache-Control'
,
'must-revalidate'
)
->
withHeader
(
'Content-Length'
,
filesize
(
$file
));
readfile
(
$file
);
return
$response
;
})
->
setName
(
'receive_equip.receive_doc'
);
/******************* only for tests ***************************/
$app
->
get
(
'/receive-equip/undo-submit/{applicationform_id}'
,
function
(
Request
$req
,
Response
$res
)
use
(
$container
)
{
$route
=
$req
->
getAttribute
(
'route'
);
$applicationform_id
=
$route
->
getArgument
(
'applicationform_id'
);
$sql
=
'update `applicationform` set `approved`=1, `received_ts`=null where `id`='
.
$applicationform_id
;
R
::
exec
(
$sql
);
return
$res
->
withRedirect
(
"/receive-equip"
);
})
->
setName
(
'receive_equip.undosubmit'
);
/****************** /only for tests ***************************/
});
};
module/receive_equip/public/css/receive_equip/pdf.css
0 → 100644
View file @
9a4e9ac8
/**
* 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
*/
*
{
font-family
:
'DejaVu Sans'
,
Arial
;
font-size
:
80%
;
}
.header
{
height
:
150px
;
}
.header
img
{
float
:
left
;
width
:
30%
;
overflow
:
hidden
;
clear
:
left
;
text-align
:
left
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
padding
:
10px
;
}
.header
.h1
{
font-size
:
200%
;
text-align
:
right
;
padding
:
0
;
}
.header.h1
a
{
text-align
:
center
;
text-decoration
:
none
;
color
:
#555
;
}
dl
{
margin-top
:
0
;
margin-bottom
:
20px
;
}
dt
,
dd
{
line-height
:
1.42857143
;
}
dt
{
font-weight
:
bold
;
float
:
left
;
width
:
30%
;
overflow
:
hidden
;
clear
:
left
;
text-align
:
left
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
th
{
text-align
:
left
;
}
table
{
width
:
100%
;
max-width
:
100%
;
margin-bottom
:
20px
;
}
table
>
thead
>
tr
>
th
,
table
>
tbody
>
tr
>
th
,
table
>
tfoot
>
tr
>
th
,
table
>
thead
>
tr
>
td
,
table
>
tbody
>
tr
>
td
,
table
>
tfoot
>
tr
>
td
{
padding
:
8px
;
line-height
:
1.42857143
;
vertical-align
:
top
;
border-top
:
1px
solid
#ddd
;
}
table
>
thead
>
tr
>
th
{
vertical-align
:
bottom
;
border-bottom
:
2px
solid
#ddd
;
}
table
>
caption
+
thead
>
tr
:first-child
>
th
,
table
>
colgroup
+
thead
>
tr
:first-child
>
th
,
table
>
thead
:first-child
>
tr
:first-child
>
th
,
table
>
caption
+
thead
>
tr
:first-child
>
td
,
table
>
colgroup
+
thead
>
tr
:first-child
>
td
,
table
>
thead
:first-child
>
tr
:first-child
>
td
{
border-top
:
0
;
}
table
>
tbody
+
tbody
{
border-top
:
2px
solid
#ddd
;
}
table
table
{
background-color
:
#fff
;
}
table
tbody
>
tr
:nth-of-type
(
odd
)
{
background-color
:
#f9f9f9
;
}
\ No newline at end of file
module/receive_equip/public/img/receive_equip/minedu_logo.jpg
0 → 100644
View file @
9a4e9ac8
8.29 KB
module/receive_equip/public/js/receive_equip/index.js
0 → 100644
View file @
9a4e9ac8
(
function
(
$
,
_
,
utils
)
{
'
use strict
'
;
var
ItemsView
,
ItemRowView
;
ItemRowView
=
Backbone
.
View
.
extend
({
tagName
:
'
tr
'
,
render
:
function
(
index
)
{
this
.
$el
.
html
(
this
.
template
({
index
:
index
|
0
}));
return
this
;
},
template
:
_
.
template
(
$
(
'
#receive-equip-item-row-template
'
).
html
())
});
ItemsView
=
Backbone
.
View
.
extend
({
el
:
'
#items-list
'
,
initialize
:
function
()
{
this
.
itemCount
=
this
.
$el
.
find
(
'
tbody tr
'
).
length
;
},
});
new
ItemsView
();
(
function
()
{
var
form
=
$
(
'
#receive-equip form
'
),
messages
=
(
function
(
messages
)
{
var
itemMessages
=
{};
_
.
each
(
messages
.
items
||
[],
function
(
message
,
idx
){
var
name
=
'
items[
'
+
idx
+
'
]
'
;
_
.
each
(
_
.
keys
(
message
),
function
(
prop
)
{
itemMessages
[
name
+
'
[
'
+
prop
+
'
]
'
]
=
message
[
prop
];
});
});
delete
messages
.
items
;
_
.
extend
(
messages
,
itemMessages
);
return
messages
;
}(
form
.
data
(
'
messages
'
)));
utils
.
formMessages
.
render
(
form
,
messages
);
}());
}(
window
.
jQuery
,
_
,
window
.
EDULABS
.
utils
));
module/receive_equip/src/Acl/Assertion/CanSubmit.php
0 → 100644
View file @
9a4e9ac8
<?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\ReceiveEquip\Acl\Assertion
;
use
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
;
use
RedBeanPHP\R
;
use
Zend\Authentication\AuthenticationServiceInterface
;
use
Zend\Permissions\Acl\Acl
;
use
Zend\Permissions\Acl\Assertion\AssertionInterface
;
use
Zend\Permissions\Acl\Resource\ResourceInterface
;
use
Zend\Permissions\Acl\Role\RoleInterface
;
class
CanSubmit
implements
AssertionInterface
{
/**
*
* @var AuthenticationServiceInterface
*/
protected
$authService
;
/**
*
* @var ReceiveEquipServiceInterface
*/
protected
$receiveEquipService
;
public
function
__construct
(
AuthenticationServiceInterface
$authService
,
ReceiveEquipServiceInterface
$receiveEquipService
)
{
$this
->
authService
=
$authService
;
$this
->
receiveEquipService
=
$receiveEquipService
;
}
public
function
assert
(
Acl
$acl
,
RoleInterface
$role
=
null
,
ResourceInterface
$resource
=
null
,
$privilege
=
null
)
{
$identity
=
$this
->
authService
->
getIdentity
();
$user
=
R
::
load
(
'user'
,
$identity
->
id
);
if
(
!
(
$school
=
$user
->
school
))
{
return
false
;
}
$receiveEquip
=
$this
->
receiveEquipService
->
findSchoolReceiveEquip
(
$school
->
id
);
return
null
!==
$receiveEquip
;
}
}
module/receive_equip/src/Action/ReceiveEquip.php
0 → 100644
View file @
9a4e9ac8
<?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\ReceiveEquip\Action
;
use
GrEduLabs\ReceiveEquip\Service\ReceiveEquipServiceInterface
;
use
Slim\Http\Request
;
use
Slim\Http\Response
;
use
Slim\Views\Twig
;
use
Zend\Authentication\AuthenticationServiceInterface
;
use
Zend\InputFilter\InputFilterInterface
;
class
ReceiveEquip
{
/**
* @var Twig
*/
protected
$view
;
/**
*
* @var ReceiveEquipServiceInterface
*/
protected
$receiveEquipService
;
/**
*
* @var InputFilterInterface
*/
protected
$receiveEquipInputFilter
;
/**
*
* @var AuthenticationServiceInterface
*/
protected
$authService
;
/**
*
* @var type SLIM application container
*/