final changes

parent c971f75c
......@@ -834,10 +834,12 @@ class ApplicationSubmit extends ControllerBase
&& preg_match(self::VALID_ADDRESS_PATTERN, $student["regionaddress"]) !== 1) {
return 1008;
}
/*
if ( ( ($wsEnabled === 1 && $student["lastschool_schoolyear"] < self::LIMIT_SCHOOL_YEAR) || ($wsEnabled === 0) )
&& preg_match(self::VALID_ADDRESSTK_PATTERN, $student["regiontk"]) !== 1) {
return 1009;
}
*/
if ( ( ($wsEnabled === 1 && $student["lastschool_schoolyear"] < self::LIMIT_SCHOOL_YEAR) || ($wsEnabled === 0) )
&& preg_match(self::VALID_NAMES_PATTERN, $student["regionarea"]) !== 1) {
return 1010;
......
......@@ -61,11 +61,191 @@ class CreateEncodedData extends ControllerBase {
//insert isolated entries to SP
//152714,225690,215472,177493 και το 46662
$ids_arr = array();
/*
array_push($ids_arr, 152714);
array_push($ids_arr, 225690);
array_push($ids_arr, 215472);
array_push($ids_arr, 177493);
array_push($ids_arr, 46662);
*/
array_push($ids_arr,235372);
array_push($ids_arr,235447);
array_push($ids_arr,233877);
array_push($ids_arr,234374);
array_push($ids_arr,234423);
array_push($ids_arr,234201);
array_push($ids_arr,234806);
array_push($ids_arr,234810);
array_push($ids_arr,234536);
array_push($ids_arr,233891);
array_push($ids_arr,235382);
array_push($ids_arr,235554);
array_push($ids_arr,235409);
array_push($ids_arr,235471);
array_push($ids_arr,234829);
array_push($ids_arr,235422);
array_push($ids_arr,234848);
array_push($ids_arr,235469);
array_push($ids_arr,234896);
array_push($ids_arr,235399);
array_push($ids_arr,235601);
array_push($ids_arr,235548);
array_push($ids_arr,234865);
array_push($ids_arr,235546);
array_push($ids_arr,233441);
array_push($ids_arr,235424);
array_push($ids_arr,233287);
array_push($ids_arr,233389);
array_push($ids_arr,233615);
array_push($ids_arr,233870);
array_push($ids_arr,233954);
array_push($ids_arr,233962);
array_push($ids_arr,234223);
array_push($ids_arr,234327);
array_push($ids_arr,234339);
array_push($ids_arr,234372);
array_push($ids_arr,234733);
array_push($ids_arr,235218);
array_push($ids_arr,235238);
array_push($ids_arr,235324);
array_push($ids_arr,235357);
array_push($ids_arr,234949);
array_push($ids_arr,235498);
array_push($ids_arr,235602);
array_push($ids_arr,233882);
array_push($ids_arr,234951);
array_push($ids_arr,235480);
array_push($ids_arr,235263);
array_push($ids_arr,235411);
array_push($ids_arr,234817);
array_push($ids_arr,235287);
array_push($ids_arr,235363);
array_push($ids_arr,235466);
array_push($ids_arr,235056);
array_push($ids_arr,234835);
array_push($ids_arr,234864);
array_push($ids_arr,234851);
array_push($ids_arr,234837);
array_push($ids_arr,235318);
array_push($ids_arr,234644);
array_push($ids_arr,234888);
array_push($ids_arr,234836);
array_push($ids_arr,235346);
array_push($ids_arr,234942);
array_push($ids_arr,233455);
array_push($ids_arr,234546);
array_push($ids_arr,235587);
array_push($ids_arr,234658);
array_push($ids_arr,234891);
array_push($ids_arr,235600);
array_push($ids_arr,234468);
array_push($ids_arr,233875);
array_push($ids_arr,234486);
array_push($ids_arr,233428);
array_push($ids_arr,233868);
array_push($ids_arr,233892);
array_push($ids_arr,233904);
array_push($ids_arr,233919);
array_push($ids_arr,233921);
array_push($ids_arr,234291);
array_push($ids_arr,234294);
array_push($ids_arr,234317);
array_push($ids_arr,234377);
array_push($ids_arr,234384);
array_push($ids_arr,234388);
array_push($ids_arr,234390);
array_push($ids_arr,234433);
array_push($ids_arr,234434);
array_push($ids_arr,234483);
array_push($ids_arr,234541);
array_push($ids_arr,234623);
array_push($ids_arr,234807);
array_push($ids_arr,234856);
array_push($ids_arr,234879);
array_push($ids_arr,234880);
array_push($ids_arr,234883);
array_push($ids_arr,234910);
array_push($ids_arr,234934);
array_push($ids_arr,235007);
array_push($ids_arr,235084);
array_push($ids_arr,235256);
array_push($ids_arr,235291);
array_push($ids_arr,235327);
array_push($ids_arr,235416);
array_push($ids_arr,235455);
array_push($ids_arr,235467);
array_push($ids_arr,235569);
array_push($ids_arr,235572);
array_push($ids_arr,235577);
array_push($ids_arr,51380);
array_push($ids_arr,124299);
array_push($ids_arr,163908);
array_push($ids_arr,234001);
array_push($ids_arr,233665);
array_push($ids_arr,234020);
array_push($ids_arr,233531);
array_push($ids_arr,233671);
array_push($ids_arr,233631);
array_push($ids_arr,234043);
array_push($ids_arr,233658);
array_push($ids_arr,233632);
array_push($ids_arr,233742);
array_push($ids_arr,233625);
array_push($ids_arr,233756);
array_push($ids_arr,233541);
array_push($ids_arr,233491);
array_push($ids_arr,233411);
array_push($ids_arr,234308);
array_push($ids_arr,234461);
array_push($ids_arr,234226);
array_push($ids_arr,234170);
array_push($ids_arr,234098);
array_push($ids_arr,234106);
array_push($ids_arr,234481);
array_push($ids_arr,234497);
array_push($ids_arr,234787);
array_push($ids_arr,234750);
array_push($ids_arr,234180);
array_push($ids_arr,234125);
array_push($ids_arr,234695);
array_push($ids_arr,234649);
array_push($ids_arr,234688);
array_push($ids_arr,234591);
array_push($ids_arr,234960);
array_push($ids_arr,234927);
array_push($ids_arr,234430);
array_push($ids_arr,234503);
array_push($ids_arr,234259);
array_push($ids_arr,234488);
array_push($ids_arr,234642);
array_push($ids_arr,235031);
array_push($ids_arr,234983);
array_push($ids_arr,235028);
array_push($ids_arr,234072);
array_push($ids_arr,234529);
array_push($ids_arr,234952);
array_push($ids_arr,234956);
array_push($ids_arr,234694);
array_push($ids_arr,235513);
array_push($ids_arr,235137);
array_push($ids_arr,235189);
array_push($ids_arr,235175);
array_push($ids_arr,235353);
array_push($ids_arr,235266);
array_push($ids_arr,235152);
array_push($ids_arr,235342);
array_push($ids_arr,235243);
array_push($ids_arr,235060);
array_push($ids_arr,235127);
array_push($ids_arr,235143);
array_push($ids_arr,235433);
array_push($ids_arr,235488);
$sCon = $this->connection
->select('gel_student', 'eInvalid')
......
......@@ -74,7 +74,7 @@ class DirectorView extends ControllerBase
if ($user) {
$epalId = $user->init->value;
//hard
//$epalId = 250;
//$epalId = 193;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $epalId));
$school = reset($schools);
if (!$school) {
......@@ -115,9 +115,9 @@ class DirectorView extends ControllerBase
$sCon->fields('eStudent', array('id','myschool_promoted','lastschool_registrynumber','currentclass', 'delapp','name','studentsurname' ,'fatherfirstname' ,'motherfirstname' ,'regionaddress' ,'regiontk' ,'regionarea','telnum' ,'guardian_name' ,'guardian_surname','guardian_fathername ','guardian_mothername', 'birthdate', 'lastschool_schoolname','lastschool_class','lastschool_schoolyear', 'created' ))
->condition('eStudent.id', $studentId , '=')
->condition('eStudent.id', $studentId , '=');
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
// ->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
......@@ -195,6 +195,7 @@ class DirectorView extends ControllerBase
'birthdate' => date("d-m-Y", strtotime($epalStudent->birthdate)),
'checkstatus' => $checkstudentstatus -> directorconfirm -> value ,
'lock_delete' => $lock_delete,
//'lock_delete' => 1,
'created' => date('d/m/Y H:i', $epalStudent -> created ),
);
......@@ -509,8 +510,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', -1 , '=')
->condition('eSchool.currentclass', 1 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -522,8 +523,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', -1 , '=')
->condition('eSchool.currentclass', 1 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -571,8 +572,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $sectorid , '=')
->condition('eSchool.currentclass', 2 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -584,8 +585,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', $sectorid , '=')
->condition('eSchool.currentclass', 2 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -628,8 +629,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 3 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -642,8 +643,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 3 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -684,8 +685,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 4 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -697,8 +698,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 4 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$capacity_class_d = ($object -> capacity_class_specialty_d ->value) *25;
......@@ -778,8 +779,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', -1 , '=')
->condition('eSchool.currentclass', 1 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -804,8 +805,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', $sectorid , '=')
->condition('eSchool.currentclass', 2 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$results = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -832,8 +833,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 3 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -859,8 +860,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 4 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -996,7 +997,7 @@ class DirectorView extends ControllerBase
if ($user) {
$schoolid = $user->init->value;
//hard
//$schoolid = 250;
//$schoolid = 193;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid));
$school = reset($schools);
if (!$school) {
......@@ -1041,8 +1042,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', -1 , '=')
->condition('eSchool.currentclass', 1 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1080,8 +1081,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $sectorid , '=')
->condition('eSchool.currentclass', 2 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
// ->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1120,8 +1121,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 3 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1156,8 +1157,8 @@ class DirectorView extends ControllerBase
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 4 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1386,8 +1387,8 @@ public function getpde(Request $request)
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', -1 , '=')
->condition('eSchool.currentclass', 1 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1399,8 +1400,8 @@ public function getpde(Request $request)
->condition('eSchool.specialization_id', -1 , '=')
->condition('eSchool.currentclass', 1 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1448,8 +1449,8 @@ public function getpde(Request $request)
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $sectorid , '=')
->condition('eSchool.currentclass', 2 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1461,8 +1462,8 @@ public function getpde(Request $request)
->condition('eSchool.specialization_id', $sectorid , '=')
->condition('eSchool.currentclass', 2 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1505,8 +1506,8 @@ public function getpde(Request $request)
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 3 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1519,8 +1520,8 @@ public function getpde(Request $request)
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 3 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1561,8 +1562,8 @@ public function getpde(Request $request)
->condition('eSchool.epal_id', $schoolid , '=')
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 4 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eStudent.delapp', 0 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchool = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -1574,8 +1575,8 @@ public function getpde(Request $request)
->condition('eSchool.specialization_id', $specialityid , '=')
->condition('eSchool.currentclass', 4 , '=')
->condition('eStudent.delapp', 0 , '=')
->condition('eSchool.directorconfirm', 1 , '=')
->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
->condition('eSchool.directorconfirm', 1 , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$studentPerSchoolConfir = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$capacity_class_d = ($object -> capacity_class_specialty_d ->value) *25;
......
<?php
namespace Drupal\epal\Controller;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Database\Connection;
use Drupal\epal\Crypt;
class DirectorView extends ControllerBase
{
protected $entityTypeManager;
protected $logger;
protected $connection;
public function __construct(
EntityTypeManagerInterface $entityTypeManager,
Connection $connection,
LoggerChannelFactoryInterface $loggerChannel
) {
$this->entityTypeManager = $entityTypeManager;
$this->connection = $connection;
$this->logger = $loggerChannel->get('epal-school');
}
public static function create(ContainerInterface $container)
{
return new static(
$container->get('entity_type.manager'),
$container->get('database'),
$container->get('logger.factory')
);
}
public function getStudentPerSchool(Request $request, $classId, $sector, $specialit)
{
try {
$authToken = $request->headers->get('PHP_AUTH_USER');
$eggrafesConfigs = $this->entityTypeManager->getStorage('eggrafes_config')->loadByProperties(array('name' => 'eggrafes_config_epal'));
$eggrafesConfig = reset($eggrafesConfigs);
if (!$eggrafesConfig) {
return $this->respondWithStatus([
"error_code" => 3001
], Response::HTTP_FORBIDDEN);
}
else
$lock_delete = $eggrafesConfig->lock_delete->value;
/*
if ($eggrafesConfig->lock_school_students_view->value) {
return $this->respondWithStatus([
"error_code" => 3002
], Response::HTTP_FORBIDDEN);
}
*/
/*
if ($eggrafesConfig->lock_delete->value) {
return $this->respondWithStatus([
"error_code" => 3002
], Response::HTTP_FORBIDDEN);
}
*/
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$epalId = $user->init->value;
//hard
//$epalId = 158;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $epalId));
$school = reset($schools);
if (!$school) {
$this->logger->warning('no access to this school='.$user->id());
return $this->respondWithStatus([
"message" => "No access to this school"
], Response::HTTP_FORBIDDEN);
}
$userRoles = $user->getRoles();
$userRole = '';
foreach ($userRoles as $tmpRole) {
if ($tmpRole === 'epal') {
$userRole = $tmpRole;
}
}
if ($userRole === '') {
return $this->respondWithStatus([
'error_code' => 4003,
], Response::HTTP_FORBIDDEN);
} elseif ($userRole === 'epal') {
if ($classId == 1) {
$selectIdNew = -1;
} elseif ($classId == 2) {
$selectIdNew = $sector;
} else {
$selectIdNew = $specialit;
}
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id' => $epalId, 'specialization_id' => $selectIdNew, 'currentclass' => $classId));
}
if ($studentPerSchool) {
$list = array();
foreach ($studentPerSchool as $object) {
$studentId = $object->student_id->target_id;
$sCon = $this->connection->select('epal_student', 'eStudent');
$sCon->fields('eStudent', array('id','myschool_promoted','lastschool_registrynumber','currentclass', 'delapp','name','studentsurname' ,'fatherfirstname' ,'motherfirstname' ,'regionaddress' ,'regiontk' ,'regionarea','telnum' ,'guardian_name' ,'guardian_surname','guardian_fathername ','guardian_mothername', 'birthdate', 'lastschool_schoolname','lastschool_class','lastschool_schoolyear', 'created' ))
->condition('eStudent.id', $studentId , '=');
//->condition(db_or()->condition(db_or()->condition('myschool_promoted', 1)->condition('myschool_promoted', 2))->condition(db_or()->condition('myschool_promoted', 6)->condition('myschool_promoted', 7)));
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$epalStudent = reset($epalStudents);
if ($epalStudents) {
$studentIdNew = $epalStudent->id;
$checkstatus = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('student_id' => $studentIdNew));
$checkstudentstatus = reset($checkstatus);
$sectorName = '';
$courseName = '';
if ($epalStudent->currentclass === '2') {
$sectors = $this->entityTypeManager->getStorage('epal_student_sector_field')->loadByProperties(array('student_id' => $studentIdNew));
$sector = reset($sectors);
if ($sector) {
$sectorName = $this->entityTypeManager->getStorage('eepal_sectors')->load($sector->sectorfield_id->target_id)->name->value;
}
} elseif ($epalStudent->currentclass === '3' || $epalStudent->currentclass === '4') {
$courses = $this->entityTypeManager->getStorage('epal_student_course_field')->loadByProperties(array('student_id' => $studentIdNew));
$course = reset($courses);
if ($course) {
$courseName = $this->entityTypeManager->getStorage('eepal_specialty')->load($course->coursefield_id->target_id)->name->value;
}
}
$crypt = new Crypt();
try {
$name_decoded = $crypt->decrypt($epalStudent->name);
$studentsurname_decoded = $crypt->decrypt($epalStudent->studentsurname);
$fatherfirstname_decoded = $crypt->decrypt($epalStudent->fatherfirstname);
$motherfirstname_decoded = $crypt->decrypt($epalStudent->motherfirstname);
$regionaddress_decoded = $crypt->decrypt($epalStudent->regionaddress);
if ($epalStudent->regiontk != null)
$regiontk_decoded = $crypt->decrypt($epalStudent->regiontk);
if ($epalStudent->regionarea != null)
$regionarea_decoded = $crypt->decrypt($epalStudent->regionarea);
$telnum_decoded = $crypt->decrypt($epalStudent->telnum);
$guardian_name_decoded = $crypt->decrypt($epalStudent->guardian_name);
$guardian_surname_decoded = $crypt->decrypt($epalStudent->guardian_surname);
$guardian_fathername_decoded = $crypt->decrypt($epalStudent->guardian_fathername);
$guardian_mothername_decoded = $crypt->decrypt($epalStudent-