added report ReportNoCapacity, updated several controlllers to conform to D...

added report ReportNoCapacity, updated several controlllers to conform to D class functionality, added boolean field aggreement in EpalStudent entity, added field capacity_class_specialty_d in EepalSpecialtiesInEpal entity
parent cb6a5670
......@@ -158,6 +158,14 @@ epal.ministry.report-all-stat:
_controller: '\Drupal\epal\Controller\ReportsCreator::makeReportAllStat'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.report-no-capacity:
path: '/ministry/report-no-capacity/{capacityEnabled}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\ReportsCreator::makeReportNoCapacity'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.retrieve-registry-id:
path: '/ministry/retrieve-registry-id'
options:
......@@ -214,4 +222,3 @@ findschoolid:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolID'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -130,7 +130,7 @@ class ApplicationSubmit extends ControllerBase {
// or: epal_student_sector_field (αφορά μαθητές Β' Λυκείου)
//if ($applicationForm[0][currentclass] === "Γ' Λυκείου") {
if ($applicationForm[0][currentclass] === "3") {
if ($applicationForm[0][currentclass] === "3" || $applicationForm[0][currentclass] === "4" ) {
//$course = array('name
$course = array(
//'name' => $aitisi[3][name],
......
......@@ -188,6 +188,8 @@ class Distribution extends ControllerBase {
$eepalSpecialtiesInEpal = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSpecialtiesInEpal as $eepalSpecialInEp) {
$this->checkCapacityAndArrange($eepalSchool->id, "3", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty);
//Δ' Λυκείου
$this->checkCapacityAndArrange($eepalSchool->id, "4", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty);
}
} //end for each school/department
......@@ -262,7 +264,8 @@ class Distribution extends ControllerBase {
$epalSectorChosen = $clCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$epalSecChos = reset($epalSectorChosen);
}
elseif ($epalStudent->currentclass === "3") {
//Δ'Λυκείου - Γ' Λυκείου
elseif ($epalStudent->currentclass === "3" || $epalStudent->currentclass === "4") {
$clCon = $this->connection->select('epal_student_course_field', 'courses')
->fields('courses', array('student_id', 'coursefield_id'))
->condition('courses.student_id', $epalStudent->id , '=');
......@@ -272,7 +275,8 @@ class Distribution extends ControllerBase {
if ($epalStudent->currentclass === "2")
$specialization_id = $epalSecChos->sectorfield_id;
elseif ($epalStudent->currentclass === "3")
//Δ'Λυκείου - Γ' Λυκείου
elseif ($epalStudent->currentclass === "3" || $epalStudent->currentclass === "4")
$specialization_id = $epalCourChos->coursefield_id;
else
$specialization_id = -1;
......@@ -530,110 +534,4 @@ class Distribution extends ControllerBase {
/*
public function makegGeneralReport(Request $request) {
try {
if (!$request->isMethod('GET')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
], Response::HTTP_METHOD_NOT_ALLOWED);
}
//user validation
//Note: $authToken = $postData->username
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if (!$user) {
return $this->respondWithStatus([
'message' => t("User not found"),
], Response::HTTP_FORBIDDEN);
}
//user role validation
//$user = \Drupal\user\Entity\User::load($user->id());
$roles = $user->getRoles();
$validRole = false;
foreach ($roles as $role)
if ($role === "ministry") {
$validRole = true;
break;
}
if (!$validRole) {
return $this->respondWithStatus([
'message' => t("User Invalid Role"),
], Response::HTTP_FORBIDDEN);
}
//υπολογισμός αριθμού αιτήσεων
$sCon = $this->connection->select('epal_student', 'eStudent')
->fields('eStudent', array('id'));
$numTotal = $sCon->countQuery()->execute()->fetchField();
//υπολογισμός αριθμού αιτήσεων που ικανοποιήθηκαν στην i προτίμηση
$numData = array();
for ($i=0; $i < 3; $i++) {
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('id', 'distribution_id'))
->condition('eStudent.distribution_id', $i+1, '=');
array_push($numData, $sCon->countQuery()->execute()->fetchField());
}
// υπολογισμός αριθμού αιτήσεων που ΔΕΝ ικανοποιήθηκαν
//Σημείωση: υπολογισμός με queries στη βάση
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('id'));
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$studentIds = array();
foreach ($epalStudents as $epalStudent)
array_push($studentIds, $epalStudent->id);
$sCon = $this->connection->select('epal_student', 'eStudent')
->fields('eStudent', array('id'))
->condition('eStudent.id', $studentIds, 'NOT IN');
$numNoAllocated = $sCon->countQuery()->execute()->fetchField();
$list = array();
//$record = new generalReportSchema;
//$record->name = "nikos";
//$record->numStudents = 20;
array_push($list,(object) array('name' => "Αριθμός Αιτήσεων", 'numStudents' => $numTotal));
// $record = (object) array('name' => "Αριθμός Αιτήσεων:", 'numStudents' => $numTotal);
array_push($list,(object) array('name' => "Αριθμός μαθητών που τοποθετήθηκαν στην πρώτη τους προτίμηση", 'numStudents' => $numData[0]));
//$record = (object) array('name' => "Αριθμός μαθητών που τοποθετήθηκαν στην πρώτη τους προτίμηση:", 'numStudents' => $numData[0]);
array_push($list,(object) array('name' => "Αριθμός μαθητών που τοποθετήθηκαν στην δεύτερή τους προτίμηση", 'numStudents' => $numData[1]));
//$record = (object) array('name' => "Αριθμός μαθητών που τοποθετήθηκαν στην δεύτερή τους προτίμηση:", 'numStudents' => $numData[1]);
array_push($list,(object) array('name' => "Αριθμός μαθητών που τοποθετήθηκαν στην τρίτη τους προτίμηση", 'numStudents' => $numData[2]));
//$record = (object) array('name' => "Αριθμός μαθητών που τοποθετήθηκαν στην τρίτη τους προτίμηση:", 'numStudents' => $numData[2]);
array_push($list,(object) array('name' => "Αριθμός μαθητών που δεν τοποθετήθηκαν σε καμμία τους προτίμηση", 'numStudents' => $numNoAllocated));
//$record = (object) array('name' => "Αριθμός μαθητών που δεν τοποθετήθηκαν σε καμμία τους προτίμηση:", 'numStudents' => $numNoAllocated);
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} //end try
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during DELETE proccess in makeSelectionOfStudents Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
*/
}
......@@ -162,9 +162,10 @@ class InformUnlocatedStudents extends ControllerBase {
$key = 'massive_mail'; //to be checked..
$to = $email;
$params['message'] = t('Σας ενημερώνουμε ότι η αίτησή σας με Α/Α: ') . $appId . t('/') . date('d/m/Y', $epalNonLocatedStudent->created)
.t(' δεν ικανοποιήθηκε. Παρακαλώ επικοινωνήστε άμεσα τηλεφωνικά με τη Διεύθυνση Δευτεροβάθμιας Εκπαίδευσης / Τμήμα Επαγγελματικής Εκπαίδευσης,
στην οποία ανήκετε, ώστε να διερευνηθεί η δυνατότητα εγγραφής σας σε αντίστοιχο ΕΠΑΛ'); //e-mail body
$params['message'] = t('Σας ενημερώνουμε ότι η αίτησή σας με Α/Α: ') . t($appId) . t(' - ') . t(date('d/m/Y', $epalNonLocatedStudent->created))
.t(' δεν ικανοποιήθηκε. Παρακαλώ επικοινωνήστε άμεσα τηλεφωνικά με τη Διεύθυνση Δευτεροβάθμιας Εκπαίδευσης / Τμήμα Επαγγελματικής Εκπαίδευσης,')
.t(' στην οποία ανήκετε, ώστε να διερευνηθεί η δυνατότητα εγγραφής σας σε αντίστοιχο ΕΠΑΛ. ')
.t('\r\nΤεστ1\nΤεστ2') ;//e-mail body
//add new lines with SENDER name - check it
//$params['subject'] = t('Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ');
......
......@@ -132,7 +132,7 @@ class ReportsCreator extends ControllerBase {
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during DELETE proccess in makeSelectionOfStudents Method of Distribution")
"message" => t("An unexpected problem occured during makegGeneralReport Method")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
......@@ -172,29 +172,15 @@ class ReportsCreator extends ControllerBase {
'message' => t("User Invalid Role"),
], Response::HTTP_FORBIDDEN);
}
/*
if ($role === "regioneduadmin") {
//ΑΝΑΚΤΗΣΗ ID της ΠΔΕ
$regionId = 1;
}
*/
$list = array();
//βρες ανώτατο επιτρεπόμενο όριο μαθητών
/*
$sCon = $this->connection->select('epal_class_limits', 'eSchool')
->fields('eSchool', array('name', 'limit_up'))
->condition('eSchool.name', '1' , '=');
$epalLimitUps = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$epalLimitUp = reset($epalLimitUps);
$limitUp = $epalLimitUp->limit_up;
*/
$limitUp = $this->retrieveUpLimit();
//βρες όλα τα σχολεία που πληρούν τα κριτήρια / φίλτρα
$sCon = $this->connection->select('eepal_school_field_data', 'eSchool')
->fields('eSchool', array('id', 'name', 'capacity_class_a', 'region_edu_admin_id', 'edu_admin_id'));
->fields('eSchool', array('id', 'name', 'capacity_class_a', 'region_edu_admin_id', 'edu_admin_id', 'operation_shift'));
if ($regionId != 0)
$sCon->condition('eSchool.region_edu_admin_id', $regionId, '=');
if ($adminId != 0)
......@@ -237,21 +223,42 @@ class ReportsCreator extends ControllerBase {
$numClassSectors += $sectorsInEpal->capacity_class_sector;
array_push($capacity, $numClassSectors * $limitUp);
//χωρητικότητα για Γ' τάξη
//ΑΛΛΑΓΗ -> ΠΡΟΣΘΗΚΗ ΝΕΟΥ ΠΕΔΙΟΥ ΓΙΑ CAPACITY ΣΤΗ Δ';
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('id', 'capacity_class_specialty'))
->condition('eSchool.epal_id', $epalSchool->id , '=');
$specialtiesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$numClassSpecialties = 0;
foreach ($specialtiesInEpals as $specialtiesInEpal)
//$numClassSpecialtiesNight = 0;
foreach ($specialtiesInEpals as $specialtiesInEpal) {
$numClassSpecialties += $specialtiesInEpal->capacity_class_specialty;
//$numClassSpecialtiesNight += $specialtiesInEpal->capacity_class_specialty;
}
array_push($capacity, $numClassSpecialties * $limitUp);
//array_push($capacity, $numClassSpecialtiesNight * $limitUp);
//χωρητικότητα για Δ' τάξη
if ($epalSchool->operation_shift === "ΕΣΠΕΡΙΝΟ") {
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('id', 'capacity_class_specialty_d'))
->condition('eSchool.epal_id', $epalSchool->id , '=');
$specialtiesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$numClassSpecialtiesNight = 0;
foreach ($specialtiesInEpals as $specialtiesInEpal)
$numClassSpecialtiesNight += $specialtiesInEpal->capacity_class_specialty_d;
array_push($capacity, $numClassSpecialtiesNight * $limitUp);
}
else
array_push($capacity,-1);
//χωρητικότητα για όλο το σχολείο
$capacityTotal = array_sum($capacity);
//βρες αριθμό μαθητών γισ κάθε τάξη
$num = array();
$perc = array();
for ( $classId = 1; $classId <= 3; $classId++) {
for ( $classId = 1; $classId <= 4; $classId++) {
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('id', 'epal_id', 'currentclass'))
->condition('eStudent.epal_id', $epalSchool->id , '=')
......@@ -271,8 +278,9 @@ class ReportsCreator extends ControllerBase {
'percTotal' => $percTotal,
'percA' => $perc[0],
'percB' => $perc[1],
'percC' => $perc[2])
);
'percC' => $perc[2],
'percD' => $perc[3]
));
}
......@@ -332,7 +340,7 @@ class ReportsCreator extends ControllerBase {
//βρες όλα τα σχολεία που πληρούν τα κριτήρια / φίλτρα
$sCon = $this->connection->select('eepal_school_field_data', 'eSchool')
->fields('eSchool', array('id', 'name', 'capacity_class_a', 'region_edu_admin_id', 'edu_admin_id'));
->fields('eSchool', array('id', 'name', 'capacity_class_a', 'region_edu_admin_id', 'edu_admin_id','operation_shift'));
//->condition('eSchool.region_edu_admin_id', $regionId, '=');
if ($regionId != 0)
$sCon->condition('eSchool.region_edu_admin_id', $regionId, '=');
......@@ -354,6 +362,7 @@ class ReportsCreator extends ControllerBase {
$numClassSec = 0;
$numClassCour = 0;
$numClassCour_D = 0;
//εύρεση ονόματος ΠΔΕ που ανήκει το σχολείο
$sCon = $this->connection->select('eepal_region_field_data', 'eRegion')
......@@ -405,20 +414,60 @@ class ReportsCreator extends ControllerBase {
array_push($capacityColumn, $specialtiesInEpal->capacity_class_specialty * $limitup);
array_push($percColumn, number_format($numStud / ($specialtiesInEpal->capacity_class_specialty * $limitup) * 100, 2 ));
/*
$specChar = "";
$prc = $numStud / ($specialtiesInEpal->capacity_class_specialty * $limitup) * 100;
if ($prc < 10)
$specChar = '0';
//array_push($percColumn, number_format($numStud / ($specialtiesInEpal->capacity_class_specialty * $limitup) * 100, 2) . "%");
array_push($percColumn, $specChar . number_format($prc, 2) . "%");
*/
} //end foreach $specialtiesNamesInEpal
$numClassCour += $specialtiesInEpal->capacity_class_specialty;
} //end foreach $specialtiesInEpals
} //end if
//ΝΕΟ!!!
//εύρεση αριθμού μαθητών για κάθε ειδικότητα της Δ' τάξης
if ($epalSchool->operation_shift === "ΕΣΠΕΡΙΝΟ") {
if ($classId === "0" || $classId === "4") {
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('specialty_id', 'capacity_class_specialty_d'))
->condition('eSchool.epal_id', $epalSchool->id , '=');
if ($courseId !== "0")
$sCon->condition('eSchool.specialty_id', $courseId, '=');
$specialtiesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($specialtiesInEpals as $specialtiesInEpal) {
$sCon = $this->connection->select('eepal_specialty_field_data', 'eSpecialties')
->fields('eSpecialties', array('name'))
->condition('eSpecialties.id', $specialtiesInEpal->specialty_id , '=');
if ($courseId === "0" && $sectorId !== "0")
$sCon->condition('eSpecialties.sector_id', $sectorId, '=');
$specialtiesNamesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($specialtiesNamesInEpals as $specialtiesNamesInEpal) {
array_push($regionColumn, $epalRegion->name);
array_push($adminColumn, $epalAdmin->name);
array_push($schoolNameColumn, $epalSchool->name);
array_push($schoolSectionColumn, 'Δ τάξη / ' . $specialtiesNamesInEpal->name );
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('id'))
->condition('eStudent.epal_id', $epalSchool->id , '=')
->condition('eStudent.currentclass', 4 , '=')
->condition('eStudent.specialization_id', $specialtiesInEpal->specialty_id , '=');
$numStud = $sCon->countQuery()->execute()->fetchField();
array_push( $numColumn, $numStud );
array_push($capacityColumn, $specialtiesInEpal->capacity_class_specialty_d * $limitup);
array_push($percColumn, number_format($numStud / ($specialtiesInEpal->capacity_class_specialty_d * $limitup) * 100, 2 ));
} //end foreach $specialtiesNamesInEpal
$numClassCour_D += $specialtiesInEpal->capacity_class_specialty_d;
} //end foreach $specialtiesInEpals
} //end if "classid == 0 or 4"
} //end if "ΕΣΠΕΡΙΝΟ"
//εύρεση αριθμού μαθητών για κάθε τομέα της Β' τάξης
if ($classId === "0" || $classId === "2") {
......@@ -451,13 +500,6 @@ class ReportsCreator extends ControllerBase {
array_push($capacityColumn, $sectorsInEpal->capacity_class_sector * $limitup);
array_push($percColumn, number_format($numStud / ($sectorsInEpal->capacity_class_sector * $limitup) * 100, 2) );
/*
$specChar = "";
$prc = $numStud / ($sectorsInEpal->capacity_class_sector * $limitup) * 100;
if ($prc < 10)
$specChar = '0';
array_push($percColumn, $specChar . number_format($prc, 2) . "%");
*/
} //end foreach sectorsNamesInEpals
$numClassSec += $sectorsInEpal->capacity_class_sector;
......@@ -465,19 +507,17 @@ class ReportsCreator extends ControllerBase {
} //end if
//εύρεση αριθμού μαθητών για κάθε τάξη
$numClasses = array();
array_push($numClasses, $epalSchool->capacity_class_a);
array_push($numClasses,$numClassSec);
array_push($numClasses, $numClassCour);
array_push($numClasses, $numClassCour_D);
if ($sectorId === "0" && $courseId == 0) {
if ($sectorId === "0" && $courseId === 0) {
$clidstart = 1;
$clidend = 3;
$clidend = 4;
if ($classId !== "0") {
$clidstart = $classId;
......@@ -488,11 +528,14 @@ class ReportsCreator extends ControllerBase {
array_push($schoolSectionColumn, 'Β τάξη');
else if ($classId === "3")
array_push($schoolSectionColumn, 'Γ τάξη');
else if ($classId === "4")
array_push($schoolSectionColumn, 'Δ τάξη');
}
else {
array_push($schoolSectionColumn, 'Α τάξη');
array_push($schoolSectionColumn, 'Β τάξη');
array_push($schoolSectionColumn, 'Γ τάξη');
array_push($schoolSectionColumn, 'Δ τάξη');
}
for ( $clId = $clidstart; $clId <= $clidend; $clId++) {
......@@ -513,13 +556,6 @@ class ReportsCreator extends ControllerBase {
array_push($capacityColumn, $numClasses[$clId-1] * $limitup);
array_push($percColumn, number_format($numStud / ($numClasses[$clId-1] * $limitup) * 100, 2) );
/*
$specChar = "";
$prc = $numStud / ($numClasses[$clId-1] * $limitup) * 100;
if ($prc < 10)
$specChar = '0';
array_push($percColumn, $specChar . number_format($prc, 2) . "%");
*/
}
......@@ -611,6 +647,214 @@ class ReportsCreator extends ControllerBase {
}
}
public function makeReportNoCapacity(Request $request, $capacityEnabled) {
try {
if (!$request->isMethod('GET')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
], Response::HTTP_METHOD_NOT_ALLOWED);
}
//user validation
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if (!$user) {
return $this->respondWithStatus([
'message' => t("User not found"),
], Response::HTTP_FORBIDDEN);
}
//user role validation
$roles = $user->getRoles();
$validRole = false;
foreach ($roles as $role)
if ($role === "ministry") {
$validRole = true;
break;
}
if (!$validRole) {
return $this->respondWithStatus([
'message' => t("User Invalid Role"),
], Response::HTTP_FORBIDDEN);
}
$list = array();
//βρες όλα τα σχολεία
$sCon = $this->connection->select('eepal_school_field_data', 'eSchool')
->fields('eSchool', array('id', 'name', 'capacity_class_a', 'region_edu_admin_id', 'edu_admin_id','operation_shift'));
//if ($capacityEnabled === "0")
// $sCon->condition('eSchool.capacity_class_a', 0, '=');
$epalSchools = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalSchools as $epalSchool) { //για κάθε σχολείο
$schoolNameColumn = array();
$regionColumn = array();
$adminColumn = array();
$schoolSectionColumn = array();
$capacityColumn = array();
//εύρεση ονόματος ΠΔΕ που ανήκει το σχολείο
$sCon = $this->connection->select('eepal_region_field_data', 'eRegion')
->fields('eRegion', array('id','name'))
->condition('eRegion.id', $epalSchool->region_edu_admin_id, '=');
$epalRegions = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$epalRegion = reset($epalRegions);
//εύρεση ονόματος ΔΙΔΕ που ανήκει το σχολείο
$sCon = $this->connection->select('eepal_admin_area_field_data', 'eAdmin')
->fields('eAdmin', array('id','name'))
->condition('eAdmin.id', $epalSchool->edu_admin_id, '=');
$epalAdmins = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$epalAdmin = reset($epalAdmins);
//εύρεση αριθμού τμημάτων (χωρητικότητα) για κάθε τμήμα της Α' τάξης
if ( ($capacityEnabled === "0" && ($epalSchool->capacity_class_a === "0" || !isset($epalSchool->capacity_class_a)) ) || ($capacityEnabled === "1") ) {
array_push($regionColumn, $epalRegion->name);
array_push($adminColumn, $epalAdmin->name);
array_push($schoolNameColumn, $epalSchool->name);
array_push($schoolSectionColumn, 'Α\' τάξη');
array_push($capacityColumn, $epalSchool->capacity_class_a);
}
//εύρεση αριθμού τμημάτων (χωρητικότητα) για κάθε τομέα της Β' τάξης
//ΠΡΟΣΟΧΗ: χειρισμ΄ός τιμών: 0 και null
$sCon = $this->connection->select('eepal_sectors_in_epal_field_data', 'eSchool')
->fields('eSchool', array('sector_id','capacity_class_sector'))
->condition('eSchool.epal_id', $epalSchool->id , '=');
//$db_or = db_or();
//$db_or->condition('eSchool.capacity_class_sector', 0, '=');
//$db_or->condition('eSchool.capacity_class_sector', null, 'is');
//$sCon->condition($db_or) ;
if ($capacityEnabled === "0") {
$sCon->condition( db_or()
->condition('eSchool.capacity_class_sector', 0, '=')
->condition('eSchool.capacity_class_sector', null, 'is') ) ;
}
$sectorsInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($sectorsInEpals as $sectorsInEpal) {
$sCon = $this->connection->select('eepal_sectors_field_data', 'eSectors')
->fields('eSectors', array('name'))
->condition('eSectors.id', $sectorsInEpal->sector_id , '=');
$sectorsNamesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($sectorsNamesInEpals as $sectorsNamesInEpal) {
array_push($regionColumn, $epalRegion->name);
array_push($adminColumn, $epalAdmin->name);
array_push($schoolNameColumn, $epalSchool->name);
array_push($schoolSectionColumn, 'Β\' τάξη / ' . $sectorsNamesInEpal->name );
array_push($capacityColumn, $sectorsInEpal->capacity_class_sector);
} //end foreach sectorsNamesInEpals
} //end foreach sectorsInEpal
//εύρεση αριθμού τμημάτων (χωρητικότητα) για κάθε ειδικότητα της Γ' τάξης
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('specialty_id', 'capacity_class_specialty'))
->condition('eSchool.epal_id', $epalSchool->id , '=');
if ($capacityEnabled === "0") {
$sCon->condition( db_or()
->condition('eSchool.capacity_class_specialty', 0, '=')
->condition('eSchool.capacity_class_specialty', null, 'is') ) ;
}
$specialtiesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($specialtiesInEpals as $specialtiesInEpal) {
$sCon = $this->connection->select('eepal_specialty_field_data', 'eSpecialties')
->fields('eSpecialties', array('name'))
->condition('eSpecialties.id', $specialtiesInEpal->specialty_id , '=');
$specialtiesNamesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($specialtiesNamesInEpals as $specialtiesNamesInEpal) {
array_push($regionColumn, $epalRegion->name);
array_push($adminColumn, $epalAdmin->name);
array_push($schoolNameColumn, $epalSchool->name);
array_push($schoolSectionColumn, 'Γ\' τάξη / ' . $specialtiesNamesInEpal->name );
array_push($capacityColumn, $specialtiesInEpal->capacity_class_specialty);
} //end foreach $specialtiesNamesInEpal
} //end foreach $specialtiesInEpals
//εύρεση αριθμού τμημάτων (χωρητικότητα) για κάθε ειδικότητα της Δ' τάξης
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('specialty_id', 'capacity_class_specialty_d'))
->condition('eSchool.epal_id', $epalSchool->id , '=');
if ($capacityEnabled === "0") {
$sCon->condition( db_or()
->condition('eSchool.capacity_class_specialty_d', 0, '=')
->condition('eSchool.capacity_class_specialty_d', null, 'is') ) ;
}
$specialtiesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($specialtiesInEpals as $specialtiesInEpal) {
$sCon = $this->connection->select('eepal_specialty_field_data', 'eSpecialties')
->fields('eSpecialties', array('name'))
->condition('eSpecialties.id', $specialtiesInEpal->specialty_id , '=');
$specialtiesNamesInEpals = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($specialtiesNamesInEpals as $specialtiesNamesInEpal) {
if ($epalSchool->operation_shift === "ΕΣΠΕΡΙΝΟ") {
array_push($regionColumn, $epalRegion->name);
array_push($adminColumn, $epalAdmin->name);
array_push($schoolNameColumn, $epalSchool->name);
array_push($schoolSectionColumn, 'Δ\' τάξη / ' . $specialtiesNamesInEpal->name );
array_push($capacityColumn, $specialtiesInEpal->capacity_class_specialty_d);
}
} //end foreach $specialtiesNamesInEpal
} //end foreach $specialtiesInEpals
//εισαγωγή εγγραφών στο tableschema
for ($j = 0; $j < sizeof($schoolNameColumn); $j++) {
array_push($list,(object) array(
'name' => $schoolNameColumn[$j],
'region' => $regionColumn[$j],