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
95dcda33
Commit
95dcda33
authored
May 21, 2017
by
Open Source Developer
Browse files
trans
parent
92b6c15c
Changes
3
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/src/Controller/DirectorView.php
View file @
95dcda33
...
...
@@ -15,7 +15,7 @@ class DirectorView extends ControllerBase
{
protected
$entityTypeManager
;
protected
$logger
;
protected
$testSchoolId
=
'0640050'
;
//
protected $testSchoolId='0640050';
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
,
LoggerChannelFactoryInterface
$loggerChannel
)
...
...
@@ -341,7 +341,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
$user
=
reset
(
$users
);
if
(
$user
)
{
// $schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $user->mail->value, 'id' => intval($epalId)));
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'
registry_no'
=>
$this
->
testS
chool
I
d
));
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'
id'
=>
$s
chool
i
d
));
$school
=
reset
(
$schools
);
if
(
!
$school
)
{
$this
->
logger
->
warning
(
"no access to this school="
.
$user
->
id
());
...
...
@@ -357,7 +357,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
{
$postData
=
json_decode
(
$content
);
$cap
=
$postData
->
capacity
;
if
((
$tomeas
==
0
)
||
(
$specialit
==
0
))
if
((
$tomeas
==
0
)
&&
(
$specialit
==
0
))
{
$CapacityPerClass
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
$classcapacity
=
reset
(
$CapacityPerClass
);
...
...
@@ -368,7 +368,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
if
((
$tomeas
!=
0
)
||
(
$specialit
==
0
))
if
((
$tomeas
!=
0
)
&&
(
$specialit
==
0
))
{
$CapacityPerClass
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'sector_id'
=>
$tomeas
));
$classcapacity
=
reset
(
$CapacityPerClass
);
...
...
@@ -379,7 +379,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
if
((
$tomeas
!=
0
)
||
(
$specialit
!=
0
))
if
((
$tomeas
!=
0
)
&&
(
$specialit
!=
0
))
{
$CapacityPerClass
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialty_id'
=>
$specialit
));
$classcapacity
=
reset
(
$CapacityPerClass
);
...
...
@@ -593,13 +593,13 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
{
$tomeasnew
=
intval
(
$tomeas
);
$specialitnew
=
intval
(
$specialit
new
)
;
$specialitnew
=
intval
(
$specialit
)
;
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
$user
)
{
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'
registry_no'
=>
$this
->
testS
chool
I
d
));
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'
id'
=>
$s
chool
i
d
));
$school
=
reset
(
$schools
);
if
(
!
$school
)
{
$this
->
logger
->
warning
(
"no access to this school="
.
$user
->
id
());
...
...
@@ -624,6 +624,8 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
$list
[]
=
array
(
'taxi'
=>
$taxi
,
'capacity'
=>
$classcapacity
->
capacity_class_a
->
value
,
'test'
=>
"lalalala"
,
'school'
=>
$schoolid
);
}
}
...
...
@@ -639,6 +641,7 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
'tomeas'
=>
$tomeasnew
,
'special'
=>
$specialitnew
,
'capacity'
=>
$classcapacity
->
capacity_class_sector
->
value
,
'sector'
=>
$tomeasnew
.
"lala"
.
$specialitnew
);
}
}
...
...
@@ -655,6 +658,7 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
'special'
=>
$specialitnew
,
'tomeas'
=>
$classcapacity
->
specialty_id
->
value
,
'capacity'
=>
$classcapacity
->
capacity_class_specialty
->
value
,
'specialty'
=>
"fromspeciality"
);
}
}
...
...
source/components/director/director-classcapacity.ts
View file @
95dcda33
...
...
@@ -54,13 +54,11 @@ import {
Τροποποίηση
</button>
</div>
<div *ngIf="(modify === true)">
<input type="number" formControlName="capacity" min="1" max="10">
<input type="number" formControlName="capacity" min="1" max="10">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="saveCapacity()">
Αποθήκευση
</button>
</div>
</form>
</div>
`
...
...
@@ -75,7 +73,9 @@ import {
private
StudentSelectedSpecialSub
:
Subscription
;
private
selectionBClass
:
BehaviorSubject
<
boolean
>
;
private
selectionCClass
:
BehaviorSubject
<
boolean
>
;
private
SchoolId
=
147
;
private
School$
:
BehaviorSubject
<
any
>
;
private
SchoolSub
:
Subscription
;
private
SchoolId
;
private
currentclass
:
Number
;
private
classCapacity$
:
BehaviorSubject
<
any
>
;
private
classCapacitySub
:
Subscription
;
...
...
@@ -94,11 +94,13 @@ import {
this
.
selectionBClass
=
new
BehaviorSubject
(
false
);
this
.
selectionCClass
=
new
BehaviorSubject
(
false
);
this
.
retrievedStudent
=
new
BehaviorSubject
(
false
);
this
.
School$
=
new
BehaviorSubject
([{}]);
this
.
formGroup
=
this
.
fb
.
group
({
tomeas
:
[
''
,
[]],
taxi
:
[
''
,
[]],
specialit
:
[
''
,
[]],
capacity
:
[
''
,
[]],
capc
:
[
''
,
[]],
});
}
...
...
@@ -120,6 +122,20 @@ import {
ngOnInit
()
{
this
.
retrievedStudent
.
next
(
false
);
this
.
SchoolSub
=
this
.
_hds
.
getSchoolId
().
subscribe
(
x
=>
{
this
.
School$
.
next
(
x
);
console
.
log
(
x
[
0
].
id
,
"
schoolid!
"
);
this
.
SchoolId
=
x
[
0
].
id
;
},
error
=>
{
this
.
School$
.
next
([{}]);
console
.
log
(
"
Error Getting School
"
);
},
()
=>
console
.
log
(
"
Getting School
"
));
}
...
...
@@ -147,6 +163,7 @@ import {
}
else
if
(
txop
.
value
===
"
2
"
)
{
this
.
formGroup
.
patchValue
({
tomeas
:
''
,
specialit
:
''
,
});
this
.
selectionBClass
.
next
(
true
);
...
...
@@ -206,9 +223,13 @@ import {
if
(
txop
.
value
===
"
3
"
)
{
console
.
log
(
"
c class
"
);
console
.
log
(
sectorint
,
specialint
,
"
cclass
"
)
this
.
classCapacitySub
=
this
.
_hds
.
getCapacityPerSchool
(
this
.
formGroup
.
value
.
taxi
,
sectorint
,
specialint
,
this
.
SchoolId
).
subscribe
(
data
=>
{
this
.
classCapacity$
.
next
(
data
);
this
.
retrievedStudent
.
next
(
true
);
// this.formGroup.get('capc').setValue(this.formGroup.value.capacity);
console
.
log
(
this
.
formGroup
.
value
.
capacity
,
"
capc
"
);
},
error
=>
{
this
.
classCapacity$
.
next
([{}]);
...
...
source/services/helper-data-service.ts
View file @
95dcda33
...
...
@@ -907,7 +907,7 @@ getCourses(username, userpassword, sectorid) {
getCapacityPerSchool
(
taxi
,
tomeas
,
specialit
,
schoolid
)
{
console
.
log
(
tomeas
,
specialit
,
"
news
"
)
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
...
...
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