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
130a8b0a
Commit
130a8b0a
authored
May 29, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'stylesandmenus' into 'develop'
limits per school category See merge request !109
parents
5933a60e
bee210b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
211 additions
and
30 deletions
+211
-30
drupal/modules/epal/epal.routing.yml
drupal/modules/epal/epal.routing.yml
+9
-1
drupal/modules/epal/src/Controller/DirectorView.php
drupal/modules/epal/src/Controller/DirectorView.php
+109
-0
source/components/director/director-view.ts
source/components/director/director-view.ts
+77
-29
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+16
-0
No files found.
drupal/modules/epal/epal.routing.yml
View file @
130a8b0a
...
...
@@ -199,7 +199,7 @@ epal.ministry.storesettings:
requirements
:
_user_is_logged_in
:
'
TRUE'
regionview
:
path
:
'
/epal/ScoolperPerf
/{perfectureId}
'
path
:
'
/epal/ScoolperPerf'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
...
...
@@ -246,5 +246,13 @@ gettypeofschool:
_controller
:
'
\Drupal\epal\Controller\DirectorView::gettypeofschool'
requirements
:
_user_is_logged_in
:
'
TRUE'
getlimitspercourse
:
path
:
'
/epal/getlimitsperCourse/{classid}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getlimitsperCourse'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/src/Controller/DirectorView.php
View file @
130a8b0a
...
...
@@ -786,6 +786,115 @@ public function gettypeofschool(Request $request)
}
public
function
getlimitsperCourse
(
Request
$request
,
$classid
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
$user
)
{
$schoolid
=
$user
->
init
->
value
;
$list
=
array
();
$SchoolCats
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
$SchoolCat
=
reset
(
$SchoolCats
);
if
(
$SchoolCat
){
$categ
=
$SchoolCat
->
metathesis_region
->
value
;
$list
=
array
();
if
(
$classid
==
1
)
{
$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
;
}
$list
[]
=
array
(
'id'
=>
'1'
,
'name'
=>
'Α Λυκείου'
,
'categ'
=>
$categ
,
'classes'
=>
1
,
'limitdown'
=>
$limit
,
);
}
if
(
$classid
==
2
){
$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
;
}
$list
[]
=
array
(
'name'
=>
'Β Λυκείου '
,
'categ'
=>
$categ
,
'classes'
=>
2
,
'limitdown'
=>
$limit
,
);
}
if
(
$classid
==
3
){
$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
;
}
$list
[]
=
array
(
'categ'
=>
$categ
,
'classes'
=>
3
,
'limitdown'
=>
$limit
,
);
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"Perfecture not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
...
...
source/components/director/director-view.ts
View file @
130a8b0a
...
...
@@ -146,6 +146,7 @@ import {
</nav>
</div>
</form>
</div>
...
...
@@ -175,14 +176,18 @@ import {
private
selectionBClass
:
BehaviorSubject
<
boolean
>
;
private
selectiontype
:
BehaviorSubject
<
boolean
>
;
private
selectionCClass
:
BehaviorSubject
<
boolean
>
;
private
limitsSub
:
Subscription
;
private
limits$
:
BehaviorSubject
<
any
>
;
private
SchoolId
;
private
currentclass
:
Number
;
private
saved
:
Array
<
number
>
=
new
Array
();
private
limitdown
=
0
;
private
limitup
=
5
;
private
pageno
=
1
;
public
totallimit
;
private
userActive
=
<
number
>-
1
;
private
type
:
Number
;
public
tot_pages
:
number
;
@
ViewChild
(
'
fileInput
'
)
fileInput
:
ElementRef
;
...
...
@@ -198,9 +203,11 @@ import {
this
.
StudentsSize$
=
new
BehaviorSubject
({});
this
.
SavedStudents$
=
new
BehaviorSubject
({});
this
.
SubmitedDetails$
=
new
BehaviorSubject
([{}]);
this
.
limits$
=
new
BehaviorSubject
([{}]);
this
.
retrievedStudent
=
new
BehaviorSubject
(
false
);
this
.
selectionBClass
=
new
BehaviorSubject
(
false
);
this
.
selectionCClass
=
new
BehaviorSubject
(
false
);
//this.outoflimits = new BehaviorSubject(false);
this
.
School$
=
new
BehaviorSubject
([{}]);
this
.
selectiontype
=
new
BehaviorSubject
(
true
);
...
...
@@ -215,6 +222,7 @@ import {
}
ngOnDestroy
()
{
if
(
this
.
StudentSelectedSub
)
this
.
StudentSelectedSub
.
unsubscribe
();
...
...
@@ -231,6 +239,7 @@ import {
}
ngOnInit
()
{
...
...
@@ -328,57 +337,96 @@ import {
findstudent
(
txop
,
pageno
)
{
var
tot_pages
:
number
;
var
sectorint
=
+
this
.
formGroup
.
value
.
tomeas
;
if
(
txop
.
value
===
"
1
"
)
{
this
.
currentclass
=
1
;
}
else
if
(
txop
.
value
===
"
2
"
)
{
this
.
currentclass
=
2
;
}
else
if
(
txop
.
value
===
"
3
"
)
{
this
.
currentclass
=
3
;
}
else
if
(
txop
.
value
===
"
4
"
)
{
this
.
currentclass
=
4
;
}
this
.
currentclass
=
+
txop
.
value
;
this
.
formGroup
.
get
(
'
pageno
'
).
setValue
(
this
.
pageno
);
if
(
this
.
pageno
==
1
)
{
console
.
log
(
this
.
SchoolId
,
sectorint
,
this
.
currentclass
,
"
testaaaaaa
"
);
console
.
log
(
"
mphkepage = 1
"
);
this
.
StudentsSizeSub
=
this
.
_hds
.
getStudentPerSchool
(
sectorint
,
this
.
currentclass
,
0
,
0
).
subscribe
(
x
=>
{
this
.
StudentsSize$
.
next
(
x
);
tot_pages
=
x
.
id
/
5
;
this
.
totallimit
=
x
.
id
;
this
.
limitsSub
=
this
.
_hds
.
getlimitsofcourse
(
this
.
currentclass
).
subscribe
(
data
=>
{
this
.
limits$
.
next
(
data
);
console
.
log
(
this
.
totallimit
,
data
[
0
].
limitdown
,
"
oria
"
);
this
.
tot_pages
=
x
.
id
/
5
;
if
(
x
.
id
%
5
>
0
)
{
tot_pages
=
(
x
.
id
-
(
x
.
id
%
5
))
/
5
+
1
;
t
his
.
t
ot_pages
=
(
x
.
id
-
(
x
.
id
%
5
))
/
5
+
1
;
}
console
.
log
(
tot_pages
,
"
totpages
"
)
if
(
isNaN
(
tot_pages
)){
console
.
log
(
t
his
.
t
ot_pages
,
"
totpages
"
)
if
(
isNaN
(
t
his
.
t
ot_pages
)){
this
.
retrievedStudent
.
next
(
false
);
tot_pages
=
0
;
t
his
.
t
ot_pages
=
0
;
}
this
.
formGroup
.
get
(
'
maxpage
'
).
setValue
(
tot_pages
);
if
(
(
x
.
id
<
data
[
0
].
limitdown
)
||
(
isNaN
(
this
.
tot_pages
)))
{
console
.
log
(
"
mphkeprwto!
"
)
this
.
retrievedStudent
.
next
(
false
);
this
.
tot_pages
=
0
;
this
.
formGroup
.
get
(
'
maxpage
'
).
setValue
(
this
.
tot_pages
);
//this.outoflimits.next(true);
}
else
{
// this.outoflimits.next(false);
this
.
formGroup
.
get
(
'
maxpage
'
).
setValue
(
this
.
tot_pages
);
console
.
log
(
this
.
tot_pages
,
"
mazeuw mathites
"
);
this
.
StudentInfoSub
=
this
.
_hds
.
getStudentPerSchool
(
sectorint
,
this
.
currentclass
,
this
.
limitdown
,
this
.
limitup
).
subscribe
(
data
=>
{
this
.
StudentInfo$
.
next
(
data
);
console
.
log
(
"
tot.pages
"
,
this
.
formGroup
.
value
.
maxpage
,
"
max1
"
,
this
.
tot_pages
);
this
.
retrievedStudent
.
next
(
true
);
},
error
=>
{
this
.
StudentInfo$
.
next
([{}]);
console
.
log
(
"
Error Getting Students
"
);
},
()
=>
console
.
log
(
"
Getting Students
"
));
}
},
error
=>
{
this
.
limits$
.
next
([{}]);
console
.
log
(
"
Error Getting limits
"
);
},
()
=>
console
.
log
(
"
Getting limits
"
));
});
}
console
.
log
(
this
.
limitdown
,
this
.
limitup
,
"
mits
"
);
this
.
StudentInfoSub
=
this
.
_hds
.
getStudentPerSchool
(
sectorint
,
this
.
currentclass
,
this
.
limitdown
,
this
.
limitup
).
subscribe
(
data
=>
{
this
.
StudentInfo$
.
next
(
data
);
if
(
tot_pages
===
0
){
console
.
log
(
"
tot.pages
"
,
this
.
formGroup
.
value
.
maxpage
);
else
{
console
.
log
(
"
eisai edw
"
,
this
.
tot_pages
);
if
(
this
.
tot_pages
==
0
){
console
.
log
(
"
mphke1
"
,
this
.
formGroup
.
value
.
maxpage
,
this
.
tot_pages
);
this
.
retrievedStudent
.
next
(
false
);
}
else
{
console
.
log
(
"
tot.pages
"
,
this
.
formGroup
.
value
.
maxpage
,
"
max
"
,
tot_pages
);
console
.
log
(
this
.
tot_pages
,
"
mazeuw mathites
"
);
this
.
StudentInfoSub
=
this
.
_hds
.
getStudentPerSchool
(
sectorint
,
this
.
currentclass
,
this
.
limitdown
,
this
.
limitup
).
subscribe
(
data
=>
{
this
.
StudentInfo$
.
next
(
data
);
console
.
log
(
"
tot.pages
"
,
this
.
formGroup
.
value
.
maxpage
,
"
max1
"
,
this
.
tot_pages
);
this
.
retrievedStudent
.
next
(
true
);
}
},
},
error
=>
{
this
.
StudentInfo$
.
next
([{}]);
console
.
log
(
"
Error Getting Students
"
);
},
()
=>
console
.
log
(
"
Getting Students
"
));
}
}
}
...
...
source/services/helper-data-service.ts
View file @
130a8b0a
...
...
@@ -875,5 +875,21 @@ gettypeofschool(){
}
getlimitsofcourse
(
classid
){
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
});
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/getlimitsperCourse/`
+
classid
,
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