Commit ffb741f5 authored by Kostas G's avatar Kostas G

sde for dde

parent 0337f27e
......@@ -78,3 +78,11 @@ deploysystem.get_school_list:
_controller: '\Drupal\deploysystem\Controller\CustomViews::getSchoolList'
requirements:
_user_is_logged_in: 'TRUE'
deploysystem.get_gelschool_list:
path: '/deploysystem/getgelschoollist/{schsearch}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\deploysystem\Controller\CustomViews::getGelSchoolList'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
......@@ -87,6 +87,37 @@ class CustomViews extends ControllerBase {
}
public function getGelSchoolList(Request $request, $schsearch) {
try {
$sCon = $this->connection->select('gel_school', 'eSchool')
->fields('eSchool', array('name', 'registry_no', 'unit_type_id', 'id'));
//->condition('eSchool.name', '%' . db_like($schsearch) . '%', 'LIKE');
$words = preg_split('/[\s]+/', $schsearch);
foreach ($words as $word)
$sCon->condition('eSchool.name', '%' . db_like($word) . '%', 'LIKE');
$schools = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
//$school = reset($schools);
$list = array();
foreach ($schools as $object) {
$list[] = array(
'registry_no' => $object->registry_no,
'name' => $object->name,
'unit_type_id' => $object->unit_type_id,
'school_id' => $object->id,
);
}
return $this->respondWithStatus($list, Response::HTTP_OK);
} catch (\Exception $e) {
$this->logger->error($e->getMessage());
return $this->respondWithStatus([
'message' => t("error in getSchoolList function"),
], Response::HTTP_FORBIDDEN);
}
}
......
......@@ -476,3 +476,11 @@ epal.svc.transition-bperiod:
_controller: '\Drupal\epal\Controller\WSConsumer::transitionToBPeriod'
requirements:
_user_is_logged_in: 'TRUE'
epal.encode:
path: '/encodedata'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\EncodedData::createData'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
......@@ -174,3 +174,19 @@ gel.deleteFromDirector:
_controller: '\Drupal\gel\Controller\GelDistribution::deleteApplicationFromDirector'
requirements:
_user_is_logged_in: 'TRUE'
gel.sdeallstudents:
path: '/gel/sde_all_students'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\gel\Controller\SdeDistribution::getSdeStudents'
requirements:
_user_is_logged_in: 'TRUE'
gel.savehighscoolselectionforSDE:
path: '/gel/saveselectionforSDE/{studentid}/{schoolid}/{undoselection}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\gel\Controller\SdeDistribution::SaveSdeStudentHighSchhool'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -2778,6 +2778,8 @@ public function FindStudentsPerSchoolGym(Request $request)
$user = reset($users);
if ($user) {
$gymId = $user->init->value;
//$gymId = 969;
$schools = $this->entityTypeManager->getStorage('gel_school')->loadByProperties(array('id' => $gymId));
$school = reset($schools);
if (!$school) {
......
......@@ -1892,4 +1892,39 @@ deleteApplicationforDirectorGel(appId) {
}
getAllSDEStudents() {
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}/gel/sde_all_students` , options)
.map(response => response.json());
}
saveHighScoolSelectionforSDE(studentid, schoolid, undosel){
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 });
//if (oldschool == false)
//{
// oldschool = 999999;
//}
return this.http.get(`${AppSettings.API_ENDPOINT}/gel/saveselectionforSDE/`+ studentid + '/'+schoolid + '/' + undosel, 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