Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Σταύρος Παπαδάκης
gredu_labs
Commits
05ab74fd
Commit
05ab74fd
authored
Mar 23, 2016
by
Vassilis Kanellopoulos
Browse files
remove checks and allow schools to resubmit the application form
parent
e7795c67
Changes
6
Hide whitespace changes
Inline
Side-by-side
config/settings/acl.global.php
View file @
05ab74fd
...
...
@@ -29,7 +29,7 @@ return [
[
'/school/assets'
,
[
'school'
],
[
'get'
,
'post'
,
'delete'
]],
[
'/school/labs/attachment'
,
[
'school'
],
[
'get'
,
'delete'
]],
[
'/school/software'
,
[
'school'
],
[
'get'
,
'post'
,
'delete'
]],
[
'/application-form'
,
[
'school'
],
[
'get'
,
'post'
]
,
'GrEduLabs\ApplicationForm\Acl\Assertion\CanSubmit'
],
[
'/application-form'
,
[
'school'
],
[
'get'
,
'post'
]],
[
'/application-form/submit-success'
,
[
'school'
],
[
'get'
]],
[
'/tpe_survey'
,
[
'school'
],
[
'get'
,
'post'
]],
[
'/tpe_survey/total-teachers'
,
[
'school'
],
[
'post'
]],
...
...
module/application_form/src/InputFilter/ApplicationForm.php
View file @
05ab74fd
...
...
@@ -29,13 +29,7 @@ class ApplicationForm extends InputFilter
->
getFilterChain
()
->
attach
(
new
Filter\ToInt
());
$schoolId
->
getValidatorChain
()
->
attach
(
new
Validator\NotEmpty
())
->
attach
(
new
Validator\Callback
([
'callback'
=>
function
(
$value
)
use
(
$appFormService
)
{
return
null
===
$appFormService
->
findSchoolApplicationForm
(
$value
);
},
'message'
=>
'Έχει ήδη γίνει αίτηση'
,
]));
->
attach
(
new
Validator\NotEmpty
());
$comments
=
new
Input
(
'comments'
);
$comments
->
setRequired
(
false
)
...
...
module/application_form/src/Service/ApplicationFormService.php
View file @
05ab74fd
...
...
@@ -42,7 +42,7 @@ class ApplicationFormService implements ApplicationFormServiceInterface
public
function
findSchoolApplicationForm
(
$schoolId
)
{
$appForm
=
R
::
findOne
(
'applicationform'
,
' school_id = ? '
,
[
$schoolId
]);
$appForm
=
R
::
findOne
(
'applicationform'
,
' school_id = ?
ORDER BY id DESC
'
,
[
$schoolId
]);
if
(
null
===
$appForm
)
{
return
;
}
...
...
module/application_form/templates/application_form/submit_success.twig
View file @
05ab74fd
...
...
@@ -11,19 +11,22 @@
<h2>
Στοιχεία αίτησης
</h2>
<div
class=
"row"
>
<dl
class=
"col-
lg
-12"
>
<dl
class=
"col-
sm
-12
col-md-6
"
>
<dt>
A/A αίτησης
</dt>
<dd>
{{
appForm.id
}}
</dd>
<dt>
Ημερ. υποβολής
</dt>
<dd>
{{
appForm.submitted
|
date
(
'd/m/Y'
)
}}
<dd>
</dl>
<dl
class=
"col-sm-12 col-md-6"
>
<dt>
Σχολείο
</dt>
<dd>
{{
school.name
}}
</dd>
<dt>
Κωδικός Υπουργείου
</dt>
<dd>
{{
school.registry_no
}}
<dd>
</dl>
<dl
class=
"col-lg-12"
>
<dt>
Σχόλια/Παρατηρήσεις
</dt>
<dd>
{{
appForm.comments
}}
</dd>
</dl>
</div>
<h3>
Αιτούμενος εξοπλισμός
</h3>
<div
class=
"table-responsive"
>
...
...
module/application_form/templates/schools/index.twig
View file @
05ab74fd
...
...
@@ -2,25 +2,25 @@
{%
block
content
%}
<div
id=
"school"
>
<h1>
{%
block
schoolTitle
%}
{{
school.name
}}
{%
endblock
%}
{%
block
schoolTitle
%}
{{
school.name
}}
{%
endblock
%}
</h1>
<ul
class=
"nav nav-tabs"
>
{%
for
page
in
nav
(
'main'
)
.
school.pages
%}
<li
role=
"presentation"
class=
"
{%
if
page.active
%}
active
{%
endif
%}
"
>
<a
href=
"
{{
page.href
}}
"
{%
if
page.id
%}
id=
"
{{
page.id
}}
"
{%
endif
%}
title=
"
{{
page.label
}}
"
>
<i
class=
"visible-xs fa fa-
{{
page.icon
}}
"
></i>
<span
class=
"hidden-xs"
>
{{
page.label
}}
</span>
</a>
</li>
<li
role=
"presentation"
class=
"
{%
if
page.active
%}
active
{%
endif
%}
"
>
<a
href=
"
{{
page.href
}}
"
{%
if
page.id
%}
id=
"
{{
page.id
}}
"
{%
endif
%}
title=
"
{{
page.label
}}
"
>
<i
class=
"visible-xs fa fa-
{{
page.icon
}}
"
></i>
<span
class=
"hidden-xs"
>
{{
page.label
}}
</span>
</a>
</li>
{%
endfor
%}
{%
block
navItems
%}{%
endblock
%}
</ul>
<br>
<div
class=
"row"
>
<div
class=
"col-xs-12 school-container"
>
{%
block
schoolContent
%}
{%
block
navItems
%}{%
endblock
%}
</ul>
<br>
<div
class=
"row"
>
<div
class=
"col-xs-12 school-container"
>
{%
block
schoolContent
%}
<div
id=
"school-info"
>
<p
class=
"col-md-12"
>
Σε αυτή την καρτέλα θα καταχωρήσετε πληροφορίες που
...
...
@@ -64,8 +64,8 @@
<div
class=
"panel-body"
>
<ul>
{%
for
lab
in
labs
%}
<li>
{{
lab.name
}}
</li>
{%
endfor
%}
<li>
{{
lab.name
}}
</li>
{%
endfor
%}
</ul>
</div>
<div
class=
"panel-footer text-center"
>
...
...
@@ -83,7 +83,7 @@
{%
for
asset
in
assets
%}
<dt>
{{
asset.category
}}
</dt>
<dd>
{{
asset.count
}}
<dd>
{%
endfor
%}
{%
endfor
%}
</dl>
</div>
<div
class=
"panel-footer text-center"
>
...
...
@@ -92,28 +92,26 @@
</div>
</div>
<div
class=
"col-md-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
<h4>
Στοιχεία αίτησης
</h4>
</div>
<div
class=
"panel-body"
>
{%
if
appForm
%}
<div
class=
"row"
>
<dl
class=
"col-sm-12 col-md-6
dl-horizontal
"
>
<dl
class=
"col-sm-12 col-md-6"
>
<dt>
A/A αίτησης
</dt>
<dd>
{{
appForm.id
}}
</dd>
<dt>
Ημερ. υποβολής
</dt>
<dd>
{{
appForm.submitted
|
date
(
'd/m/Y'
)
}}
<dd>
</dl>
<dl
class=
"col-sm-12 col-md-6"
>
<dt>
Σχολείο
</dt>
<dd>
{{
school.name
}}
</dd>
<dt>
Κωδικός Υπουργείου
</dt>
<dd>
{{
school.registry_no
}}
<dd>
</dl>
<dl
class=
"col-sm-12 col-md-6 dl-horizontal"
>
<dt>
Αίτημα του σχολείου για
</dt>
<dd>
{{
appForm.apply_for
}}
</dd>
<dt>
Ύπαρξη - προοπτική αίθουσας για δημιουργία νέου εργαστηρίου
</dt>
<dd>
{{
appForm.new_lab_perspective
}}
<dd>
<dl
class=
"col-lg-12"
>
<dt>
Σχόλια/Παρατηρήσεις
</dt>
<dd>
{{
appForm.comments
}}
</dd>
</dl>
...
...
@@ -128,12 +126,12 @@
</tr>
</thead>
<tbody>
{%
for
item
in
appForm.items
%}
<tr>
<th>
{{
item.category
}}
</th>
<td>
{{
item.count
}}
<td>
</tr>
{%
endfor
%}
{%
for
item
in
appForm.items
%}
<tr>
<th>
{{
item.category
}}
</th>
<td>
{{
item.count
}}
<td>
</tr>
{%
endfor
%}
</tbody>
</table>
</div>
...
...
@@ -142,17 +140,27 @@
{%
endif
%}
</div>
<div
class=
"panel-footer text-center"
>
{%
if
not
appForm
%}
<a
class=
"btn btn-sm btn-primary"
href=
"
{{
path_for
(
'application_form'
)
}}
"
>
Υποβολή αίτησης
</a>
{%
endif
%}
<a
class=
"btn btn-sm btn-primary"
href=
"
{{
path_for
(
'application_form'
)
}}
"
>
{%
if
not
appForm
%}
Υποβολή αίτησης
{%
else
%}
Υποβολή νέας αίτησης
<sup>
*
</sup>
{%
endif
%}
</a>
<div
class=
"text-left"
>
{%
if
appForm
%}
<small
class=
"text-muted"
><sup>
*
</sup>
Λαμβάνεται υπόψη μόνο η τελευταία αίτηση.
</small>
{%
endif
%}
</div>
</div>
</div>
</div>
</div>
{%
endblock
%}
</div>
{%
endblock
%}
</div>
</div>
</div>
{%
endblock
%}
{%
block
inlinejs
%}
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"
></script>
...
...
module/debug/bootstrap.php
View file @
05ab74fd
...
...
@@ -37,15 +37,15 @@ return function (Slim\App $app) {
});
},
-
10
);
$events
(
'on'
,
'app.bootstrap'
,
function
(
$app
,
$container
)
{
$container
->
get
(
'router'
)
->
getNamedRoute
(
'application_form'
)
->
add
(
function
(
$req
,
$res
,
$next
)
{
$school_id
=
$req
->
getAttribute
(
'school'
)
->
id
;
$appForm
=
RedBeanPHP\R
::
findOne
(
'applicationform'
,
'school_id = ?'
,
[
$school_id
]);
if
(
$appForm
)
{
RedBeanPHP\R
::
trash
(
$appForm
);
}
return
$next
(
$req
,
$res
);
});
},
-
10
);
//
$events('on', 'app.bootstrap', function ($app, $container) {
//
$container->get('router')->getNamedRoute('application_form')->add(function ($req, $res, $next) {
//
$school_id = $req->getAttribute('school')->id;
//
$appForm = RedBeanPHP\R::findOne('applicationform', 'school_id = ?', [$school_id]);
//
if ($appForm) {
//
RedBeanPHP\R::trash($appForm);
//
}
//
//
return $next($req, $res);
//
});
//
}, -10);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment