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
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
582f8c41
Commit
582f8c41
authored
Mar 31, 2017
by
Open Source Developer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trans
parent
f5ca8c2d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
9 deletions
+209
-9
drupal/modules/epal/epal.routing.yml
drupal/modules/epal/epal.routing.yml
+17
-0
drupal/modules/epal/src/Controller/DirectorView.php
drupal/modules/epal/src/Controller/DirectorView.php
+108
-2
source/components/director/director-view.ts
source/components/director/director-view.ts
+50
-7
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+34
-0
No files found.
drupal/modules/epal/epal.routing.yml
View file @
582f8c41
...
...
@@ -90,3 +90,20 @@ sectorperschool:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSectorsPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
specialityperschool
:
path
:
'
/epal/specialityperSchool/{epalId}/{sectorId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSpecialPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
studentperschool
:
path
:
'
/epal/studentperSchool/{epalId}/{selectId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getStudentPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/src/Controller/DirectorView.php
View file @
582f8c41
...
...
@@ -27,8 +27,6 @@ class DirectorView extends ControllerBase
public
function
getSectorsPerSchool
(
Request
$request
,
$epalId
)
{
...
...
@@ -74,7 +72,115 @@ public function getSectorsPerSchool(Request $request, $epalId)
}
public
function
getSpecialPerSchool
(
Request
$request
,
$epalId
,
$sectorId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$epalIdNew
=
intval
(
$epalId
);
$specialityPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$epalIdNew
));
$i
=
0
;
if
(
$specialityPerSchool
)
{
$list
=
array
();
$SectorIdNew
=
intval
(
$sectorId
);
foreach
(
$specialityPerSchool
as
$object
)
{
$idSpecial
=
$object
->
specialty_id
->
entity
->
id
()
;
$specialityPerSector
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialty'
)
->
loadByProperties
(
array
(
'id'
=>
$idSpecial
,
'sector_id'
=>
$SectorIdNew
));
$specialPerSec
=
reset
(
$specialityPerSector
);
if
(
$specialPerSec
)
{
$list
[]
=
array
(
'specialty_id'
=>
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
'id'
=>
$object
->
specialty_id
->
entity
->
id
()
);
$i
++
;
}
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"School not found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getStudentPerSchool
(
Request
$request
,
$epalId
,
$selectId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$epalIdNew
=
intval
(
$epalId
);
$selectIdNew
=
intval
(
$selectId
);
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$epalIdNew
,
'specialization_id'
=>
$selectIdNew
));
$i
=
0
;
if
(
$studentPerSchool
)
{
$list
=
array
();
foreach
(
$studentPerSchool
as
$object
)
{
$studentId
=
$object
->
id
()
;
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'id'
=>
$studentId
));
$i
=
0
;
if
(
$epalStudents
)
{
$list
[]
=
array
(
'name'
=>
$epalStudents
->
name
->
value
,
'studentsurname'
=>
$epalStudents
->
studentsurname
->
value
,
'fatherfirstname'
=>
$epalStudents
->
fatherfirstname
->
value
,
'fathersurname'
=>
$epalStudents
->
fathersurtname
->
value
,
'motherfirstname'
=>
$epalStudents
->
motherfirstname
->
value
,
'mothersurname'
=>
$epalStudents
->
mothersurname
->
value
,
'birthdate'
=>
$epalStudents
->
birthdate
->
value
,
);
$i
++
;
}
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"No students found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
...
...
source/components/director/director-view.ts
View file @
582f8c41
...
...
@@ -30,13 +30,24 @@ import {
</select>
<div>
<div class="form-group" *ngIf="
(StudentSelected$ != {}) && (bclassenabled === true)"
>
<div class="form-group" *ngIf="
StudentSelected$ != {}"
>
<label for="tomeas">Τομέας</label><br/>
<select #tmop [(ngModel)]="tomeas" [ngModelOptions]="{standalone: true}" >
<select #tmop [(ngModel)]="tomeas" [ngModelOptions]="{standalone: true}"
(change) ="checkbclass(tmop,txoption)"
>
<option *ngFor="let SectorSelection$ of StudentSelected$ | async" [ngValue]="SectorSelection$.id">{{SectorSelection$.sector_id}}</option>
</select>
<div>
<div class="form-group" *ngIf="StudentSelectedSpecial$ != {}">
<label for="special">Ειδικότητα</label><br/>
<select #spop [(ngModel)]="specialit" [ngModelOptions]="{standalone: true}" >
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async" [ngValue]="SpecialSelection$.id">{{SpecialSelection$.specialty_id}}</option>
</select>
<div>
<button type="button" class="btn-primary btn-sm pull-right" (click)="findstudent()">
Αναζήτηση
</button>
`
})
...
...
@@ -45,9 +56,12 @@ import {
public
formGroup
:
FormGroup
;
private
StudentSelected$
:
BehaviorSubject
<
any
>
;
private
StudentSelectedSub
:
Subscription
;
private
StudentSelectedSpecial$
:
BehaviorSubject
<
any
>
;
private
StudentSelectedSpecialSub
:
Subscription
;
public
bClassEnabled
:
boolean
;
public
gClassEnabled
:
boolean
;
private
SchoolId
=
1
2
;
private
SchoolId
=
1
47
;
constructor
(
private
fb
:
FormBuilder
,
...
...
@@ -56,9 +70,11 @@ import {
private
router
:
Router
)
{
this
.
StudentSelected$
=
new
BehaviorSubject
([{}]);
this
.
StudentSelectedSpecial$
=
new
BehaviorSubject
([{}]);
this
.
formGroup
=
this
.
fb
.
group
({
taxi
:[],
tomeas
:
[]
tomeas
:
[],
specialit
:[]
});
}
...
...
@@ -66,6 +82,9 @@ import {
{
if
(
this
.
StudentSelectedSub
)
this
.
StudentSelectedSub
.
unsubscribe
();
if
(
this
.
StudentSelectedSpecialSub
)
this
.
StudentSelectedSpecialSub
.
unsubscribe
();
}
...
...
@@ -74,6 +93,9 @@ import {
this
.
bClassEnabled
=
false
;
this
.
gClassEnabled
=
false
;
this
.
StudentSelectedSub
=
this
.
_hds
.
getSectorPerSchool
(
this
.
SchoolId
).
subscribe
(
this
.
StudentSelected$
);
console
.
log
(
this
.
StudentSelected$
);
}
...
...
@@ -99,4 +121,25 @@ import {
}
checkbclass
(
tmop
,
txop
)
{
const
[
id
,
sector
]
=
tmop
.
value
.
split
(
'
:
'
);
var
sectorint
=
+
sector
;
if
(
txop
.
value
===
"
3
"
)
{
this
.
StudentSelectedSpecialSub
=
this
.
_hds
.
getSpecialityPerSchool
(
this
.
SchoolId
,
sectorint
).
subscribe
(
this
.
StudentSelectedSpecial$
);
}
}
findstudent
(
tmop
,
txop
)
{
let
sectorint
=
8
;
{
this
.
StudentSelectedSpecialSub
=
this
.
_hds
.
getStudentPerSchool
(
this
.
SchoolId
,
sectorint
).
subscribe
(
this
.
StudentSelectedSpecial$
);
}
}
}
\ No newline at end of file
source/services/helper-data-service.ts
View file @
582f8c41
...
...
@@ -473,6 +473,40 @@ transformUserSchema(userlogin:any,oauthtoken:string, oauthrole:string){
.
map
(
response
=>
response
.
json
());
}
getSpecialityPerSchool
(
SchoolId
,
SectorId
)
{
let
SchoolIdNew
=
SchoolId
.
toString
();
let
SectorIdNew
=
SectorId
.
toString
();
this
.
loginInfo$
.
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
get
(
0
).
auth_token
;
});
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createAuthorizationHeader
(
headers
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/specialityperSchool/`
+
SchoolIdNew
+
'
/
'
+
SectorIdNew
,
options
)
.
map
(
response
=>
response
.
json
());
}
getStudentPerSchool
(
SchoolId
,
SelectId
)
{
let
SchoolIdNew
=
SchoolId
.
toString
();
let
SelectIdNew
=
SelectId
.
toString
();
this
.
loginInfo$
.
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
get
(
0
).
auth_token
;
});
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createAuthorizationHeader
(
headers
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/studentperSchool/`
+
SchoolIdNew
+
'
/
'
+
SelectIdNew
,
options
)
.
map
(
response
=>
response
.
json
());
}
...
...
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