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

trans

parent ef77a939
......@@ -7,7 +7,7 @@ epal.user.send_verification_code:
requirements:
_user_is_logged_in: 'TRUE'
epal.user.verify_verification_code:
path: '/epal/user/verifyvercode'
path: '/epal/user/verifyvercode'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -172,7 +172,14 @@ coursesperschools:
_controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool'
requirements:
_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
}
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) {
......
......@@ -50,8 +50,8 @@ import {
public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>;
private SchoolPerPerfSub: Subscription;
private LimitPerCategSub: BehaviorSubject<any>;
private LimitPerCateg$: Subscription;
private LimitPerCateg$: BehaviorSubject<any>;
private LimitPerCategSub: Subscription;
private CoursesPerPerf$: BehaviorSubject<any>;
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
......
......@@ -726,8 +726,8 @@ export class HelperDataService implements OnInit, OnDestroy {
getLimitPerCateg(categ, classes){
let classesNew = classes.toString();
console.log(categ,classes,"aaaa");
// let classesNew = classes.toString();
this.loginInfo$.getValue().forEach(loginInfoToken => {
......@@ -741,7 +741,7 @@ export class HelperDataService implements OnInit, OnDestroy {
});
this.createAuthorizationHeader(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());
}
......
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