Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
1b42a987
Commit
1b42a987
authored
Apr 05, 2017
by
Open Source Developer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trans
parent
a4eb4c01
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
19 deletions
+27
-19
drupal/modules/epal/epal.routing.yml
drupal/modules/epal/epal.routing.yml
+9
-0
drupal/modules/epal/src/Controller/DirectorView.php
drupal/modules/epal/src/Controller/DirectorView.php
+16
-18
drupal/modules/epal/src/Entity/EpalStudentClass.php
drupal/modules/epal/src/Entity/EpalStudentClass.php
+1
-0
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+1
-1
No files found.
drupal/modules/epal/epal.routing.yml
View file @
1b42a987
...
...
@@ -98,6 +98,14 @@ specialityperschool:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSpecialPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
confirmstudents
:
path
:
'
/epal/confirmstudent'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::ConfirmStudents'
requirements
:
_user_is_logged_in
:
'
TRUE'
studentperschool
:
path
:
'
/epal/studentperSchool/{epalId}/{selectId}'
options
:
...
...
@@ -106,4 +114,5 @@ studentperschool:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getStudentPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/src/Controller/DirectorView.php
View file @
1b42a987
...
...
@@ -8,6 +8,8 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use
Drupal\Core\Controller\ControllerBase
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Drupal\Core\Database\Connection
;
use
Drupal\Core\Logger\LoggerChannelFactoryInterface
;
class
DirectorView
extends
ControllerBase
{
...
...
@@ -153,7 +155,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
'name'
=>
$epalStudent
->
name
->
value
,
'studentsurname'
=>
$epalStudent
->
studentsurname
->
value
,
'fatherfirstname'
=>
$epalStudent
->
fatherfirstname
->
value
,
'fathersurname'
=>
$epalStudent
->
fathersur
t
name
->
value
,
'fathersurname'
=>
$epalStudent
->
fathersurname
->
value
,
'motherfirstname'
=>
$epalStudent
->
motherfirstname
->
value
,
'mothersurname'
=>
$epalStudent
->
mothersurname
->
value
,
'birthdate'
=>
$epalStudent
->
birthdate
->
value
,
...
...
@@ -200,16 +202,20 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$postData
=
null
;
if
(
$content
=
$request
->
getContent
())
{
foreach
(
$content
as
&
$value
)
{
$studentForConfirm
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'id'
=>
&
$value
));
if
(
$studentForConfirm
)
{
$studentForConfirm
->
set
(
'directorconfirm'
,
"yes"
);
$studentForConfirm
->
save
();
}
{
$postData
=
json_decode
(
$content
);
$arr
=
$postData
->
students
;
foreach
(
$arr
as
$value
)
{
$valnew
=
intval
(
$value
);
$studentForConfirm
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'id'
=>
$valnew
));
$studentConfirm
=
reset
(
$studentForConfirm
);
if
(
$studentConfirm
)
{
$studentConfirm
->
set
(
'directorconfirm'
,
true
);
$studentConfirm
->
save
();
}
}
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"saved"
),
...
...
@@ -232,14 +238,6 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
...
...
drupal/modules/epal/src/Entity/EpalStudentClass.php
View file @
1b42a987
...
...
@@ -122,6 +122,7 @@ class EpalStudentClass extends ContentEntityBase implements EpalStudentClassInte
return
$this
;
}
/**
* {@inheritdoc}
*/
...
...
source/services/helper-data-service.ts
View file @
1b42a987
...
...
@@ -521,7 +521,7 @@ export class HelperDataService {
this
.
createAuthorizationHeader
(
headers
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
http
.
post
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/confirmstudent`
,
{
students
:
students
},
options
)
this
.
http
.
post
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/confirmstudent`
,
{
students
},
options
)
.
map
(
response
=>
response
.
json
())
.
subscribe
(
data
=>
{
resolve
(
data
);
...
...
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