Commit 3b25e4a0 authored by Open Source Developer's avatar Open Source Developer

trans

parent ef77a939
...@@ -7,7 +7,7 @@ epal.user.send_verification_code: ...@@ -7,7 +7,7 @@ epal.user.send_verification_code:
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
epal.user.verify_verification_code: epal.user.verify_verification_code:
path: '/epal/user/verifyvercode' path: '/epal/user/verifyvercode'
options: options:
_auth: [ 'basic_auth' ] _auth: [ 'basic_auth' ]
defaults: defaults:
...@@ -172,7 +172,14 @@ coursesperschools: ...@@ -172,7 +172,14 @@ coursesperschools:
_controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool' _controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool'
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
limitpercateg:
path: '/epal/LimitPerCateg/{categ}/{classId}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getLimitPerCateg'
requirements:
_user_is_logged_in: 'TRUE'
...@@ -538,7 +538,47 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid ...@@ -538,7 +538,47 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
} }
public function getLimitPerCateg(Request $request, $categ, $classId)
{
$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('epal_class_limits')->loadByProperties(array('name'=> $classId, 'category' => $categ ));
if ($schools)
{
$list = array();
foreach ($schools as $object) {
$list[] = array(
'limit_down' => $object -> limit_down ->value,
);
$i++;
}
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) { private function respondWithStatus($arr, $s) {
......
...@@ -50,8 +50,8 @@ import { ...@@ -50,8 +50,8 @@ import {
public formGroup: FormGroup; public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>; private SchoolsPerPerf$: BehaviorSubject<any>;
private SchoolPerPerfSub: Subscription; private SchoolPerPerfSub: Subscription;
private LimitPerCategSub: BehaviorSubject<any>; private LimitPerCateg$: BehaviorSubject<any>;
private LimitPerCateg$: Subscription; private LimitPerCategSub: Subscription;
private CoursesPerPerf$: BehaviorSubject<any>; private CoursesPerPerf$: BehaviorSubject<any>;
private CoursesPerPerfSub: Subscription; private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>; private StudentsSize$: BehaviorSubject<any>;
......
...@@ -726,8 +726,8 @@ export class HelperDataService implements OnInit, OnDestroy { ...@@ -726,8 +726,8 @@ export class HelperDataService implements OnInit, OnDestroy {
getLimitPerCateg(categ, classes){ getLimitPerCateg(categ, classes){
console.log(categ,classes,"aaaa");
let classesNew = classes.toString(); // let classesNew = classes.toString();
this.loginInfo$.getValue().forEach(loginInfoToken => { this.loginInfo$.getValue().forEach(loginInfoToken => {
...@@ -741,7 +741,7 @@ export class HelperDataService implements OnInit, OnDestroy { ...@@ -741,7 +741,7 @@ export class HelperDataService implements OnInit, OnDestroy {
}); });
this.createAuthorizationHeader(headers); this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers }); let options = new RequestOptions({ headers: headers });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/LimitPerCateg/` + categ + classesNew , options) return this.http.get(`${AppSettings.API_ENDPOINT}/epal/LimitPerCateg/` + categ + classes , options)
.map(response => response.json()); .map(response => response.json());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment