conflict resolution. Role checking in DirectorView controller

parents e4897f30 cc188496
......@@ -46,10 +46,15 @@ function epal_mail($key, &$message, $params) {
$message['subject'] = t('Σύστημα υποβολής αιτήσεων εγγραφής σε ΕΠΑΛ: Επιβεβαίωση e-mail', $options);
$message['body'][] = $params['message'];
break;
case 'massive_mail':
case 'massive_mail_unallocated':
$message['from'] = \Drupal::config('system.site')->get('mail');
$message['subject'] = t('Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ', $options);
$message['body'][] = $params['message'];
break;
case 'massive_mail_located':
$message['from'] = \Drupal::config('system.site')->get('mail');
$message['subject'] = t('Ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ', $options);
$message['body'][] = $params['message'];
break;
}
}
......@@ -151,7 +151,7 @@ epal.ministry.report-completeness:
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.report-all-stat:
path: '/ministry/report-all-stat/{regionId}/{adminId}/{schId}/{classId}/{sectorId}/{courseId}'
path: '/ministry/report-all-stat/{regionId}/{adminId}/{schId}/{classId}/{sectorId}/{courseId}/{finalized}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -174,12 +174,20 @@ epal.ministry.retrieve-registry-id:
_controller: '\Drupal\epal\Controller\ReportsCreator::retrieveUserRegistryNo'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.massive_mail:
path: '/ministry/send-massive-mail'
epal.ministry.massive_mail_unallocated:
path: '/ministry/send-unallocated-massive-mail'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\InformUnlocatedStudents::sendMailToStudents'
_controller: '\Drupal\epal\Controller\InformUnlocatedStudents::sendMailToUnallocatedStudents'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.massive_mail_located:
path: '/ministry/send-located-massive-mail'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\InformUnlocatedStudents::sendMailToLocatedStudents'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.retrievesettings:
......@@ -203,7 +211,7 @@ epal.perfectureschools:
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolsPerPerfecture'
_controller: '\Drupal\epal\Controller\DirectorView::getSchools'
requirements:
_user_is_logged_in: 'TRUE'
epal.coursesperschools:
......@@ -246,3 +254,11 @@ epal.gettypeofschool:
_controller: '\Drupal\epal\Controller\DirectorView::gettypeofschool'
requirements:
_user_is_logged_in: 'TRUE'
getlimitspercourse:
path: '/epal/getlimitsperCourse/{classid}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getlimitsperCourse'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -426,8 +426,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit)
}
public function getSchoolsPerPerfecture(Request $request)
public function getSchools(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
......@@ -436,14 +435,32 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit)
$user = reset($users);
if ($user)
{
$perfectureId = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('region_edu_admin_id'=> $perfectureId ));
$selectionId = $user -> init -> value;
$userRoles = $user->getRoles();
$userRole = '';
foreach ($userRoles as $tmpRole) {
if (($tmpRole === 'epal') || ($tmpRole === 'regioneduadmin') || ($tmpRole === 'eduadmin')) {
$userRole = $tmpRole;
}
}
if ($userRole === '') {
return $this->respondWithStatus([
'error_code' => 4003,
], Response::HTTP_FORBIDDEN);
}
else if ($userRole === 'regioneduadmin') {
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('region_edu_admin_id'=> $selectionId ));
}
else if ($userRole === 'eduadmin') {
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('edu_admin_id'=> $selectionId ));
}
if ($schools)
{
$list = array();
foreach ($schools as $object) {
$status = $this->returnstatus(147);
$status = $this->returnstatus($object -> id());
$list[] = array(
'id' =>$object -> id(),
'name' => $object -> name ->value,
......@@ -595,10 +612,74 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit)
public function returnstatus($id)
{
if ($id == 147)
return true ;
$schoolid = $id;
$SchoolCats = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid ));
$SchoolCat = reset($SchoolCats);
if ($SchoolCat){
$categ = $SchoolCat-> metathesis_region -> value;
}
$CourseA = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id'=> $schoolid ));
if ($CourseA)
{
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name'=> 1, 'category' => $categ ));
$limitdown = reset($limit_down);
if ($limitdown)
{
$limit = $limitdown -> limit_down -> value;
}
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal'=> $schoolid, 'specialization_id' => -1, 'currentclass' => 1 ));
//foreach ($CourseA as $object) {
if (sizeof($studentPerSchool) < $limit){
return false;
// exit;
}
} // }
$CourseB = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid ));
if ($CourseB)
{
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name'=> 2, 'category' => $categ ));
$limitdown = reset($limit_down);
if ($limitdown)
{
$limit = $limitdown -> limit_down -> value;
}
foreach ($CourseB as $object) {
$sectorid = $object -> sector_id -> entity -> id();
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal'=> $schoolid, 'specialization_id' => $sectorid, 'currentclass' => 2 ));
if (sizeof($studentPerSchool) < $limit){
return false;
exit;
}
}
}
$CourseC = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid ));
if ($CourseC)
{
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name'=> 3, 'category' => $categ ));
$limitdown = reset($limit_down);
if ($limitdown)
{
$limit = $limitdown -> limit_down -> value;
}
foreach ($CourseC as $object) {
$specialityid = $object -> specialty_id -> entity -> id() ;
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal'=> $schoolid, 'specialization_id' => $specialityid, 'currentclass' => 3 ));
if (sizeof($studentPerSchool) < $limit){
return false;
exit;
}
}
}
return true;
// exit;
}
......@@ -784,6 +865,115 @@ public function gettypeofschool(Request $request)
}
public function getlimitsperCourse(Request $request, $classid)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user)
{
$schoolid = $user -> init -> value;
$list= array();
$SchoolCats = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid ));
$SchoolCat = reset($SchoolCats);
if ($SchoolCat){
$categ = $SchoolCat-> metathesis_region -> value;
$list = array();
if ($classid == 1)
{
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name'=> 1, 'category' => $categ ));
$limitdown = reset($limit_down);
if ($limitdown)
{
$limit = $limitdown -> limit_down -> value;
}
$list[] = array(
'id' => '1',
'name' => 'Α Λυκείου',
'categ' => $categ,
'classes' => 1,
'limitdown' => $limit,
);
}
if ($classid == 2){
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name'=> 2, 'category' => $categ ));
$limitdown = reset($limit_down);
if ($limitdown)
{
$limit = $limitdown -> limit_down -> value;
}
$list[] = array(
'name' => 'Β Λυκείου ',
'categ' => $categ,
'classes' => 2,
'limitdown' => $limit,
);
}
if ($classid == 3){
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name'=> 3, 'category' => $categ ));
$limitdown = reset($limit_down);
if ($limitdown)
{
$limit = $limitdown -> limit_down -> value;
}
$list[] = array(
'categ' => $categ,
'classes' => 3,
'limitdown' => $limit,
);
}
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) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -4,6 +4,7 @@
* Contains \Drupal\query_example\Controller\QueryExampleController.
*/
namespace Drupal\epal\Controller;
use Drupal\Core\Entity\Query\QueryFactory;
......@@ -24,6 +25,12 @@ use Drupal\Core\TypedData\Plugin\DataType\TimeStamp;
use Drupal\Core\Language\LanguageManagerInterface;
define("SUCCESS", 0);
define("ERROR_DB", -1);
define("NO_CLASS_LIMIT_DOWN", -2);
define("SMALL_CLASS", 1);
define("NON_SMALL_CLASS", 2);
class Distribution extends ControllerBase {
protected $entity_query;
......@@ -68,9 +75,15 @@ class Distribution extends ControllerBase {
public function createDistribution(Request $request) {
//$this->findSmallClasses();
//return;
$numDistributions = 3;
$sizeOfBlock = 100000;
//POST method is checked
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
......@@ -102,6 +115,7 @@ class Distribution extends ControllerBase {
], Response::HTTP_FORBIDDEN);
}
//check where distribution can be done now ($capacityDisabled / $directorViewDisabled settings)
$capacityDisabled = false;
$directorViewDisabled = false;
......@@ -188,9 +202,7 @@ class Distribution extends ControllerBase {
//checkCapacityAndArrange (school_id, class_id, sectorORcourse_id, limitUp, schoolCapacity)
$sCon = $this->connection->select('eepal_school_field_data', 'eSchool')
->fields('eSchool', array('id', 'capacity_class_a'));
//->condition('eSchool.id', 151, '>=')
//->condition('eSchool.id', 153, '<='); //προσαρμοσμένο για τα demo data --> να αλλάξει
->fields('eSchool', array('id', 'capacity_class_a', 'operation_shift'));
$eepalSchools = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSchools as $eepalSchool) {
......@@ -212,8 +224,10 @@ class Distribution extends ControllerBase {
foreach ($eepalSpecialtiesInEpal as $eepalSpecialInEp) {
$this->checkCapacityAndArrange($eepalSchool->id, "3", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty);
//Δ' Λυκείου
if ($eepalSchool->operation_shift === "ΕΣΠΕΡΙΝΟ") {
$this->checkCapacityAndArrange($eepalSchool->id, "4", $eepalSpecialInEp->specialty_id, $limitUp_class, $eepalSpecialInEp->capacity_class_specialty);
}
}
} //end for each school/department
......@@ -221,6 +235,7 @@ class Distribution extends ControllerBase {
} //end while
$this->findSmallClasses();
} //end try
......@@ -232,14 +247,6 @@ class Distribution extends ControllerBase {
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
//return new RedirectResponse($this->redirectUrl . '?auth_token=' . $epalToken.'&auth_role=director', 302, []);
//return new RedirectResponse("../eepal/dist/#/minister/minister-view");
/*
return $this->respondWithStatus([
"message" => t("Distribution has made successfully")
], Response::HTTP_OK);
*/
$postData = null;
if ($content = $request->getContent()) {
$postData = json_decode($content);
......@@ -305,7 +312,6 @@ class Distribution extends ControllerBase {
$specialization_id = -1;
//$currentTime = \Drupal\Core\TypedData\Plugin\DataType\TimeStamp::getDateTime();
$timestamp = strtotime(date("Y-m-d"));
$this->connection->insert('epal_student_class')->fields(
array('id' => $this->globalCounterId++,
......@@ -319,6 +325,7 @@ class Distribution extends ControllerBase {
'specialization_id' => $specialization_id,
'points' => $epalStudent->points,
'distribution_id' => $choice_id,
'finalized' => 1,
'status' => 1,
'created' => $timestamp,
'changed' => $timestamp,)
......@@ -367,7 +374,14 @@ class Distribution extends ControllerBase {
return $row->limit_up;
}
public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup, $capacity) {
public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup, $capacity) {
if (!isset($capacity)) {
//print_r("<br> ΜΠΗΚΑ!!! ");
//print_r("<br> ΣΧΟΛΕΙΟ: " . $epalId . " ΤΑΞΗ: " . $classId . " ΤΟΜΕΑΣ/ΕΙΔΙΚΟΤΗΤΑ: " . $secCourId . " ΧΩΡΗΤΙΚΟΤΗΤΑ: " . $capacity);
$capacity = 0;
}
$transaction = $this->connection->startTransaction();
......@@ -451,11 +465,10 @@ class Distribution extends ControllerBase {
//$this->pendingStudents = array_diff($this->pendingStudents, array($val));
}
public function makeSelectionOfStudents(&$students, $limit) {
public function makeSelectionOfStudents_VERSION_WITH_POINTS(&$students, $limit) {
//συνάρτηση επιλογής μαθητών σε περίπτωση υπερχείλισης
// (1) έχουν απόλυτη προτεραιότητα όσοι ήδη φοιτούσαν στο σχολείο (σε περίπτωση που φοιτούσαν περισσότεροι από την χωρητικότητα, τους δεχόμαστε όλους)
// (2) αν απομένουν κενές θέσεις, επέλεξε από τους εναπομείναντες μαθητές αυτούς με τα περισσότερα μόρια. Σε περίπτωση ισοβαθμίας δεχόμαστε όλους όσους ισοβαθμούν.
//αυτοδίκαια έχουν προτεραιότητα όσοι ήδη φοιτούσαν στο σχολείο
foreach($students as $student) {
$student->student_id;
......@@ -525,6 +538,66 @@ class Distribution extends ControllerBase {
], Response::HTTP_OK);
}
public function makeSelectionOfStudents(&$students, $limit) {
//συνάρτηση επιλογής μαθητών σε περίπτωση υπερχείλισης
// (1) έχουν απόλυτη προτεραιότητα όσοι ήδη φοιτούσαν στο σχολείο (σε περίπτωση που φοιτούσαν περισσότεροι από την χωρητικότητα, τους δεχόμαστε όλους)
// (2) αν απομένουν κενές θέσεις,...τοποθέτησε και όλους τους άλλους!!.
//εύρεση αριθμού μαθητών που ήδη φοιτούσαν στο σχολείο
$cnt = 0;
foreach($students as $student) {
if ($student->currentepal === $student->epal_id) {
$cnt++;
if ($this->choice_id !== 1)
//διέγραψε τον μαθητή από τον πίνακα εκκρεμοτήτων (αν βρίσκεται εκεί)
//Κάτι τέτοιο δεν είναι δυνατό πια! (έκδοση χωρίς μόρια..)
$this->removeFromPendingStudents($student->student_id);
}
}
//print_r("<br>#ΕΓΓΡΑΦΩΝ ΠΟΥ ΟΙ ΜΑΘΗΤΕΣ ΦΟΙΤΟΥΣΑΝ ΗΔΗ:" . $cnt);
$newlimit = $limit - $cnt;
//print_r("<br>ΑΝΩΤΑΤΟ ΟΡΙΟ ΜΑΘΗΤΩΝ:" . $limit);
$transaction = $this->connection->startTransaction();
//Αν δεν απέμειναν θέσεις (δηλαδή αν η χωρητικότητα είναι μικρότερη ή ίση από το πλήθος μαθητών που ήδη φοιτούν στο σχολείο)
//τότε διέγραψέ τους από τον προσωρινό πίνακα αποτελεσμάτων και βάλε τους στον στον πίνακα εκκρεμοτήτων
if ($newlimit <= 0) {
foreach($students as $student) {
if ($student->currentepal !== $student->epal_id) {
//print_r("<br>ΣΕ ΕΚΚΡΕΜΟΤΗΤΑ - ΔΙΑΓΡΑΦΗ: " . $student->student_id);
array_push($this->pendingStudents, $student->student_id);
try {
$this->connection->delete('epal_student_class')
->condition('student_id', $student->student_id)
->execute();
}
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
$transaction->rollback();
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during DELETE proccess in makeSelectionOfStudents Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
} //end if currentepal
} //end foreach
} //endif newlimit
return $this->respondWithStatus([
"message" => t("makeSelectionOfStudents Method of Distribution has made successfully")
], Response::HTTP_OK);
} //end function
public function calculatePoints() {
return rand(0,20);
......@@ -549,8 +622,166 @@ class Distribution extends ControllerBase {
"message" => t("An unexpected problem occured during initializeResults Method of Distribution")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
private function findSmallClasses() {
//Για κάθε σχολείο βρες τα ολιγομελή τμήματα
$sCon = $this->connection->select('eepal_school_field_data', 'eSchool')
->fields('eSchool', array('id', 'metathesis_region','operation_shift'));
$eepalSchools = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSchools as $eepalSchool) {
//isSmallClass (school_id, class_id, sectorORcourse_id, school_category_metathesis)
// Α' τάξη
if ($this->isSmallClass($eepalSchool->id, "1", "-1", $eepalSchool->metathesis_region) === SMALL_CLASS) {
//print_r("<br> ΚΛΗΣΗ markStudentsInSmallClass: SCHOOL_ID: " . $eepalSchool->id . " CLASSID: " . "1 " . "SECTOR/COURSE ID: " . "-1 ");
if ($this->markStudentsInSmallClass($eepalSchool->id, "1", "-1") === ERROR_DB )
return ERROR_DB;
}
//print_r("<br>");
// Β' τάξη
$sCon = $this->connection->select('eepal_sectors_in_epal_field_data', 'eSchool')
->fields('eSchool', array('epal_id', 'sector_id'))
->condition('eSchool.epal_id', $eepalSchool->id, '=');
$eepalSectorsInEpal = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSectorsInEpal as $eepalSecInEp) {
if ($this->isSmallClass($eepalSchool->id, "2", $eepalSecInEp->sector_id, $eepalSchool->metathesis_region) === SMALL_CLASS) {
//print_r("<br> ΚΛΗΣΗ markStudentsInSmallClass: SCHOOL_ID: " . $eepalSchool->id . " CLASSID: " . "2 " . "SECTOR/COURSE ID: " . $eepalSecInEp->sector_id);
if ($this->markStudentsInSmallClass($eepalSchool->id, "2", $eepalSecInEp->sector_id) === ERROR_DB )
return ERROR_DB;
}
//print_r("<br>");
}
// Γ' τάξη
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('epal_id', 'specialty_id'))
->condition('eSchool.epal_id', $eepalSchool->id, '=');
$eepalSpecialtiesInEpal = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSpecialtiesInEpal as $eepalSpecialInEp) {
if ($this->isSmallClass($eepalSchool->id, "3", $eepalSpecialInEp->specialty_id, $eepalSchool->metathesis_region) === SMALL_CLASS) {
//print_r("<br> ΚΛΗΣΗ markStudentsInSmallClass: SCHOOL_ID: " . $eepalSchool->id . " CLASSID: " . "3 " . "SECTOR/COURSE ID: " . $eepalSpecialInEp->specialty_id);
if ($this->markStudentsInSmallClass($eepalSchool->id, "3", $eepalSpecialInEp->specialty_id) === ERROR_DB )
return ERROR_DB;
}
//print_r("<br>");
}
// Δ' τάξη
if ($eepalSchool->operation_shift === "ΕΣΠΕΡΙΝΟ") {
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool')
->fields('eSchool', array('epal_id', 'specialty_id'))
->condition('eSchool.epal_id', $eepalSchool->id, '=');
$eepalSpecialtiesInEpal = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($eepalSpecialtiesInEpal as $eepalSpecialInEp) {
if ($this->isSmallClass($eepalSchool->id, "4", $eepalSpecialInEp->specialty_id, $eepalSchool->metathesis_region) === SMALL_CLASS) {
//print_r("<br> ΚΛΗΣΗ markStudentsInSmallClass: SCHOOL_ID: " . $eepalSchool->id . " CLASSID: " . "4 " . "SECTOR/COURSE ID: " . $eepalSpecialInEp->specialty_id);
if ($this->markStudentsInSmallClass($eepalSchool->id, "4", $eepalSpecialInEp->specialty_id) === ERROR_DB )
return ERROR_DB;
}
//print_r("<br>");
}
} //end if ΕΣΠΕΡΙΝΟ
} //end for each school/department
} //end function
private function isSmallClass($schoolId, $classId, $sectorOrcourseId, $regionId) {
//print_r("<br> ΚΛΗΣΗ isSmallClass: SCHOOL_ID: " . $schoolId . " CLASSID: " . $classId . "SECTOR/COURSE ID: " . $sectorOrcourseId . "ΠΕΡΙΟΧΗ ΜΕΤΑΘΕΣΗΣ: " . $regionId);
$limitDown = $this->retrieveLimitDown($classId, $regionId);
//print_r("<br> ΚΑΤΩΤΑΤΟ ΟΡΙΟ ΜΑΘΗΤΩΝ: " . $limitDown);
if ($limitDown === NO_CLASS_LIMIT_DOWN)
return NO_CLASS_LIMIT_DOWN;
else if ($limitDown === ERROR_DB)
return ERROR_DB;
$numStudents = $this->countStudents($schoolId, $classId, $sectorOrcourseId);
//print_r("<br> ΑΡΙΘΜΟΣ ΜΑΘΗΤΩΝ: " . $numStudents);
if ($numStudents === ERROR_DB)
return ERROR_DB;
//Αν $numStudents == 0, γύρισε fasle, ώστε να μη γίνει περιττή κλήση στην markStudentsInSmallClass
if ( ($numStudents < $limitDown) && ($numStudents > 0) )
return SMALL_CLASS;
else
return NON_SMALL_CLASS;
}
private function retrieveLimitDown($classId, $regionId) {
try {
$sCon = $this->connection->select('epal_class_limits', 'eClassLimit')
->fields('eClassLimit', array('limit_down'))
->condition('eClassLimit.name', $classId, '=')
->condition('eClassLimit.category', $regionId, '=');