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
Χάρης Παπαδόπουλος
e-epal
Commits
f6170ef9
Commit
f6170ef9
authored
Jun 21, 2017
by
Χάρης Παπαδόπουλος
Browse files
Merge branch 'report-prfix' into 'develop'
Restrict report access See merge request !199
parents
833c1993
267e52ca
Changes
5
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/src/Controller/DirectorView.php
View file @
f6170ef9
...
...
@@ -369,15 +369,20 @@ class DirectorView extends ControllerBase
$userRole
=
$tmpRole
;
}
}
$this
->
logger
->
warning
(
'userRole='
.
$userRole
);
if
(
$userRole
===
''
)
{
return
$this
->
respondWithStatus
([
'error_code'
=>
4003
,
],
Response
::
HTTP_FORBIDDEN
);
'error_code'
=>
4003
,
],
Response
::
HTTP_FORBIDDEN
);
}
elseif
(
$userRole
===
'regioneduadmin'
)
{
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'region_edu_admin_id'
=>
$selectionId
));
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'region_edu_admin_id'
=>
$selectionId
));
}
elseif
(
$userRole
===
'eduadmin'
)
{
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'edu_admin_id'
=>
$selectionId
));
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'edu_admin_id'
=>
$selectionId
));
}
else
{
$schools
=
[];
}
if
(
$schools
)
{
$list
=
array
();
...
...
@@ -385,23 +390,22 @@ class DirectorView extends ControllerBase
foreach
(
$schools
as
$object
)
{
$status
=
$this
->
returnstatus
(
$object
->
id
());
$list
[]
=
array
(
'id'
=>
$object
->
id
(),
'name'
=>
$object
->
name
->
value
,
'status'
=>
$status
,
);
'id'
=>
$object
->
id
(),
'name'
=>
$object
->
name
->
value
,
'status'
=>
$status
,
);
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'
Perfecture not
found!'
),
],
Response
::
HTTP_FORBIDDEN
);
'message'
=>
t
(
'
No schools
found!'
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'User not found!'
),
],
Response
::
HTTP_FORBIDDEN
);
'message'
=>
t
(
'User not found!'
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
...
...
@@ -422,122 +426,143 @@ class DirectorView extends ControllerBase
}
if
(
$userRole
===
''
)
{
return
$this
->
respondWithStatus
([
'error_code'
=>
4003
,
],
Response
::
HTTP_FORBIDDEN
);
'error_code'
=>
4003
,
],
Response
::
HTTP_FORBIDDEN
);
}
elseif
(
$userRole
===
'regioneduadmin'
)
{
$SchoolCats
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
,
'region_edu_admin_id'
=>
$newid
));
$SchoolCats
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
,
'region_edu_admin_id'
=>
$newid
));
}
elseif
(
$userRole
===
'eduadmin'
)
{
$SchoolCats
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
,
'edu_admin_id'
=>
$newid
));
$SchoolCats
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
,
'edu_admin_id'
=>
$newid
));
}
$SchoolCat
=
reset
(
$SchoolCats
);
if
(
$SchoolCat
)
{
$list
=
array
();
$categ
=
$SchoolCat
->
metathesis_region
->
value
;
$operation_shift
=
$SchoolCat
->
operation_shift
->
value
;
$operation_shift
=
$SchoolCat
->
operation_shift
->
value
;
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'No school located'
),
],
Response
::
HTTP_FORBIDDEN
);
}
$CourseA
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
$list
=
array
();
$limit
=
-
1
;
$CourseA
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
if
(
$CourseA
)
{
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
1
,
'category'
=>
$categ
));
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
1
,
'category'
=>
$categ
));
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
-
1
,
'currentclass'
=>
1
));
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
-
1
,
'currentclass'
=>
1
));
$list
=
array
();
foreach
(
$CourseA
as
$object
)
{
$list
[]
=
array
(
'id'
=>
'1'
,
'name'
=>
'Α Λυκείου'
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
1
,
'limitdown'
=>
$limit
,
);
'id'
=>
'1'
,
'name'
=>
'Α Λυκείου'
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
1
,
'limitdown'
=>
$limit
,
);
}
}
$CourseB
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
));
$CourseB
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
));
if
(
$CourseB
)
{
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
2
,
'category'
=>
$categ
));
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
2
,
'category'
=>
$categ
));
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
foreach
(
$CourseB
as
$object
)
{
$sectorid
=
$object
->
sector_id
->
entity
->
id
();
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
$sectorid
,
'currentclass'
=>
2
));
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
$sectorid
,
'currentclass'
=>
2
));
$list
[]
=
array
(
'id'
=>
$object
->
sector_id
->
entity
->
id
(),
'name'
=>
'Β Λυκείου '
.
$object
->
sector_id
->
entity
->
get
(
'name'
)
->
value
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
2
,
'limitdown'
=>
$limit
,
);
'id'
=>
$object
->
sector_id
->
entity
->
id
(),
'name'
=>
'Β Λυκείου '
.
$object
->
sector_id
->
entity
->
get
(
'name'
)
->
value
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
2
,
'limitdown'
=>
$limit
,
);
}
}
$CourseC
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
));
$CourseC
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
));
if
(
$CourseC
)
{
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
3
,
'category'
=>
$categ
));
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
3
,
'category'
=>
$categ
));
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
foreach
(
$CourseC
as
$object
)
{
$specialityid
=
$object
->
specialty_id
->
entity
->
id
();
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
$specialityid
,
'currentclass'
=>
3
));
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
$specialityid
,
'currentclass'
=>
3
));
$list
[]
=
array
(
'id'
=>
$object
->
specialty_id
->
entity
->
id
(),
'name'
=>
'Γ Λυκείου '
.
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
3
,
'limitdown'
=>
$limit
,
);
'id'
=>
$object
->
specialty_id
->
entity
->
id
(),
'name'
=>
'Γ Λυκείου '
.
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
3
,
'limitdown'
=>
$limit
,
);
}
}
if
(
$CourseC
&&
$operation_shift
!=
'ΗΜΕΡΗΣΙΟ'
)
{
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
4
,
'category'
=>
$categ
));
$limit_down
=
$this
->
entityTypeManager
->
getStorage
(
'epal_class_limits'
)
->
loadByProperties
(
array
(
'name'
=>
4
,
'category'
=>
$categ
));
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
foreach
(
$CourseC
as
$object
)
{
$specialityid
=
$object
->
specialty_id
->
entity
->
id
();
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
$specialityid
,
'currentclass'
=>
4
));
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
$specialityid
,
'currentclass'
=>
4
));
$list
[]
=
array
(
'id'
=>
$object
->
specialty_id
->
entity
->
id
(),
'name'
=>
'Δ Λυκείου '
.
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
4
,
'limitdown'
=>
$limit
,
);
'id'
=>
$object
->
specialty_id
->
entity
->
id
(),
'name'
=>
'Δ Λυκείου '
.
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
'size'
=>
sizeof
(
$studentPerSchool
),
'categ'
=>
$categ
,
'classes'
=>
4
,
'limitdown'
=>
$limit
,
);
}
}
if
(
$CourseA
||
$CourseB
||
$CourseC
)
{
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'
Perfecture not
found!'
),
],
Response
::
HTTP_FORBIDDEN
);
'message'
=>
t
(
'
No courses
found!'
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'User not found!'
),
],
Response
::
HTTP_FORBIDDEN
);
'message'
=>
t
(
'User not found!'
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
...
...
@@ -548,6 +573,8 @@ class DirectorView extends ControllerBase
$SchoolCat
=
reset
(
$SchoolCats
);
if
(
$SchoolCat
)
{
$categ
=
$SchoolCat
->
metathesis_region
->
value
;
}
else
{
$categ
=
'-'
;
}
$CourseA
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
...
...
@@ -556,7 +583,10 @@ class DirectorView extends ControllerBase
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
-
1
,
'currentclass'
=>
1
));
if
(
sizeof
(
$studentPerSchool
)
<
$limit
)
{
...
...
@@ -570,6 +600,8 @@ class DirectorView extends ControllerBase
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
foreach
(
$CourseB
as
$object
)
{
...
...
@@ -587,6 +619,8 @@ class DirectorView extends ControllerBase
$limitdown
=
reset
(
$limit_down
);
if
(
$limitdown
)
{
$limit
=
$limitdown
->
limit_down
->
value
;
}
else
{
$limit
=
-
1
;
}
foreach
(
$CourseC
as
$object
)
{
...
...
drupal/modules/epal/src/Controller/ReportsCreator.php
View file @
f6170ef9
...
...
@@ -272,16 +272,22 @@ class ReportsCreator extends ControllerBase
$validRole
=
false
;
foreach
(
$roles
as
$role
)
{
if
(
$role
===
"ministry"
||
$role
===
"regioneduadmin"
||
$role
===
"eduadmin"
)
{
$validRole
=
tru
e
;
$validRole
=
$rol
e
;
break
;
}
}
if
(
!
$validRole
)
{
if
(
$validRole
===
false
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
if
(
!
$this
->
canReportOn
(
$user
,
$role
,
$regionId
,
$adminId
,
$schId
))
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'User access to area forbidden'
),
],
Response
::
HTTP_FORBIDDEN
);
}
$list
=
array
();
//βρες ανώτατο επιτρεπόμενο όριο μαθητών
...
...
@@ -410,7 +416,6 @@ class ReportsCreator extends ControllerBase
}
}
public
function
makeReportAllStat
(
Request
$request
,
$regionId
,
$adminId
,
$schId
,
$classId
,
$sectorId
,
$courseId
,
$finalized
)
{
try
{
...
...
@@ -435,16 +440,22 @@ class ReportsCreator extends ControllerBase
$validRole
=
false
;
foreach
(
$roles
as
$role
)
{
if
(
$role
===
"ministry"
||
$role
===
"regioneduadmin"
||
$role
===
"eduadmin"
)
{
$validRole
=
tru
e
;
$validRole
=
$rol
e
;
break
;
}
}
if
(
!
$validRole
)
{
if
(
$validRole
===
false
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
if
(
!
$this
->
canReportOn
(
$user
,
$role
,
$regionId
,
$adminId
,
$schId
))
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'User access to area forbidden'
),
],
Response
::
HTTP_FORBIDDEN
);
}
$limitup
=
$this
->
retrieveUpLimit
();
$list
=
array
();
...
...
@@ -1011,6 +1022,65 @@ class ReportsCreator extends ControllerBase
}
}
/**
* Check if $user, under $role, can issue the report on the
* designated region, admin area and school.
*
* @return boolean
*/
protected
function
canReportOn
(
$user
,
$role
,
$regionId
,
$adminId
,
$schId
)
{
if
(
$role
===
'ministry'
)
{
$can
=
true
;
}
elseif
(
$role
===
'regioneduadmin'
)
{
$can
=
(
(
$user
->
init
->
value
==
$regionId
)
&&
((
$adminId
==
0
)
||
$this
->
isAdminUnderRegion
(
$adminId
,
$regionId
))
);
}
elseif
(
$role
===
'eduadmin'
)
{
$can
=
(
(
$user
->
init
->
value
==
$adminId
)
&&
((
$regionId
==
0
)
||
$this
->
isAdminUnderRegion
(
$adminId
,
$regionId
))
&&
((
$schId
==
0
)
||
$this
->
isSchoolUnderAdmin
(
$schId
,
$adminId
))
);
}
else
{
$can
=
false
;
}
return
$can
;
}
protected
function
isSchoolUnderAdmin
(
$schId
,
$adminId
)
{
$map
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
([
'id'
=>
$schId
,
'edu_admin_id'
=>
$adminId
,
]);
$existing_map
=
reset
(
$map
);
if
(
!
$existing_map
)
{
return
false
;
}
else
{
return
true
;
}
}
protected
function
isAdminUnderRegion
(
$adminId
,
$regionId
)
{
$map
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_admin_area'
)
->
loadByProperties
([
'id'
=>
$adminId
,
'region_to_belong'
=>
$regionId
,
]);
$existing_map
=
reset
(
$map
);
if
(
!
$existing_map
)
{
return
false
;
}
else
{
return
true
;
}
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
...
...
source/components/infoviews/eduadmin-view.ts
View file @
f6170ef9
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
,
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
,
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
"
../../app.settings
"
;
import
{
HelperDataService
}
from
"
../../services/helper-data-service
"
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
"
@angular/http
"
;
import
{
NgRedux
,
select
}
from
"
ng2-redux
"
;
import
{
IAppState
}
from
"
../../store/store
"
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
"
@angular/router
"
;
import
{
BehaviorSubject
,
Subscription
}
from
"
rxjs/Rx
"
;
import
{
ILoginInfo
}
from
"
../../store/logininfo/logininfo.types
"
;
import
{
FormBuilder
,
...
...
@@ -15,34 +15,46 @@ import {
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
}
from
"
@angular/forms
"
;
@
Component
({
selector
:
'
eduadmin-view
'
,
selector
:
"
eduadmin-view
"
,
template
:
`
<div class = "loading" *ngIf="(showLoader | async) === true"></div>
<div id="informationfeedback" class="modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header {{modalHeader | async}}">
<h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i> {{ modalTitle | async }}</h3>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
</button>
</div>
<div class="modal-body"><p>{{ modalText | async }}</p></div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal" (click)="hideModal()">Κλείσιμο</button>
</div>
</div>
</div>
</div>
<div style="min-height: 500px;">
<form [formGroup]="formGroup">
<p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
</p>
<div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Τα τμήματα. </b>
<p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
<br/>Επιλέξτε σχολείο για να εμφανιστούν τα τμήματα του σχολείου.</p>
<div class="row" style="margin-top: 20px; line-height: 2em;"><p><strong>Τα τμήματα</strong></p></div>
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" style="font-size: 0.8em; font-weight: bold;">
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)"
[class.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd"
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<div class="col-md-12">{{SchoolNames$.name}}</div>
<div class = "row" *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even"
[class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)"
[class.selectedappout]="regionActive === j"
[hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-9">{{CoursesNames$.name}}</div>
<div class="col-md-3">{{CoursesNames$.size}}</div>
</div>
</li>
</div>
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)"
[class.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd"
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<div class="col-md-12" style="font-size: 0.8em; font-weight: bold;" >{{SchoolNames$.name}}</div>
</li>
<div class = "row" *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even"
[class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)"
[class.selectedappout]="regionActive === j"
[hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.name}}</div>
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.size}}</div>
</div>
</div>
</form>
</div>
...
...
@@ -65,8 +77,9 @@ import {
private
regionActive
=
<
number
>-
1
;
private
School$
:
BehaviorSubject
<
any
>
;
private
SchoolSub
:
Subscription
;
private
modalTitle
:
BehaviorSubject
<
string
>
;
private
modalText
:
BehaviorSubject
<
string
>
;
private
modalHeader
:
BehaviorSubject
<
string
>
;
constructor
(
private
fb
:
FormBuilder
,
private
router
:
Router
,
...
...
@@ -80,63 +93,74 @@ import {
this
.
showLoader
=
new
BehaviorSubject
(
false
);
this
.
formGroup
=
this
.
fb
.
group
({
});
this
.
modalTitle
=
new
BehaviorSubject
(
""
);
this
.
modalText
=
new
BehaviorSubject
(
""
);
this
.
modalHeader
=
new
BehaviorSubject
(
""
);
}
ngOnDestroy
()
{
(
<
any
>
$
(
"
#informationfeedback
"
)).
remove
();
}
ngOnInit
()
{
(
<
any
>
$
(
"
#informationfeedback
"
)).
appendTo
(
"
body
"
);
this
.
showLoader
.
next
(
true
);
this
.
SchoolPerPerfSub
=
this
.
_hds
.
getSchools
().
subscribe
(
data
=>
{
this
.
SchoolsPerPerf$
.
next
(
data
);
this
.
showLoader
.
next
(
false
);
},
this
.
SchoolPerPerfSub
=
this
.
_hds
.
getSchools
()
.
subscribe
(
data
=>
{
this
.
SchoolsPerPerf$
.
next
(
data
);
this
.
showLoader
.
next
(
false
);
},
error
=>
{
this
.
SchoolsPerPerf$
.
next
([{}]);
console
.
log
(
"
Error Getting Schools
"
);
this
.
modalHeader
.
next
(
"
modal-header-danger
"
);
this
.
modalTitle
.
next
(
"
Αδυναμία άντλησης στοιχείων
"
);
this
.
modalText
.
next
(
"
Προέκυψε σφάλμα κατά την άντληση των στοιχείων. Παρακαλώ δοκιμάστε ξανά. Εφόσον το πρόβλημα συνεχίσει να υφίσταται, επικοινωνήστε με την ομάδα υποστήριξης.
"
);
this
.
showModal
();
this
.
showLoader
.
next
(
false
);
});
}
calccolor
(
size
,
limit
)
{
if
(
size
<
limit
)
return
true
;
else
return
false
;
}
setActiveRegion
(
ind
)
{
this
.
CoursesPerPerf$
.
next
([{}]);
if
(
ind
===
this
.
regionActive
)
{
ind
=
-
1
;
this
.
regionActive
=
ind
;
}
else
{
this
.
regionActive
=
ind
;
this
.
showLoader
.
next
(
true
);
this
.
CoursesPerPerfSub
=
this
.
_hds
.
getCoursePerPerfecture
(
this
.
regionActive
).
subscribe
(
data
=>
{
this
.
CoursesPerPerf$
.
next
(
data
);