Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 64 |
CRAP | |
0.00% |
0 / 1035 |
SemesterService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 64 |
41820.00 | |
0.00% |
0 / 1035 |
__construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
__clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 5 |
|||
getSemIdByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getSemesters | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
getStudentCurrentSemester | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
getSemestersName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getOtherDepartmentSubjectsHandledByFacultyByDeptID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getPreviousYears | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
isCurrentSemester | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
addSemRegistration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getsemRegistration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
deleteSemRegistration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
updateSemRegistration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
toggleSemRegistrationStatusById | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 12 |
|||
getAllSemRegistrations | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 36 |
|||
getSemRegClosedBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getAllRegistrations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getPreviousSemesterByStudentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getAllPreviousSemestersOfAStudent | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getSemRegistrationDetails | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 23 |
|||
upsertSemRegistrationDetails | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 18 |
|||
insertMultipleSemRegistrationDetails | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
closePreviousSemRegistrations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
toggleAllSemRegistrations | |
0.00% |
0 / 1 |
210.00 | |
0.00% |
0 / 34 |
|||
getPrevSemRegStudentDetailsByName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getSemregStudentDetailsByBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getSemRegStudentCount | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
checkIfAStudentIsAlreadyApprovedByTutor | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 29 |
|||
checkIfAStudentIsAlreadyConfirmedByHOD | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 29 |
|||
getPreviousSemsters | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getSemDetailsByCourseTypeIdAndBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getAllSemesters | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getSemDetailsBySemId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getSemesterBySbsId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getSemesterByName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getNextSemester | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getSemByExamRegId | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 13 |
|||
getSemregStudentDetailsByBatchFromFailedStudents | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getSemByRequest | |
0.00% |
0 / 1 |
182.00 | |
0.00% |
0 / 67 |
|||
getPreviousSemId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
checkIfAFailedStudentIsAlreadyApprovedByTutor | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 29 |
|||
getAllSemestersForAdvancedSearch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getAllSemestersOfBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getExamConductedSemestersOfBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 20 |
|||
getSemestersBySemId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 12 |
|||
getSupplyExamSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getAllPreviousSemestersOfBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getAllSemestersOfBatchByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getSemIdsBytype | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getSemestersByFinalSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getLatestSemesterOfThisBatchSemRegistration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
getSemeregistrarionByRequest | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 25 |
|||
getSemesterByExamRegBatch | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 13 |
|||
getAllSemestersFromInternalMarkAssignedStaff | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 20 |
|||
getAllSemestersByBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getRegularPublishedSemestersOfStudent | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
getSemestersByExamRegIds | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 13 |
|||
getSemByExamRegIds | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 13 |
|||
getBatchPromotedDateByHod | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 36 |
|||
getBatchCommencedDate | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getSemDetailsByCourseTypeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
checkFeePaidForSemRegistration | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 23 |
|||
semDetailsWithAdvancedDetails | |
0.00% |
0 / 1 |
210.00 | |
0.00% |
0 / 69 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use com\linways\core\ams\professional\constant\SemesterConstants; | |
use com\linways\core\ams\professional\constant\SemRegistrationFormConstants; | |
use com\linways\core\ams\professional\constant\ExamType; | |
use com\linways\core\ams\professional\dto\AMSConstants; | |
use com\linways\core\ams\professional\dto\Batch; | |
use com\linways\core\ams\professional\dto\Semester; | |
use com\linways\core\ams\professional\dto\SemRegistration; | |
use com\linways\core\ams\professional\dto\SemRegistrationDetails; | |
use com\linways\core\ams\professional\dto\Subject; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
use com\linways\core\ams\professional\mapper\SemesterServiceMapper; | |
use com\linways\core\ams\professional\request\GetSemRegistrationRequest; | |
use com\linways\core\ams\professional\response\GetSemRegistrationResponse; | |
class SemesterService extends BaseService | |
{ | |
// /Condition 1 - Presence of a static member variable | |
private static $_instance = null; | |
private $mapper = []; | |
// /Condition 2 - Locked down the constructor | |
private function __construct() | |
{ | |
$this->mapper = SemesterServiceMapper::getInstance()->getMapper(); | |
} | |
// Prevent any oustide instantiation of this class | |
// /Condition 3 - Prevent any object or instance of that class to be cloned | |
private function __clone() | |
{ | |
} | |
// Prevent any copy of this object | |
// /Condition 4 - Have a single globally accessible static method | |
public static function getInstance() | |
{ | |
if (!is_object(self::$_instance)) // or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
self::$_instance = new self (); | |
return self::$_instance; | |
} | |
/** | |
* Get batch details by batchID | |
* | |
* @param int $batchId | |
* @return \com\linways\base\connection\Object | |
* @throws ProfessionalException | |
*/ | |
public function getSemIdByBatchId($batchId) | |
{ | |
$sql = "select batchName,deptID,semID,groups_id from batches where batchID=$batchId"; | |
try { | |
$semDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
/** | |
* Get All Semesters | |
* | |
* @param bool $includeCourseCompleted | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSemesters($includeCourseCompleted = FALSE) | |
{ | |
$semesters = NULL; | |
$sql = "SELECT semID as id, | |
semName as name, | |
orderNo,type | |
FROM semesters"; | |
if (!$includeCourseCompleted) { | |
$sql .= " where semName not in ('" . SemesterConstants::COURSE_COMPLETED . "','" . SemesterConstants::PASSOUT_STUDENTS . "')"; | |
} | |
$sql .= " ORDER BY semID"; | |
try { | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
/** | |
* @param $studentId | |
* @return Object | |
* @throws ProfessionalException | |
* @author jithinvijayan | |
*/ | |
public function getStudentCurrentSemester($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
if (empty($studentId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_STUDENT_ID, "Invalid student details given"); | |
} | |
$sql = "SELECT s.semID as id,s.semName as name FROM studentaccount sa | |
INNER JOIN batches b ON b.batchID =sa.batchID | |
INNER JOIN semesters s ON s.semID = b.semID | |
WHERE sa.studentID = $studentId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get name of a Semesters | |
* | |
* @param int $semID | |
* @return string $semesterName | |
* @throws ProfessionalException | |
*/ | |
public function getSemestersName($semID) | |
{ | |
$semesterName = NULL; | |
$sql = "SELECT semName as name FROM semesters WHERE semID='$semID' ORDER BY orderNo"; | |
try { | |
$semesterName = $this->executeQueryForObject($sql)->name; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesterName; | |
} | |
/** | |
* Get subjects handled by staffs in other departments | |
* | |
* @param int $deptId | |
* @param int $courseTypeId | |
* @return \com\linways\base\connection\Object | |
* @throws ProfessionalException | |
*/ | |
public function getOtherDepartmentSubjectsHandledByFacultyByDeptID($deptId, $courseTypeId) | |
{ | |
$sql = "SELECT sem.semID, sem.semName,sem.year, bat.batchID, bat.batchName, bat.batchStartYear, bat.batchEndYear, bat.semID AS currentSemId, dept.deptID, dept.deptName as staffDept, dept.departmentDesc, sa.staffID, sa.staffName, sd.deptName as staffDept, sub.subjectID, sub.subjectName, sub.subjectDesc, sc.subjectcatName AS subjectCategory FROM semesters sem INNER JOIN batches bat ON sem.semID = bat.semID INNER JOIN department dept ON bat.deptID = dept.deptID INNER JOIN sbs_relation sr ON sr.batchID = bat.batchID AND sr.semID = bat.semID INNER JOIN staffaccounts sa ON sa.staffID = sr.staffID INNER JOIN subjects sub ON sub.subjectID = sr.subjectID INNER JOIN subject_category sc ON (sc.subjectcatID = sub.subjectcatID) LEFT JOIN department sd ON sa.deptID = sd.deptID WHERE dept.deptID != $deptId and sa.deptID = $deptId and sub.subjectName != '" . Subject::TUTOR_SUBJECT . "' and patternID = $courseTypeId ORDER BY bat.semID , sub.subjectcatID DESC"; | |
try { | |
$subjectDetails = $this->executeQueryForList($sql, $this->mapper [SemesterServiceMapper::GET_SEMESTER_DETAILS]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $subjectDetails; | |
} | |
/** | |
* Get previous years of a sem | |
* | |
* @param int $batchId | |
* @return \com\linways\base\connection\Object | |
* @throws ProfessionalException | |
*/ | |
public function getPreviousYears($batchId) | |
{ | |
$sql = "select distinct year from semesters where year <= (select year from batches bat inner join semesters sem on bat.semID = sem.semID and batchID = $batchId)"; | |
try { | |
$years = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $years; | |
} | |
/** | |
* checks if the sem is the current sem of the batch | |
* | |
* @param int $batchId | |
* @param int $semId | |
* @return boolean | |
* @throws ProfessionalException | |
*/ | |
public function isCurrentSemester($batchId, $semId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "select semID from batches where batchID = '$batchId' and semID = '$semId'"; | |
try { | |
$currentSem = $this->executeQueryForObject($sql); | |
if ($currentSem) { | |
return true; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return false; | |
} | |
/** | |
* Add a semester registration detail | |
* | |
* @param SemRegistration $semRegistration | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function addSemRegistration($semRegistration) | |
{ | |
$semRegistration = $this->realEscapeObject($semRegistration); | |
$sql = "INSERT INTO semRegistration(batchId,semId,classStartDate,batchPromotionDate, isOpen,autoBatchPromotion,createdBy,createdDate,updatedBy,updatedDate) VALUES('$semRegistration->batchId','$semRegistration->semId','$semRegistration->classStartDate','$semRegistration->batchPromotionDate','$semRegistration->isOpen','$semRegistration->autoBatchPromotion','$semRegistration->createdBy',utc_timestamp(),'$semRegistration->updatedBy','utc_timestamp()')"; | |
try { | |
return $this->executeQueryForObject($sql, true); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get semester registration details | |
* @param int $batchId | |
* @param int $semId | |
* @return \com\linways\base\dto\MySqlResult | |
* @throws ProfessionalException | |
*/ | |
public function getsemRegistration($batchId, $semId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "SELECT * FROM semRegistration reg INNER JOIN batches btch ON btch.batchID = reg.batchId where reg.batchID = $batchId and reg.semID = $semId;"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Delete sem registration by id | |
* | |
* @param string $registrationId | |
* @return \com\linways\base\dto\MySqlResult | |
* @throws ProfessionalException | |
*/ | |
public function deleteSemRegistration($registrationId) | |
{ | |
$registrationId = $this->realEscapeString($registrationId); | |
$sql = "DELETE FROM semRegistration WHERE id=$registrationId"; | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* update semester registration details | |
* | |
* @param SemRegistration $semRegistration | |
* @return boolean | |
* @throws ProfessionalException | |
*/ | |
public function updateSemRegistration($semRegistration) | |
{ | |
$semRegistration = $this->realEscapeObject($semRegistration); | |
$sql = "UPDATE semRegistration SET semId='$semRegistration->semId',classStartDate='$semRegistration->classStartDate',batchPromotionDate='$semRegistration->batchPromotionDate',isOpen='$semRegistration->isOpen', autoBatchPromotion='$semRegistration->autoBatchPromotion',updatedBy='$semRegistration->updatedBy',updatedDate=UTC_TIMESTAMP() WHERE id=$semRegistration->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* Open or close a sem registration | |
* @param int $id | |
* @param int $isOpen | |
* @return boolean | |
* @throws ProfessionalException | |
*/ | |
public function toggleSemRegistrationStatusById($id, $isOpen) | |
{ | |
$id = $this->realEscapeString($id); | |
$isOpen = $this->realEscapeString($isOpen); | |
$isOpen = $isOpen == '1' ? 0 : 1; | |
$sql = "UPDATE semRegistration reg inner join batches ba on reg.batchID = ba.batchID and reg.semID = ba.semID SET isOpen=$isOpen WHERE id = $id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* Get all semregistrations | |
* @param GetSemRegistrationRequest $getSemRegistrationRequest | |
* @return GetSemRegistrationResponse | |
* @throws ProfessionalException | |
*/ | |
public function getAllSemRegistrations($getSemRegistrationRequest) | |
{ | |
$getSemRegistrationResponse = new GetSemRegistrationResponse(); | |
$getSemRegistrationRequest = $this->realEscapeObject($getSemRegistrationRequest); | |
$condition = ""; | |
if ($getSemRegistrationRequest->currentRequest == 1) { | |
$sql = "SELECT ba.batchID, ba.batchName, ba.batchStartYear, ba.batchEndYear, ba.deptID, ba.semID as currentSem, ba.patternID, ba.universityId, reg.id, reg.batchId as regBatch, reg.classStartDate, reg.batchPromotionDate, reg.isOpen, sem.semID, sem.semName, sem.year, sem.orderNo, reg.autoBatchPromotion FROM batches ba LEFT JOIN semRegistration reg ON ba.batchID = reg.batchId AND ba.semID =reg.semId LEFT JOIN semesters sem on ba.semID = sem.semID where ba.batchName != '" . Batch::BATCH_FAILED_NAME . "' and sem.semName != '" . Semester::COURSE_COMPLETED_SEM . "'"; | |
$sql_count = "SELECT count(ba.batchID) as count FROM batches ba LEFT JOIN semRegistration reg ON ba.batchID = reg.batchId AND ba.semID =reg.semId LEFT JOIN semesters sem on ba.semID = sem.semID where ba.batchName != '" . Batch::BATCH_FAILED_NAME . "' and sem.semName != '" . Semester::COURSE_COMPLETED_SEM . "'"; | |
} else { | |
$sql = "SELECT ba.batchID, ba.batchName, ba.batchStartYear, ba.batchEndYear, ba.deptID, ba.semID as currentSem, ba.patternID, ba.universityId, reg.id, reg.batchId as regBatch, reg.classStartDate, reg.batchPromotionDate, reg.isOpen, sem.semID, sem.semName, sem.year,sem.orderNo, reg.autoBatchPromotion FROM batches ba inner JOIN semRegistration reg ON ba.batchID = reg.batchId AND ba.semID !=reg.semId inner JOIN semesters sem on sem.semID = reg.semId where ba.batchName != '" . Batch::BATCH_FAILED_NAME . "' and sem.semName != '" . Semester::COURSE_COMPLETED_SEM . "'"; | |
$sql_count = "SELECT count(ba.batchID) as count FROM batches ba inner JOIN semRegistration reg ON ba.batchID = reg.batchId AND ba.semID !=reg.semId inner JOIN semesters sem on sem.semID = reg.semId where ba.batchName != '" . Batch::BATCH_FAILED_NAME . "' and sem.semName != '" . Semester::COURSE_COMPLETED_SEM . "'"; | |
} | |
$condition .= " and ba.is_admission = 0"; | |
if (!empty($getSemRegistrationRequest->deptId)) { | |
$condition .= " and ba.deptID = $getSemRegistrationRequest->deptId"; | |
} | |
if (!empty($getSemRegistrationRequest->batchId)) { | |
$condition .= " and ba.batchID = $getSemRegistrationRequest->batchId"; | |
} | |
if (!empty($getSemRegistrationRequest->semId)) { | |
$condition .= " and sem.semID = $getSemRegistrationRequest->semId"; | |
// $condition .= " and reg.semId = $getSemRegistrationRequest->semId"; | |
} | |
if (!empty($getSemRegistrationRequest->isOpen)) { | |
$condition .= " and reg.isOpen = $getSemRegistrationRequest->isOpen"; | |
} | |
$sql .= $condition; | |
$sql_count .= $condition; | |
$sql .= " limit $getSemRegistrationRequest->startIndex, $getSemRegistrationRequest->endIndex"; | |
try { | |
$this->closePreviousSemRegistrations(); | |
$getSemRegistrationResponse->semesterList = $this->executeQueryForList($sql); | |
$getSemRegistrationResponse->totalRecords = $this->executeQueryForObject($sql_count)->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $getSemRegistrationResponse; | |
} | |
/** | |
* Get sem reg closed batches | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSemRegClosedBatches() | |
{ | |
$sql = "select ba.batchID as batchId, ba.batchName, ba.batchStartYear, ba.batchEndYear, ba.deptID, ba.semID as semId, ba.patternID, ba.universityId, reg.id as regId, reg.batchId as regBatch, reg.classStartDate, reg.isOpen from batches ba left join semRegistration reg on ba.batchID = reg.batchID and ba.semID = reg.semID where (id is null or isOpen = 0) and batchName != '" . Batch::BATCH_FAILED_NAME . "'"; | |
try { | |
$batchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* Get all sem registrations | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getAllRegistrations() | |
{ | |
$sql = "SELECT ba.batchID as batchId, ba.batchName, ba.batchStartYear, ba.batchEndYear, ba.deptID, ba.semID as semId, ba.patternID, ba.universityId, reg.id as regId, reg.batchId as regBatch, reg.classStartDate, reg.isOpen FROM semRegistration reg INNER JOIN batches ba ON ba.batchID = reg.batchId"; | |
try { | |
$semRegistrations = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semRegistrations; | |
} | |
/** | |
* Get previous semester of student | |
* @param int $studentId | |
* @param string $semType | |
* @return object|NULL|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getPreviousSemesterByStudentId($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "select sa.studentID, sa.studentName, ba.batchID, ba.batchName, sem.semID, sem.semName, sem.year, sem.orderNo, sem.type, prevSem.semID as prevSemId, prevSem.semName as prevSemName, prevSem.year as prevYear, prevSem.orderNo as prevOrderNo from studentaccount sa inner join batches ba on ba.batchID = sa.batchID inner join semesters sem on sem.semID = ba.semID inner join semesters prevSem on sem.type= prevSem.type and prevSem.orderNo = sem.orderNo -1 where sa.studentID = $studentId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getAllPreviousSemestersOfAStudent($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$semList = []; | |
$currentSemId = null; | |
$studentDetails = StudentService::getInstance()->getStudentDetailsById($studentId); | |
$currentSemId = $studentDetails->semID; | |
$sql = "select sem.semID as semId, sem.semName from semesters sem inner join semesters curSem on sem.type = curSem.type and sem.orderNo < curSem.orderNo where curSem.semID = $currentSemId"; | |
try { | |
$semList = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
if (!empty($semList)) { | |
return $semList; | |
} | |
} | |
/** | |
* | |
* @param SemRegistrationDetails $semRegistrationDetails | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSemRegistrationDetails($semRegistrationDetails) | |
{ | |
$condition = ""; | |
$semRegistrationDetails = $this->realEscapeObject($semRegistrationDetails); | |
$sql = "SELECT sd.id, sd.semRegistrationId, sd.studentId, sd.name, sd.value, sr.batchId, sr.semId, sr.classStartDate, sr.isOpen FROM semRegistrationStudentDetails sd inner join semRegistration sr on sd.semRegistrationId = sr.id WHERE sd.id is not null"; | |
if (!empty($semRegistrationDetails->id)) { | |
$condition .= " and sd.id='$semRegistrationDetails->id'"; | |
} | |
if (!empty($semRegistrationDetails->semRegistrationId)) { | |
$condition .= " and sd.semRegistrationId='$semRegistrationDetails->semRegistrationId'"; | |
} | |
if (!empty($semRegistrationDetails->studentId)) { | |
$condition .= " and sd.studentId='$semRegistrationDetails->studentId'"; | |
} | |
if (!empty($semRegistrationDetails->name)) { | |
$condition .= " and sd.name='$semRegistrationDetails->name'"; | |
} | |
$sql .= $condition; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* | |
* @param SemRegistrationDetails $semRegistrationDetails | |
* @return object|NULL|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function upsertSemRegistrationDetails($semRegistrationDetails) | |
{ | |
foreach ($semRegistrationDetails as $key => $value) { | |
if ($semRegistrationDetails->typeName != SemRegistrationFormConstants::TEXTAREA) { | |
$semRegistrationDetails->$key = $this->realEscapeString($value); | |
} | |
} | |
$semRegistrationDetails->id = $this->getSemRegistrationDetails($semRegistrationDetails)[0]->id; | |
if ($semRegistrationDetails->id) { | |
//update | |
$sql = "update semRegistrationStudentDetails set semRegistrationId = $semRegistrationDetails->semRegistrationId, studentId = $semRegistrationDetails->studentId, name='$semRegistrationDetails->name', value='$semRegistrationDetails->value', updatedBy= '$semRegistrationDetails->updatedBy', updatedDate=UTC_TIMESTAMP() where id=$semRegistrationDetails->id"; | |
} else { | |
//insrt | |
$sql = "insert into semRegistrationStudentDetails (semRegistrationId, studentId, name, value, createdBy, createdDate, updatedBy, updatedDate) values ($semRegistrationDetails->semRegistrationId, $semRegistrationDetails->studentId, '$semRegistrationDetails->name', '$semRegistrationDetails->value', $semRegistrationDetails->createdBy, UTC_TIMESTAMP(),'$semRegistrationDetails->updatedBy', UTC_TIMESTAMP())"; | |
} | |
try { | |
return $this->executeQueryForObject($sql, true); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Undocumented function | |
* | |
* @param [type] $semRegistrationDetailsList | |
* @return void | |
* @throws ProfessionalException | |
*/ | |
public function insertMultipleSemRegistrationDetails($semRegistrationDetailsList) | |
{ | |
$valueList = []; | |
$semRegistrationDetailsList = $this->realEscapeArray($semRegistrationDetailsList); | |
foreach ($semRegistrationDetailsList as $semRegistrationDetails) { | |
$valueList[] = "($semRegistrationDetails->semRegistrationId, $semRegistrationDetails->studentId, '$semRegistrationDetails->name', '$semRegistrationDetails->value', $semRegistrationDetails->createdBy, UTC_TIMESTAMP(),'$semRegistrationDetails->updatedBy', UTC_TIMESTAMP())"; | |
} | |
$sql = "insert into semRegistrationStudentDetails (semRegistrationId, studentId, name, value, createdBy, | |
createdDate, updatedBy, updatedDate) values " . implode(',', $valueList); | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Close registrations defined for previous semesters. | |
* @return object|NULL|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function closePreviousSemRegistrations() | |
{ | |
$sql = "update semRegistration reg inner join batches ba on reg.batchID = ba.batchID and reg.semID != ba.semID set isOpen = 0;"; | |
try { | |
return $this->executeQueryForObject($sql, true); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* open or close sem registrations for current semesters | |
* @param SemRegistration $semRegistration | |
* @return object|NULL|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function toggleAllSemRegistrations($semRegistration) | |
{ | |
$semRegistration = $this->realEscapeObject($semRegistration); | |
if ($semRegistration->isOpen == 1 && $semRegistration->classStartDate) { | |
$sqlInsert = "insert ignore into semRegistration (batchID, semID, classStartDate, batchPromotionDate, isOpen, createdBy, createdDate, updatedBy, updatedDate ) select ba.batchID, ba.semID, '$semRegistration->classStartDate','$semRegistration->batchPromotionDate', 1, $semRegistration->createdBy, UTC_TIMESTAMP(), $semRegistration->updatedBy, UTC_TIMESTAMP() from batches ba left join semRegistration reg on ba.batchID = reg.batchID and ba.semID = reg.semID left join semesters sem on ba.semID = sem.semID where reg.id is null and batchName != '" . Batch::BATCH_FAILED_NAME . "' and semName !='" . Semester::COURSE_COMPLETED_SEM . "' and orderNo !=1"; | |
$startDate = $semRegistration->classStartDate ? "classStartDate='$semRegistration->classStartDate', " : ''; | |
$batchPromotionDate = $semRegistration->batchPromotionDate ? "batchPromotionDate='$semRegistration->batchPromotionDate', " : ''; | |
$sql_update = "update batches ba left join semRegistration reg on ba.batchID = reg.batchID and ba.semID = reg.semID set isOpen = $semRegistration->isOpen, $startDate $batchPromotionDate updatedBy= $semRegistration->updatedBy, updatedDate=UTC_TIMESTAMP() where reg.id is not null"; | |
} else if ($semRegistration->isOpen == 1 && $semRegistration->batchPromotionDate) { | |
$batchPromotionDate = $semRegistration->batchPromotionDate ? "batchPromotionDate='$semRegistration->batchPromotionDate', " : ''; | |
$sql_update = "update batches ba left join semRegistration reg on ba.batchID = reg.batchID and ba.semID = reg.semID set autoBatchPromotion = $semRegistration->autoBatchPromotion, $batchPromotionDate updatedBy= $semRegistration->updatedBy, updatedDate=UTC_TIMESTAMP() where reg.id is not null AND reg.classStartDate >= '$semRegistration->batchPromotionDate'"; | |
} else { | |
$sql_update = "update batches ba left join semRegistration reg on ba.batchID = reg.batchID and ba.semID = reg.semID set isOpen = $semRegistration->isOpen , updatedBy= $semRegistration->updatedBy, updatedDate=UTC_TIMESTAMP() where reg.id is not null"; | |
} | |
$condition = NULL; | |
if (!empty($semRegistration->deptId)) { | |
$condition .= " and ba.deptID = $semRegistration->deptId"; | |
} | |
if (!empty($semRegistration->batchId)) { | |
$condition .= " and ba.batchID = $semRegistration->batchId"; | |
} | |
if (!empty($semRegistration->semId)) { | |
$condition .= " and ba.semID = $semRegistration->semId"; | |
} | |
$sql_update .= $condition; | |
try { | |
if ($semRegistration->isOpen == 1 && $semRegistration->classStartDate) { | |
$sqlInsert .= $condition; | |
$this->executeQueryForObject($sqlInsert); | |
} | |
return $this->executeQueryForObject($sql_update); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get previous sem registration details of a student by detail name | |
* @param int $studentId | |
* @param int $name | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getPrevSemRegStudentDetailsByName($studentId, $name) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT semRegistrationId, studentId, name, value, reg.batchId, reg.semID, classStartDate, isOpen, batchName, semName, type, year, orderNo FROM semRegistrationStudentDetails srd inner join semRegistration reg on srd.semRegistrationId = reg.id inner join batches ba on reg.batchId = ba.batchID and reg.semID <= ba.semID inner join semesters sem on sem.semID = reg.semID where studentId = $studentId and name='$name' order by orderNo;"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get semester registered student details | |
* @param int $batchId | |
* @param int $semId | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSemregStudentDetailsByBatch($batchId, $semId, $sortByColumn = 'rollNo') | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sortByColumn = $this->realEscapeString($sortByColumn); | |
$sql ="SELECT sa.studentId, sa.studentName, sa.regNo, MAX(CASE WHEN sd.name = 'isRegistered' THEN sd.value END) AS isRegistered, MAX(CASE WHEN sd.name = 'canEdit' THEN sd.value END) AS canEdit, MAX(CASE WHEN sd.name = 'receipt_no' THEN sd.value END) AS receiptNo, MAX(CASE WHEN sd.name = 'approvedByTutor' THEN sd.value END) AS approvedByTutor, MAX(CASE WHEN sd.name = 'confirmedByHod' THEN sd.value END) AS confirmedByHod FROM semRegistration sem INNER JOIN studentaccount sa ON sa.batchID = sem.batchId LEFT JOIN semRegistrationStudentDetails sd ON sem.id = semRegistrationId AND sd.studentId = sa.studentID AND sd.name IN ('isRegistered' , 'canEdit', 'receipt_no', 'approvedByTutor', 'confirmedByHod') INNER JOIN semesters se ON se.semID = sem.semID INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID WHERE sem.batchId = '$batchId' AND sem.semId = '$semId' AND joinedSem.orderNo <= se.orderNo group by sa.studentId ORDER BY ".$sortByColumn.""; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get count of students registered for sem promotion | |
* @param int $batchId | |
* @param int $semId | |
* @return unknown | |
* @throws ProfessionalException | |
*/ | |
public function getSemRegStudentCount($batchId, $semId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "SELECT count(sa.studentId) as count FROM studentaccount sa inner join semRegistration sem on sem.batchId = sa.batchID inner join semRegistrationStudentDetails sd on sem.id = semRegistrationId and sa.studentID = sd.studentId inner join semesters se on se.semID = sem.semID inner join semesters joinedSem on sa.joiningSemId = joinedSem.semID where sd.name = 'isRegistered' and sd.value='1' and sem.batchId = $batchId and sem.semId = $semId and joinedSem.orderNo <= se.orderNo"; | |
try { | |
return $this->executeQueryForObject($sql)->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Undocumented function | |
* | |
* @param [type] $studentId | |
* @param [type] $batchId | |
* @param [type] $semId | |
* @return void | |
* @throws ProfessionalException | |
*/ | |
public function checkIfAStudentIsAlreadyApprovedByTutor($studentId, $batchId, $semId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$approvalDetails = null; | |
$sql = "SELECT | |
sa.studentId, value AS approvedByTutor | |
FROM | |
studentaccount sa | |
INNER JOIN semRegistration sem ON sem.batchId = sa.batchID | |
LEFT JOIN semRegistrationStudentDetails sd ON sem.id = semRegistrationId | |
AND sa.studentID = sd.studentId | |
AND sd.name = 'approvedByTutor' | |
INNER JOIN semesters se ON se.semID = sem.semID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
WHERE | |
sem.batchId = '$batchId' | |
AND sem.semId = '$semId' AND sd.studentId = $studentId | |
AND joinedSem.orderNo <= se.orderNo"; | |
try { | |
$approvalDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
if (empty($approvalDetails)) { | |
return false; | |
} | |
return true; | |
} | |
/** | |
* Undocumented function | |
* | |
* @param [type] $studentId | |
* @param [type] $batchId | |
* @param [type] $semId | |
* @return void | |
* @throws ProfessionalException | |
*/ | |
public function checkIfAStudentIsAlreadyConfirmedByHOD($studentId, $batchId, $semId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$approvalDetails = null; | |
$sql = "SELECT | |
sa.studentId, value AS confirmedByHod | |
FROM | |
studentaccount sa | |
INNER JOIN semRegistration sem ON sem.batchId = sa.batchID | |
LEFT JOIN semRegistrationStudentDetails sd ON sem.id = semRegistrationId | |
AND sa.studentID = sd.studentId | |
AND sd.name = 'confirmedByHod' | |
INNER JOIN semesters se ON se.semID = sem.semID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
WHERE | |
sem.batchId = '$batchId' | |
AND sem.semId = '$semId' AND sd.studentId = $studentId | |
AND joinedSem.orderNo <= se.orderNo"; | |
try { | |
$approvalDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
if (empty($approvalDetails)) { | |
return false; | |
} | |
return true; | |
} | |
/** | |
* Get previous semesters of the current sem | |
* @param unknown $currentSemId | |
* @return unknown | |
* @throws ProfessionalException | |
*/ | |
public function getPreviousSemsters($currentSemId) | |
{ | |
$currentSemId = $this->realEscapeString($currentSemId); | |
$sql = "select group_concat(sem.semID) as semIDs from semesters sem inner join semesters curSem on sem.type = curSem.type and sem.orderNo < curSem.orderNo where curSem.semID = $currentSemId"; | |
try { | |
return $this->executeQueryForObject($sql)->semIDs; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting current semId with batchStartYear and courseTypeId | |
* @input $batchStartYear, $courseTypeId | |
* @author Vishnu M | |
*/ | |
public function getSemDetailsByCourseTypeIdAndBatchStartYear($courseTypeId, $batchStartYear) | |
{ | |
$semDetails = null; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
try { | |
$sql = "SELECT DISTINCT b.semID AS semId FROM batches b WHERE b.is_admission = 0 AND b.batchStartYear = '" . $batchStartYear . "' AND b.courseTypeID = " . $courseTypeId . ""; | |
$semDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
/** | |
* Method To Fetch All Semesters. | |
* @param bool $excludePassOutSemesters | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getAllSemesters($excludePassOutSemesters = false) | |
{ | |
$semesterArray = []; | |
$passOutSemester = SemesterConstants::PASSOUT_STUDENTS; | |
$courseCompletedSemester = SemesterConstants::COURSE_COMPLETED; | |
try { | |
$sql = "SELECT semID, semName, year, type, orderNo | |
FROM semesters"; | |
if ($excludePassOutSemesters) { | |
$sql .= " WHERE semName NOT IN ('$passOutSemester','$courseCompletedSemester')"; | |
} | |
$semesterArray = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesterArray; | |
} | |
/** | |
* Method To details of a sem by semId. | |
* @param $semId | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getSemDetailsBySemId($semId) | |
{ | |
$semester = null; | |
try { | |
$semId = $this->realEscapeString($semId); | |
$sql = "SELECT semID, semName, year, type, orderNo FROM semesters WHERE semID = " . $semId . ""; | |
$semester = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semester; | |
} | |
/** | |
* Undocumented function | |
* | |
* @param [type] $sbsId | |
* @return void | |
* @throws ProfessionalException | |
*/ | |
public function getSemesterBySbsId($sbsId) | |
{ | |
$sql = ""; | |
$semester = null; | |
$sbsId = $this->realEscapeString($sbsId); | |
try { | |
$sql = "select smr.semID as semId,smr.semName,smr.sheduleType FROM semesters smr | |
INNER JOIN sbs_relation sbsr ON smr.semID = sbsr.semID WHERE sbsID = $sbsId"; | |
$semester = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semester; | |
} | |
/** | |
* Get Semester by sem name | |
* @return Semester | |
* @throws ProfessionalException | |
*/ | |
public function getSemesterByName($name) | |
{ | |
$semester = null; | |
try { | |
$name = $this->realEscapeString($name); | |
$sql = "SELECT semID as id , semName as name, year, type, orderNo,sheduleType FROM semesters WHERE semName = '$name'"; | |
$semester = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semester; | |
} | |
public function getNextSemester($semId) | |
{ | |
$semId = (int)$this->realEscapeString($semId); | |
$sql = "SELECT semester.semID FROM semesters sem INNER JOIN semesters semester on (semester.type = sem.type or semester.type is null) and semester.orderNo > sem.orderNo where sem.semID = $semId order by semester.orderNo ASC limit 1"; | |
try { | |
$nextSemID = ""; | |
$nextSemID = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $nextSemID->semID; | |
} | |
/** | |
* Get sem of regular Exams | |
* | |
* @param int $examRegId | |
* @return sems list | |
* @throws ProfessionalException | |
*/ | |
public function getSemByExamRegId($examRegId, $examType) | |
{ | |
if ($examType == ExamType::REGULAR) { | |
$sql = "SELECT DISTINCT s.semID,s.semName FROM exam e INNER JOIN semesters s ON s.semID=e.semID WHERE examregID = $examRegId"; | |
} else if ($examType == ExamType::SUPPLY) { | |
$sql = "SELECT DISTINCT s.semID,s.semName FROM exam e INNER JOIN semesters s ON s.semID=e.semID WHERE supply_examreg_id = $examRegId"; | |
} | |
try { | |
$semDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
/** | |
* Get semester registered student details | |
* @param int $batchId | |
* @param int $semId | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSemregStudentDetailsByBatchFromFailedStudents($batchId, $semId, $sortByColumn = 'rollNo') | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sortByColumn = $this->realEscapeString($sortByColumn); | |
$sql ="SELECT sa.studentId, sa.studentName, sa.regNo, MAX(CASE WHEN sd.name = 'isRegistered' THEN sd.value END) AS isRegistered, MAX(CASE WHEN sd.name = 'canEdit' THEN sd.value END) AS canEdit, MAX(CASE WHEN sd.name = 'receipt_no' THEN sd.value END) AS receiptNo, MAX(CASE WHEN sd.name = 'approvedByTutor' THEN sd.value END) AS approvedByTutor, MAX(CASE WHEN sd.name = 'confirmedByHod' THEN sd.value END) AS confirmedByHod FROM semRegistration sem INNER JOIN failed_students fs ON fs.previousBatch = sem.batchId AND fs.reason = 'LATE_SEM_REGISTRATION' INNER JOIN studentaccount sa ON sa.studentId = fs.studentId LEFT JOIN semRegistrationStudentDetails sd ON sem.id = semRegistrationId AND sd.studentId = sa.studentID AND sd.name IN ('isRegistered' , 'canEdit', 'receipt_no', 'approvedByTutor', 'confirmedByHod') INNER JOIN semesters se ON se.semID = sem.semID INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID WHERE sem.batchId = '$batchId' AND sem.semId = '$semId' AND joinedSem.orderNo <= se.orderNo AND fs.isFailNow=1 group by sa.studentId ORDER BY '$sortByColumn'"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get sem of regular Exams | |
* | |
* @param int $examRegId | |
* @return sems list | |
* @throws ProfessionalException | |
*/ | |
public function getSemByRequest($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$coursePattern = $request->coursePattern; | |
$courseId = $request->courseId; | |
$examRegId = $request->examRegId; | |
$examType = $request->examType; | |
$batch = $request->batch; | |
$termId = $request->termId; | |
$joinTables = ""; | |
$whereConditions = ""; | |
if(!empty($request->semesterIds)) { | |
$whereConditions .= " AND sem.semID in ('".(implode("','",$request->semesterIds))."')"; | |
} | |
if ($examType || $examRegId) { | |
if ($examType == ExamType::REGULAR) { | |
$examTypeBatchTable = "exam_registration_batches"; | |
$examTypeBatchTableColumn = "examregID"; | |
} else if ($examType == ExamType::SUPPLY) { | |
$examTypeBatchTable = "supply_improve_batches"; | |
$examTypeBatchTableColumn = "exam_supplementary_id"; | |
} | |
if ($examType != ExamType::INTERNAL) { | |
// should remove after Internal exam registraion batches table creation | |
$joinTables .= " INNER JOIN | |
$examTypeBatchTable erb ON erb.semID = sem.semID"; | |
if ($examRegId) { | |
$whereConditions .= " AND erb.$examTypeBatchTableColumn IN ($examRegId)"; | |
} | |
} | |
} | |
if ($courseId) { | |
$joinTables .= " INNER JOIN | |
course_pattern c ON c.patternID = b.patternID | |
"; | |
$whereConditions .= " AND b.patternID IN ($courseId) | |
"; | |
} | |
if ($batch) { | |
$joinTables .= " INNER JOIN | |
batches b ON sem.semID = b.semID"; | |
$whereConditions .= " AND b.batchID IN ($batch) | |
"; | |
} | |
if ($coursePattern) { | |
$joinTables .= " INNER JOIN | |
pattern_deptcourses pdc ON pdc.patterncourseID = b.patterncourseID"; | |
$whereConditions .= " AND b.patterncourseID IN ($coursePattern)"; | |
} | |
if($termId){ | |
$whereConditions .= " AND termId = '$termId' "; | |
} | |
$sql = "SELECT DISTINCT | |
sem.semID AS id, sem.semName AS name | |
FROM | |
semesters sem | |
$joinTables | |
WHERE | |
sem.semID <> '' | |
$whereConditions | |
ORDER BY | |
sem.orderNo"; | |
try { | |
$semDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
/** | |
* Get previous semId of the current sem | |
* @param unknown $semId | |
* @return unknown | |
* @throws ProfessionalException | |
* @author Ajay | |
*/ | |
public function getPreviousSemId($semId) | |
{ | |
$semId = $this->realEscapeString($semId); | |
$sql = "select sem.semID as semID from semesters sem inner join semesters curSem on sem.type = curSem.type and sem.orderNo < curSem.orderNo where curSem.semID = $semId order by sem.semID desc limit 1"; | |
try { | |
return $this->executeQueryForObject($sql)->semID; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Undocumented function | |
* | |
* @param $studentId | |
* @param $batchId | |
* @param $semId | |
* @return bool | |
* @throws ProfessionalException | |
*/ | |
public function checkIfAFailedStudentIsAlreadyApprovedByTutor($studentId, $batchId, $semId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$approvalDetails = null; | |
$sql = "SELECT sa.studentId, value AS approvedByTutor | |
FROM | |
semRegistration sem | |
INNER JOIN failed_students fs ON fs.previousBatch = sem.batchId AND fs.hisSemestersInThisbatch = sem.semId AND fs.reason = \"" . SemRegistrationFormConstants::LATE_SEM_REGISTRATION . "\" and fs.isFailNow = 1 | |
INNER JOIN studentaccount sa ON sa.studentId = fs.studentId | |
LEFT JOIN semRegistrationStudentDetails sd ON sem.id = semRegistrationId | |
AND sd.studentId = sa.studentID | |
AND sd.name = 'approvedByTutor' | |
INNER JOIN semesters se ON se.semID = sem.semID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
WHERE | |
sem.batchId = '$batchId' | |
AND sem.semId = '$semId' AND sd.studentId = $studentId | |
AND joinedSem.orderNo <= se.orderNo"; | |
try { | |
$approvalDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
if (empty($approvalDetails)) { | |
return false; | |
} | |
return true; | |
} | |
/** | |
* @throws ProfessionalException | |
*/ | |
public function getAllSemestersForAdvancedSearch() | |
{ | |
$sql = "SELECT semID as id,semName as name | |
FROM semesters"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $batchId | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getAllSemestersOfBatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = null; | |
$semesters = null; | |
try { | |
$sql = "SELECT s.semID AS id, s.semName AS name, s.year, s.type, s.orderNo, b.semID AS currentSem FROM semesters sem INNER JOIN batches b ON b.semID = sem.semID INNER JOIN semesters s ON s.type = sem.type WHERE s.orderNo <= b.final_semester AND b.batchID = '$batchId' ORDER BY s.orderNo ASC "; | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
/** | |
* @param $batchId | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getExamConductedSemestersOfBatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = null; | |
$semesters = null; | |
try { | |
$sql = "SELECT | |
DISTINCT sem.semID AS id, | |
sem.semName AS name | |
FROM | |
exam_registration_batches erb | |
INNER JOIN semesters sem ON | |
sem.semID = erb.semID | |
WHERE | |
erb.batchID = $batchId"; | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
/** | |
* Method To details of a sem by semIds. | |
* @param $semId | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getSemestersBySemId($semId) | |
{ | |
$semId = $this->realEscapeArray($semId); | |
$semester = null; | |
try { | |
$semeterString = is_array($semId) ? implode(",", $semId) : $semId; | |
$sql = "SELECT semID AS id, semName AS name, year, type, orderNo FROM semesters WHERE semID IN ($semeterString) ORDER BY orderNo DESC"; | |
$semester = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semester; | |
} | |
/** | |
* Method for getting supply sem by supplyexam reg id | |
* @throws ProfessionalException | |
* @return $sem | |
* @author Sibin | |
*/ | |
public function getSupplyExamSem($supplyExamRegId) | |
{ | |
$sem=""; | |
$supplyExamRegId = $this->realEscapeString($supplyExamRegId); | |
try{ | |
$sql = "SELECT | |
id,supplyDesc,semId from exam_supplementary where id='$supplyExamRegId'"; | |
$sem = $this->executeQueryForObject($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $sem; | |
} | |
/** | |
* @param $batchId | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getAllPreviousSemestersOfBatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = null; | |
$semesters = null; | |
try { | |
$sql = "SELECT DISTINCT sem.semID AS id, sem.semName AS name FROM semesters sem INNER JOIN sbs_relation sr ON sr.semID = sem.semID WHERE sr.batchID = '$batchId' ORDER BY sem.orderNo ASC "; | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
public function getAllSemestersOfBatchByBatchId($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = null; | |
$semesters = null; | |
try { | |
$sql = "SELECT s.semID AS id, s.semName AS name, s.year, s.type, s.orderNo | |
FROM batches bat | |
INNER JOIN semesters sem ON sem.semID = bat.final_semester | |
INNER JOIN semesters s ON s.orderNo <= sem.orderNo AND sem.type = s.type | |
WHERE batchID = '$batchId' | |
ORDER BY s.orderNo ASC;"; | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
/** | |
* Get semester by type | |
* | |
* @param int $semType | |
* @throws ProfessionalException | |
*/ | |
public function getSemIdsBytype($semType) | |
{ | |
$semIds = NULL; | |
$sql = "SELECT GROUP_CONCAT(semID) as semIds FROM semesters WHERE type='$semType' ORDER BY orderNo"; | |
try { | |
$semIds = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semIds[0]->semIds; | |
} | |
/** | |
* Get semester by final sem | |
* @param int $semType | |
* @throws ProfessionalException | |
* @author Sibin | |
*/ | |
public function getSemestersByFinalSem($finalSem) | |
{ | |
$finalSem = $this->realEscapeString($finalSem); | |
$semesters = NULL; | |
$sql = "SELECT semID as id,semName as name ,year,orderNo from semesters where semID <= '$finalSem' ORDER BY orderNo"; | |
try { | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
public function getLatestSemesterOfThisBatchSemRegistration($batchId){ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT sm.id AS semRegistrationId,sm.batchId, sm.semId, sem.semID AS reg_sem_id, sem.semName | |
FROM | |
semRegistration sm | |
INNER JOIN semesters sms ON sms.semID = sm.semId | |
INNER JOIN semesters sem ON sem.type = sms.type AND sem.orderNo <= sms.orderNo | |
inner join batches b on b.batchID = sm.batchId | |
WHERE | |
sm.batchId = '$batchId' | |
ORDER BY sms.orderNo DESC,sem.orderNo DESC | |
LIMIT 1;"; | |
try { | |
$semReDetails = $this->executeQueryForObject($sql); | |
$semReDetails->toSemId = $this->getNextSemester($semReDetails->reg_sem_id); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $semReDetails; | |
} | |
public function getSemeregistrarionByRequest($request){ | |
$request = $this->realEscapeObject($request); | |
if (empty($request->batchId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_BATCH_ID, "Invalid batch details given"); | |
} | |
if (empty($request->semId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_SEMESTER_ID, "Invalid semester details given"); | |
} | |
$sql = | |
"SELECT | |
ba.batchID, ba.batchName, ba.batchStartYear, ba.batchEndYear, ba.deptID, ba.semID as currentSem, ba.patternID, ba.universityId, reg.id, reg.batchId as regBatch, reg.classStartDate, reg.batchPromotionDate, reg.isOpen, sem.semID, sem.semName, sem.year, sem.orderNo, reg.autoBatchPromotion, case when csem.orderNo > sem.orderNo then 'true' else 'false' end as promoted | |
FROM batches ba | |
INNER JOIN semesters csem ON csem.semID = ba.semID | |
INNER JOIN semRegistration reg ON ba.batchID = reg.batchId | |
INNER JOIN semesters sem on reg.semId = sem.semID | |
where ba.batchName != 'failed' | |
and csem.semName != 'Course Completed' | |
and ba.batchID = '$request->batchId' | |
and sem.semID = '$request->semId' | |
limit 1;"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get semester by exam reg batch | |
* @param int $semType | |
* @throws ProfessionalException | |
* @author Sibin | |
*/ | |
public function getSemesterByExamRegBatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$semester = NULL; | |
if($request->examRegId && $request->batchId){ | |
$sql = "SELECT semID as semId from exam_registration_batches where examregID= '$request->examRegId' and batchID='$request->batchId'"; | |
} | |
try { | |
$semester = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $semester; | |
} | |
/** | |
*get all semesters from internal mark assigned staff. | |
* @param bool $staffId | |
* @return object|array|$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getAllSemestersFromInternalMarkAssignedStaff($batchId, $staffId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$staffId = $this->realEscapeString($staffId); | |
$semesterArray = []; | |
try { | |
$sql = "SELECT | |
DISTINCT s.semID, s.semName, s.year, s.type, s.orderNo | |
FROM | |
assign_staff_internal_mark_entry asime | |
INNER JOIN | |
semesters s ON (s.semID =asime.semID) | |
WHERE | |
asime.adminID = $staffId AND asime.batchID = $batchId | |
ORDER BY s.semID ASC;"; | |
$semesterArray = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesterArray; | |
} | |
/** | |
* @param $batchId | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Sibin | |
*/ | |
public function getAllSemestersByBatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = null; | |
$semesters = null; | |
try { | |
$sql = "SELECT s.semID AS id, s.semName AS name, s.year, s.type, s.orderNo FROM semesters sem INNER JOIN batches b ON b.final_semester = sem.semID INNER JOIN semesters s ON s.type = sem.type WHERE s.orderNo <= b.final_semester AND b.batchID = '$batchId' ORDER BY s.orderNo ASC "; | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
/** | |
* @param $batchId | |
* @return Object|null | |
* @throws ProfessionalException | |
*/ | |
public function getRegularPublishedSemestersOfStudent($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = null; | |
$semesters = null; | |
try { | |
$sql = "SELECT | |
DISTINCT sem.semID AS id, | |
sem.semName AS name | |
FROM | |
exam_reg_studentchallan ers | |
INNER JOIN studentaccount sa ON | |
sa.studentID = ers.studentID | |
INNER JOIN exam_registration_batches erb ON | |
erb.batchID = sa.batchID | |
INNER JOIN semesters sem ON | |
sem.semID = erb.semID | |
LEFT JOIN ec_marklist_application_applied_students emas ON | |
emas.semID = erb.semID | |
AND emas.studentID = ers.studentID | |
WHERE | |
erb.publish = 1 | |
AND ers.paid = 1 | |
AND ers.studentID = $studentId | |
AND emas.studentID IS NULL"; | |
$semesters = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semesters; | |
} | |
/** | |
* Get semesters by examregIds | |
* @param int $examRegId | |
* @return sems list | |
* @throws ProfessionalException | |
*/ | |
public function getSemestersByExamRegIds($examRegId, $examType) | |
{ | |
if ($examType == ExamType::REGULAR) { | |
$sql = "SELECT DISTINCT s.semID,s.semName FROM exam e INNER JOIN semesters s ON s.semID=e.semID WHERE examregID IN ($examRegId)"; | |
} else if ($examType == ExamType::SUPPLY) { | |
$sql = "SELECT DISTINCT s.semID,s.semName FROM exam e INNER JOIN semesters s ON s.semID=e.semID WHERE supply_examreg_id IN ($examRegId)"; | |
} | |
try { | |
$semDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
/** | |
* Get sem of regular Exams | |
* | |
* @param int $examRegId | |
* @return sems list | |
* @throws ProfessionalException | |
*/ | |
public function getSemByExamRegIds($examRegId, $examType) | |
{ | |
if ($examType == ExamType::REGULAR) { | |
$sql = "SELECT DISTINCT s.semID,s.semName FROM exam e INNER JOIN semesters s ON s.semID=e.semID WHERE examregID IN ($examRegId)"; | |
} else if ($examType == ExamType::SUPPLY) { | |
$sql = "SELECT DISTINCT s.semID,s.semName FROM exam e INNER JOIN semesters s ON s.semID=e.semID WHERE supply_examreg_id IN ($examRegId)"; | |
} | |
try { | |
$semDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
/** | |
* Get hod approved date of sem term registration | |
* @author Ajay | |
* @param int $studentId | |
* @return String $semRegDetails | |
* @throws ProfessionalException | |
*/ | |
public function getBatchPromotedDateByHod($studentId) | |
{ | |
try{ | |
$sql_batch = "SELECT batchID FROM studentaccount s WHERE studentID = $studentId"; | |
$batchID = $this->executeQueryForObject($sql_batch)->batchID; | |
if($batchID) | |
{ | |
$currentSem = $this->getStudentCurrentSemester($studentId)->id; | |
} | |
if($currentSem && $batchID) | |
{ | |
$sql_semRegistrationId = "SELECT id FROM semRegistration sr WHERE batchId ='$batchID' and semId = '$currentSem'"; | |
$semRegistrationId = $this->executeQueryForObject($sql_semRegistrationId)->id; | |
} | |
if($semRegistrationId == null) | |
{ | |
$prevSem = $this->getPreviousSemesterByStudentId($studentId)->prevSemId; | |
if($prevSem) | |
{ | |
$sql_semRegistrationId = "SELECT id FROM semRegistration sr WHERE batchId ='$batchID' and semId = $prevSem"; | |
$semRegistrationId = $this->executeQueryForObject($sql_semRegistrationId)->id; | |
} | |
} | |
if($semRegistrationId) | |
{ | |
$sql_semRegDetails = "SELECT DATE_FORMAT(CONVERT_TZ(updatedDate,'+05:30',@@global.time_zone),'%d-%m-%Y %H:%i:%S') AS updatedDate FROM semRegistrationStudentDetails WHERE semRegistrationId = $semRegistrationId and studentId = $studentId and name = 'confirmedByHod' and value =1"; | |
$semRegDetails = $this->executeQueryForObject($sql_semRegDetails)->updatedDate; | |
} | |
if($semRegDetails == null) | |
{ | |
return "-"; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $semRegDetails; | |
} | |
/** | |
* Get hod approved date of sem term registration | |
* @author Ajay | |
* @param int $BatchID | |
* @return String $semRegclassStartDate | |
* @throws ProfessionalException | |
*/ | |
public function getBatchCommencedDate($batchID) | |
{ | |
try{ | |
$sql = "SELECT classStartDate FROM semRegistration WHERE batchId = $batchID ORDER BY id DESC LIMIT 1"; | |
$result = $this->executeQueryForObject($sql)->classStartDate; | |
if($result) | |
{ | |
$date= date("d-m-Y", strtotime($result)); | |
} | |
else{ | |
$date = "-"; | |
} | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $date; | |
} | |
public function getSemDetailsByCourseTypeId($courseTypeIds) | |
{ | |
$semDetails = null; | |
$courseTypeIds = $this->realEscapeArray($courseTypeIds); | |
$courseTypeIds = implode(",",$courseTypeIds); | |
try { | |
$sql = "SELECT DISTINCT s.semID,s.semName from semesters s inner join batches b on b.semID = s.semID WHERE b.courseTypeID IN ($courseTypeIds) order by semID "; | |
$semDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $semDetails; | |
} | |
public function checkFeePaidForSemRegistration($semRegID,$studentID) | |
{ | |
try{ | |
$semRegID = $this->realEscapeString($semRegID); | |
$studentID = $this->realEscapeString($studentID); | |
$sql = "SELECT CASE WHEN value ='YES' THEN 1 ELSE 0 END AS status from semRegistrationStudentDetails WHERE studentId = '$studentID' and semRegistrationId = '$semRegID' and name = \"whether_fee_paid\""; | |
$result = $this->executeQueryForObject($sql); | |
if($result) | |
{ | |
if($result->status) | |
{ | |
return true; | |
} | |
else{ | |
return false; | |
} | |
} | |
else{ | |
return false; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function semDetailsWithAdvancedDetails($currentsemID) | |
{ | |
try{ | |
$currentsemID = $this->realEscapeString($currentsemID); | |
$sql = "SELECT * from semesters"; | |
$aboutBatch = BatchService::getInstance()->getBatchById($_SESSION['batchID']); | |
if($aboutBatch->name == "failed") | |
{ | |
$studentID = $_SESSION['studentID']; | |
$sqlGetOldBatchId = "SELECT previousBatch as batchID from failed_students fs WHERE studentID = $studentID and failedInSemester =$currentsemID"; | |
$batchID = $this->executeQueryForObject($sqlGetOldBatchId)->batchID; | |
if($batchID) | |
{ | |
$aboutBatch = BatchService::getInstance()->getBatchById($batchID); | |
$finalSemester = (int) $aboutBatch->finalSemester; | |
} | |
} | |
else{ | |
$finalSemester = (int) $aboutBatch->finalSemester; | |
} | |
$semesters = $this->executeQueryForList($sql); | |
foreach ($semesters as $k => $semester) { | |
$semester->orderNo = (int)$semester->orderNo; | |
if($semester->orderNo) | |
{ | |
if($semester->orderNo > $finalSemester) | |
{ | |
unset($semesters[$k]); | |
} | |
} | |
} | |
foreach ($semesters as $key => $sem) { | |
if($sem->semID == $currentsemID) | |
{ | |
$result = new \stdClass(); | |
$result->currentSemID = $sem->semID; | |
$result->currentSemName = $sem->semName; | |
$result->currentSemYear = $sem->year; | |
$sem->orderNo = (int)$sem->orderNo; | |
if($sem->orderNo) | |
{ | |
if($sem->orderNo % 2 == 1) | |
{ | |
$result->isEvenSem = 0; | |
$result->isOddSem = 1; | |
} | |
else | |
{ | |
$result->isEvenSem = 1; | |
$result->isOddSem = 0; | |
} | |
} | |
else | |
{ | |
$result->isEvenSem = ""; | |
$result->isOddSem = ""; | |
} | |
$result->previousSemID = $semesters[$key-1] ? $semesters[$key-1]->semID : $semesters[0]; | |
if(!$finalSemester) | |
{ | |
throw new ProfessionalException("FINAL SEMSTER NOT DEFINED", "FINAL SEMSTER NOT DEFINED"); | |
} | |
$result->nextSemID = $semesters[$key+1] ? $semesters[$key+1]->semID : $semesters[$finalSem]; | |
return $result; | |
} | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
} |