Commit 79467204 authored by Νίκος Κατσαούνος's avatar Νίκος Κατσαούνος

Merge branch 'sde' into 'develop'

Sde

See merge request itminedu/e-eggrafes!127
parents 198a4ce8 425675d7
......@@ -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
......@@ -134,6 +134,9 @@ class WSConsumer extends ControllerBase
$sCon->condition('gel_app.lastschool_schoolyear','2017-2018', '<');
$sCon->condition('gel_app.myschool_id',NULL, 'IS NOT');
$sCon->condition('gel_app.delapp',0, '=');
$sCon->condition('gel_app.myschool_promoted',NULL, 'IS');
$sCon->condition('gel_app.second_period',1, '=');
$students_promotions = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($students_promotions as $student) {
......@@ -151,14 +154,16 @@ class WSConsumer extends ControllerBase
}
if ($result==NULL){
$this->logger->warning($count.",".$student->myschool_id.", null response");
$this->logger->warning($count.",".$student->myschool_id.", null result");
}
else{
$promotion=json_decode($result);
if ($promotion==NULL){
$this->logger->warning($count.",".$student->myschool_id.", null response");
$this->logger->warning($count.",".$student->myschool_id.", null promotion");
$promotion=0;
}
$transaction = $this->connection->startTransaction();
......@@ -194,6 +199,9 @@ class WSConsumer extends ControllerBase
$sCon->condition('epal_app.lastschool_schoolyear','2017-2018', '<');
$sCon->condition('epal_app.myschool_id',NULL, 'IS NOT');
$sCon->condition('epal_app.delapp',0, '=');
$sCon->condition('epal_app.myschool_promoted',NULL, 'IS');
$sCon->condition('epal_app.second_period',1, '=');
$students_promotions = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($students_promotions as $student) {
......@@ -211,14 +219,15 @@ class WSConsumer extends ControllerBase
}
if ($result==NULL){
$this->logger->warning($count.",".$student->myschool_id.", null response");
$this->logger->warning($count.",".$student->myschool_id.", null result");
}
else{
$promotion=json_decode($result);
if ($promotion==NULL){
$this->logger->warning($count.",".$student->myschool_id.", null response");
$this->logger->warning($count.",".$student->myschool_id.", null promotion");
$promotion=0;
}
$transaction = $this->connection->startTransaction();
......
......@@ -174,6 +174,22 @@ 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'
gel.initializationBperiod:
path: '/gel/initializationBperiod'
options:
......
......@@ -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) {
......@@ -3968,7 +3970,35 @@ public function Initializationbperiod(Request $request)
$entity_storage_student->save($entity_object);
}
}
$this->logger->warning("sde prin");
$student = array();
//initialazation for sde
$sCon = $this->connection->select('gel_student', 'gStudent');
$sCon->fields('gStudent', array('id', 'lastschool_registrynumber','lastschool_unittypeid','lastschool_class','nextclass','second_period'))
->condition('gStudent.lastschool_unittypeid', 40 , '=')
->condition('gStudent.delapp', 0, '=');
$schools = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
//$this->logger->warning("9");
foreach ($schools as $school) {
$student = array(
'langcode' => 'el',
'id' => $school ->id,
'student_id' => $school ->id,
'taxi' => $school-> nextclass,
'dide' => 0,//$school ->edu_admin_id,
'second_period' => 1,
);
$entity_storage_student = $this->entityTypeManager->getStorage('gelstudenthighschool');
$entity_object = $entity_storage_student->create($student);
$entity_storage_student->save($entity_object);
}
}
......
This diff is collapsed.
......@@ -1911,4 +1911,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