Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 195 |
CRAP | |
0.00% |
0 / 4114 |
BatchService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 195 |
542432.00 | |
0.00% |
0 / 4114 |
__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 |
|||
getAllBatchesForApi | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 42 |
|||
getBatchDetailsByIdForApi | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 49 |
|||
getBatchesByDeptId | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 34 |
|||
getBatchListByAdmsnYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getSubBatchesByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getBatchById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 31 |
|||
getBatchDetailsById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 28 |
|||
getSubBatchById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getTotalNumberOfStudents | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getTotalNumberOfStudentsInSubbatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getBatchCourseType | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getSubbatchDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 20 |
|||
getSubbatchBySubject | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 22 |
|||
getBatchStudentCount | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
getNormalizeTutorPrivilageBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getNormalizeTutorUnprivilegeBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getFailedBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getBatchIDsByDeptID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getTimetableDates | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
getAddMarksPrivilegeBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getAddMarksUnPrivilegeBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
isHiddenAddMarksBatch | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 13 |
|||
getAddMarksNormalizeByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getRoundOffPrivilegedBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getCourseTypeById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getCourseTypeByTypeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getNormalizeSubjectWiseRuleBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
isCourseTyeDefined | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 15 |
|||
getCourseTypeUnassignedBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getBatchesBybatchCourseTypeId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 19 |
|||
getBatchesByCourseTypeId | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
getClassEndDate | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getCurrentBatchStartYears | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getPseudoCurrentBatchStartYears | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getAllBatchStartYears | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
isStudentInSubbatch | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
getSubbatchDetailsBySbsId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getSubbatchDetailsByStudentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getCourseTypeIdByCode | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getSubbatchBystaffIdAndSubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getBatchDetailsByAdmissionNo | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getBatchesByCourseTypeAndBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getTotalStudentsInABatch | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
createSubbatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
createSubbatchSBS | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
createSubbatchStudent | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
finalizePseudoSubjectSubbatches | |
0.00% |
0 / 1 |
210.00 | |
0.00% |
0 / 75 |
|||
getBatchDetailsByCourseTypeIdBatchStartYearAndsemId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
getCurrentSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getCurrentSemesterByBatchId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 11 |
|||
promoteBatchSemester | |
0.00% |
0 / 1 |
462.00 | |
0.00% |
0 / 143 |
|||
getAllTcIssuedDates | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
addTcDate | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getBatchesByDepartmentIdWithoutPassoutBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 21 |
|||
getBatchesByDepartmentIdAndStartYearWithoutPassoutBatches | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 13 |
|||
getBatchDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 21 |
|||
getBatchByCourseTypeIdAndSemId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getBatchPatternCourseDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getPseudoSubjSubbatchesById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 18 |
|||
listSupplyRoundOffConfigIndividual | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
knowCourseType | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getCourseTypeByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
checkIfSecondLanguageValidForABatch | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 18 |
|||
showSubbatchStudentsInternalMarks | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 36 |
|||
getHODBatchesByStaffId | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 35 |
|||
getHODPrivilegedBatchIdsAndSemIds | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 19 |
|||
getStudentSortByColumnOfABatch | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
getBatchByBatchCodeAndDeptCode | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 22 |
|||
getCampusTypes | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 14 |
|||
getBatchesFromCourseTypeForFee | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getCourseTypeByCourseTypeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getBatchesTeachingByStaff | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 23 |
|||
isAdmissionBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getBatchesByDepartmentIds | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 25 |
|||
searchBatches | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 26 |
|||
getBatchByCourseTypeIdSemIdAndDeptID | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 35 |
|||
getFinalizedRuleForSubject | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 60 |
|||
getBatchesByCourseTypeOrSemesterAndDepartment | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 19 |
|||
getBatcheIdByStudentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getPreviousBatchWithStudentID | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 18 |
|||
getAvailableAcademicYears | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getBatchDetailsByStudentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 39 |
|||
batchPromotion | |
0.00% |
0 / 1 |
462.00 | |
0.00% |
0 / 117 |
|||
getAllCurrentBatchesWithDeptID | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 21 |
|||
getBatchesByDeptIdAndExamRegId | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 36 |
|||
getBatchesByRequest | |
0.00% |
0 / 1 |
342.00 | |
0.00% |
0 / 80 |
|||
getBatchesByCourseTypeIdAndCampusTypeId | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 25 |
|||
getBatchesForComponentRuleAssign | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
getBatchesAssignedToPseudoSubjectForAStaff | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 29 |
|||
getBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getConcatenatedBatchNameByBatchIds | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 11 |
|||
getBatchesExamRegSemSubject | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getBatchesForCopyCoByRequest | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
getAllRunningBatchesByDepartmentIds | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 19 |
|||
getAllBatchesByDepartmentIds | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getDepartmentByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getAllBatchesForFormways | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 30 |
|||
getAllBatchStartYearsForAdvancedStudentSearch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getAllBatchesInHall | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 42 |
|||
getTotalNumberOfStudentsBySubbatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getBatchDetailsByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 40 |
|||
getBatchesByCourseTypeAndAdmissionYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
getSessionalMarksSettingsByBarch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
getBatchesByAcademicYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getBatchesHodPrivelegesByStaff | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 26 |
|||
getAcademicStartYearEndYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getExamRegBatchesByRequest | |
0.00% |
0 / 1 |
272.00 | |
0.00% |
0 / 72 |
|||
getBatchListBybatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getBatchListByAdmsnYearForMarklist | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
copySubjectCredits | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 55 |
|||
getBatchesByDeptIdAndCourseTypeID | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 25 |
|||
getMarkListSubjectCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 29 |
|||
getBatchSubjectCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 24 |
|||
getBatchesByExamRegId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 27 |
|||
getBatchSemSubjectCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 22 |
|||
getStudentSubjectMenu | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getBatcheByPatternCourseIdAndBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getBatchStartYearByCourseType | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getBatchDetailListByBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getBatchNameById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getPassoutBatchesByCourseTypeAndBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getSubjectCreditDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
addBatch | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 33 |
|||
updateBatch | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 32 |
|||
deleteBatch | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 31 |
|||
addSBSRelation | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 24 |
|||
updateSBSRelation | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 26 |
|||
deleteSBSRelation | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 28 |
|||
addSubbatch | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 24 |
|||
updateSubbatch | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 29 |
|||
deleteSubbatch | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 25 |
|||
getAllBatchStartYearsForAPI | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getBatchesWithValuationDatesByExamRegId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
isBatchExamRegisteredForSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getAllBatchesByRequest | |
0.00% |
0 / 1 |
182.00 | |
0.00% |
0 / 49 |
|||
isBatchPassout | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 12 |
|||
getBatchesWithValuationDatesByExamRegAndBatch | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 34 |
|||
isBatchExamRegisteredForSemAndShortCourse | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getBatchesByExamRegDepartment | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 16 |
|||
getBatchesByIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getBatchesFromInternalMarkAssignedStaff | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
getsubjectWiseBatchDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
updateExtraDetails | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
getBatchDetailsByIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getBatchesWithValuationDatesByExamRegRequest | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 23 |
|||
getFinalSemBatchesByCourseType | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 22 |
|||
saveBatchPriority | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 19 |
|||
getAllBatchesForDataImport | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getBatchDetailsByCourseTypeIdBatchStartYearAndsemIdConsideringSbs | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 22 |
|||
getTotalNumberOfSeatsForABatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getExamRegBatchesByDepartment | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 24 |
|||
getStudentAllBatchPeriodOfStudyDetails | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 44 |
|||
getExamRegBatchesHallTicketIssuedStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
setExamRegBatchesHallTicketIssuedStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getBatchesWithRequestForFilter | |
0.00% |
0 / 1 |
240.00 | |
0.00% |
0 / 48 |
|||
getBatchNameOrdered | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
checkCondonationCount | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
applyAndPrint | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getBatchesByCourseTypeAndStartYear | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 22 |
|||
checkCurrentCondonations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getBatchesBySemIdAndDeptIdAndBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getEvaluationsByBatchId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 27 |
|||
getUnassignedEvaluations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getBatchesByDepartmentIdAndStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getEvaluationsByBatchIdForResult | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 24 |
|||
getBatchSubsidiaryCourseName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 13 |
|||
getAllbatchesForSec | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 32 |
|||
addBatchesToSec | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 26 |
|||
getBatchesFromsec | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 20 |
|||
deleteApplication | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
checkForSecBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getAssignedSecBatchesForStaff | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 26 |
|||
getSecStats | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 35 |
|||
getSecNameBySecBatchID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getStudentState | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 24 |
|||
getBatchesByDeptIds | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
getStudentDataBySecAppId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 37 |
|||
updateApplicationOfStudent | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 24 |
|||
checkForSecBatchTimeRange | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 10 |
|||
getnoDueReportsByBatchAndSectionIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
checkForSpecialPermission | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
giveSpecialAccessToStudent | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 48 |
|||
getBatchesBySecId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getStudentsOfBatchSec | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 60 |
|||
secDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getAllAssignedFaculties | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getAllDistinctBatchStartYears | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getEntintiesForV4 | |
0.00% |
0 / 1 |
182.00 | |
0.00% |
0 / 44 |
|||
getStudentAcademicStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getCourseTypeFrombatchID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getBatchesByProgramId | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 31 |
|||
getFailedBatchDetailes | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use stdClass; | |
use Exception; | |
use com\linways\core\ams\professional\dto\Batch; | |
use com\linways\core\ams\professional\dto\AmsLog; | |
use com\linways\core\ams\professional\dto\Semester; | |
use com\linways\core\ams\professional\dto\Subbatch; | |
use com\linways\core\ams\professional\dto\Timetable; | |
use com\linways\core\ams\professional\dto\CourseType; | |
use com\linways\core\ams\professional\util\CommonUtil; | |
use com\linways\core\ams\professional\constant\ExamType; | |
use com\linways\core\ams\professional\queue\AMSTaskQueue; | |
use com\linways\core\ams\professional\dto\SettingsConstents; | |
use com\linways\core\ams\professional\service\AmsLogService; | |
use com\linways\core\ams\professional\service\CommonService; | |
use com\linways\core\ams\professional\constant\BatchConstants; | |
use com\linways\core\ams\professional\service\SemesterService; | |
use com\linways\core\ams\professional\constant\AmsLogConstants; | |
use com\linways\core\ams\professional\toggles\PermissionToggle; | |
use com\linways\core\ams\professional\mapper\BatchServiceMapper; | |
use com\linways\core\ams\professional\request\GetBatchesRequest; | |
use com\linways\core\ams\professional\constant\SemesterConstants; | |
use com\linways\core\ams\professional\constant\SettingsConstants; | |
use com\linways\core\ams\professional\request\SearchBatchesRequest; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
use com\linways\core\ams\professional\request\api\GetAllBatchesRequest; | |
use com\linways\core\ams\professional\constant\SemRegistrationFormConstants; | |
use com\linways\core\ams\professional\request\GetBatchesForComponentRuleAssignRequest; | |
class BatchService 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 = BatchServiceMapper::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; | |
} | |
/** | |
* | |
* @param GetAllBatchesRequest $request | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author gadheyan | |
*/ | |
public function getAllBatchesForApi(GetAllBatchesRequest $request) | |
{ | |
$sql = ""; | |
$request = $this->realEscapeObject($request); | |
$sql = "SELECT | |
btc.batchID AS id, | |
btc.batchName as name, | |
btc.batchDesc AS description, | |
btc.batchStartYear as startYear, | |
btc.batchEndYear as endYear | |
FROM | |
batches btc | |
INNER JOIN | |
department dpt ON btc.deptID = dpt.deptID | |
INNER JOIN | |
semesters sem ON sem.semID = btc.semID WHERE 1=1 "; | |
if ($request) { | |
if ($request->id) { | |
$sql .= " AND btc.batchID = $request->id"; | |
} | |
if ($request->batchHide || $request->batchHide === 0 || $request->batchHide === "0") { | |
$sql .= " AND btc.batchHide = $request->batchHide"; | |
} | |
if ($request->semId) { | |
$sql .= " AND btc.semID = $request->semId"; | |
} | |
if (is_array($request->deptId) && sizeof($request->deptId)>0) | |
{ | |
$sql .= " AND btc.deptID IN ('" . (implode("','", $request->deptId)) . "')"; | |
} | |
elseif ($request->deptId) { | |
$sql .= " AND btc.deptID = $request->deptId"; | |
} | |
if (!empty($request->ids)) { | |
$sql .= " AND btc.batchID IN ('" . (implode("','", $request->ids)) . "')"; | |
} | |
} | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* | |
* @param GetAllBatchesRequest $request | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author gadheyan | |
*/ | |
public function getBatchDetailsByIdForApi(GetAllBatchesRequest $request) | |
{ | |
$sql = ""; | |
$request = $this->realEscapeObject($request); | |
$sql = "SELECT | |
btc.batchID AS id, | |
btc.batchName as name, | |
btc.batchDesc AS description, | |
btc.batchStartYear as startYear, | |
btc.batchEndYear as endYear, | |
btc.batchCreateTime AS createdDate, | |
btc.deptID AS departmentId, | |
dpt.deptName AS departmentName, | |
dpt.departmentDesc AS departmentDescription, | |
btc.semID AS semId, | |
sem.semName AS semesterName, | |
sem.orderNo, | |
sem.year as semesterYear, | |
btc.totalSemester, | |
btc.stream, | |
btc.final_semester | |
FROM | |
batches btc | |
INNER JOIN | |
department dpt ON btc.deptID = dpt.deptID | |
INNER JOIN | |
semesters sem ON sem.semID = btc.semID WHERE 1=1 "; | |
if ($request) { | |
if ($request->id) { | |
$sql .= " AND btc.batchID = $request->id"; | |
} | |
if ($request->batchHide) { | |
$sql .= " AND btc.batchHide = $request->batchHide"; | |
} | |
if ($request->semId) { | |
$sql .= " AND btc.semID = $request->semId"; | |
} | |
if ($request->deptId) { | |
$sql .= " AND btc.deptID = $request->deptId"; | |
} | |
if ($request->groupId) { | |
$sql .= " AND btc.groups_id = '$request->groupId'"; | |
} | |
} | |
try { | |
return $this->executeQueryForObject($sql, FALSE, $this->mapper[BatchServiceMapper::GETBATCHDETAILSBYIDFORAPI]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get batches of a department | |
* @param $deptId | |
* @param boolean $includeFailedBatch | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByDeptId($deptId = null, $excludeFailedBatch = FALSE, $courseTypeId = NULL, $includePassout = FALSE, $isAdmission = 0, $batchStartYear = "") | |
{ | |
$batches = []; | |
$deptId = $this->realEscapeString($deptId); | |
$excludeFailedBatch = $this->realEscapeString($excludeFailedBatch); | |
$sql = "SELECT b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description, | |
b.batchStartYear as startYear, | |
b.batchEndYear as endYear, | |
b.batchCreateTime as createdDate, | |
b.semID as currentSemId,s.semName,d.deptName,b.batchHide,b.patterncourseID,b.subsideryID,b.campus_typeID,b.isPassOut,b.tcIssueDate,b.stream FROM batches b | |
INNER JOIN semesters s ON b.semID=s.semID | |
INNER JOIN department d ON b.deptID=d.deptID | |
WHERE 1=1 "; | |
if ($deptId) { | |
$sql .= " AND b.deptID IN ($deptId)"; | |
} | |
// if ($isAdmission) { | |
// $sql .= " AND is_admission=0"; | |
// } | |
/** | |
if ($includePassout) { | |
$sql .= " AND b.isPassOut=0"; | |
} | |
**/ | |
if ($excludeFailedBatch) { | |
$sql .= " AND batchName <> 'failed' "; | |
} | |
if ($courseTypeId) { | |
$sql .= " AND courseTypeID = '$courseTypeId' "; | |
} | |
if ($batchStartYear) { | |
$sql .= " AND batchStartYear = $batchStartYear"; | |
} | |
$sql .= " ORDER BY batchName"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* | |
* @param unknown $courseTypeId | |
* @param unknown $admsnStartYear | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchListByAdmsnYear($courseTypeId, $admsnStartYear) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$admsnStartYear = $this->realEscapeString($admsnStartYear); | |
$getBatchListByAdmsnYear = []; | |
$sql = "SELECT batchID as batchId, batchName, patterncourseID, deptID, semID FROM batches WHERE courseTypeID = $courseTypeId AND batchStartYear = $admsnStartYear"; | |
try { | |
$getBatchListByAdmsnYear = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $getBatchListByAdmsnYear; | |
} | |
/** | |
* | |
* @param int $batchId | |
* @return object $subbatch | |
* @throws ProfessionalException | |
*/ | |
public function getSubBatchesByBatchId($batchId) | |
{ | |
$subbatch = []; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "select sub.subbatchID as id, sub.subbatchName as name, sub.semID FROM subbatches sub INNER JOIN batches b ON b.batchID = sub.batchID AND b.semID=sub.semID WHERE sub.batchID=$batchId"; | |
try { | |
$subbatch = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subbatch; | |
} | |
/** | |
* get batch details by batch id | |
* @param int $batchId | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchById($batchId) | |
{ | |
$batch = NULL; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT batchID as id, | |
bth.batchName as name, | |
bth.batchDesc as description, | |
bth.batchStartYear as startYear, | |
bth.batchEndYear as endYear, | |
bth.batchCreateTime as createdDate, | |
bth.patternID as courseTypeId, | |
bth.studentShowField, | |
bct.type_code as typeCode, | |
bct.type_name as typeName, | |
bth.deptID, | |
bth.isPassOut, | |
bth.semID as currentSemId,studentSortBy, bth.tcIssueDate, bth.campus_typeID as campusTypeID, | |
bth.courseTypeID as courseType, bth.subsideryID,bth.patterncourseID,camp.name AS campusTypeName, | |
final_semester AS finalSemester, bth.batchOptionName,un.name as universityName,sem.semID as semId,sem.semName | |
FROM batches bth | |
LEFT JOIN semesters sem on sem.semID = bth.semID | |
LEFT JOIN batch_course_type bct ON bth.patternID = bct.id | |
LEFT JOIN campus_type camp ON camp.id = bth.campus_typeID | |
LEFT JOIN university un on un.id = bth.universityId | |
WHERE batchID = $batchId"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get batch details by batch id | |
* @param int $batchId | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchDetailsById($batchId) | |
{ | |
$batch = NULL; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT bth.batchID as id, | |
bth.batchName as name, | |
bth.batchDesc as description, | |
bth.batchStartYear as startYear, | |
bth.batchEndYear as endYear, | |
bth.batchCreateTime as createdDate, | |
bth.deptID as deptId, | |
bth.semID as currentSemId, | |
bth.courseTypeID, | |
bth.isPassOut, | |
bth.stream, | |
bth.final_semester AS finalSemster, | |
bth.batchOptionName, | |
sem.semName, | |
sem.orderNo, | |
sem.type, | |
dpt.departmentDesc, | |
dpt.deptName FROM batches bth LEFT JOIN department dpt ON dpt.deptID=bth.deptID LEFT JOIN semesters sem ON sem.semID=bth.semID WHERE batchID = '$batchId'"; | |
try { | |
$batch = $this->executeQueryForObject($sql, false, $this->mapper[BatchServiceMapper::GETBATCHDETAILSBYID]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get subbatch details by id | |
* @param int $subbatchId | |
* @return object|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSubBatchById($subbatchId) | |
{ | |
$subbatch = []; | |
$subbatchId = $this->realEscapeString($subbatchId); | |
$sql = "select sub.subbatchID as id, sub.subbatchName as name, b.batchName FROM subbatches sub INNER JOIN batches b ON b.batchID=sub.batchID WHERE subbatchID=$subbatchId"; | |
try { | |
$subbatch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subbatch; | |
} | |
/** | |
* get count of total number of students in a batch | |
* @param int $batchId | |
* @return int $count | |
* @throws ProfessionalException | |
*/ | |
public function getTotalNumberOfStudents($batchId) | |
{ | |
$count = 0; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "select count(studentID) as count from studentaccount WHERE batchID = $batchId"; | |
try { | |
$count = $this->executeQueryForObject($sql)->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $count; | |
} | |
/** | |
* get count of total number of students in a subbatch | |
* @param int $sbsId | |
* @return int $count | |
* @throws ProfessionalException | |
*/ | |
public function getTotalNumberOfStudentsInSubbatch($sbsId) | |
{ | |
$sbsId = $this->realEscapeString($sbsId); | |
$sql = "SELECT COUNT(sst.studentID) as count FROM subbatch_sbs sbs, subbatch_student sst WHERE sbs.sbsID= $sbsId AND sbs.subbatchID = sst.subbatchID"; | |
try { | |
$count = $this->executeQueryForObject($sql)->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $count; | |
} | |
/** | |
* get all course types | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchCourseType() | |
{ | |
$courseType = NULL; | |
$sql = "SELECT id,type_name FROM batch_course_type"; | |
try { | |
$courseType = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $courseType; | |
} | |
/** | |
* Get details of subbatch | |
* @param int $batchId | |
* @param int $semId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSubbatchDetails($batchId, $semId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
// $sql = "select distinct s.subbatchID,s.subbatchName from subbatches s inner join subbatch_sbs ss on s.subbatchID=ss.subbatchID inner join sbs_relation sr on ss.sbsID=sr.sbsID where sr.batchID=$batchId and sr.semID=$semId"; | |
$sql = "select | |
distinct sub.subbatchID, sub.subbatchName | |
from | |
subbatches sub inner join subbatch_sbs subs on | |
sub.subbatchID = subs.subbatchID join sbs_relation sr on | |
subs.sbsID = sr.sbsID | |
and sub.batchID = sr.batchID | |
and sub.semID = sr.semID | |
and sr.batchID = $batchId | |
and sr.semID =$semId"; | |
try { | |
$subbatchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subbatchDetails; | |
} | |
/** | |
* get subbatches of a subject | |
* @param int $subjectId | |
* @param int $semId | |
* @param int $batchId | |
* @param null $staffId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSubbatchBySubject($subjectId, $semId, $batchId, $staffId = NULL, $pseudoSubjectId = null) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$subjectId = $this->realEscapeString($subjectId); | |
$staffId = $this->realEscapeString($staffId); | |
$pseudoSubjectId = $this->realEscapeString($pseudoSubjectId); | |
$condition = ""; | |
if (!empty((int)$pseudoSubjectId)) { | |
$condition .= " and sub.psID = '$pseudoSubjectId' "; | |
} | |
if (!empty((int)$staffId)) { | |
$condition .= " AND sr.staffID = '$staffId'"; | |
} | |
$staffId=$_SESSION['staffID']; | |
$sql = "select distinct sub.subbatchID, sub.subbatchName, sr.sbsID from subbatches sub inner join subbatch_sbs subs on sub.subbatchID = subs.subbatchID inner join sbs_relation sr on subs.sbsID=sr.sbsID and sr.batchID='$batchId' and sr.subjectID='$subjectId' and sr.semID='$semId'" . $condition; | |
try { | |
$subbatches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subbatches; | |
} | |
/** | |
* Get Student count in a batch | |
* @param int $batchID | |
* @param string $joiningDate | |
* @return int $nof_students; | |
* @throws ProfessionalException | |
*/ | |
public function getBatchStudentCount($batchID, $joiningDate = "") | |
{ | |
$nof_students = 0; | |
$batchID = $this->realEscapeString($batchID); | |
$joiningDate = $this->realEscapeString($joiningDate); | |
$sql = "SELECT COUNT(studentID) as studentCount FROM studentaccount WHERE batchID=\"$batchID\" "; | |
if ($joiningDate) { | |
$sql .= "AND studentJoindate <= '" . date('Y-m-d', strtotime($joiningDate)) . "'"; | |
} | |
try { | |
$nof_students = $this->executeQueryForObject($sql)->studentCount; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $nof_students; | |
} | |
/** | |
* Get batch details with tutor privilege to normalize | |
* @param int $deptId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
function getNormalizeTutorPrivilageBatch($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select batchName as name, batchStartYear as startYear, batchEndYear as endYear, ntp.batchId as privilegeBatch , bat.batchID,na.batchID as markPrivilegeBatch from batches bat left join normalize_tutor_privilege ntp on bat.batchID = ntp.batchID left join normalize_add_marks_privilege na on na.batchID = bat.batchID where bat.deptID = $deptId and bat.batchHide = 0 order by batchStartYear"; | |
try { | |
$batchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* Get batch details without tutor privilege to normalize | |
* @param int $deptId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getNormalizeTutorUnprivilegeBatch($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select bat.batchID from batches bat where bat.batchID not in (select ntp.batchID from normalize_tutor_privilege ntp where ntp.deptID = $deptId) and bat.deptID = $deptId"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* /** | |
* Method for getting failed batch Id | |
* @return int $failedBatchId | |
* @throws ProfessionalException | |
*/ | |
public function getFailedBatchId() | |
{ | |
$failedBatchId = 0; | |
$sql = "SELECT batchID FROM batches WHERE batchName='" . Batch::BATCH_FAILED_NAME . "'"; | |
try { | |
$failedBatchId = $this->executeQueryForObject($sql)->batchID; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $failedBatchId; | |
} | |
/** | |
* Get batchIDs of a department | |
* @param int $deptID | |
* @return string batchIDs | |
* @throws ProfessionalException | |
*/ | |
public function getBatchIDsByDeptID($deptID) | |
{ | |
$batchIDs = ""; | |
$sql = "SELECT GROUP_CONCAT(batchID) as batchIDs FROM batches where deptID=" . $this->realEscapeString($deptID) . ""; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch->batchIDs; | |
} | |
/** | |
* Get dates with timetable assigned between dates | |
* @param int $deptId | |
* @param int $batchId | |
* @param string $fromDate | |
* @param string $toDate | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getTimetableDates($deptId, $batchId, $fromDate, $toDate) | |
{ | |
$timetableDates[] = NULL; | |
if ($deptId != 0) { | |
if ($batchId != 0) { | |
$sqlCond = "AND batchID = " . $this->realEscapeString($batchId) . ""; | |
} else { | |
$sqlCond = "AND batchID IN(" . $this->getBatchIDsByDeptID($deptId) . ")"; | |
} | |
} | |
$sql = "SELECT DISTINCT(timetableDate) as date from batch_timetable where timetableDate >= '" . $this->realEscapeString($fromDate) . "' AND timetableDate <= '" . $this->realEscapeString($toDate) . "' $sqlCond ORDER BY date ASC"; | |
try { | |
$timetableDates = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $timetableDates; | |
} | |
/** | |
* Get staff privilege batches to add marks on autonormalize | |
* @param $deptId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getAddMarksPrivilegeBatches($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select batchId from normalize_add_marks_privilege where deptId = $deptId and addMarksHide = 1"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Get batches without staff privilege to add marks on autonormalize | |
* @param $deptId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getAddMarksUnPrivilegeBatches($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select batchID from batches where batchID not in (select batchID from normalize_add_marks_privilege where deptID = $deptId ) and deptID = $deptId"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Checks if the staff has privilege to add and round normalize marks | |
* @param $batchId | |
* @return bool | |
* @throws ProfessionalException | |
*/ | |
public function isHiddenAddMarksBatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "select batchId from normalize_add_marks_privilege where batchId = $batchId"; | |
try { | |
$batchId = $this->executeQueryForObject($sql)->batchId; | |
if ($batchId) { | |
return true; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return false; | |
} | |
/** | |
* get normalised marks by batch id | |
* @param int $batchId | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getAddMarksNormalizeByBatchId($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "select addMarksHide,roundOffHide,facultyNormalizeHide from normalize_add_marks_privilege where batchId = $batchId"; | |
try { | |
$hidemarksBatchDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $hidemarksBatchDetails; | |
} | |
/** | |
* Get batches where round off is hidden | |
* @param int $deptId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getRoundOffPrivilegedBatches($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select batchId from normalize_add_marks_privilege where deptId = $deptId and roundOffHide = 1"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Get CourseType details by course type id | |
* @param $id | |
* @return CourseType | |
* @throws ProfessionalException | |
*/ | |
public function getCourseTypeById($id) | |
{ | |
$courseType = NULL; | |
$sql = "SELECT id, | |
type_name as name, | |
is_pg as isPG, | |
type_code as code | |
FROM batch_course_type where id = $id;"; | |
try { | |
$courseType = $this->executeQueryForObject($sql);; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $courseType; | |
} | |
/** | |
* Get course type details | |
* @param int $courseTypeId | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getCourseTypeByTypeId($courseTypeId) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$sql = "select type_name,is_pg from batch_course_type where id = $courseTypeId"; | |
try { | |
$courseDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $courseDetails; | |
} | |
/** | |
* Get batches where subject wise deine rule is hidden | |
* @param int $deptId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getNormalizeSubjectWiseRuleBatches($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select batchId from normalize_add_marks_privilege where deptId = $deptId and facultyNormalizeHide = 1"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Returns true if course type assigned for all batches in the department | |
* @param int $deptId | |
* @return boolean | |
* @throws ProfessionalException | |
*/ | |
public function isCourseTyeDefined($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "SELECT distinct (patternID) from batches where deptID = $deptId"; | |
try { | |
$courseTypes = $this->executeQueryForList($sql); | |
foreach ($courseTypes as $courseType) { | |
if (!$courseType->patternID) { | |
return false; | |
} | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* Get course type unassigned batches | |
* @param int $deptId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getCourseTypeUnassignedBatches($deptId) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$sql = "select batchID,batchName from batches b inner join semesters s on b.semID = s.semID where ( patternID is null or patternID = 0 ) and batchHide=0 and semName !='" . Semester::COURSE_COMPLETED_SEM . "' and deptID = $deptId"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* get batches of a department | |
* @param int $batchCourseTypeId | |
* @return batch[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesBybatchCourseTypeId($batchCourseTypeId = 0) | |
{ | |
$batches = []; | |
$sql = "SELECT bch.batchID as id, | |
bch.batchName as name, | |
bch.batchDesc as description, | |
bch.batchStartYear as startYear, | |
bch.batchEndYear as endYear, | |
bch.batchCreateTime as createdDate, | |
bch.semID as currentSemId, bch.deptID as deptID FROM batches bch INNER JOIN batch_course_type bc ON bch.patternID = bc.id WHERE bch.batchName <> 'failed' "; | |
if ($batchCourseTypeId != 0) { | |
$sql .= "AND bc.id = $batchCourseTypeId "; | |
} | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* get batches of a department | |
* @param integer $courseTypeId | |
* @param integer $batchStartYear | |
* @return batch[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByCourseTypeId($courseTypeId, $batchStartYear, $deptId = null,$semId = null) | |
{ | |
$condition = null; | |
if ($deptId) { | |
$condition .= " AND deptId IN ( $deptId ) "; | |
} | |
if ($semId) { | |
$condition .= " AND semID IN ( $semId ) "; | |
} | |
$batches = []; | |
$sql = "SELECT batchID as id, batchName as name, batchDesc as description, batchStartYear as startYear, batchEndYear as endYear, batchCreateTime as createdDate, semID as currentSemId, deptID as deptID FROM batches WHERE batchName <> 'failed' AND courseTypeID IN ($courseTypeId) AND batchStartYear IN ($batchStartYear) $condition "; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Get class end date of a batch | |
* @param int $batchId | |
* @param int $semId | |
* @return string | |
* @throws ProfessionalException | |
*/ | |
public function getClassEndDate($batchId, $semId) | |
{ | |
$classEndDate = NULL; | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "SELECT classEnds FROM attendance_rules WHERE batchID=$batchId AND semID=$semId"; | |
try { | |
$classEndDate = $this->executeQueryForObject($sql)->classEnds; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $classEndDate; | |
} | |
/** | |
* Get start years of current batches | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getCurrentBatchStartYears($excludePassoutBatches = false) | |
{ | |
$batches = []; | |
$condition = ""; | |
if ($excludePassoutBatches) { | |
$condition = " AND isPassout = 0"; | |
} | |
$sql = "select distinct batchStartYear from batches where batchEndYear>=YEAR(CURDATE()) $condition ORDER BY batchStartYear DESC"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Get start years of current batches | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getPseudoCurrentBatchStartYears($excludePassoutBatches = false) | |
{ | |
$batches = []; | |
$condition = ""; | |
if ($excludePassoutBatches) { | |
$condition = " isPassout = 0"; | |
} | |
$sql = "SELECT distinct batchStartYear from batches where isPassout = 0 ORDER BY batchStartYear DESC"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Get start years of current batches | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getAllBatchStartYears() | |
{ | |
$batches = []; | |
$sql = "select distinct batchStartYear from batches WHERE batchStartYear IS NOT NULL ORDER BY batchStartYear DESC"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* check whether student in a subbatch or not | |
* @param int $subbatchId | |
* @param int $studentId | |
* @return boolean | |
* @throws ProfessionalException | |
*/ | |
public function isStudentInSubbatch($subbatchId, $studentId) | |
{ | |
$subbatchId = $this->realEscapeString($subbatchId); | |
$studentId = $this->realEscapeString($studentId); | |
$studentInSubbatch = false; | |
$sql = "select subbatchID from subbatch_student where subbatchID=$subbatchId AND studentID=$studentId"; | |
try { | |
$subbatch = $this->executeQueryForObject($sql); | |
if ($subbatch) { | |
$studentInSubbatch = true; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $studentInSubbatch; | |
} | |
/** | |
* get subbatch details by sbsId | |
* @param Timetable $timetable | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSubbatchDetailsBySbsId($timetable) | |
{ | |
$subbatchList = null; | |
$sql = "select distinct t1.subbatchID, t1.subbatchName, t3.sbsID from subbatches t1, subbatch_sbs t2, sbs_relation t3 where t2.sbsID=t3.sbsID and t3.staffID=$timetable->staffID and t3.batchID=$timetable->batchID and t3.subjectID=$timetable->subjectID and t3.semID=$timetable->semID and t2.subbatchID=t1.subbatchID AND t3.semID=t1.semID AND t1.batchID=t3.batchID and t3.sbsID = $timetable->sbsID"; | |
try { | |
$subbatchList = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $subbatchList; | |
} | |
/** | |
* get student subbatch by semester wise | |
* @param int $studentId | |
* @param int $semId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSubbatchDetailsByStudentId($studentId, $semId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "select sbt.subbatchID, sbt.subbatchName, sbt.description from subbatches sbt INNER JOIN studentaccount sa ON sbt.batchID=sa.batchID INNER JOIN subbatch_student ss ON ss.subbatchID=sbt.subbatchID AND ss.studentID=sa.studentID WHERE sa.studentID='$studentId' AND sbt.semID='$semId'"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get course type id by code | |
* @param string $code | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getCourseTypeIdByCode($code) | |
{ | |
$courseType = null; | |
$sql = "SELECT id | |
FROM batch_course_type where type_code = '$code'"; | |
try { | |
$courseType = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException(ProfessionalException::QUERY_EXECUTION_FAILED, $e->getMessage()); | |
} | |
return $courseType; | |
} | |
/** | |
* Get subbatches by staffId,batchId,subjectId and semId | |
* @param int $batchId | |
* @param int $subjectId | |
* @param int $semId | |
* @param int $staffId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getSubbatchBystaffIdAndSubjectId($batchId, $subjectId, $semId, $staffId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$subjectId = $this->realEscapeString($subjectId); | |
$semId = $this->realEscapeString($semId); | |
$staffId = $this->realEscapeString($staffId); | |
$subbatches = []; | |
$sql = "select distinct t1.subbatchID, t1.subbatchName, t3.sbsID from subbatches t1, subbatch_sbs t2, sbs_relation t3 where t2.sbsID=t3.sbsID and t3.staffID=$staffId and t3.batchID=$batchId and t3.subjectID=$subjectId and t3.semID=$semId and t2.subbatchID=t1.subbatchID"; | |
try { | |
return $this->executeQueryForList($sql, FALSE, $this->mapper[BatchServiceMapper::GETSUBBATCHBYSTAFFANDSUBJECT]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get Batch Details by student admissionNo | |
* @param $admissionNo | |
* @param int $batchId | |
* @return Batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchDetailsByAdmissionNo($admissionNo) | |
{ | |
$batch = null; | |
$admissionNo = $this->realEscapeString($admissionNo); | |
$sql = "select distinct b.* from studentaccount sa inner join batches b on b.batchID = sa.batchID WHERE sa.admissionNo= '$admissionNo'"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get batches using parameters course type and admission year | |
* @param int $courseTypeId | |
* @param int $batchStartYear | |
* @return BatchList | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByCourseTypeAndBatchStartYear($courseTypeId, $batchStartYear) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$query = "SELECT b.batchID AS batchId,b.batchName,s.semID AS semesterId,s.semName AS semesterName,d.deptID AS departmentId,d.deptName AS departmentName FROM batches b INNER JOIN semesters s ON b.semID=s.semID INNER JOIN department d ON b.deptID=d.deptID WHERE b.courseTypeID='$courseTypeId' AND batchStartYear='$batchStartYear'"; | |
try { | |
$response = $this->executeQueryForList($query); | |
return $response; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get count of students in a sem of a batch | |
* @param int $batchId | |
* @param int $semId | |
* @return unknown | |
* @throws ProfessionalException | |
*/ | |
public function getTotalStudentsInABatch($batchId, $semId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$semDetails = SemesterService::getInstance()->getSemDetailsBySemId($semId); | |
if ($isCurrentSem) { | |
$sql = "select count(sa.studentID) as count from studentaccount sa inner join department dep on dep.deptID = sa.deptID inner join batches ba on ba.batchID = sa.batchID inner join semesters sem on sem.semID = ba.semID inner join semesters joinedSem on sa.joiningSemId = joinedSem.semID where sa.batchID=$batchID and joinedSem.orderNo <= sem.orderNo ORDER BY sa.rollNo"; | |
} else { | |
$semDetails = SemesterService::getInstance()->getSemDetailsBySemId($semId); | |
$sql = "select count(studentID) as count from ( select sa.studentID from studentaccount sa inner join batches ba on sa.batchID = ba.batchID inner join semesters joinedSem on sa.joiningSemId = joinedSem.semID where ba.batchID = " . $batchId . " and joinedSem.orderNo <= " . $semDetails->orderNo . " union select sa.studentID from failed_students fs left join studentaccount sa on fs.studentID= sa.studentID inner join semesters fsem on fsem.semID = fs.failedInSemester inner join semesters joinedSem on sa.joiningSemId = joinedSem.semID where previousBatch = " . $batchId . " and fsem.orderNo > " . $semDetails->orderNo . " and joinedSem.orderNo <= " . $semDetails->orderNo . " ) as students "; | |
} | |
try { | |
return $this->executeQueryForObject($sql)->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* create subbatches | |
* @param Subbatch $subbatch | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function createSubbatches($subbatch) | |
{ | |
$subbatch = $this->realEscapeObject($subbatch); | |
$sql = "insert into subbatches(subbatchName,description,batchID,semID,psID) values ('" . $subbatch->subbatchName . "','" . $subbatch->description . "',$subbatch->batchId, $subbatch->semId, $subbatch->psId)"; | |
try { | |
return $this->executeQueryForObject($sql, true); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Create subbatch sbs | |
* @param int $subbatchId | |
* @param int $sbsId | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @throws ProfessionalException | |
*/ | |
public function createSubbatchSBS($subbatchId, $sbsId) | |
{ | |
$subbatchId = $this->realEscapeString($subbatchId); | |
$sbsId = $this->realEscapeString($sbsId); | |
$sql = "insert into subbatch_sbs(subbatchID,sbsID) values (" . $subbatchId . ", " . $sbsId . ")"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Create subbatch students | |
* @param int $subbatchId | |
* @param unknown $studentIds | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @throws ProfessionalException | |
*/ | |
public function createSubbatchStudent($subbatchId, $studentIds) | |
{ | |
$subbatchId = $this->realEscapeString($subbatchId); | |
$studentIds = $this->realEscapeArray($studentIds); | |
foreach ($studentIds as $studentId) { | |
$values[] = "(" . $subbatchId . ", " . $studentId . ")"; | |
} | |
$sqlValues = implode(", ", $values); | |
$sql = "insert into subbatch_student(subbatchID, studentID) values " . $sqlValues; | |
try { | |
return $this->executeQueryForObject($sql, true); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Finalize psuedosubject subbatches | |
* @param int $psId | |
* @return boolean | |
* @throws ProfessionalException | |
* @throws ProfessionalException | |
*/ | |
public function finalizePseudoSubjectSubbatches($psId) | |
{ | |
$psId = (int)$this->realEscapeString($psId); | |
try { | |
$studentList = StudentService::getInstance()->getStudentsAssignedToApseudoSub($psId); | |
$staffList = StaffService::getInstance()->getStaffDetailsAssignedToPseudoSub($psId); | |
$studentBatches = []; | |
foreach ($studentList as $student) { | |
if (!in_array($student->batchID, $studentBatches)) | |
$studentBatches[] = $student->batchID; | |
} | |
$staffBatches = []; | |
foreach ($staffList as $staff) { | |
if (!in_array($staff->batchID, $staffBatches)) | |
$staffBatches[] = $staff->batchID; | |
} | |
if (array_diff($studentBatches, $staffBatches)) | |
throw new ProfessionalException("DIFFERENCE_IN_BATCHES", "Please assign staffs to all "); | |
if (array_diff($staffBatches, $studentBatches)) | |
throw new ProfessionalException("DIFFERENCE_IN_BATCHES", "Please assign students"); | |
$batchId = 0; | |
foreach ($staffList as $staff) { | |
if ($batchId != $staff->batchID) { | |
$sql = "SELECT subbatchID,batchID | |
FROM subbatches WHERE psID = $psId AND batchID = $staff->batchID AND semID = $staff->semID"; | |
$subBatches = $this->executeQueryForObject($sql); | |
if (empty($subBatches)) { | |
// create subbatch | |
$subbatch = new Subbatch(); | |
$subbatch->subbatchName = $staff->batchName . "-" . $staff->subjectName; | |
$subbatch->description = $staff->batchName . "-" . $staff->subjectName; | |
$subbatch->batchId = $staff->batchID; | |
$subbatch->semId = $staff->semID; | |
$subbatch->psId = $psId; | |
$subbatchId = $this->createSubbatches($subbatch); | |
} else { | |
$subbatchId = $subBatches->subbatchID; | |
} | |
// check if subbatch_sbs assigned | |
$sql = "SELECT subbatchID FROM subbatch_sbs ssbs | |
INNER JOIN sbs_relation sr ON sr.sbsID = ssbs.sbsID | |
WHERE sr.sbsID = " . $staff->sbsID . " AND subbatchID = " . $subbatchId; | |
// else | |
if (empty($this->executeQueryForObject($sql))) { | |
// create sbs | |
$this->createSubbatchSBS($subbatchId, $staff->sbsID); | |
} | |
$sqlStudents = "SELECT pss.pseudosubjectID, pss.studentID, sa.batchID | |
FROM pseudosubjects_students pss | |
INNER JOIN studentaccount sa ON pss.studentID = sa.studentID | |
INNER JOIN subbatches sub ON sub.psID = pss.pseudoSubjectID AND sa.batchID = sub.batchID | |
LEFT JOIN subbatch_student ss ON ss.studentID = pss.studentID | |
AND ss.subbatchID = sub.subbatchID | |
WHERE pss.pseudoSubjectID = $psId AND sub.subbatchID = $subbatchId AND ss.studentID is null;"; | |
// get pseudosubj students by batchId | |
$students = $this->executeQueryForList($sqlStudents); | |
foreach ($students as $student) { | |
$studentIds[] = $student->studentID; | |
} | |
if (!empty($studentIds)) { | |
// subbatch_students | |
$this->createSubbatchStudent($subbatchId, $studentIds); | |
} | |
$sql = "DELETE FROM subbatch_student | |
WHERE studentID NOT IN ( | |
SELECT pss.studentID FROM pseudosubjects_students pss | |
INNER JOIN subbatches sub ON pss.pseudosubjectID = sub.psId | |
WHERE subbatchID = " . $subbatchId . " | |
) AND subbatchID = " . $subbatchId; | |
$this->executeQuery($sql); | |
$batchId = $staff->batchID; | |
} else { | |
$this->createSubbatchSBS($subbatchId, $staff->sbsID); | |
} | |
unset($studentIds); | |
} | |
SubjectService::getInstance()->updateFinalizePsuedoSubject($psId, 1); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* Method fro getting batchName with courseTypeId batchStartYear and semId | |
* @input $semId, $batchStartYear, $courseTypeId | |
* @param $courseTypeId | |
* @param $batchStartYear | |
* @param null $semId | |
* @return array|Object | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getBatchDetailsByCourseTypeIdBatchStartYearAndsemId($courseTypeId, $batchStartYear, $semId = null, $showAdmissionBatches = false) | |
{ | |
$batchDetails = []; | |
$condition = null; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$semId = $this->realEscapeString($semId); | |
if ($semId) { | |
$condition .= " AND b.semID = " . $semId . " "; | |
} | |
// if (!$showAdmissionBatches) { | |
// $condition .= " AND b.is_admission = 0 "; | |
// } | |
try { | |
$sql = "SELECT b.batchID as batchId, b.batchName as batchName FROM batches b WHERE b.courseTypeID = " . $courseTypeId . " AND b.batchStartYear = '" . $batchStartYear . "' " . $condition . ""; | |
$batchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* Method for getting current semester for an admissionYear and courseTypeId | |
* @param Int $admissionYear | |
* @param Int $courseTypeId | |
* @return current sem | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getCurrentSem($admissionYear, $courseTypeId) | |
{ | |
$sql = ''; | |
$admissionYear = $this->realEscapeString($admissionYear); | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$currentSem = null; | |
try { | |
$sql = "SELECT semID AS currentSemId FROM batches WHERE batchStartYear = " . $admissionYear . " AND courseTypeID = " . $courseTypeId . ""; | |
error_log($sql); | |
$currentSem = $this->executeQueryForObject($sql)->currentSemId; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $currentSem; | |
} | |
/** | |
* @param $batchId | |
* @return int | |
* @throws ProfessionalException | |
*/ | |
public function getCurrentSemesterByBatchId($batchId) | |
{ | |
if (empty($batchId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_BATCH_ID, "Invalid batch details given"); | |
} | |
$sql = "SELECT semID as currentSemester FROM batches WHERE batchID =$batchId"; | |
try { | |
return $this->executeQueryForObject($sql)->currentSemester; | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Method for promoting a batch from one semester to another semester | |
* @param integer $batchId | |
* @param integer $currentSemId | |
* @param integer $promoteSemId | |
* @param integer $isPassOut | |
* @param integer $courseTypeId | |
* @return array | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function promoteBatchSemester($batchId, $currentSemId, $promoteSemId, $isPassOut, $courseTypeId, $isFailedCheck, $date) | |
{ | |
$sql = ''; | |
$currentSemId = $this->realEscapeString($currentSemId); | |
$batchId = $this->realEscapeString($batchId); | |
$promoteSemId = $this->realEscapeString($promoteSemId); | |
$isPassOut = $this->realEscapeString($isPassOut); | |
$isFailedCheck = $this->realEscapeString($isFailedCheck); | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$adminId = $_SESSION['adminID']; | |
$fullStudents = []; | |
$examRegId = null; | |
$isStudentRegistered = null; | |
$studentsNotRegistered = []; | |
$prevSemesters = []; | |
$semIDArr = []; | |
$semIDArrSTR = null; | |
$studentAlreadyExist = null; | |
if ($isFailedCheck == 1) { | |
try { | |
$sql = "SELECT batchID AS batchId FROM batches WHERE batchName = 'failed'"; | |
$failedBatchId = $this->executeQueryForObject($sql)->batchId; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
try { | |
$sql = "SELECT sa.studentID AS studentId FROM studentaccount sa INNER JOIN batches b ON b.batchID = sa.batchID WHERE b.batchID = " . $batchId . ""; | |
$fullStudents = $this->executeQueryForList($sql); | |
$error = 0; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
$error = 1; | |
} | |
try { | |
$sql = "SELECT erb.examregID AS examRegId FROM exam_registration_batches erb INNER JOIN exam_registration er ON erb.examregID = er.examregID WHERE erb.batchID = $batchId AND erb.semID = $currentSemId AND er.shortCourse = 0"; | |
$examRegId = $this->executeQueryForObject($sql)->examRegId; | |
$error = 0; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
$error = 1; | |
} | |
if ($examRegId) { | |
foreach ($fullStudents as $studentList) { | |
$studentId = $studentList->studentId; | |
try { | |
$sql = "SELECT studentID FROM exam_reg_studentsubject WHERE studentID = $studentId AND examregID = $examRegId"; | |
$isStudentRegistered = $this->executeQueryForList($sql); | |
$error = 0; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
$error = 1; | |
} | |
if (count($isStudentRegistered) == 0) { | |
array_push($studentsNotRegistered, $studentId); | |
} | |
} | |
} | |
if (count($studentsNotRegistered)) { | |
try { | |
$semIDArrSTR = SemesterService::getInstance()->getPreviousSemsters($currentSemId); | |
$error = 0; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
$error = 1; | |
} | |
foreach ($studentsNotRegistered as $notStudents) { | |
$failedStudentId = $notStudents; | |
try { | |
$sql = "SELECT studentID AS studentId FROM failed_students WHERE studentID = $failedStudentId AND previousBatch = $batchId AND failedInSemester = $currentSemId"; | |
$studentAlreadyExist = $this->executeQueryForObject($sql)->studentId; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
if ($studentAlreadyExist) { | |
} else { | |
$studentDetails = StudentService::getInstance()->getStudentDetailsById($failedStudentId); | |
try { | |
$sql = "INSERT INTO failed_students (studentID,previousBatch,failedInSemester,hisSemestersInThisbatch,isFailNow,failedDate,updated_by,userType) VALUES ($failedStudentId,$batchId,$currentSemId,'$semIDArrSTR','1','$date','$adminId','ADMIN')"; | |
$result = $this->executeQuery($sql); | |
$error = 0; | |
if ($result) { //create log | |
$amsLog = new AmsLog(); | |
$amsLog->type = AmsLogConstants::STUDENT_ENTITY_UPDATE; | |
$amsLog->name = AmsLogConstants::STUDENT_FAILED; | |
$amsLog->columnName = "batchID"; | |
$amsLog->fromValue = $batchId; | |
$amsLog->toValue = 1; | |
$amsLog->entityID = $failedStudentId; | |
$amsLog->entityName = $studentDetails->name; | |
$amsLog->message = "Student Moved to failed_students during semester promotion"; | |
$amsLog->time = date("d-m-Y h:i:s A"); | |
$createAmsLog = AmsLogService::getInstance()->createAmsLog($amsLog); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
$error = 1; | |
} | |
try { | |
$sql = "UPDATE studentaccount SET batchID = $failedBatchId WHERE studentID = $failedStudentId"; | |
$result = $this->executeQuery($sql); | |
if ($result) { //create log | |
$amsLog = new AmsLog(); | |
$amsLog->type = AmsLogConstants::STUDENT_ENTITY_UPDATE; | |
$amsLog->name = AmsLogConstants::STUDENT_BATCH_UPDATE; | |
$amsLog->columnName = "batchID"; | |
$amsLog->fromValue = $studentDetails->batchID; | |
$amsLog->toValue = $failedBatchId; | |
$amsLog->entityID = $failedStudentId; | |
$amsLog->entityName = $studentDetails->name; | |
$amsLog->message = "Student Batch Updated to failed BatchID during semester promotion"; | |
$amsLog->time = date("d-m-Y h:i:s A"); | |
$createAmsLog = AmsLogService::getInstance()->createAmsLog($amsLog); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
} | |
} | |
} | |
try { | |
$sql = "UPDATE batches SET semID = $promoteSemId , isPassOut = $isPassOut WHERE batchID = $batchId AND semID = $currentSemId AND courseTypeID = $courseTypeId"; | |
$result = $this->executeQuery($sql); | |
$error = 0; | |
if ($result) { //create log | |
$amsLog = new AmsLog(); | |
$amsLog->type = AmsLogConstants::BATCH_UPDATE; | |
$amsLog->name = AmsLogConstants::BATCH_SEMESTER_PROMOTION; | |
$amsLog->columnName = "semID"; | |
$amsLog->fromValue = $currentSemId; | |
$amsLog->toValue = $promoteSemId; | |
$amsLog->entityID = $batchId; | |
$amsLog->message = "Semester of batch having batchID=" . $batchId . " was updated for semester promotion"; | |
$amsLog->time = date("d-m-Y h:i:s A"); | |
$createAmsLog = AmsLogService::getInstance()->createAmsLog($amsLog); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
$error = 1; | |
} | |
if ($error == 0) { | |
return $studentsNotRegistered; | |
} | |
} | |
public function getAllTcIssuedDates() | |
{ | |
$TCIssuedDates = []; | |
try { | |
$sql = "SELECT b.tcIssueDate as tcIssueDate, ct.typeName as typeName, s.semName as semName FROM batches b INNER JOIN course_type ct ON b.courseTypeID = ct.courseTypeID INNER JOIN semesters s ON s.semID = b.semID GROUP BY ct.courseTypeID, s.semID"; | |
$TCIssuedDates = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $TCIssuedDates; | |
} | |
/** | |
* Method for adding tc issue date for all batches | |
* | |
* @param int $courseTypeId | |
* @param int $semId | |
* @param int $tcDate | |
* @throws ProfessionalException | |
* @author Vishnu M | |
* | |
*/ | |
public function addTcDate($courseTypeId, $semId, $tcDate) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$semId = $this->realEscapeString($semId); | |
$tcDate = $this->realEscapeString($tcDate); | |
$sql = "UPDATE batches SET tcIssueDate = '" . $tcDate . "' WHERE courseTypeID = " . $courseTypeId . " AND semID = " . $semId . ""; | |
error_log($sql); | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param unknown $departmentId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author sujesh | |
*/ | |
public function getBatchesByDepartmentIdWithoutPassoutBatches($departmentId) | |
{ | |
$batchObjectArray = null; | |
$sql = ""; | |
$departmentId = $this->realEscapeString($departmentId); | |
try { | |
$sql = "SELECT b.batchID, | |
b.batchName, | |
b.semID, | |
b.isPassOut, | |
b.batchDesc | |
from batches b | |
inner join course_type ct on ct.courseTypeID = b.courseTypeID | |
where b.deptID='$departmentId' and | |
b.isPassOut = 0 and | |
ct.courseTypeID in (SELECT courseTypeID FROM course_type)"; | |
$batchObjectArray = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException (ProfessionalException::QUERY_EXECUTION_FAILED, $e->getMessage()); | |
} | |
return $batchObjectArray; | |
} | |
public function getBatchesByDepartmentIdAndStartYearWithoutPassoutBatches($request) | |
{ | |
$batchObjectArray = null; | |
$sql = ""; | |
try { | |
$hasCourseTypeId = $request->courseTypeId? "and ct.courseTypeID in (SELECT courseTypeID from course_type ct where courseTypeID = $request->courseTypeId )":""; | |
$isPassOut = $request->includePassedOut=="1"?"":"and b.isPassOut = 0 "; | |
$sql = "SELECT b.batchID,b.batchName,b.semID,b.isPassOut,b.batchDesc from batches b inner join course_type ct on ct.courseTypeID = b.courseTypeID where b.deptID='$request->departmentId' $isPassOut and b.batchStartYear='$request->batchStartYear' $hasCourseTypeId"; | |
$batchObjectArray = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException (ProfessionalException::QUERY_EXECUTION_FAILED, $e->getMessage()); | |
} | |
return $batchObjectArray; | |
} | |
/** | |
* Get all details of a batch by batchId | |
* @param int $batchId | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchDetails($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT bth.batchID as id, | |
bth.batchName as name, | |
bth.batchDesc as description, | |
bth.batchStartYear as startYear, | |
bth.batchOptionName as batchOptionName, | |
bth.batchEndYear as endYear, | |
bth.batchCreateTime as createdDate, | |
bth.deptID as deptId, | |
bth.semID as currentSemId, | |
sem.semName, | |
sem.orderNo, | |
bth.patternID, patternName, patternDesc, bth.courseTypeID, ct.typeName as courseTypeName, campus_typeID, cpt.name as campusTypeName, bth.patterncourseID, pdc.patterncourseName, pdc.patterncourseCode,pdc.patternAbbreviation, universityId, un.name as university, | |
dpt.deptName, dpt.departmentDesc, bth.final_semester AS finalSem, ct.course_Type AS courseType ,dpt.departmentSpecialization,pdc.patterncourseID as patternCourseId,ct.courseTypeFlag,bth.stream,pdc.externalCourseName FROM batches bth INNER JOIN department dpt ON dpt.deptID=bth.deptID INNER JOIN semesters sem ON sem.semID=bth.semID left join course_pattern cp on cp.patternID = bth.patternID left join course_type ct on ct.courseTypeID = bth.courseTypeID left join campus_type cpt on cpt.id = bth.campus_typeID left join pattern_deptcourses pdc on pdc.patterncourseID = bth.patterncourseID left join university un on un.id = bth.universityId WHERE batchID = " . $batchId . ""; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting batch details by courseTypeId and semId | |
* @param unknown $courseTypeId | |
* @param unknown $semId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function getBatchByCourseTypeIdAndSemId($courseTypeId, $semId) | |
{ | |
$sql = ''; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$semId = $this->realEscapeString($semId); | |
$batchDetails = []; | |
try { | |
$sql = "SELECT batchID AS batchId, batchName FROM batches WHERE courseTypeID = " . $courseTypeId . " AND semID = " . $semId . ""; | |
$batchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* WIP | |
* Method for getting pattern course name and subsidery course name for a batch | |
* @param int $batchId | |
* @return Object|null $patternCourseDetails | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getBatchPatternCourseDetails($batchId) | |
{ | |
$sql = ''; | |
$batchId = $this->realEscapeString($batchId); | |
$patternCourseDetails = null; | |
$sql = "SELECT pdc.patterncourseID AS patternCourseId, pdc.patterncourseName AS patternCourseName, sc.subsiderycoursename AS subsideryCourseName, | |
pdc.patterncourseCode as patternCourseCode, pdc.extraSettings,pdc.patternAbbreviation FROM batches b LEFT JOIN pattern_deptcourses pdc ON b.patterncourseID = pdc.patterncourseID LEFT JOIN subsiderycourse sc ON sc.pattern_deptcourses_id = pdc.patterncourseID WHERE b.batchID = " . $batchId . ""; | |
try { | |
$patternCourseDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $patternCourseDetails; | |
} | |
/** | |
* Get pseudo subject details | |
* @param unknown $psId | |
* @param unknown $staffId | |
* @return unknown | |
* @throws ProfessionalException | |
*/ | |
public function getPseudoSubjSubbatchesById($psId, $staffId) | |
{ | |
$psId = $this->realEscapeString($psId); | |
$staffId = $this->realEscapeString($staffId); | |
$sql = "select | |
ps.pseudosubjectID, sr.batchID, sr.semID, psbs.sbsID, sr.staffID, subbatchID | |
from sbs_relation sr | |
inner join batches ba on sr.batchID = ba.batchID | |
inner join pseudosubjects_sbs psbs on psbs.sbsID = sr.sbsID | |
inner join pseudosubjects ps on ps.pseudosubjectID = psbs.pseudosubjectID | |
inner join subbatches subb on subb.psId = ps.pseudosubjectID and subb.batchID = sr.batchID and subb.semID = sr.semID | |
where | |
ps.pseudosubjectID = " . $psId . " and isFinalized = 1 and sr.staffID =" . $staffId . " ORDER BY ba.batchName"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* list individual supply round off configuration | |
* @param int $courseTypeId | |
* @param int $admissionYear | |
* @param int $semId | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function listSupplyRoundOffConfigIndividual($courseTypeId, $admissionYear, $semId) | |
{ | |
$sql = ''; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$admissionYear = $this->realEscapeString($admissionYear); | |
$semId = $this->realEscapeString($semId); | |
$configList = null; | |
try { | |
$sql = "SELECT * FROM supplyMarkRoundOffConfig WHERE courseTypeId = $courseTypeId AND batchStartYear = $admissionYear AND semId = $semId"; | |
$configList = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $configList; | |
} | |
/** | |
* Method to know whether this batch is a UG or PG | |
* | |
* @param int $batchId | |
* @return |null |null | |
* @throws ProfessionalException | |
*/ | |
public function knowCourseType($batchId) | |
{ | |
$extval = null; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT ct.extval_required as extval FROM course_type | |
ct inner join batches b WHERE ct.courseTypeID = b.courseTypeID AND b.batchID = " . $batchId . ""; | |
try { | |
$extval = $this->executeQueryForObject($sql)->extval; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $extval; | |
} | |
/** | |
* Method for getting course type of a batch | |
* | |
* @param int $batchId | |
* @return String | |
* @throws ProfessionalException | |
*/ | |
public function getCourseTypeByBatchId($batchId) | |
{ | |
$type = null; | |
$sql = "SELECT ct.course_Type as type FROM course_type | |
ct inner join batches b WHERE ct.courseTypeID = b.courseTypeID AND b.batchID = " . $batchId . ""; | |
try { | |
$type = $this->executeQueryForObject($sql)->type; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $type; | |
} | |
/** | |
* method to check if second language is active for a batch | |
* | |
* @param integer $batchId | |
* @return void | |
* @throws ProfessionalException | |
*/ | |
public function checkIfSecondLanguageValidForABatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
if (empty($batchId)) { | |
return 1; | |
} | |
$sql = "SELECT t2.sec_lang from batches t1, course_type t2 where t2.courseTypeID=t1.courseTypeID and t1.batchID=" . $batchId; | |
try { | |
$result = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
$enableSecondLangOption = CommonService::getInstance()->getSettings(SettingsConstants::ADMIN,SettingsConstants::ENABLE_SECOND_LANG_OPTION_IN_STUDENT); | |
if (!empty($result) && (PermissionToggle::isEnabled("EXAMCONTROLLER") || $enableSecondLangOption)) { | |
return $result->sec_lang; | |
} else { | |
return null; | |
} | |
} | |
/** | |
* show students and internalmarks or normalized marks | |
* @param int $batchID | |
* @param int $subbatchID | |
* @param int $import | |
* @param int $subjectID | |
* @param int $semId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author Aswin | |
*/ | |
public function showSubbatchStudentsInternalMarks($batchID, $subbatchID, $import, $subjectID, $semId) | |
{ | |
$semId = $this->realEscapeString($semId); | |
$batchID = $this->realEscapeString($batchID); | |
$subbatchID = $this->realEscapeString($subbatchID); | |
$import = $this->realEscapeString($import); | |
$subjectID = $this->realEscapeString($subjectID); | |
if ($subbatchID != 0) { | |
if (!$import) { | |
$query = "SELECT sa.studentID, sa.rollNo, sa.regNo, sa.studentName, im.internalMarks as mark FROM studentaccount sa | |
INNER JOIN subbatch_student ss ON sa.studentID = ss.studentID LEFT JOIN | |
internal_marks im ON sa.batchID = im.batchID | |
AND sa.studentID = im.studentID AND im.subjectID = $subjectID AND im.semID = $semId | |
WHERE sa.batchID = $batchID AND ss.subbatchID = $subbatchID ORDER BY sa.regNo"; | |
} else if ($import == 1) { | |
$query = "SELECT sa.studentID, sa.rollNo, sa.regNo, sa.studentName, nm.normalisedMark as mark FROM | |
studentaccount sa INNER JOIN subbatch_student ss ON sa.studentID = ss.studentID | |
LEFT JOIN normalise_marks nm ON sa.batchID = nm.batchID AND sa.studentID = nm.studentID | |
AND nm.subjectID = $subjectID AND nm.semID = $semId WHERE sa.batchID = $batchID AND ss.subbatchID = $subbatchID ORDER BY sa.regNo"; | |
} | |
} else { | |
if (!$import) { | |
$query = "SELECT sa.studentID, sa.rollNo, sa.regNo, sa.studentName, im.internalMarks as mark FROM studentaccount sa LEFT JOIN internal_marks im ON sa.batchID = im.batchID AND sa.studentID = im.studentID AND im.subjectID = $subjectID AND im.semID = $semId WHERE sa.batchID = $batchID ORDER BY sa.regNo"; | |
} else if ($import == 1) { | |
$query = "SELECT sa.studentID, sa.rollNo, sa.regNo, sa.studentName, nm.normalisedMark as mark FROM | |
studentaccount sa | |
LEFT JOIN normalise_marks nm ON sa.batchID = nm.batchID AND sa.studentID = nm.studentID | |
AND nm.subjectID = $subjectID AND nm.semID = $semId WHERE sa.batchID = $batchID ORDER BY sa.regNo"; | |
} | |
} | |
try { | |
$response = $this->executeQueryForList($query); | |
return $response; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get all batches controlled by an hod | |
* @param integer $staffId | |
* @param integer $deptId | |
* @param bool $includeFailedBatch | |
* @return \com\linways\base\connection\Object | |
* @throws ProfessionalException | |
*/ | |
public function getHODBatchesByStaffId($staffId, $deptId, $includeFailedBatch = FALSE) | |
{ | |
$batches = []; | |
$staffId = $this->realEscapeString($staffId); | |
$deptId = $this->realEscapeString($deptId); | |
$sqlHodPref = "SELECT batchIDs FROM hodPrivileges where staffID = " . $staffId . ""; | |
$hodPrefBatches = $this->executeQueryForList($sqlHodPref); | |
if ($hodPrefBatches != NULL) { | |
foreach ($hodPrefBatches as $hodPrefBatch) { | |
$prefBatches .= ($hodPrefBatch->batchIDs) . ','; | |
} | |
$prefBatches = substr($prefBatches, 0, -1); | |
} | |
if ($prefBatches) { | |
$sqlCond = "(deptID = $deptId OR batchID in (" . $prefBatches . "))"; | |
} else { | |
$sqlCond = "deptID = $deptId"; | |
} | |
$sql = "SELECT batchID as id, | |
batchName as name, | |
batchDesc as description, | |
batchStartYear as startYear, | |
batchEndYear as endYear, | |
batchCreateTime as createdDate, | |
semID as currentSemId FROM batches WHERE $sqlCond "; | |
if ($includeFailedBatch) { | |
$sql .= " AND batchName <> 'failed' "; | |
} | |
$sql .= " ORDER BY batchName"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* Get HOD privileged batchIds and semIds | |
* @param int $staffId | |
* @return array[] | |
* @throws ProfessionalException | |
*/ | |
public function getHODPrivilegedBatchIdsAndSemIds($staffId) | |
{ | |
$staffId = $this->realEscapeString($staffId); | |
$sql = "SELECT * FROM hodPrivileges WHERE staffID = " . $staffId; | |
try { | |
$privilegedBatches = $this->executeQueryForList($sql); | |
if (!empty($privilegedBatches)) { | |
foreach ($privilegedBatches as $privilege) { | |
$batchId = $batchId . $privilege->batchIDs . ","; | |
$semId = $semId . $privilege->semIDs . ","; | |
} | |
$batchIds = explode(",", trim($batchId, ",")); | |
$semIds = explode(",", trim($semId, ",")); | |
return ["batchIds" => $batchIds, "semIds" => $semIds]; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return; | |
} | |
/** | |
* Service to get sort by column for a batch | |
* | |
* | |
* @param [type] $batchId | |
* @return void | |
*/ | |
public function getStudentSortByColumnOfABatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = ""; | |
$sql = "SELECT studentSortBy FROM batches WHERE batchID = $batchId"; | |
try { | |
$sortByColumn = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
if (empty($sortByColumn)) { | |
return 'rollNo'; | |
} | |
if (empty(trim($sortByColumn->studentSortBy))) { | |
return 'rollNo'; | |
} | |
return $sortByColumn->studentSortBy; | |
} | |
/** | |
* get batch details by batch id | |
* @param $batchCode | |
* @param $deptCode | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchByBatchCodeAndDeptCode($batchCode, $deptCode) | |
{ | |
$batch = NULL; | |
$batchCode = $this->realEscapeString($batchCode); | |
$deptCode = $this->realEscapeString($deptCode); | |
$sql = "SELECT bth.batchID as id, | |
bth.batchName as name, | |
bth.batchDesc as description, | |
bth.batchStartYear as startYear, | |
bth.batchEndYear as endYear, | |
bth.batchCreateTime as createdDate, | |
bth.deptID as deptId, | |
bth.semID as currentSemId, | |
sem.semName, | |
dpt.deptName, | |
bth.batchOptionName FROM batches bth INNER JOIN department dpt ON dpt.deptID=bth.deptID INNER JOIN semesters sem ON sem.semID=bth.semID WHERE bth.batchName = '$batchCode' AND dpt.deptName='$deptCode'"; | |
try { | |
$batch = $this->executeQueryForObject($sql, false, $this->mapper[BatchServiceMapper::GETBATCHDETAILSBYID]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get campus type | |
* @param unknown $id | |
* @return object|NULL|\com\linways\base\util\$objectList[]|object|array|\com\linways\base\util\$objectList[] | |
* @throws AutonomousException | |
* @author Aswin | |
*/ | |
public function getCampusTypes($id = null) | |
{ | |
$id = $this->realEscapeString($id); | |
$query = "SELECT id as campusTypeId,name as campusTypeName FROM campus_type"; | |
if ($id) | |
$query .= " WHERE id=$id"; | |
try { | |
if ($id) | |
return $this->executeQueryForObject($query); | |
else | |
return $this->executeQueryForList($query); | |
} catch (\Exception $e) { | |
throw new AutonomousException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get batches from curse type for fee | |
* @param unknown $courseTypeID | |
* @param unknown $batchStartYear | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws AutonomousException | |
* @author Aswin | |
*/ | |
public function getBatchesFromCourseTypeForFee($courseTypeID, $batchStartYear, $campusTypeId = null) | |
{ | |
$courseTypeID = $this->realEscapeString($courseTypeID); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$campusTypeId = $this->realEscapeString($campusTypeId); | |
$query = "SELECT b.batchID AS batchId,b.batchName,s.semID AS semesterId,s.semName AS semesterName,d.deptID AS departmentId,d.deptName AS departmentName FROM batches b INNER JOIN semesters s ON b.semID=s.semID INNER JOIN department d ON b.deptID=d.deptID WHERE b.courseTypeID='$courseTypeID' AND batchStartYear='$batchStartYear' AND b.batchHide=0"; | |
if ($campusTypeId) | |
$query .= " AND campus_typeID=$campusTypeId"; | |
try { | |
$response = $this->executeQueryForList($query); | |
return $response; | |
} catch (\Exception $e) { | |
throw new AutonomousException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $courseTypeId | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getCourseTypeByCourseTypeId($courseTypeId) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$courseType = NULL; | |
$sql = "SELECT id, type_name as name, is_pg as isPG, type_code as code FROM batch_course_type where courseTypeID = '$courseTypeId' "; | |
try { | |
$courseType = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $courseType; | |
} | |
/** | |
* @param $staffId | |
* @param null $deptId | |
* @return array|Object | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesTeachingByStaff($staffId, $deptId = NULL,$noPassout = NULL, $includeCurrentSem = NULL) | |
{ | |
$staffId = $this->realEscapeString($staffId); | |
$deptId = $this->realEscapeString($deptId); | |
$condition = ""; | |
$join = ""; | |
$batches = []; | |
if ($deptId) { | |
$condition .= " AND b.deptID = '$deptId' "; | |
} | |
if($noPassout){ | |
$condition .= " AND b.isPassOut = '0' "; | |
} | |
if($includeCurrentSem){ | |
$join = " AND sbs.semID = b.semID "; | |
} | |
$sql = "SELECT DISTINCT b.batchID, b.batchName FROM batches b INNER JOIN sbs_relation sbs ON (sbs.batchID = b.batchID $join) WHERE sbs.staffID = '$staffId' $condition "; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* @param $batchId | |
* @return bool | |
* @throws ProfessionalException | |
*/ | |
public function isAdmissionBatch($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$query = "SELECT is_admission FROM batches WHERE batchID = '$batchId'"; | |
try { | |
return $this->executeQueryForObject($query)->is_admission === "1"; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $departmentIds | |
* @param null $courseTypeId | |
* @param array $batchStartYears | |
* @return Object|[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByDepartmentIds($departmentIds, $courseTypeId = null, $batchStartYears = []) | |
{ | |
$response = []; | |
$departmentIds = $this->realEscapeArray($departmentIds); | |
if (!is_array($departmentIds)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_ARGUMENT_TYPE, "Expected Array got " . gettype($departmentIds)); | |
} | |
if (count($departmentIds) <= 0) { | |
throw new ProfessionalException(ProfessionalException::ARRAY_EMPTY, "Empty department details"); | |
} | |
$sql = "SELECT batchID,batchCreateTime,batchDesc,batchEndYear,batchStartYear, deptID,isPassOut,batchName,courseTypeID | |
FROM batches | |
WHERE deptID IN (" . implode(",", $departmentIds) . ") AND batchHide = 0 "; | |
if (count($batchStartYears) > 0) { | |
$sql .= " AND batchStartYear IN (" . implode(",", $batchStartYears) . ")"; | |
} | |
if (!empty($courseTypeId)) { | |
$sql .= " AND courseTypeID = $courseTypeId"; | |
} | |
try { | |
$responses = $this->executeQueryForList($sql, $this->mapper[BatchServiceMapper::GET_BATCHES_BY_DEPARTMENT_IDS]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $responses; | |
} | |
/** | |
* @param SearchBatchesRequest $request | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function searchBatches(SearchBatchesRequest $request = null) | |
{ | |
$response = []; | |
$request = $this->realEscapeObject($request); | |
$conditions = ""; | |
if (!empty($request->departmentIds) && count($request->departmentIds) > 0) { | |
$conditions .= " AND deptID IN (" . implode(",", $request->departmentIds) . ")"; | |
} | |
if (!empty($request->batchStartYears) && count($request->batchStartYears) > 0) { | |
$conditions .= " AND batchStartYear IN (" . implode(",", $request->batchStartYears) . ")"; | |
} | |
if (!empty($request->courseTypeIds) && count($request->courseTypeIds) > 0) { | |
$conditions .= " AND courseTypeID IN (" . implode(",", $request->courseTypeIds) . ")"; | |
} | |
// if (!empty($request->includeAdmissionBatch)) { | |
// $conditions .= " AND is_admission = 0"; | |
// } | |
if (!empty($request->semID)){ | |
$conditions .= " AND semID = $request->semId"; | |
} | |
$sql = "SELECT batchID,batchCreateTime,batchDesc,batchEndYear,batchStartYear, deptID,isPassOut,batchName,courseTypeID | |
FROM batches | |
WHERE 1=1 AND batchHide = 0 $conditions"; | |
try { | |
$responses = $this->executeQueryForList($sql, $this->mapper[BatchServiceMapper::GET_BATCHES_BY_DEPARTMENT_IDS]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $responses; | |
} | |
/** | |
* Method for getting batch details by courseTypeId and semId | |
* @param unknown $courseTypeId | |
* @param unknown $semId | |
* @param string $deptID | |
* @param string $batchID | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author Nandu | |
*/ | |
public function getBatchByCourseTypeIdSemIdAndDeptID($courseTypeId, $semId, $deptID, $batchID) | |
{ | |
$sql = ''; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$semId = $this->realEscapeString($semId); | |
$deptID = $this->realEscapeString($deptID); | |
if ($courseTypeId) | |
$course = "courseTypeID = '$courseTypeId' AND"; | |
if ($deptID == "ALL" && $batchID == "ALL") | |
$sql = "SELECT batchID AS batchId, batchName, batchDesc, courseTypeID, deptID FROM batches WHERE $course semID = '$semId'"; | |
elseif ($deptID != "ALL" && $batchID == "ALL") | |
$sql = "SELECT batchID AS batchId, batchName, batchDesc, courseTypeID, deptID FROM batches WHERE $course semID = '$semId' and deptID= '$deptID'"; | |
else | |
$sql = "SELECT batchID AS batchId, batchName, batchDesc, courseTypeID, deptID FROM batches WHERE $course batchID='$batchID'"; | |
try { | |
$batchDetails = $this->executeQueryForList($sql); | |
foreach ($batchDetails as $batchDetail) { | |
$sql = "SELECT ar.batchID, ar.semID, ar.dateOfjoining, ar.morninghours, ar.classStartsFrom, ar.classEnds, ar.halfdayHourCount, ar.fulldayHourCount | |
from batches b | |
LEFT JOIN attendance_rules ar on ar.batchID = b.batchID | |
WHERE b.courseTypeId='$courseTypeId' and ar.semID='$semId' and ar.batchID='$batchDetail->batchId';"; | |
$row = $this->executeQueryForObject($sql); | |
$attendanceRule = new \stdClass(); | |
$attendanceRule->dateOfjoining = $row->dateOfjoining; | |
$attendanceRule->morninghours = $row->morninghours; | |
$attendanceRule->classStartsFrom = $row->classStartsFrom; | |
$attendanceRule->classEnds = $row->classEnds; | |
$attendanceRule->halfDayHourCount = $row->halfdayHourCount; | |
$attendanceRule->fullDayHourCount = $row->fulldayHourCount; | |
$batchDetail->attendanceRule = $attendanceRule; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* To get finalized rule for a subject and sem | |
* | |
* @param int $batchID | |
* @param int $semID | |
* @param int $subjectID | |
* @param int $subBatchID =NULL | |
* | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
Public function getFinalizedRuleForSubject($batchID, $semID, $subjectID, $subBatchID = NULL) | |
{ | |
$batchID = $this->realEscapeString($batchID); | |
$semID = $this->realEscapeString($semID); | |
$subjectID = $this->realEscapeString($subjectID); | |
$subBatchID = $this->realEscapeString($subBatchID); | |
$subject_specific_disabled = 1; | |
$sql = "SELECT ruleID as id,isAttendance,roundOffAttnPercent FROM normalization_rule3 WHERE batchID='$batchID' and semID='$semID'"; | |
try { | |
$rule = $this->executeQueryForObject($sql); | |
if ($rule) { | |
$ruleID = $rule->id; | |
$assign_needed = 1; | |
$isAttendance = $rule->isAttendance; | |
$roundOffAttnPercent = $rule->roundOffAttnPercent; | |
} | |
$sql = "select id from normalization_subjectwise_rule_privilege where batch_id='$batchID' and sem_id='$semID'"; | |
$privilege = $this->executeQueryForList($sql); | |
if (!$privilege) { | |
$subject_specific_disabled = 0; | |
if ($subBatchID != 0) { | |
$subcond = " AND subbatchID = $subBatchID "; | |
} | |
$sql_check = "SELECT id,isAttendance,roundOffAttnPercent from normalization_rule3_subject WHERE batch_id = '$batchID' AND sem_id = '$semID' AND subject_id = '$subjectID' $subcond"; | |
$normalizedRule = $this->executeQueryForObject($sql_check); | |
if ($normalizedRule) { | |
$ruleID = $normalizedRule->id; | |
$isAttendance = $normalizedRule->isAttendance; | |
$roundOffAttnPercent = $normalizedRule->roundOffAttnPercent; | |
} else { | |
$sql_check = "SELECT id,isAttendance,roundOffAttnPercent from normalization_rule3_subject WHERE batch_id = '$batchID' AND sem_id = '$semID' AND subject_id = '$subjectID'"; | |
$normalizedRule = $this->executeQueryForObject($sql_check); | |
if ($normalizedRule) { | |
$ruleID = $normalizedRule->id; | |
$isAttendance = $normalizedRule->isAttendance; | |
$roundOffAttnPercent = $normalizedRule->roundOffAttnPercent; | |
} | |
} | |
if ($normalizedRule) { | |
$sql = "select rule_id from normalization_rule3_groupassignments_subject where rule_id = $ruleID"; | |
$rules = $this->executeQueryForObject($sql); | |
if ($rules) { | |
if ($rules->rule_id) { | |
$assign_needed = 1; | |
} | |
} else { | |
$assign_needed = 0; | |
} | |
} | |
} | |
$actualRule = new stdClass(); | |
$actualRule->assign_needed = $assign_needed; | |
$actualRule->ruleID = $ruleID; | |
$actualRule->subject_specific_disabled = $subject_specific_disabled; | |
$actualRule->isAttendance = $isAttendance; | |
$actualRule->roundOffAttnPercent = $roundOffAttnPercent; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $actualRule; | |
} | |
/** | |
* @param $courseTypeId | |
* @param array $semesters | |
* @param null $departmentId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByCourseTypeOrSemesterAndDepartment($courseTypeId = null, $semesters = [], $departmentId = null) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$semesters = $this->realEscapeArray($semesters); | |
$sql = "SELECT batchID as batchId, batchName FROM batches WHERE 1=1 "; | |
if (!empty($courseTypeId)) { | |
$sql .= " AND courseTypeID = $courseTypeId "; | |
} | |
if (!empty($semesters)) { | |
$sql .= " AND semID IN (" . implode(",", $semesters) . ")"; | |
} | |
if (!empty($departmentId)) { | |
$sql .= " AND deptID=$departmentId "; | |
} | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** get Batch ID from student table | |
* @param $studentId | |
* @return $batchId | |
* @throws ProfessionalException | |
*/ | |
public function getBatcheIdByStudentId($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT batchID as batchId FROM studentaccount WHERE studentId= '$studentId' "; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
return $batch->batchId; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $studentId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getPreviousBatchWithStudentID($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "select previousBatch,failedInSemester,hisSemestersInThisbatch from failed_students where isFailNow = 1 and studentID = '$studentId';"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
if ($batch->failedInSemester == "0") { | |
$sql = "select e.semID from exam e inner join exam_reg_studentsubject ers on (e.examregID = ers.examregID AND e.subjectID = ers.subjectID) where ers.studentID = '$studentId' order by e.semID desc limit 1;"; | |
$sem = $this->executeQueryForObject($sql); | |
if ($sem) | |
$batch->failedInSemester = $sem->semID; | |
else | |
$batch->failedInSemester = 1; | |
} | |
return $batch; | |
} catch (Exception $exception) { | |
throw new ProfessionalException($exception->getCode(), $exception->getMessage()); | |
} | |
} | |
/** | |
* @param null $courseTypeID | |
* @return Object|array | |
* @throws ProfessionalException | |
*/ | |
public function getAvailableAcademicYears($courseTypeID = null) | |
{ | |
$courseTypeJoin = ""; | |
$courseTypeCondition = ""; | |
if ($courseTypeID) { | |
$courseTypeJoin = "INNER JOIN course_type ct ON ct.courseTypeID = b.courseTypeID"; | |
$courseTypeCondition = " AND ct.courseTypeID = '$courseTypeID' "; | |
} | |
$failedBatch = BatchConstants::BATCH_FAILED_NAME; | |
$sql = "SELECT DISTINCT batchStartYear FROM batches b $courseTypeJoin | |
WHERE b.batchName!='$failedBatch' $courseTypeCondition ORDER BY b.batchStartYear DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (Exception $exception) { | |
throw new ProfessionalException($exception->getCode(), $exception->getMessage()); | |
} | |
} | |
/** get Batch Details of studen from Batch table | |
* @param $studentId | |
* @return Object $batchDtails | |
* @throws ProfessionalException | |
*/ | |
public function getBatchDetailsByStudentId($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$batchId = $this->getBatcheIdByStudentId($studentId); | |
try { | |
$sql = "SELECT | |
batchID, | |
batchName, | |
batchDesc, | |
batchStartYear, | |
batchEndYear, | |
batchCreateTime, | |
deptID, | |
semID, | |
batchHide, | |
totalSemester, | |
stream, | |
course_type_id, | |
universityId, | |
studentSortBy, | |
studentShowField, | |
courseTypeID, | |
patternID, | |
patterncourseID, | |
subsideryID, | |
campus_typeID, | |
final_semester, | |
hasUGCalMethod, | |
schemeId, | |
isPassOut, | |
tcIssueDate, | |
batchOptionName, | |
is_admission | |
FROM batches WHERE batchID=$batchId "; | |
$batchDetails = $this->executeQueryForObject($sql); | |
return $batchDetails; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** promot students to next sem on a date set by admin (works from scheduler) | |
* related to sem/term registration | |
* unregistered students will be moved to fail batch | |
* @param $request | |
* @return void | |
* @throws ProfessionalException AJ-13 | |
*/ | |
public function batchPromotion($request) | |
{ | |
$batchId = $request->batchID; | |
$semId = $request->semID; | |
$updatedBy = $request->updatedBy; | |
$userType = $request->userType; | |
$assignRollNoOnPromotion = (Boolean)CommonService::getInstance()->getSettings(SettingsConstants::ASSIGN_ROLL_NO_ON_STUDENT_PROMOTION,SettingsConstants::ASSIGN_ROLL_NO_ON_STUDENT_PROMOTION); | |
$automaticPromotion = CommonService::getInstance()->getSettings(SettingsConstents::SEM_REGISTRATION_SECTIONS, "AUTOMATIC_PROMOTION"); | |
$nextSemId = SemesterService::getInstance()->getNextSemester($semId); | |
$pevSemId = $semId; | |
$prSemId = SemesterService::getInstance()->getPreviousSemId($semId); | |
if ($automaticPromotion) { | |
$pevSemId = $prSemId; | |
} | |
$hisSem = SemesterService::getInstance()->getPreviousSemsters($prSemId); | |
$failedBatchId = $this->getFailedBatchId(); | |
$studentDetails = SemesterService::getInstance()->getSemregStudentDetailsByBatch($batchId, $pevSemId); | |
if($assignRollNoOnPromotion) | |
{ | |
$studentDetails = SemesterService::getInstance()->getSemregStudentDetailsByBatch($batchId, $pevSemId,'studentName'); | |
} | |
$failedStudents = []; | |
$passedStudentList = []; | |
$failedValues = ""; | |
$failedHookParams = []; | |
$failedHookParams['studentAndOldBatch'] = []; | |
$failedHookParams['createdBy'] = 0; | |
if ($studentDetails) { | |
$reason = SemRegistrationFormConstants::LATE_SEM_REGISTRATION; | |
foreach ($studentDetails as $studentDetail) { | |
$approvedByHod = $studentDetail->confirmedByHod ? 1 : 0; | |
if (!$approvedByHod) { | |
$failedStudents[] = $studentDetail->studentId; | |
$failedHookParams['studentAndOldBatch'] [] = ["studentId" => $studentDetail->studentId, "oldBatchId" => $batchId]; | |
$failedValues .= "(" . $studentDetail->studentId . "," . $batchId . "," . $pevSemId . ",'" . $hisSem . "',UTC_TIMESTAMP(),'$reason','$updatedBy','$userType'),"; | |
} | |
if($approvedByHod) | |
{ | |
$passedStudentList[] = $studentDetail->studentId; | |
} | |
} | |
if ($failedStudents) { | |
$failedValues = rtrim($failedValues, ","); | |
$sql = "INSERT into failed_students (studentID,previousBatch,failedInSemester,hisSemestersInThisbatch,failedDate,reason,updated_by,userType) values $failedValues"; | |
try { | |
$this->executeQuery($sql); | |
} catch (Exception $exception) { | |
throw new ProfessionalException($exception->getCode(), $exception->getMessage()); | |
} | |
$failedStudents = implode(",", $failedStudents); | |
$sql = "UPDATE studentaccount SET batchID = " . $failedBatchId . " WHERE studentID in (" . $failedStudents . ") "; | |
try { | |
$this->executeQuery($sql); | |
} catch (Exception $exception) { | |
throw new ProfessionalException($exception->getCode(), $exception->getMessage()); | |
} | |
} | |
$sql = "UPDATE batches SET semId = '$semId' WHERE batchID = '$batchId'"; | |
try { | |
$this->executeQuery($sql); | |
$tutorList = StaffService::getInstance()->getBatchTutors($batchId, $pevSemId); | |
if (!empty($tutorList)) { | |
$staffIDs = CommonUtil::getObjectAttributeAsArrayFromObjectList($tutorList, 'staffID'); | |
StaffService::getInstance()->createTutors($batchId, $semId, $staffIDs); | |
foreach ($tutorList as $tutor) { | |
$isAssignedSubject = StaffService::getInstance()->isStaffAssignedBatch($tutor->staffID, $batchId, $semId); | |
if (!$isAssignedSubject) { | |
$subjectId = SubjectService::getInstance()->getTutorSubjectIdIfExists(); | |
if (!$subjectId) { | |
$subjectId = SubjectService::getInstance()->createTutorSubject(); | |
} | |
StaffService::getInstance()->assignFacultyForSubject($batchId, $semId, $subjectId, $tutor->staffID, 1); | |
} | |
} | |
if($assignRollNoOnPromotion) | |
{ | |
$sql_prefix = "SELECT rollNoPrefix FROM batches WHERE batchID = '$batchId'"; | |
$prefix = $this->executeQueryForObject($sql_prefix); | |
$rollNoGenerator = 0; | |
if($passedStudentList) | |
{ | |
foreach ($passedStudentList as $passedStudentId) { | |
$rollNoGenerator++; | |
$roll = sprintf("%02d", $rollNoGenerator); | |
$roll = $prefix->rollNoPrefix.$roll; | |
$sql = "UPDATE studentaccount SET rollNo = '$roll' WHERE studentID = $passedStudentId"; | |
$this->executeQuery($sql); | |
} | |
} | |
$passedStudentList = implode(",",$passedStudentList); | |
$sql_check_for_existing = "SELECT `batchId`, `promotedSem`, `currentStudentIdCount` FROM semTermRegistrationBuffer WHERE `batchId` = $batchId AND `promotedSem` =$semId "; | |
$existing = $this->executeQueryForObject($sql_check_for_existing); | |
if($existing->promotedSem == null) | |
{ | |
$sql="INSERT INTO semTermRegistrationBuffer (batchId, promotedSem, studentIds, currentStudentIdCount, created_by, created_date) | |
VALUES( $batchId, | |
$semId, | |
'$passedStudentList', | |
$rollNoGenerator, | |
$updatedBy, | |
NOW())"; | |
$this->executeQuery($sql); | |
} | |
if($existing->promotedSem) | |
{ | |
$currentStudentCount =(int) $existing->currentStudentIdCount; | |
$currentStudentCount++; | |
$sql = "UPDATE semTermRegistrationBuffer SET studentIds = '$passedStudentList', currentStudentIdCount = $currentStudentCount WHERE batchId = $batchId AND promotedSem = $nextSemId"; | |
$this->executeQuery($sql); | |
} | |
} | |
} | |
} catch (Exception $exception) { | |
throw new ProfessionalException($exception->getCode(), $exception->getMessage()); | |
} | |
} | |
return; | |
} | |
/** | |
* get all current batches which having staffs by deptID | |
* | |
* @param [type] $deptID | |
* @return array|object | |
* @throws ProfessionalException | |
*/ | |
public function getAllCurrentBatchesWithDeptID($deptID) | |
{ | |
$batchDetails = []; | |
$deptID = $this->realEscapeString($deptID); | |
$condition = ""; | |
if ($deptID) { | |
$condition = "AND b.deptID = '$deptID'"; | |
} | |
$yearNow = date("Y"); | |
$sql = "SELECT b.batchID,b.batchName,b.batchDesc,b.batchStartYear,b.batchEndYear | |
FROM batches b | |
INNER JOIN sbs_relation sbs ON b.batchID = sbs.batchID | |
LEFT JOIN department dept ON dept.deptID = b.deptID | |
WHERE b.isPassOut = 0 $condition AND b.batchHide = 0 AND b.batchEndYear >= '$yearNow' AND dept.deptShow = '1' | |
GROUP BY b.batchID;"; | |
try { | |
$batchDetails = $this->executeQueryForList($sql); | |
return $batchDetails; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get batches of a department | |
* @param $deptId | |
* @param $examRegId | |
* @param $examType | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByDeptIdAndExamRegId($deptId, $examRegId, $examType) | |
{ | |
$deptId = $this->realEscapeString($deptId); | |
$examRegId = $this->realEscapeString($examRegId); | |
$examType = $this->realEscapeString($examType); | |
$batches = []; | |
$deptIdSql = ""; | |
$examRegIdSql = ""; | |
if ($examType == ExamType::REGULAR) { | |
$examTypeBatchTable = "exam_registration_batches"; | |
$examTypeBatchTableColumn = "examregID"; | |
} else if ($examType == ExamType::SUPPLY) { | |
$examTypeBatchTable = "supply_improve_batches"; | |
$examTypeBatchTableColumn = "exam_supplementary_id"; | |
} | |
if ($deptId) { | |
$deptIdSql = " AND b.deptID IN ($deptId)"; | |
} | |
if ($examRegId) { | |
$examRegIdSql = " AND erb.$examTypeBatchTableColumn = $examRegId"; | |
} | |
$sql = "SELECT | |
b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description | |
FROM | |
batches b | |
INNER JOIN | |
$examTypeBatchTable erb ON erb.batchID = b.batchID | |
WHERE b.batchName <> 'failed'$deptIdSql $examRegIdSql ORDER BY b.batchName"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* get batches | |
* @param object $request | |
* @param boolean $includeFailedBatch | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByRequest($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$departments = $request->departments; | |
$courseId = $request->courseId; | |
$examRegId = $request->examRegId; | |
$examType = $request->examType; | |
$coursePattern = $request->coursePattern; | |
$semester = $request->semester; | |
$batchStartYear = $request->batchStartYear; | |
$campusTypeId = $request->campusTypeId; | |
$batches = []; | |
$innerJoinTables = ""; | |
$whereConditions = ""; | |
if ($examType || $examRegId) { | |
if ($examType == ExamType::REGULAR) { | |
$examTypeBatchTable = "exam_registration_batches"; | |
$examTypeBatchTableColumn = "examregID"; | |
if($request->examSemId){ | |
$whereConditions .= " AND erb.semID IN ($request->examSemId) "; | |
} | |
} else if ($examType == ExamType::SUPPLY) { | |
$examTypeBatchTable = "supply_improve_batches"; | |
$examTypeBatchTableColumn = "exam_supplementary_id"; | |
} | |
if ($examType != ExamType::INTERNAL) { // should remove after Internal exam registraion table creation | |
$innerJoinTables .= " INNER JOIN | |
$examTypeBatchTable erb ON erb.batchID = b.batchID"; | |
} | |
if ($examRegId) { | |
$whereConditions .= " AND erb.$examTypeBatchTableColumn IN ($examRegId)"; | |
} | |
} | |
if ($courseId) { | |
$innerJoinTables .= " INNER JOIN | |
course_pattern c ON c.patternID = b.patternID | |
"; | |
$whereConditions .= " AND b.patternID IN ($courseId)"; | |
} | |
if ($coursePattern) { // pattern_deptcourses | |
$innerJoinTables .= " INNER JOIN | |
pattern_deptcourses pdc ON pdc.patterncourseID = b.patterncourseID"; | |
$whereConditions .= " AND b.patterncourseID IN ($coursePattern)"; | |
} | |
if ($request->coursePatternId) { // course_pattern | |
$innerJoinTables .= " INNER JOIN | |
course_pattern cp ON cp.patternID = b.patternID"; | |
$whereConditions .= " AND b.patternID IN ($request->coursePatternId)"; | |
} | |
if ($semester) { | |
$whereConditions .= " AND b.semID IN ($semester)"; | |
} | |
if ($departments) { | |
$whereConditions .= " AND b.deptID IN ($departments)"; | |
} | |
// if ($examRegId) { | |
// $whereConditions .= " AND erb.$examTypeBatchTableColumn IN ($examRegId)"; | |
// } | |
if ($batchStartYear) { | |
$whereConditions .= " AND b.batchStartYear IN ($batchStartYear)"; | |
} | |
if ($campusTypeId) { | |
$whereConditions .= " AND b.campus_typeID = '$campusTypeId'"; | |
} | |
if ($request->courseTypeId) { | |
$whereConditions .= " AND b.courseTypeID = '$request->courseTypeId'"; | |
} | |
$orderCondition = $request->batchDisplayOrder ? "b.batchDisplayOrder , ":""; | |
$sql = "SELECT DISTINCT | |
b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description, | |
b.batchStartYear | |
FROM | |
batches b | |
$innerJoinTables | |
WHERE b.batchName <> 'failed' $whereConditions ORDER BY $orderCondition b.batchName DESC"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
// foreach($batches as $batch){ | |
// $batch->name=$batch->name." [".$batch->patterncourseName."]"; | |
// } | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* @param $courseTypeId | |
* @param $batchStartYear | |
* @param $campusTypeId | |
* @return array|Object | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByCourseTypeIdAndCampusTypeId($courseTypeId, $batchStartYear, $campusTypeId) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$campusTypeId = $this->realEscapeString($campusTypeId); | |
$batches = []; | |
$sql = "SELECT batchID as id, batchName as name, batchDesc as description, batchStartYear as startYear, batchEndYear as endYear, batchCreateTime as createdDate, semID as currentSemId, deptID as deptID,extra_details AS extraDetails FROM batches WHERE batchName <> 'failed' AND batchHide=0"; | |
if (!empty($campusTypeId)) { | |
$sql .= " AND campus_typeID = '" . $campusTypeId . "'"; | |
} | |
if(!empty($courseTypeId)) { | |
$sql .= " AND courseTypeID = '" . $courseTypeId . "'"; | |
} | |
if(!empty($batchStartYear)) { | |
$sql .= " AND batchStartYear = '" . $batchStartYear . "'"; | |
} | |
try { | |
$batches = $this->executeQueryForList($sql); | |
foreach($batches as $bth) { | |
$bth->extraDetails = json_decode($bth->extraDetails ? $bth->extraDetails : "{}"); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* @param GetBatchesForComponentRuleAssignRequest $request | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesForComponentRuleAssign(GetBatchesForComponentRuleAssignRequest $request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$query = "SELECT b.batchID AS batchId,b.batchName,b.courseTypeID,b.batchStartYear,b.semID as semId, | |
IF(acrb.assessment_component_rule_id = '$request->ruleId',1,0) AS alreadyAssignedToThisComponent, | |
IF((acrb.id IS NOT NULL AND acrb.assessment_component_rule_id <> '$request->ruleId'), 1, 0) AS alreadyAssignedToAnotherComponent,IF(acr.rule <> acrb.rule,1,0) AS ruleChanged | |
FROM | |
batches b | |
LEFT JOIN | |
assessment_component_rule_assigned_batches acrb ON b.batchID = acrb.batch_id AND b.semID = acrb.sem_id | |
LEFT JOIN assessment_component_rule acr ON acr.id=acrb.assessment_component_rule_id | |
WHERE | |
b.courseTypeID = '$request->courseTypeId' AND b.batchStartYear = '$request->batchStartYear' AND b.batchHide=0;"; | |
try { | |
$batches = $this->executeQueryForList($query); | |
return $batches; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $pssubId | |
* @param $staffId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesAssignedToPseudoSubjectForAStaff($pssubId, $staffId) | |
{ | |
$pssubId = $this->realEscapeString($pssubId); | |
$staffId = $this->realEscapeString($staffId); | |
$query = "SELECT DISTINCT sb.batchID,sr.semID,sr.subjectID,sb.subbatchID,b.batchName,s.semName,b.batchStartYear as startYear,b.batchEndYear as endYear,s.orderNo,ct.typeName as courseTypeName,pdc.patterncourseName | |
FROM | |
subbatches sb | |
INNER JOIN | |
sbs_relation sr ON sb.batchID = sr.batchID AND sb.semID = sr.semID | |
INNER JOIN | |
pseudosubjects_sbs psbs ON (sr.sbsID = psbs.sbsID AND psbs.pseudosubjectID = sb.psID) | |
INNER JOIN | |
batches b ON sr.batchID = b.batchID | |
INNER JOIN | |
semesters s ON sr.semID = s.semID | |
LEFT JOIN | |
course_pattern cp on cp.patternID = b.patternID | |
LEFT JOIN | |
course_type ct on ct.courseTypeID = b.courseTypeID | |
LEFT JOIN | |
pattern_deptcourses pdc on pdc.patterncourseID = b.patterncourseID | |
WHERE | |
sb.psID = '$pssubId' AND sr.staffID = '$staffId' AND sr.isPseudosubject = 1;"; | |
try { | |
$batches = $this->executeQueryForList($query); | |
return $batches; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param GetBatchesRequest $request | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getBatches(GetBatchesRequest $request) | |
{ | |
$sql = "SELECT batchID as id,batchName as name | |
FROM batches | |
WHERE 1=1 "; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Return concatenated batch name separated by commas | |
* @param $batchIds | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getConcatenatedBatchNameByBatchIds($batchIds) | |
{ | |
if (count($batchIds) === 0) { | |
throw new ProfessionalException(ProfessionalException::INVALID_BATCH_IDS, "Batch list is emoty"); | |
} | |
$sql = "SELECT GROUP_CONCAT(batchName)as name FROM batches WHERE batchID IN (" . implode(",", $batchIds) . ")"; | |
try { | |
return $this->executeQueryForObject($sql)->name; | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get batches for a subject to define exam | |
* @author Vishnu M | |
*/ | |
public function getBatchesExamRegSemSubject($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
try { | |
if ($request->isSupply) { | |
$sql = "SELECT DISTINCT sib.batchID as batchId FROM supply_improve_batches sib INNER JOIN sbs_relation sbs ON (sib.batchID = sbs.batchID) WHERE sib.exam_supplementary_id = '$request->supplyExamRegId' AND sbs.subjectID = '$request->subjectId' AND sbs.semID = '$request->semId' "; | |
} else { | |
$sql = "SELECT DISTINCT erb.batchID as batchId FROM exam_registration_batches erb INNER JOIN sbs_relation sbs ON (erb.batchID = sbs.batchID AND erb.semID = sbs.semID) WHERE erb.examregID = '$request->examRegId' AND sbs.subjectID = '$request->subjectId' AND sbs.semID = '$request->semId' "; | |
} | |
return $this->executeQueryForList($sql); | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get batches for copy co | |
* @param object $request | |
* @return List | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesForCopyCoByRequest($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$departmentId = $request->departmentId; | |
$semId = $request->semId; | |
$subjectId = $request->subjectId; | |
$groupId = $request->groupId; | |
$sql = "SELECT | |
bch.batchID AS id, | |
bch.batchName AS name, | |
bch.semID AS currentSemId, | |
bch.deptID AS deptID | |
FROM | |
nba_po_group_to_batches_mapping npb | |
INNER JOIN | |
batches bch ON npb.batch_id = bch.batchID | |
INNER JOIN | |
sbs_relation sr ON bch.batchID = sr.batchID -- AND bch.semID = sr.semID | |
WHERE | |
bch.deptID = $departmentId | |
AND sr.semID = $semId | |
AND sr.subjectID = $subjectId | |
AND npb.nba_po_group_id = $groupId | |
group by bch.batchID"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* | |
* @param $departmentIds | |
* @return Object | |
* @throws ProfessionalException | |
* @author jithinvijayan | |
*/ | |
public function getAllRunningBatchesByDepartmentIds($departmentIds, $includeAdmissionBatches = false) | |
{ | |
if (count($departmentIds) === 0) { | |
throw new ProfessionalException(ProfessionalException::INVALID_DEPARTMENT_IDS, "department details not found"); | |
} | |
$conditions = ""; | |
$passOutSemester = SemesterConstants::PASSOUT_STUDENTS; | |
$courseCompletedSemester = SemesterConstants::COURSE_COMPLETED; | |
// if (!$includeAdmissionBatches) { | |
// $conditions = " AND is_admission = 0"; | |
// } | |
try { | |
$sql = "SELECT b.batchID as id, b.batchName as name,b.batchDesc as description,s.semID as semesterId | |
FROM batches b | |
INNER JOIN semesters s ON s.semID = b.semID | |
WHERE batchHide=0 AND deptID IN (" . implode(",", $departmentIds) . ") | |
AND s.semName NOT IN ('$passOutSemester','$courseCompletedSemester') $conditions | |
ORDER BY batchStartYear DESC, batchName ASC"; | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $departmentIds | |
* @param bool $includeAdmissionBatches | |
* @return Object | |
* @throws ProfessionalException | |
* @author Jithin Vijayan<jithin@linways.com> | |
*/ | |
public function getAllBatchesByDepartmentIds($departmentIds, $includeAdmissionBatches = false) | |
{ | |
if (!count($departmentIds)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_DEPARTMENT_IDS, "department details not found"); | |
} | |
$conditions = ""; | |
// if (!$includeAdmissionBatches) { | |
// $conditions = " AND is_admission = 0"; | |
// } | |
try { | |
$sql = "SELECT b.batchID as id, b.batchName as name,b.batchName as text,b.batchDesc as description | |
FROM batches b | |
WHERE batchHide=0 AND deptID IN (" . implode(",", $departmentIds) . ") | |
$conditions | |
ORDER BY batchStartYear DESC, batchName ASC"; | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $batchId | |
* @return mixed | |
* @throws ProfessionalException | |
* @author jithinvijayan | |
*/ | |
public function getDepartmentByBatchId($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT deptID FROM batches WHERE batchID =$batchId"; | |
try { | |
return $this->executeQueryForObject($sql)->deptID; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** Formways services **/ | |
/** | |
* | |
* @param GetAllBatchesRequest $request | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
* @author gadheyan | |
*/ | |
public function getAllBatchesForFormways(GetAllBatchesRequest $request) | |
{ | |
$sql = ""; | |
$request = $this->realEscapeObject($request); | |
$sql = "SELECT | |
btc.batchID AS value, | |
btc.batchName as label, | |
btc.batchDesc AS description | |
FROM | |
batches btc | |
WHERE 1=1 "; | |
if ($request) { | |
if ($request->id) { | |
$sql .= " AND btc.batchID = $request->id"; | |
} | |
if ($request->batchHide) { | |
$sql .= " AND btc.batchHide = $request->batchHide"; | |
} | |
if ($request->semId) { | |
$sql .= " AND btc.semID = $request->semId"; | |
} | |
if ($request->deptId) { | |
$sql .= " AND btc.deptID = $request->deptId"; | |
} | |
} | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Returns admission years for advanced student search | |
* | |
* @return Object | |
* @throws ProfessionalException | |
* @author jithinvijayan | |
*/ | |
public function getAllBatchStartYearsForAdvancedStudentSearch() | |
{ | |
$sql = "SELECT DISTINCT batchStartYear as id,batchStartYear as name | |
FROM batches ORDER BY batchStartYear DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getAllBatchesInHall($hallId, $patternId = null, $semId = null, $examTypeId = null) | |
{ | |
$hallId = $this->realEscapeString($hallId); | |
$patternId = $this->realEscapeString($patternId); | |
$semId = $this->realEscapeString($semId); | |
$examTypeId = $this->realEscapeString($examTypeId); | |
$sqlCondition = ""; | |
if (empty($hallId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, "Invalid hall"); | |
} | |
if (!empty($patternId)) { | |
$sqlCondition .= " AND b.patternID = $patternId"; | |
} | |
if (!empty($semId)) { | |
$sqlCondition .= " AND e.semID = $semId"; | |
} | |
if (!empty($examTypeId)) { | |
$sqlCondition .= " AND e.examTypeID = $examTypeId"; | |
} | |
$sql = "SELECT | |
DISTINCT b.batchID AS id, | |
b.batchName AS name | |
FROM | |
batches b | |
INNER JOIN studentaccount sa ON | |
sa.batchID = b.batchID | |
INNER JOIN exam_hall_arranged_students ehas ON | |
ehas.studentID = sa.studentID | |
INNER JOIN exam_halls eh ON | |
eh.hallID = ehas.hallID | |
INNER JOIN exam e ON | |
e.batchID = b.batchID | |
AND e.batchID = sa.batchID | |
AND e.examID = ehas.examID | |
WHERE | |
eh.hallID = $hallId | |
$sqlCondition"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get count of total number of students in a subbatch | |
* @param int $sbsId | |
* @return int $count | |
* @throws ProfessionalException | |
*/ | |
public function getTotalNumberOfStudentsBySubbatchId($subBatchID, $sbsId) | |
{ | |
$subBatchID = $this->realEscapeString($subBatchID); | |
$sbsId = $this->realEscapeString($sbsId); | |
$sql = "SELECT COUNT(sst.studentID) as count FROM subbatch_sbs sbs, subbatch_student sst WHERE sbs.subbatchID=$subBatchID and sbs.sbsID= $sbsId AND sbs.subbatchID = sst.subbatchID; | |
"; | |
try { | |
$count = $this->executeQueryForObject($sql)->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $count; | |
} | |
/** | |
* Method to get batc details by batchId. | |
* @param number $batchId | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws AutonomousException | |
*/ | |
public function getBatchDetailsByBatchId($batchId) | |
{ | |
$batch = null; | |
$sql = null; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT | |
t1.batchID AS batchId, | |
t1.batchName, | |
t1.batchDesc, | |
t1.deptID AS deptId, | |
t1.isPassOut, | |
t1.courseTypeID, | |
t1.batchStartYear, | |
t1.semID, | |
t1.isPassOut AS isPassOut, | |
t1.patternID AS patternId, | |
t1.batchEndYear, | |
t1.final_semester AS lastSemester, | |
t2.departmentDesc, | |
t1.campus_typeID, | |
t3.name AS universityName, | |
t1.batchOptionName, | |
bct.is_pg, | |
t5.semID, | |
t5.semName | |
FROM | |
batches t1 | |
left JOIN department t2 ON t2.deptID = t1.deptID | |
left join semesters t5 ON t5.semID = t1.semID | |
LEFT JOIN university t3 ON | |
t3.id = t1.universityId | |
LEFT JOIN batch_course_type bct ON bct.id = t1.patternID | |
WHERE | |
t1.batchID = $batchId"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* | |
* @param unknown $courseTypeId | |
* @param unknown $admsnStartYear | |
* @param unknown $semId | |
* @param unknown $examType | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByCourseTypeAndAdmissionYear($courseTypeId, $admissionYear, $semId) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$admissionYear = $this->realEscapeString($admissionYear); | |
$semId = $this->realEscapeString($semId); | |
$getBatchListByAdmsnYear = []; | |
$sql = "SELECT b.batchID,b.batchName from sbs_relation sr | |
inner join batches b | |
on sr.batchID=b.batchID | |
WHERE b.courseTypeID= '$courseTypeId' | |
AND b.batchStartYear='$admissionYear' | |
AND sr.semID='$semId' | |
GROUP BY b.batchID"; | |
try { | |
$getBatchListByAdmsnYear = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $getBatchListByAdmsnYear; | |
} | |
/** | |
* | |
* @param unknown $batchId | |
* @param unknown $examType | |
* @param unknown $semId | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getSessionalMarksSettingsByBarch($batchId, $semId, $examType) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$examType = $this->realEscapeString($examType); | |
$getBatchListByAdmsnYear = []; | |
$sql = "SELECT distinct sms.batchID, | |
sms.fromDate, | |
sms.toDate | |
from sessional_marks_settings sms | |
where batchID ='$batchId' | |
and semID='$semId' | |
and examTypeID='$examType'"; | |
try { | |
$batchDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* Get batches by startYear and endYear | |
* @param number $startYear | |
* @param number $endYear | |
* @return object|array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByAcademicYear($startYear, $endYear) | |
{ | |
$startYear = $this->realEscapeString($startYear); | |
$endYear = $this->realEscapeString($endYear); | |
$sql = "SELECT batchID, batchName,deptID,semID FROM batches WHERE batchStartYear = '$startYear' AND batchEndYear = '$endYear' AND batchHide = 0"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
return $batches; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get batch list with hod privileges by staffID | |
* @param number $startYear | |
* @param number $startYear | |
* @param number $staffID | |
* @return object|array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesHodPrivelegesByStaff($staffID, $startYear, $endYear) | |
{ | |
$staffID = $this->realEscapeString($staffID); | |
$startYear = $this->realEscapeString($startYear); | |
$endYear = $this->realEscapeString($endYear); | |
$sql = "SELECT | |
b.batchID, b.batchName,b.semID, h.id | |
FROM | |
batches b | |
LEFT JOIN | |
staffaccounts s ON b.deptID = s.deptID AND isHOD > 0 | |
AND s.staffID = $staffID | |
LEFT JOIN | |
hodPrivileges h ON FIND_IN_SET(batchID, batchIDs) | |
AND h.staffID = $staffID | |
WHERE | |
b.batchStartYear = '$startYear' | |
AND b.batchEndYear = '$endYear' | |
AND b.batchHide = 0 | |
AND s.staffID IS NULL"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
return $batches; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get valid academic year(startyear and endyear) | |
* @param NULL | |
* @return object|array | |
* @throws ProfessionalException | |
*/ | |
public function getAcademicStartYearEndYear() | |
{ | |
$sql = "SELECT DISTINCT(batchStartYear), batchEndYear FROM batches WHERE batchStartYear <> '' AND batchEndYear <> '' AND batchHide = 0 order by batchStartYear ASC"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
return $batches; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get exam registerd batches | |
* @param object $request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getExamRegBatchesByRequest($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$examRegId = $request->examRegId; | |
$examType = $request->examType; | |
$semester = $request->semester; | |
$batches = []; | |
$innerJoinTables = ""; | |
$whereConditions = ""; | |
$orderBy = ""; | |
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 table creation | |
$innerJoinTables .= " INNER JOIN | |
$examTypeBatchTable erb ON erb.batchID = b.batchID"; | |
} | |
if ($examRegId) { | |
$whereConditions .= " AND erb.$examTypeBatchTableColumn IN ($examRegId)"; | |
} | |
} | |
if ($semester && ($examType == ExamType::REGULAR)) { | |
$whereConditions .= " AND erb.semID IN ($semester)"; | |
} | |
if ($request->batchStartYear) { | |
$whereConditions .= " AND b.batchStartYear IN ($request->batchStartYear)"; | |
} | |
if ($request->deptId) { | |
$whereConditions .= " AND b.deptId IN ($request->deptId)"; | |
} | |
if ($request->patternId) { // course_pattern | |
$innerJoinTables .= " INNER JOIN | |
course_pattern cp ON cp.patternID = b.patternID"; | |
$whereConditions .= " AND b.patternID IN ($request->patternId)"; | |
} | |
if ($semester && ($examType == ExamType::SUPPLY)) { | |
$innerJoinTables .= " INNER JOIN exam e ON e.supply_examreg_id = erb.exam_supplementary_id "; | |
$whereConditions .= " AND e.semID IN ($semester)"; | |
} | |
if ($request->orderByBatchOrder) { | |
$orderBy = " ORDER BY b.batchDisplayOrder ASC"; | |
} else { | |
$orderBy = " ORDER BY b.batchName DESC"; | |
} | |
$groupBy = " GROUP BY b.batchID "; | |
$sql = "SELECT DISTINCT | |
b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description, | |
b.batchStartYear, | |
b.final_semester as finalSem, | |
b.deptID, | |
d.deptName, | |
d.departmentDesc | |
FROM | |
batches b | |
$innerJoinTables | |
INNER JOIN department d ON d.deptID = b.deptID | |
WHERE b.batchName <> 'failed' $whereConditions | |
$groupBy | |
$orderBy"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
// foreach($batches as $batch){ | |
// $batch->name=$batch->name." [".$batch->patterncourseName."]"; | |
// } | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/* | |
Method for getting batch list by semId, batchStartYear and courseTypeId | |
*/ | |
public function getBatchListBybatchStartYear($courseTypeId, $batchStartYear) | |
{ | |
$batchDetails = []; | |
$condition = null; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
try { | |
$sql = "SELECT b.batchID as batchId, b.batchName as batchName FROM batches b WHERE b.courseTypeID = ' $courseTypeId ' AND b.batchStartYear = ' $batchStartYear ' "; | |
$batchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/** | |
* Method for getting batch list by admission year and coursetypeId | |
* @param unknown $courseTypeId | |
* @param unknown $admsnStartYear | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchListByAdmsnYearForMarklist($courseTypeId, $admsnStartYear) | |
{ | |
$getBatchListByAdmsnYear = []; | |
$sql = "SELECT b.batchID as batchId,b.batchName,b.patterncourseID,b.deptID FROM batches b WHERE b.courseTypeID = $courseTypeId AND b.batchStartYear = $admsnStartYear AND b.is_admission = 0"; | |
try { | |
$getBatchListByAdmsnYear = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $getBatchListByAdmsnYear; | |
} | |
/** | |
* CopyMarklistSetting | |
* @param unknown $fromBatchId , $toBatchId, $courseTypeId, $semIdFrom, $semIdTo | |
* @throws ProfessionalException | |
*/ | |
public function copySubjectCredits($fromBatchId, $toBatchId, $courseTypeId, $semIdFrom, $semIdTo) | |
{ | |
$sql = ''; | |
$fromBatchId = $this->realEscapeString($fromBatchId); | |
$toBatchId = $this->realEscapeString($toBatchId); | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$semIdFrom = $this->realEscapeString($semIdFrom); | |
$semIdTo = $this->realEscapeString($semIdTo); | |
$subjectDetails = []; | |
$subjectIdPresent = null; | |
$copyFailedSubjects =[]; | |
try { | |
$toBatchDetails = BatchService::getInstance()->getBatchNameById($toBatchId); | |
$sql = "SELECT esc.subjectID AS subjectId,s.subjectName,s.subjectDesc,b.batchName FROM exam_subjectcredit esc | |
INNER JOIN subjects s ON s.subjectID = esc.subjectID | |
INNER JOIN batches b ON b.batchID = esc.batchID | |
WHERE esc.batchID = $fromBatchId AND esc.semID = $semIdFrom"; | |
$subjectDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
if (count($subjectDetails)) { | |
foreach ($subjectDetails as $subject) { | |
$subjectId = $subject->subjectId; | |
$subjectIdPresent = null; | |
try { | |
$sql = "SELECT subjectID AS subjectIdPresent FROM sbs_relation WHERE batchID = $toBatchId AND semID = $semIdTo AND subjectID = $subjectId"; | |
$subjectIdPresent = $this->executeQueryForObject($sql)->subjectIdPresent; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
if ($subjectIdPresent) { | |
try { | |
$subjectIdEntryPresent = null; | |
$sql = "SELECT subjectID AS subjectId FROM exam_subjectcredit WHERE batchID = $toBatchId AND semID = $semIdTo AND subjectID = $subjectIdPresent"; | |
$subjectIdEntryPresent = $this->executeQueryForObject($sql)->subjectId; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
if (!$subjectIdEntryPresent) { | |
try { | |
$sql = "INSERT INTO exam_subjectcredit (batchID, semID, subjectID, credit, isInternal, isExternal, hideGrade, excludeSubjectFromTotal, subjectType, subjectOrder) SELECT '$toBatchId', '$semIdTo',subjectID, credit, isInternal, isExternal, hideGrade, excludeSubjectFromTotal, subjectType, subjectOrder FROM exam_subjectcredit WHERE batchID='$fromBatchId' AND semID = '$semIdFrom' AND subjectID = $subjectId"; | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
}else{ | |
$subject->toBatchName = $toBatchDetails->name; | |
$copyFailedSubjects[]=$subject; | |
} | |
} | |
$response->copyFailedSubjects = $copyFailedSubjects; | |
return $response; | |
} | |
} | |
/** | |
* get batches of a department | |
* @param $deptId | |
* @param boolean $includeFailedBatch | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByDeptIdAndCourseTypeID($deptId, $excludeFailedBatch = FALSE, $courseTypeId = NULL) | |
{ | |
$batches = []; | |
$deptId = $this->realEscapeString($deptId); | |
$excludeFailedBatch = $this->realEscapeString($excludeFailedBatch); | |
$sql = "SELECT batchID as id, | |
batchName as name, | |
batchDesc as description, | |
batchStartYear as startYear, | |
batchEndYear as endYear, | |
batchCreateTime as createdDate, | |
semID as currentSemId FROM batches WHERE deptID IN ($deptId)"; | |
if ($excludeFailedBatch) { | |
$sql .= " AND batchName <> 'failed' "; | |
} | |
if ($courseTypeId) { | |
$sql .= " AND courseTypeID = '$courseTypeId' "; | |
} | |
$sql .= " ORDER BY batchName"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
public function getMarkListSubjectCategories($batchId) | |
{ | |
$sql = ''; | |
$batchId = $this->realEscapeObject($batchId); | |
$getMarkListSubjectCategories = []; | |
try { | |
$sql = "SELECT | |
mcs.id, | |
mcs.batches_id AS batchId, | |
mcs.subject_category_id AS subjectCatId, | |
mcs.displayName, | |
mcs.secondLangFlag, | |
mcs.openCourseFlag, | |
mcs.priority, | |
sc.subjectcatName AS subjectCatName, | |
sc.type AS subjectCatType, | |
sc.code AS subjectCatCode, | |
concat(sc.subjectcatName,' ',mcs.displayName) AS name | |
FROM | |
marklist_categorize_subjects mcs | |
INNER JOIN subject_category sc ON | |
sc.subjectcatID = mcs.subject_category_id | |
WHERE | |
batches_id = $batchId"; | |
$getMarkListSubjectCategories = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new AutonomousException($e->getCode(), $e->getMessage()); | |
} | |
return $getMarkListSubjectCategories; | |
} | |
public function getBatchSubjectCategories($batchId) | |
{ | |
$sql = ''; | |
$batchId = $this->realEscapeObject($batchId); | |
$getBatchSubjectCategories = []; | |
try { | |
$sql = "SELECT DISTINCT | |
sc.subjectcatID AS subjectCatId, | |
sc.subjectcatName AS subjectCatName, | |
sc.subjectcatPriority AS priority, | |
sc.code | |
FROM | |
sbs_relation sbsr | |
INNER JOIN subjects s ON | |
s.subjectID = sbsr.subjectID | |
INNER JOIN subject_category sc ON | |
sc.subjectcatID = s.subjectcatID | |
WHERE | |
sbsr.batchID = $batchId"; | |
$getBatchSubjectCategories = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new AutonomousException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatchSubjectCategories; | |
} | |
/** | |
* get batches of examReg | |
* @param $request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByExamRegId($examregId) | |
{ | |
$sql = ''; | |
$examregID = $this->realEscapeString($examregId); | |
$getBatches = []; | |
try { | |
$sql = "SELECT t1.batchID, | |
t1.semID, | |
t2.batchName, | |
t3.deptName, | |
t3.departmentDesc, | |
t4.patternName, | |
t5.semName, | |
t6.extval_required, | |
t6.courseTypeID | |
FROM exam_registration_batches t1, batches t2, department t3, course_pattern t4, semesters t5, course_type t6 | |
WHERE t1.examregID=\"" . $examregID . "\" | |
AND t1.batchID=t2.batchID | |
AND t2.patternID=t4.patternID | |
AND t2.deptID=t3.deptID | |
AND t1.semID=t5.semID | |
AND t2.courseTypeID=t6.courseTypeID"; | |
$getBatches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatches; | |
} | |
public function getBatchSemSubjectCategories($batchId, $semId) | |
{ | |
$sql = ''; | |
$batchId = $this->realEscapeObject($batchId); | |
$semId = $this->realEscapeObject($semId); | |
$getBatchSubjectCategories = []; | |
try { | |
$sql = "SELECT DISTINCT | |
sc.subjectcatID AS subjectCatId, | |
sc.subjectcatName AS subjectCatName, | |
sc.subjectcatPriority AS priority | |
FROM | |
batch_sem_subjectCategory_relation bsscr | |
INNER JOIN subject_category sc ON | |
sc.subjectcatID = bsscr.subjectcatID | |
WHERE | |
bsscr.batchID = $batchId"; | |
$getBatchSubjectCategories = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new AutonomousException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatchSubjectCategories; | |
} | |
public function getStudentSubjectMenu($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
try { | |
$sql = "SELECT bat.student_batch_menu FROM batches bat | |
INNER JOIN studentaccount st ON st.batchID = bat.batchID | |
WHERE st.studentID = $studentId;"; | |
return $this->executeQueryForObject($sql)->student_batch_menu; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get batche by patterCourseId, batchstarYear | |
* @param integer $patternCourseId | |
* @param integer $deptId | |
* @param integer $batchStartYear | |
* @return batch[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatcheByPatternCourseIdAndBatchStartYear($patternCourseId, $batchStartYear, $deptId) | |
{ | |
$sql = "SELECT batchID as id, batchName as name, batchDesc as description, batchStartYear as startYear, batchEndYear as endYear, batchCreateTime as createdDate, semID as currentSemId, deptID FROM batches WHERE batchName <> 'failed' AND patterncourseID = $patternCourseId AND deptID= $deptId AND batchStartYear = $batchStartYear"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* get batchstarYears by courseType | |
* @param integer $courseTypeId | |
* @return batch[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchStartYearByCourseType($courseTypeId,$excludePassoutBatches = false) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
if ($excludePassoutBatches) { | |
$condition = " AND isPassout = 0"; | |
} | |
$batchStartYears = null; | |
$sql = "SELECT distinct batchStartYear as id,batchStartYear as name from batches where courseTypeID ='$courseTypeId' $condition order by batchStartYear DESC"; | |
try { | |
$batchStartYears = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batchStartYears; | |
} | |
/** | |
* gat batch detail list by start year ,coursetype | |
* @param unknown $courseTypeId | |
* @param unknown $admsnStartYear | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchDetailListByBatchStartYear($courseTypeId, $admsnStartYear) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$admsnStartYear = $this->realEscapeString($admsnStartYear); | |
$getBatchListByAdmsnYear = []; | |
$sql = "SELECT b.batchID as batchId, b.batchName,b.batchDesc, b.patterncourseID, b.deptID, b.semID ,dp.deptName,dp.departmentDesc,b.batchDisplayOrder,b.final_semester as finalSemester FROM batches b | |
INNER JOIN department dp ON dp.deptID = b.deptID | |
WHERE courseTypeID = '$courseTypeId' AND batchStartYear = '$admsnStartYear' AND batchHide = 0 order by b.batchDisplayOrder ASC"; | |
try { | |
$getBatchListByAdmsnYear = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatchListByAdmsnYear; | |
} | |
/* | |
* get batchName by batch id | |
* @param int $batchId | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchNameById($batchId) | |
{ | |
$batch = NULL; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description,b.batchStartYear from batches b WHERE b.batchID = '$batchId'"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get batches using parameters course type and admission year | |
* @param int $courseTypeId | |
* @param int $batchStartYear | |
* @return BatchList | |
* @throws ProfessionalException | |
*/ | |
public function getPassoutBatchesByCourseTypeAndBatchStartYear($courseTypeId, $batchStartYear) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$query = "SELECT b.batchID AS batchId,b.batchName,s.semID AS semesterId,s.semName AS semesterName,d.deptID AS departmentId,d.deptName AS departmentName, b.final_semester FROM batches b INNER JOIN semesters s ON b.semID=s.semID INNER JOIN department d ON b.deptID=d.deptID WHERE b.courseTypeID='$courseTypeId' AND batchStartYear='$batchStartYear' and b.isPassOut = 1"; | |
try { | |
$response = $this->executeQueryForList($query); | |
return $response; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getSubjectCreditDetails($batchId, $semId, $subjectId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$subjectId = $this->realEscapeString($subjectId); | |
$getSubjectCreditDetails = null; | |
$sql = "SELECT isInternal,isExternal FROM exam_subjectcredit WHERE batchID = $batchId AND semID = $semId AND subjectID = $subjectId"; | |
try { | |
$getSubjectCreditDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $getSubjectCreditDetails; | |
} | |
/** | |
* Add new batch | |
* @param $request | |
* @return Integer batchID | |
* @throws ProfessionalException | |
*/ | |
public function addBatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
if (empty($request->batchName)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_BATCH_NAME, "Invalid batch name given"); | |
} | |
if (empty($request->deptId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_DEPARTMENT_ID, "Invalid department given"); | |
} | |
if (empty($request->semId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_SEMESTER_ID, "Invalid semester given"); | |
} | |
if (empty($request->batchHide)) { | |
$request->batchHide = 0; | |
} | |
if (empty($request->studentSortBy)) { | |
$request->studentSortBy = 'rollNo'; | |
} | |
if (empty($request->studentShowField)) { | |
$request->studentShowField = 'rollNo'; | |
} | |
if(empty($request->hasUGCalMethod)) { | |
$request->hasUGCalMethod = 0; | |
} | |
if(empty($request->isAdmission)) { | |
$request->isAdmission = 0; | |
} | |
$sql = "INSERT INTO batches (batchName, batchDesc, batchStartYear,batchEndYear,batchCreateTime,deptID,semID,batchHide,totalSemester,stream,course_type_id,universityId,studentSortBy,studentShowField,courseTypeID,patternID,patterncourseID,subsideryID,campus_typeID,final_semester,hasUGCalMethod,schemeId,isPassOut,tcIssueDate,batchOptionName,is_admission,student_batch_menu) VALUES ('$request->batchName','$request->batchDescription','$request->batchStartYear','$request->batchEndYear','$request->batchCreateTime',$request->deptId,$request->semId,$request->batchHide,$request->totalSemester,'$request->stream',$request->courseTypeId,$request->universityId,'$request->studentSortBy','$request->studentShowField',$request->courseTypeID,$request->patternId,$request->patternCourseId,$request->subsideryId,$request->campusTypeId,$request->finalSemester,$request->hasUGCalMethod,'$request->schemeId',$request->isPassOut,'$request->tcIssueDate','$request->batchOptionName',$request->isAdmission,'$request->studentBatchMenu')"; | |
try { | |
return $this->executeQuery($sql, true)->id; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Update batch | |
* @param $request | |
* @return null | |
* @throws ProfessionalException | |
*/ | |
public function updateBatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$fields = ""; | |
if ($request->batchName) { | |
$fields .= "batchName = '$request->batchName',"; | |
} | |
if ($request->deptId) { | |
$fields .= "deptID = $request->deptId,"; | |
} | |
if ($request->semId) { | |
$fields .= "semID = $request->semId,"; | |
} | |
if ($request->courseTypeId) { | |
$fields .= "course_type_id = $request->courseTypeId,"; | |
} | |
if ($request->patternId) { | |
$fields .= "patternID = $request->patternId,"; | |
} | |
if ($request->patternCourseId) { | |
$fields .= "patterncourseID = $request->patternCourseId,"; | |
} | |
if ($request->subsideryId) { | |
$fields .= "subsideryID = $request->subsideryId,"; | |
} | |
$fields = rtrim($fields,","); | |
$sql = "UPDATE batches SET $fields WHERE batchID = $request->batchId"; | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Delete batch | |
* @param $request | |
* @return null | |
* @throws ProfessionalException | |
*/ | |
public function deleteBatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
$sql = "DELETE FROM batches WHERE 1=1"; | |
if ($request->batchId) { | |
$sql .= " AND batchID = $request->batchId"; | |
} | |
if ($request->deptId) { | |
$sql .= " AND deptID = $request->deptId"; | |
} | |
if ($request->semId) { | |
$sql .= " AND semID = $request->semId"; | |
} | |
if ($request->courseTypeId) { | |
$sql .= " AND course_type_id = $request->courseTypeId"; | |
} | |
if ($request->patternId) { | |
$sql .= " AND patternID = $request->patternId"; | |
} | |
if ($request->patternCourseId) { | |
$sql .= " AND patterncourseID = $request->patternCourseId"; | |
} | |
if ($request->subsideryId) { | |
$sql .= " AND subsideryID = $request->subsideryId"; | |
} | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Add new sbs relation | |
* @param $request | |
* @return sbsID | |
* @throws ProfessionalException | |
*/ | |
public function addSBSRelation($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
if (empty($request->staffId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_STAFF_ID, "Invalid staff details given"); | |
} | |
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 given"); | |
} | |
if (empty($request->isPseudoSubject)) { | |
$request->isPseudoSubject = 0; | |
} | |
if (empty($request->csId)) { | |
$request->csId = 0; | |
} | |
$sql = "INSERT INTO sbs_relation (staffID, batchID, subjectID,semID,csID ,isPseudosubject ,createdBy,createdDate,updatedBy,updatedDate) VALUES ($request->staffId,$request->batchId,$request->subjectId,$request->semId,$request->csId,$request->isPseudoSubject,1,utc_timestamp(),1,utc_timestamp())"; | |
try { | |
return $this->executeQuery($sql, true)->id; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Update sbs relation | |
* @param $request | |
* @return null | |
* @throws ProfessionalException | |
*/ | |
public function updateSBSRelation($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$fields = ""; | |
if ($request->staffId) { | |
$fields .= "staffID = $request->staffId,"; | |
} | |
if ($request->batchId) { | |
$fields .= "batchID = $request->batchId,"; | |
} | |
if ($request->semId) { | |
$fields .= "semID = $request->semId,"; | |
} | |
if ($request->isPseudoSubject) { | |
$fields .= "isPseudosubject = $request->isPseudoSubject,"; | |
} | |
if ($request->csId) { | |
$fields .= "csID = $request->csId,"; | |
} | |
$fields .= "updatedDate = utc_timestamp() "; | |
$sql = "UPDATE sbs_relation SET $fields WHERE sbsID = $request->sbsId"; | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Delete sbs relation | |
* @param $request | |
* @return null | |
* @throws ProfessionalException | |
*/ | |
public function deleteSBSRelation($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
$sql = "DELETE FROM sbs_relation WHERE 1=1"; | |
if ($request->sbsId) { | |
$sql .= " AND sbsID = $request->sbsId"; | |
} | |
if ($request->staffId) { | |
$sql .= " AND staffID = $request->staffId"; | |
} | |
if ($request->batchId) { | |
$sql .= " AND batchID = $request->batchId"; | |
} | |
if ($request->semId) { | |
$sql .= " AND semID = $request->semId"; | |
} | |
if ($request->isPseudoSubject) { | |
$sql .= " AND isPseudosubject = $request->isPseudoSubject"; | |
} | |
if ($request->csId) { | |
$sql .= " AND csID = $request->csId"; | |
} | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Add new subbatch | |
* @param $request | |
* @return subbatchID | |
* @throws ProfessionalException | |
*/ | |
public function addSubbatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
if (empty($request->subbatchName)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_STAFF_ID, "Invalid staff details given"); | |
} | |
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 given"); | |
} | |
if (empty($request->pseudoSubjectId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_PSEUDO_SUBJECT_ID, "Invalid pseudo subject given"); | |
} | |
if (empty($request->courseId)) { | |
$request->courseId = 0; | |
} | |
$sql = "INSERT INTO subbatches (subbatchName,description,batchID,semID,courseID ,psID) VALUES ('$request->subbatchName','$request->description',$request->batchId,$request->semId,$request->courseId,$request->pseudoSubjectId)"; | |
try { | |
return $this->executeQuery($sql, true)->id; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Update subbatch | |
* @param $request | |
* @return null | |
* @throws ProfessionalException | |
*/ | |
public function updateSubbatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$fields = ""; | |
if ($request->subbatchName) { | |
$fields .= "subbatchName = '$request->subbatchName',"; | |
} | |
if($request->description) { | |
$fields .= "description = '$request->description',"; | |
} | |
if ($request->batchId) { | |
$fields .= "batchID = $request->batchId,"; | |
} | |
if ($request->semId) { | |
$fields .= "semID = $request->semId,"; | |
} | |
if ($request->pseudoSubjectId) { | |
$fields .= "psID = $request->pseudoSubjectId,"; | |
} | |
if ($request->courseId) { | |
$fields .= "courseID = $request->courseId,"; | |
} | |
$fields = rtrim($fields,","); | |
$sql = "UPDATE subbatches SET $fields WHERE subbatchID = $request->subbatchId"; | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Delete subbatch | |
* @param $request | |
* @return null | |
* @throws ProfessionalException | |
*/ | |
public function deleteSubbatch($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
$sql = "DELETE FROM subbatches WHERE 1=1"; | |
if ($request->subbatchId) { | |
$sql .= " AND subbatchID = $request->subbatchId"; | |
} | |
if ($request->batchId) { | |
$sql .= " AND batchID = $request->batchId"; | |
} | |
if ($request->semId) { | |
$sql .= " AND semID = $request->semId"; | |
} | |
if ($request->pseudoSubjectId) { | |
$sql .= " AND psID = $request->pseudoSubjectId"; | |
} | |
if ($request->courseId) { | |
$sql .= " AND courseID = $request->courseId"; | |
} | |
try { | |
return $this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
public function getAllBatchStartYearsForAPI($sortBy = 'year', $sortOrder = 'DESC') | |
{ | |
$sql = "SELECT distinct b.batchStartYear AS year, | |
b.batchStartYear AS id | |
FROM batches b | |
ORDER BY $sortBy $sortOrder"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get batches of examReg with valuation dates | |
* @param $request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesWithValuationDatesByExamRegId($examregId) | |
{ | |
$sql = ''; | |
$examregID = $this->realEscapeString($examregId); | |
$getBatches = []; | |
try { | |
$sql = "SELECT distinct erb.batchID,b.batchName,b.batchDesc, | |
vd.firstval_Datestart as firstStartDate , | |
vd.firstval_Dateend as firstEndDate, | |
vd.secondval_Datestart as secondStartDate, | |
vd.secondval_Dateend as secondEndDate from exam_registration_batches erb | |
INNER JOIN batches b ON b.batchID=erb.batchID | |
LEFT JOIN valuationdates vd ON vd.examregID =erb.examregID AND vd.batchID = erb.batchID | |
WHERE erb.examregID='$examregID'"; | |
$getBatches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatches; | |
} | |
/** | |
* author sibin | |
* get isBatch Exam Registered For Sem | |
* @param integer $semId | |
* @param integer $batchId | |
* @return batch | |
* @throws ProfessionalException | |
*/ | |
public function isBatchExamRegisteredForSem($batchId, $semId) | |
{ | |
$condition = null; | |
$batch = null; | |
$sql = "SELECT distinct erb.batchID from exam_registration er | |
INNER JOIN exam_registration_batches erb ON erb.examregID = er.examregID | |
WHERE erb.batchID='$batchId' and erb.semID='$semId' and er.shortCourse=0"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
*get batches by request | |
* @param GetAllBatchesRequest $request | |
* @throws ProfessionalException | |
* @author sibin | |
*/ | |
public function getAllBatchesByRequest(GetAllBatchesRequest $request) | |
{ | |
$sql = ""; | |
$request = $this->realEscapeObject($request); | |
$sql = "SELECT | |
btc.batchID AS id, | |
btc.batchName as name, | |
btc.batchDesc AS description, | |
btc.batchStartYear as startYear, | |
btc.batchEndYear as endYear, | |
btc.semID, | |
sem.semName | |
FROM | |
batches btc | |
INNER JOIN | |
department dpt ON btc.deptID = dpt.deptID | |
INNER JOIN | |
semesters sem ON sem.semID = btc.semID WHERE 1=1 "; | |
if ($request) { | |
if ($request->id) { | |
$sql .= " AND btc.batchID = $request->id"; | |
} | |
if ($request->batchHide || $request->batchHide === 0 || $request->batchHide === "0") { | |
$sql .= " AND btc.batchHide = $request->batchHide"; | |
} | |
if ($request->semId) { | |
$sql .= " AND btc.semID = $request->semId"; | |
} | |
if ($request->deptId) { | |
$sql .= " AND btc.deptID = $request->deptId"; | |
} | |
if (!empty($request->ids)) { | |
$sql .= " AND btc.batchID IN ('" . (implode("','", $request->ids)) . "')"; | |
} | |
if (!empty($request->admissionYears)) { | |
$sql .= " AND btc.batchStartYear IN ('" . (implode("','", $request->admissionYears)) . "')"; | |
} | |
if ($request->courseTypeId) { | |
$sql .= " AND btc.courseTypeID = $request->courseTypeId"; | |
} | |
if ($request->excludeCourseCompleted == '1') { | |
$sql .= " AND sem.semName != 'Course Completed' "; | |
} | |
} | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* method to check batch is passout | |
* @param integer $batchID | |
* @return BOOLEAN | |
* @throws ProfessionalException | |
*/ | |
public function isBatchPassout($batchID) | |
{ | |
$sql = "SELECT isPassOut FROM batches WHERE batchID = $batchID"; | |
try { | |
$result = $this->executeQueryForObject($sql)->isPassOut; | |
if ($result) { | |
return true; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return false; | |
} | |
/** | |
* get batches of examReg and batchids with valuation dates | |
* @param $request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesWithValuationDatesByExamRegAndBatch($request) | |
{ | |
$sql = ''; | |
$request = $this->realEscapeObject($request); | |
$conditions = ""; | |
if ($request->batchIds) { | |
$conditions .= " AND erb.batchID IN($request->batchIds) "; | |
} | |
if ($request->examType) { | |
$conditions .= " AND vd.examType = '$request->examType'"; | |
} | |
if($request->examType == "SUPPLY"){ | |
$batchRegTable = "supply_improve_batches"; | |
$examRegIdField = "exam_supplementary_id"; | |
}else{ | |
$batchRegTable = "exam_registration_batches"; | |
$examRegIdField = "examregID"; | |
} | |
$getBatches = []; | |
try { | |
$sql = "SELECT distinct erb.batchID,b.batchName,b.batchDesc, | |
vd.firstval_Datestart as firstStartDate , | |
vd.firstval_Dateend as firstEndDate, | |
vd.secondval_Datestart as secondStartDate, | |
vd.secondval_Dateend as secondEndDate from $batchRegTable erb | |
INNER JOIN batches b ON b.batchID=erb.batchID | |
LEFT JOIN valuationdates vd ON vd.examregID =erb.$examRegIdField AND vd.batchID = erb.batchID | |
WHERE erb.$examRegIdField='$request->examRegId' | |
$conditions"; | |
$getBatches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatches; | |
} | |
/** | |
* get isBatch Exam Registered For Sem | |
* @param integer $semId | |
* @param integer $batchId | |
* @return batch | |
* @throws ProfessionalException | |
*/ | |
public function isBatchExamRegisteredForSemAndShortCourse($batchId, $semId,$shortCourse) | |
{ | |
$condition = null; | |
$batch = null; | |
$sql = "SELECT distinct erb.batchID from exam_registration er | |
INNER JOIN exam_registration_batches erb ON erb.examregID = er.examregID | |
WHERE erb.batchID='$batchId' and erb.semID='$semId' and er.shortCourse=$shortCourse"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get batches by examreg,batchstart year,deptId | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByExamRegDepartment($request) | |
{ | |
$batches = null; | |
$request = $this->realEscapeObject($request); | |
$examRegBatchTable = $request->isSupply ? "supply_improve_batches": "exam_registration_batches"; | |
$examRegField = $request->isSupply ? "exam_supplementary_id": "examregID"; | |
$sql = "SELECT b.batchID as batchId,b.batchName | |
FROM batches b | |
INNER JOIN $examRegBatchTable erb ON erb.batchID = b.batchID | |
WHERE erb.$examRegField = '$request->examRegId' AND b.batchStartYear='$request->batchStartYear' AND b.deptID='$request->deptId'"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/* | |
* get batchList by batch ids | |
* @param $batchIds | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesByIds($batchIds) | |
{ | |
$batch = NULL; | |
$batchIds = $this->realEscapeString($batchIds); | |
$sql = "SELECT batchID as id, | |
batchName as name, | |
batchDesc as description from batches WHERE batchID IN ($batchIds)"; | |
try { | |
$batch = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get batches of a department from internal mark assigned staff | |
* @param $deptId | |
* @param $adminId | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesFromInternalMarkAssignedStaff($deptId, $adminId) | |
{ | |
$batches = []; | |
$deptId = $this->realEscapeString($deptId); | |
$adminId = $this->realEscapeString($adminId); | |
$sql = "SELECT b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description, | |
b.batchStartYear as startYear, | |
b.batchEndYear as endYear, | |
b.batchCreateTime as createdDate, | |
b.semID as currentSemId | |
FROM | |
batches b | |
INNER JOIN | |
assign_staff_internal_mark_entry asime ON b.batchID = asime.batchID | |
WHERE asime.adminID = $adminId AND b.deptID = $deptId | |
GROUP BY b.batchID | |
ORDER BY b.batchName ASC "; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/** | |
* get batches of a department from internal mark assigned staff | |
* @param $courseTypeId | |
* @param $batchStartYear | |
* @param $subjectId | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getsubjectWiseBatchDetails($courseTypeId, $batchStartYear, $subjectId, $semId) | |
{ | |
$batches = []; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$subjectId = $this->realEscapeString($subjectId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "SELECT | |
DISTINCT bt.batchID, bt.batchName | |
FROM | |
exam_reg_studentsubject ers | |
INNER JOIN | |
studentaccount sa ON (sa.studentID = ers.studentID) | |
INNER JOIN | |
batches bt ON (bt.batchID = sa.batchID ) | |
INNER JOIN | |
sbs_relation esc ON(esc.batchID = sa.batchID AND esc.subjectID = ers.subjectID) | |
WHERE | |
bt.batchStartYear =$batchStartYear AND bt.courseTypeID =$courseTypeId AND ers.subjectID =$subjectId AND esc.semID = $semId"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
public function updateExtraDetails($extraDetails,$batchId) { | |
$extraDetails = $this->realEscapeObject($extraDetails); | |
$batchId = $this->realEscapeString($batchId); | |
try{ | |
$query = "UPDATE batches SET "; | |
foreach($extraDetails as $key => $value) { | |
$query .= " extra_details=JSON_SET(extra_details,'$.$key','$value'),"; | |
} | |
$query = rtrim($query,","); | |
$query .= " WHERE batchID='$batchId' AND extra_details IS NOT NULL"; | |
$this->executeQuery($query); | |
$query = "UPDATE batches SET extra_details='".(json_encode($extraDetails))."' WHERE batchID='$batchId' AND extra_details IS NULL"; | |
$this->executeQuery($query); | |
}catch(\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/* | |
* get batchList by batch ids ordr by batchDIsplayOrder | |
* @param $batchIds | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getBatchDetailsByIds($batchIds) | |
{ | |
$batch = NULL; | |
$batchIds = $this->realEscapeString($batchIds); | |
$sql = "SELECT batchID as id, | |
batchName as name, | |
semID as semId, | |
batchDesc as description from batches WHERE batchID IN ($batchIds) ORDER BY deptID, batchDisplayOrder ASC"; | |
try { | |
$batch = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/** | |
* get batches of examReg with valuation dates | |
* @param $request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesWithValuationDatesByExamRegRequest($request) | |
{ | |
$sql = ''; | |
$request = $this->realEscapeObject($request); | |
$examRegBatchTable = ($request->examType == ExamType::SUPPLY) ? "supply_improve_batches" : "exam_registration_batches"; | |
$examRegField = ($request->examType == ExamType::SUPPLY) ? "exam_supplementary_id": "examregID"; | |
$orderCondition = $request->batchDisplayOrder ? "b.batchDisplayOrder , " : ""; | |
$getBatches = []; | |
try { | |
$sql = "SELECT distinct erb.batchID,b.batchName,b.batchDesc, | |
vd.firstval_Datestart as firstStartDate , | |
vd.firstval_Dateend as firstEndDate, | |
vd.secondval_Datestart as secondStartDate, | |
vd.secondval_Dateend as secondEndDate from $examRegBatchTable erb | |
INNER JOIN batches b ON b.batchID=erb.batchID | |
LEFT JOIN valuationdates vd ON vd.examregID =erb.$examRegField AND vd.batchID = erb.batchID AND vd.examType = '$request->examType' | |
WHERE erb.$examRegField='$request->examRegId' | |
ORDER BY $orderCondition b.batchName DESC"; | |
$getBatches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $getBatches; | |
} | |
/* | |
* get final semester batches by courseTypeId | |
* @param $courseTypeId | |
* @throws ProfessionalException | |
*/ | |
public function getFinalSemBatchesByCourseType($courseTypeId, $sortBy = false) | |
{ | |
$batch = NULL; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$condition = NULL; | |
if($sortBy){ | |
$condition = " ORDER BY bp.batchPriority ASC"; | |
} | |
$sql = "SELECT | |
bt.semID,bt.batchID,bt.batchName, dept.deptName, dept.departmentDesc, cp.patternName, s.semName,bt.final_semester, bt.batchStartYear, IF ( bp.batchPriority,bp.batchPriority, '') AS batchPriority | |
from batches bt | |
INNER JOIN department dept ON(bt.deptID = dept .deptID ) | |
INNER JOIN course_pattern cp ON(bt.patternID = cp.patternID ) | |
INNER JOIN semesters s ON(bt.semID = s.semID ) | |
LEFT JOIN batch_priority bp ON(bt.batchID = bp.batchID ) | |
WHERE bt.semID = bt.final_semester AND bt.courseTypeID = $courseTypeId $condition"; | |
try { | |
$batch = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/* | |
* save batch priority | |
* @param $batchId | |
* @param $batchPriority | |
* @throws ProfessionalException | |
*/ | |
public function saveBatchPriority($batchId, $batchPriority) | |
{ | |
$batch = NULL; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT batchPriority from batch_priority | |
WHERE batchID = $batchId"; | |
try { | |
$result = $this->executeQueryForList($sql); | |
if($result){ | |
$sql1 = "UPDATE batch_priority set batchPriority='$batchPriority' WHERE batchID = $batchId"; | |
} | |
else{ | |
$sql1 = "INSERT INTO batch_priority (batchPriority, batchID) VALUES ($batchPriority, $batchId)"; | |
} | |
$batch = $this->executeQuery($sql1); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
public function getAllBatchesForDataImport() | |
{ | |
try{ | |
$sql = "SELECT | |
btc.batchID AS id, | |
btc.batchName as name | |
FROM | |
batches btc | |
INNER JOIN | |
department dpt ON btc.deptID = dpt.deptID | |
INNER JOIN | |
semesters sem ON sem.semID = btc.semID | |
order by btc.batchName ASC"; | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Method fro getting batchName with courseTypeId batchStartYear and semId | |
* @input $semId, $batchStartYear, $courseTypeId | |
* @param $courseTypeId | |
* @param $batchStartYear | |
* @param null $semId | |
* @return array|Object | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getBatchDetailsByCourseTypeIdBatchStartYearAndsemIdConsideringSbs($courseTypeId, $batchStartYear, $semId = null) | |
{ | |
$batchDetails = []; | |
$condition = null; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$semId = $this->realEscapeString($semId); | |
if ($semId) { | |
$condition .= " AND b.semID = " . $semId . " "; | |
} | |
try { | |
$sql = | |
"SELECT b.batchID AS batchId, b.batchName from batches b | |
INNER JOIN sbs_relation sbs ON sbs.batchID = b.batchID AND b.semID = sbs.semID | |
INNER JOIN studentaccount st on st.batchID = b.batchID | |
WHERE b.batchHide = 0 AND b.courseTypeID = '".$courseTypeId."' AND b.batchStartYear = '".$batchStartYear."' ".$condition." | |
GROUP BY b.batchID;"; | |
$batchDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batchDetails; | |
} | |
/* | |
* get total no of seats of a batch | |
* @param $batchId | |
* @return object $noOfSeats | |
* @throws ProfessionalException | |
*/ | |
public function getTotalNumberOfSeatsForABatch($batchId) | |
{ | |
$batch = NULL; | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT SUM(numberofSeat) as noOfSeats from admission_deptcourse_seats ads INNER JOIN batches b ON (ads.patterncourseID = b.patterncourseID ) WHERE b.batchID = $batchId"; | |
try { | |
$seats = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $seats; | |
} | |
/** | |
* Get all details exam reg batches by department | |
* @param int $request | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getExamRegBatchesByDepartment($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$condition=""; | |
$result=[]; | |
if($request->examRegId){ | |
$condition .= " AND erb.examregID IN ($request->examRegId)"; | |
} | |
if($request->semId){ | |
$condition .= " AND erb.semID IN ($request->semId)"; | |
} | |
if ($request->deptId) { | |
$condition .= " AND dp.deptID IN ($request->deptId)"; | |
} | |
$sql = "SELECT erb.batchID as batchId,b.batchName,b.batchDesc FROM exam_registration_batches erb | |
INNER JOIN batches b ON b.batchID = erb.batchID | |
INNER JOIN department dp ON dp.deptID = b.deptID | |
WHERE 1=1 $condition"; | |
try { | |
$result = $this->executeQueryForList($sql); | |
return $result; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param $studentId | |
* @return Object | |
* @throws ProfessionalException | |
*/ | |
public function getStudentAllBatchPeriodOfStudyDetails($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$batches=[]; | |
$sql = "SELECT fs.previousBatch as batchId,fs.failedInSemester,fs.hisSemestersInThisbatch,b.batchName,b.batchStartYear,b.batchEndYear,b.final_semester as finalSemester,1 as isPreviousBatch | |
FROM failed_students fs | |
INNER JOIN batches b ON b.batchID = fs.previousBatch | |
WHERE fs.studentID = '$studentId' ORDER BY fs.failedInSemester"; | |
$sqlCurrentBatch = "SELECT sa.batchID as batchId,b.semID,b.batchName,b.batchStartYear,b.batchEndYear,b.final_semester as finalSemester,1 as isCurrentBatch | |
FROM studentaccount sa | |
INNER JOIN batches b ON b.batchID = sa.batchID | |
WHERE sa.studentID = '$studentId'"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
$currentBatch = $this->executeQueryForObject($sqlCurrentBatch); | |
$batches[] = $currentBatch; | |
if(!empty($batches)){ | |
$periodOfStudies = []; | |
$key = 0; | |
foreach ($batches as $preBatch) { | |
$periodOfStudy = new stdClass; | |
if ($preBatch->isPreviousBatch) { | |
$preBatch->semesters = explode(",", $preBatch->hisSemestersInThisbatch); | |
$preBatch->startSem = current($preBatch->semesters); | |
$preBatch->endSem = end($preBatch->semesters); | |
$periodOfStudy->startYear = $preBatch->batchStartYear + floor($preBatch->startSem / 2); | |
$periodOfStudy->endYear = $preBatch->batchStartYear + floor($preBatch->endSem / 2); | |
$periodOfStudy->endYear = ($periodOfStudy->startYear == $periodOfStudy->endYear) ? $periodOfStudy->startYear + 1: $periodOfStudy->endYear; | |
$periodOfStudy->endSem = $preBatch->endSem; | |
} else if ($preBatch->isCurrentBatch) { | |
$periodOfStudy->prevBatchAddSem = (floor($periodOfStudies[$key - 1]->endSem / 2) < 1 ) ? 1 : floor($periodOfStudies[$key - 1]->endSem / 2); | |
$periodOfStudy->startYear = $key > 0 ? ($preBatch->batchStartYear + $periodOfStudy->prevBatchAddSem) : $preBatch->batchStartYear; | |
$periodOfStudy->endYear = $preBatch->batchEndYear; | |
} | |
$periodOfStudy->periodOfStudy = $periodOfStudy->startYear . " - " . substr($periodOfStudy->endYear, -2);; | |
$periodOfStudies[$key] = $periodOfStudy; | |
$key++; | |
} | |
$periodOfStudies = array_column($periodOfStudies, 'periodOfStudy'); | |
} | |
return $periodOfStudies; | |
} catch (Exception $exception) { | |
throw new ProfessionalException($exception->getCode(), $exception->getMessage()); | |
} | |
} | |
/* | |
* get hall ticket issue status by batch | |
* @param $request | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function getExamRegBatchesHallTicketIssuedStatus($request) | |
{ | |
$batch = NULL; | |
$request = $this->realEscapeObject($request); | |
$sql = "SELECT batchID as batchId,isHallTicketIssued from exam_registration_batches WHERE examregID = '$request->examRegId' AND batchID IN ($request->batchId)"; | |
try { | |
$batch = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batch; | |
} | |
/* | |
*set hall ticket issue status by batch | |
* @param $request | |
* @return object $batch | |
* @throws ProfessionalException | |
*/ | |
public function setExamRegBatchesHallTicketIssuedStatus($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = "UPDATE exam_registration_batches set isHallTicketIssued = '$request->issueHallTicket' WHERE examregID = '$request->examRegId' AND batchID IN ($request->batchId)"; | |
try { | |
$this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/* | |
* Get batch properties for filters | |
* @param $request | |
* @return [{"id":"","name":""}] | |
* @throws ProfessionalException | |
*/ | |
public function getBatchesWithRequestForFilter($request, $out) | |
{ | |
$request = $this->realEscapeObject($request); | |
$where = []; | |
$request->startYear?$where[] = " b.batchStartYear = '$request->startYear' ":""; | |
$request->batchId?$where[] = " b.batchID = $request->batchId ":""; | |
$request->semId?$where[] = " b.semID = $request->semId " :""; | |
$request->courseTypeId?$where[] = " b.courseTypeID = $request->courseTypeId ":""; | |
$request->deptId?$where[] = " b.deptID = $request->deptId ":""; | |
$select = []; | |
$groupBy = []; | |
$orderBy = []; | |
switch ($out) { | |
case 'START_YEARS': | |
$select = ['b.batchStartYear as id','b.batchStartYear as name']; | |
$groupBy = ['b.batchStartYear']; | |
$orderBy = ['b.batchStartYear']; | |
break; | |
case 'BATCHES': | |
$select = ['b.batchID as id','b.batchName as name']; | |
$groupBy = ['b.batchID']; | |
$orderBy = ['b.batchID']; | |
break; | |
case 'DEPARTMENTS': | |
$select = ['d.deptID as id','d.deptName as name']; | |
$groupBy = ['d.deptID']; | |
$orderBy = ['d.deptID']; | |
break; | |
case 'COURSE_TYPES': | |
$select = ['ct.courseTypeID as id','ct.typeName as name']; | |
$groupBy = ['ct.courseTypeID']; | |
$orderBy = ['ct.courseTypeID']; | |
break; | |
default: | |
# code... | |
break; | |
} | |
$sql = "SELECT DISTINCT " . ($select ? implode(' , ', $select) : "*") . " from batches b | |
INNER JOIN course_type ct ON ct.courseTypeID = b.courseTypeID | |
INNER JOIN department d ON d.deptID = b.deptID | |
" . ($where ? " WHERE " . implode(' AND ', $where) : "") . " | |
" . ($groupBy ? " GROUP BY " . implode(' , ', $groupBy) : "") . " | |
" . ($orderBy ? " ORDER BY " . implode(' , ', $orderBy) : "") . " | |
"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchNameOrdered($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = "SELECT b.batchID from batches b WHERE b.batchID IN (" . implode(",", $request) . ") ORDER BY b.batchName"; | |
try { | |
$batchIds = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batchIds; | |
} | |
public function checkCondonationCount($studentID) | |
{ | |
try { | |
$studentID = $this->realEscapeString($studentID); | |
$sql = "SELECT count(id) as count FROM condonations_students WHERE student_id = '$studentID'"; | |
$result = $this->executeQueryForObject($sql); | |
return $result->count; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function applyAndPrint($studentID) | |
{ | |
try{ | |
$studentID = $this->realEscapeString($studentID); | |
$batchID = $_SESSION['batchID']; | |
$batch = $this->getBatchDetailsById($batchID); | |
$semID = $batch->currentSemId; | |
$sql = "INSERT ignore INTO condonations_students(batch_id,sem_id,student_id,created_by,created_date) values('$batchID','$semID','$studentID','$studentID',NOW())"; | |
$this->executeQuery($sql); | |
return true; | |
} | |
catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchesByCourseTypeAndStartYear($courseType, $courseStartYear) | |
{ | |
$courseType = $this->realEscapeArray($courseType); | |
$courseStartYear = $this->realEscapeArray($courseStartYear); | |
$cond = ""; | |
if(count($courseType) != 0) | |
{ | |
$courseTypeIds = implode(',',$courseType); | |
$cond = " WHERE courseTypeID IN ($courseTypeIds)"; | |
} | |
if(count($courseStartYear) != 0) | |
{ | |
$courseStartYears = implode(',',$courseStartYear); | |
$cond = $cond ?$cond." AND batchStartYear IN ($courseStartYears)" : $cond." WHERE batchStartYear IN ($courseStartYears)"; | |
} | |
$sql = "SELECT batchID ,batchName FROM batches $cond"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
public function checkCurrentCondonations($batchID, $semID, $studentID) | |
{ | |
$sql = "SELECT id FROM condonations_students WHERE student_id = '$studentID' and sem_id = '$semID' and batch_id = '$batchID'"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchesBySemIdAndDeptIdAndBatchStartYear($startYear,$departmentIds,$semIds) | |
{ | |
$startYear = $this->realEscapeArray($startYear); | |
$startYearString = implode(",",$startYear); | |
$departmentIds = $this->realEscapeArray($departmentIds); | |
$departmentIdString = implode(",",$departmentIds); | |
$semIds = $this->realEscapeArray($semIds); | |
$semIdsString = implode(",",$semIds); | |
$sql ="SELECT batchID,batchName from batches where deptID in ($departmentIdString) and batchStartYear in ($startYearString) and semID in ($semIdsString)"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getEvaluationsByBatchId($batchIds,$type = "") | |
{ | |
$batchIds = $this->realEscapeArray($batchIds); | |
$batchIds = implode(",",$batchIds); | |
$cond = $type ? " AND staffeval_type = '$type'":""; | |
try { | |
$sql = "SELECT | |
DISTINCT | |
st.eval_typeID, | |
st.eval_name, | |
st.instruction, | |
st.question_per_page, | |
st.loginType, | |
st.is_locked | |
FROM | |
staffeval_type st | |
inner join staffeval_studentanswers ss on | |
ss.eval_typeID = st.eval_typeID | |
where | |
ss.batchID in ($batchIds) | |
$cond | |
ORDER BY | |
st.eval_typeID desc"; | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getUnassignedEvaluations() | |
{ | |
$sql = " SELECT DISTINCT | |
eval_typeID, | |
eval_name, | |
instruction, | |
question_per_page, | |
loginType, | |
is_locked | |
FROM staffeval_type | |
WHERE eval_typeID NOT IN (SELECT eval_typeID FROM staffeval_studentanswer_sbsids) | |
order by eval_typeID desc"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchesByDepartmentIdAndStartYear($deptIds, $startYears) | |
{ | |
try { | |
$deptIds = $this->realEscapeArray($deptIds); | |
$departmentIds = implode(',',$deptIds); | |
$startYears = $this->realEscapeArray($startYears); | |
$years = implode(',',$startYears); | |
$sql = "SELECT batchID,batchName from batches WHERE deptID in ($departmentIds) and batchStartYear in ($years)"; | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getEvaluationsByBatchIdForResult($batchId, $semId, $type) | |
{ | |
$batchId = $this->realEscapeArray($batchId); | |
$semId = $this->realEscapeArray($semId); | |
$batchIds = implode(",", $batchId); | |
$semIds = implode(",", $semId); | |
$type = $this->realEscapeString($type); | |
try{ | |
$sql = "SELECT | |
et.eval_typeID , | |
et.eval_name, | |
COUNT(DISTINCT ss.batchID) AS count | |
FROM | |
staffeval_type et | |
LEFT JOIN staffeval_studentanswers ss ON | |
ss.eval_typeID = et.eval_typeID | |
WHERE ss.batchID IN ($batchIds) AND ss.semID IN ($semIds) ".($type ? "and et.staffeval_type = '$type'" : "")." | |
group by | |
et.eval_typeID | |
ORDER BY et.eval_typeID DESC, ss.batchID DESC;"; | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchSubsidiaryCourseName($batchId) | |
{ | |
try { | |
$batchId = $this->realEscapeString($batchId); | |
if($batchId){ | |
$sql = "SELECT sc.id,sc.subsiderycoursename FROM subsiderycourse sc | |
INNER JOIN batches b ON b.subsideryID = sc.id | |
WHERE b.batchID IN ($batchId)"; | |
return $this->executeQueryForObject($sql); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getAllbatchesForSec($courseTypeId, $sem, $batchStartYears) | |
{ | |
try{ | |
$courseTypeId = $this->realEscapeArray($courseTypeId); | |
$courseTypeId = implode(",", $courseTypeId); | |
$sem = $this->realEscapeString($sem); | |
$batchStartYears = $this->realEscapeArray($batchStartYears); | |
$batchStartYears = implode(",", $batchStartYears); | |
$sql = "SELECT | |
b.batchID , | |
b.batchName , | |
b.batchDesc , | |
b.batchStartYear , | |
GROUP_CONCAT(bt.staffID) as staffID, | |
bt.semID , | |
GROUP_CONCAT( s.staffName) as staffName | |
from | |
batches b | |
left join batch_tutor bt | |
on bt.batchID = b.batchID | |
and bt.semID = b.semID | |
left join staffaccounts s on s.staffID = bt.staffID | |
WHERE | |
b.batchStartYear in ($batchStartYears) | |
and b.courseTypeID in ($courseTypeId) | |
and b.semID = '$sem' | |
group by b.batchID"; | |
return $this->executeQueryForList($sql); | |
} | |
catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function addBatchesToSec($batch, $app) | |
{ | |
try{ | |
$adminStaff = $_SESSION['adminID']; | |
$batch = $this->realEscapeObject($batch); | |
$app = $this->realEscapeObject($app); | |
$sqlCheck = "SELECT id from sec_batches WHERE batch_id = $batch->batchID and sec_id=$app->id"; | |
$duplicateCheck = $this->executeQueryForObject($sqlCheck)->id; | |
if($duplicateCheck) | |
{ | |
return false; | |
} | |
if(!$duplicateCheck) | |
{ | |
$result = []; | |
$staffIds = explode(",",$batch->staffID); | |
foreach ($staffIds as $staffId) { | |
$sql = "INSERT INTO sec_batches (batch_id, sem_id, staff_id, created_by, created_time, sec_id) | |
VALUES ($batch->batchID, $batch->semID, $staffId, $adminStaff, NOW(), $app->id);"; | |
$result[] = $this->executeQuery($sql); | |
} | |
return $result; | |
} | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchesFromsec($app) | |
{ | |
$app = $this->realEscapeObject($app); | |
try{ | |
$sql = "SELECT | |
s.id, | |
b.batchID , | |
b.batchName , | |
s2.staffName , | |
s2.staffID | |
from | |
sec_batches s | |
inner join batches b on | |
b.batchID = s.batch_id | |
inner join staffaccounts s2 on s2.staffID = s.staff_id | |
WHERE s.sec_id = $app->id"; | |
return $this->executeQueryForList($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function deleteApplication($applicationID, $hardDelete) | |
{ | |
try{ | |
$applicationID = $this->realEscapeString($applicationID); | |
$hardDelete = $this->realEscapeString($hardDelete); | |
if($hardDelete) | |
{ | |
$sql = "DELETE from sec_batches WHERE sec_id = '$applicationID'"; | |
$this->executeQuery($sql); | |
} | |
$sql = "DELETE from sec_application WHERE id = '$applicationID'"; | |
return $this->executeQuery($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function checkForSecBatch($batchID) | |
{ | |
try{ | |
$batchID = $this->realEscapeString($batchID); | |
$sql = "SELECT sb.id as sec_bid, | |
sb.sec_id | |
FROM batches b | |
inner join sec_batches sb on sb.batch_id = b.batchID | |
and b.semID =2 | |
and b.batchID ='$batchID' ORDER BY sb.id DESC"; | |
return $this->executeQueryForObject($sql); | |
// return $exists ? true : false; | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getAssignedSecBatchesForStaff($staffID) | |
{ | |
try{ | |
$staffID = $this->realEscapeString($staffID); | |
$sql = " | |
SELECT | |
sa.id, | |
sa.name, | |
sa.`from` , | |
sa.`to`, | |
sa.description , | |
sb.id as secBatchId, | |
b.batchName | |
FROM | |
sec_batches sb | |
inner join batch_tutor bt on | |
bt.staffID = sb.staff_id | |
inner join sec_application sa on sa.id = sb.sec_id | |
INNER join batches b on b.batchID = sb.batch_id and b.semID =2 WHERE bt.staffID = '$staffID' | |
GROUP BY sb.id; | |
"; | |
return $this->executeQueryForList($sql); | |
} | |
catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getSecStats($applicationID) | |
{ | |
try{ | |
$applicationID = $this->realEscapeString($applicationID); | |
$result = new stdClass(); | |
//total students | |
$sqlTotalStudents = "SELECT | |
count(DISTINCT studentID) as studentCount | |
from | |
studentaccount s | |
inner join sec_batches sb on | |
sb.batch_id = s.batchID | |
inner join sec_application sa on sa.id = sb.sec_id | |
WHERE | |
sa.id = $applicationID"; | |
$result->totalCount = $this->executeQueryForObject($sqlTotalStudents)->studentCount; | |
//totalSubmissions | |
$sqlTotalSubmittedStudents = "SELECT | |
COUNT(ss.student_id) as studentCount | |
from | |
sec_students ss | |
inner join sec_batches sb on sb.id = ss.sec_batch_id | |
inner join sec_application sa on sa.id = sb.sec_id | |
WHERE sa.id = $applicationID ;"; | |
$result->totalSubmissions = $this->executeQueryForObject($sqlTotalSubmittedStudents)->studentCount; | |
//totalapprovals | |
$sqlTotalApprovedStudents = "SELECT | |
COUNT(ss.student_id) as studentCount | |
from | |
sec_students ss | |
inner join sec_batches sb on sb.id = ss.sec_batch_id | |
inner join sec_application sa on sa.id = sb.sec_id | |
WHERE sa.id = $applicationID and ss.status =1;"; | |
$result->totalApprovals = $this->executeQueryForObject($sqlTotalApprovedStudents)->studentCount; | |
return $result; | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getSecNameBySecBatchID($secBatchID) | |
{ | |
try{ | |
$secBatchID = $this->realEscapeString($secBatchID); | |
$sql = "SELECT sa.name from sec_batches sb inner join sec_application sa on sa.id = sb.sec_id WHERE sb.id =$secBatchID"; | |
return $this->executeQueryForObject($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getStudentState($secBatchID , $studentID) | |
{ | |
try{ | |
$secBatchID = $this->realEscapeString($secBatchID); | |
$studentID = $this->realEscapeString($studentID); | |
$currentDate = date("Y-m-d"); | |
$sql = "SELECT | |
ss.id | |
from | |
sec_students ss | |
inner join sec_batches sb on | |
sb.id = ss.sec_batch_id | |
inner join sec_application sa on sa.id = sb.sec_id | |
WHERE | |
ss.sec_batch_id = $secBatchID | |
AND ss.student_id = $studentID | |
and ss.status IN (1,2) | |
AND '$currentDate' BETWEEN sa.`from` AND sa.`to` ;"; | |
$result = $this->executeQueryForObject($sql)->id ? true : false; | |
return $result; | |
} | |
catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getBatchesByDeptIds($deptIDs) | |
{ | |
try{ | |
$deptIDs = $this->realEscapeArray($deptIDs); | |
if(count($deptIDs)) | |
{ | |
$deptIDs = implode(',',$deptIDs); | |
$sql = "SELECT batchID,batchName FROM batches WHERE deptID in ($deptIDs) ORDER BY batchID DESC"; | |
return $this->executeQueryForList($sql); | |
} | |
else | |
{ | |
return []; | |
} | |
} | |
catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getStudentDataBySecAppId($applicationID) | |
{ | |
try{ | |
$applicationID = $this->realEscapeString($applicationID); | |
$sql = "SELECT | |
s.studentID, | |
s.studentName , | |
s.regNo , | |
s.rollNo , | |
s.fatherName, | |
ss.item_name , | |
ss.resource_id , | |
ss.remarks , | |
ss.status , | |
ss.sec_batch_id, | |
'$applicationID' as applicationID, | |
ss.allowSpecialAccess, | |
b.batchID, | |
b.batchName, | |
ss.updated_date | |
from | |
studentaccount s | |
inner join batches b on s.batchID = b.batchID | |
left join sec_students ss on ss.student_id = s.studentID | |
WHERE | |
s.batchID in ( | |
SELECT | |
DISTINCT batch_id | |
FROM | |
sec_batches sb | |
WHERE | |
sb.sec_id = $applicationID) | |
ORDER BY s.studentName ASC, ss.updated_date DESC"; | |
return $this->executeQueryForList($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function updateApplicationOfStudent($updation,$batchSecId,$studentId) | |
{ | |
try{ | |
$updation = $this->realEscapeString($updation); | |
$batchSecId = $this->realEscapeString($batchSecId); | |
$studentId = $this->realEscapeString($studentId); | |
$applicationID = $this->realEscapeString($applicationID); | |
if($updation == "APPROVE") | |
{ | |
$status = 1; | |
$remarks = "Approved by admin"; | |
} | |
elseif ($updation == "REJECT") { | |
$status = 0; | |
$remarks = "Rejected by admin"; | |
} | |
else{ | |
$status = 0; | |
} | |
$sql = "UPDATE sec_students SET status = $status,updated_date = NOW(),remarks = '$remarks' WHERE student_id = $studentId AND sec_batch_id = $batchSecId"; | |
return $this->executeQuery($sql)->sqlResult ? true : false; | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function checkForSecBatchTimeRange($secID) | |
{ | |
try{ | |
$secID = $this->realEscapeString($secID); | |
$currentDate = date('Y-m-d H:i:s'); | |
$sql = "SELECT sa.id FROM sec_application sa WHERE '$currentDate' BETWEEN sa.`from` and sa.`to` and sa.id = $secID"; | |
return $this->executeQueryForObject($sql) ? true :false; | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getnoDueReportsByBatchAndSectionIds($batchIDs) | |
{ | |
try{ | |
$batchIDs = $this->realEscapeArray($batchIDs); | |
$batchIDs = implode(",",$batchIDs); | |
$sql = "SELECT | |
nds.id ,s.studentID ,s.studentName, s.admissionNo ,b.batchID ,b.batchName ,nds.is_cleared_detailed ,d.deptID ,d.deptName | |
from | |
no_dues_student nds | |
inner join studentaccount s on | |
s.studentID = nds.student_id | |
inner join no_dues_section_batch_sem ndsbs ON ndsbs.id = nds.batch_sem_no_due_id | |
inner join batches b on b.batchID = ndsbs.batch_id and b.semID = ndsbs.sem_id | |
inner join department d on d.deptID = b.deptID | |
AND b.batchID in ($batchIDs)"; | |
return $this->executeQueryForList($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function checkForSpecialPermission($studentID) | |
{ | |
try{ | |
$studentID = $this->realEscapeString($studentID); | |
$sql = "SELECT allowSpecialAccess FROM sec_students ss WHERE ss.student_id =$studentID"; | |
$results = $this->executeQueryForList($sql); | |
foreach($results as $result) | |
{ | |
if($result->allowSpecialAccess) | |
{ | |
return true; | |
} | |
} | |
return false; | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function giveSpecialAccessToStudent($applicationID, $studentId) | |
{ | |
$applicationID = $this->realEscapeString($applicationID); | |
$studentId = $this->realEscapeString($studentId); | |
try{ | |
$studentDetails = StudentService::getInstance()->getStudentDetailsById($studentId); | |
$sql = "SELECT id FROM sec_batches WHERE sec_id =$applicationID and batch_id =$studentDetails->batchID"; | |
$secBatchDetails = $this->executeQueryForObject($sql); | |
if($secBatchDetails) | |
{ | |
$sql = "SELECT id,allowSpecialAccess from sec_students ss WHERE ss.sec_batch_id = $secBatchDetails->id and student_id = $studentId"; | |
$checkEntry = $this->executeQueryForObject($sql); | |
if($checkEntry->id) | |
{ | |
$allow = $checkEntry->allowSpecialAccess ? 0:1; | |
$sqlInsertOrUpdate = "UPDATE sec_students SET allowSpecialAccess = $allow,updated_date = NULL WHERE id = $checkEntry->id"; | |
} | |
else{ | |
$adminId = $_SESSION['adminID']; | |
$sqlInsertOrUpdate = "INSERT INTO sec_students (student_id, | |
sec_batch_id, | |
created_by, | |
updated_by, | |
created_date, | |
updated_date, | |
status, | |
item_name, | |
resource_id, | |
remarks, | |
allowSpecialAccess) | |
VALUES($studentId, | |
$secBatchDetails->id, | |
$adminId, | |
NULL, | |
NOW(), | |
NULL, | |
0, | |
'', | |
'', | |
'', | |
1);"; | |
} | |
$this->executeQuery($sqlInsertOrUpdate); | |
} | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
public function getBatchesBySecId($applicationID,$deptIds) | |
{ | |
try{ | |
$applicationID = $this->realEscapeString($applicationID); | |
$deptIds = $this->realEscapeArray($deptIds); | |
$deptIds = implode(",", $deptIds); | |
$sql = "SELECT DISTINCT b.batchID ,b.batchName FROM sec_batches sb inner join batches b on sb.batch_id = b.batchID WHERE sb.sec_id =$applicationID and b.deptID in ($deptIds) "; | |
return $this->executeQueryForList($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getStudentsOfBatchSec($batchIds, $individualSearch, $searchValue,$status) | |
{ | |
try{ | |
$WHERE = []; | |
$batchIds = $this->realEscapeArray($batchIds); | |
$batchIds = implode(",",$batchIds); | |
if($batchIds) | |
{ | |
$WHERE[] = " s.batchID in ($batchIds)"; | |
} | |
$individualSearch = $this->realEscapeString($individualSearch); | |
$searchValue = $this->realEscapeString($searchValue); | |
if($searchValue) | |
{ | |
$WHERE[] = " $individualSearch LIKE '%".$searchValue."%'"; | |
} | |
$status = $this->realEscapeString($status); | |
if($status == "2") | |
{ | |
$WHERE[] = " status = 0 AND ss.updated_date IS NULL "; | |
} | |
elseif($status == "0") | |
{ | |
$WHERE[] = " status = 0 AND ss.updated_date IS NOT NULL"; | |
} | |
elseif($status != "") | |
{ | |
$WHERE[] = trim($status) == "NULL" ? " status IS NULL ":" status = ".$status; | |
} | |
$condition = implode(" AND ",$WHERE); | |
$sql = "SELECT | |
s.studentID , | |
s.studentName , | |
s.regNo , | |
s.batchID , | |
b.batchName , | |
f.staffID , | |
f.staffName, | |
case | |
WHEN ss.status = 1 THEN 'Approved' | |
WHEN ss.status = 0 THEN 'Rejected' | |
ELSE 'Not Applied' | |
end as Status, | |
ss.updated_date as updated | |
FROM | |
studentaccount s | |
left join sec_students ss on | |
ss.student_id = s.studentID | |
inner join batches b on | |
b.batchID = s.batchID | |
left join sec_batches sb on | |
sb.batch_id = s.batchID | |
left join staffaccounts f on | |
f.staffID = sb.staff_id | |
WHERE | |
$condition"; | |
return $this->executeQueryForList($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function secDetails($secID) | |
{ | |
try{ | |
$secID = $this->realEscapeString($secID); | |
$sql = "SELECT * FROM sec_application sa WHERE sa.id = $secID"; | |
return $this->executeQueryForObject($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getAllAssignedFaculties() | |
{ | |
try{ | |
$sql = "SELECT ndsf.id,ndsf.staff_id ,ndsf.section_id,nds.section_name FROM no_dues_section_faculty ndsf INNER JOIN no_dues_sections nds on nds.id = ndsf.section_id"; | |
return $this->executeQueryForList($sql); | |
}catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get start years of current batches | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @throws ProfessionalException | |
*/ | |
public function getAllDistinctBatchStartYears() | |
{ | |
$batches = []; | |
$sql = "select distinct batchStartYear as id , batchStartYear as name from batches WHERE batchStartYear IS NOT NULL ORDER BY batchStartYear DESC"; | |
try { | |
$batches = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $batches; | |
} | |
/* | |
* get total no of seats of a batch | |
* @return object [{id:"",name:""}] | |
* @throws ProfessionalException | |
*/ | |
public function getEntintiesForV4($request) | |
{ | |
$batchId = $this->realEscapeString($request->batchId); | |
$programId = $this->realEscapeString($request->programId); | |
$departmentId = $this->realEscapeString($request->deptId); | |
$action = $this->realEscapeString($request->action); | |
switch ($action) { | |
case 'PROGRAM': | |
$select = "p.id,p.name"; | |
$groupBy = "p.id"; | |
break; | |
case 'BATCH': | |
$select = "b.batchID as id,b.batchName as name,bct.is_pg"; | |
$groupBy = "b.batchID"; | |
break; | |
case 'DEPARTMENT': | |
$select = "d.deptID as id, d.deptName as name"; | |
$groupBy = "d.deptID"; | |
break; | |
case 'SEMESTER': | |
$select = "s.semID as id, s.semName as name"; | |
$groupBy = "s.semID"; | |
break; | |
} | |
$where = []; | |
$programId && $action != "PROGRAM" ? $where [] = " p.id = '$programId' " : null; | |
$batchId && $action != "BATCH" ? $where [] = " b.batchID = '$batchId' " : null; | |
$departmentId && $action != "DEPARTMENT" ? $where [] = " d.deptID = '$departmentId' " : null; | |
$sql = "SELECT | |
$select | |
FROM program p | |
INNER JOIN `groups` g ON g.properties->>'$.programId' = p.id | |
INNER JOIN `batches` b ON b.groups_id = g.id | |
INNER JOIN `program_department_relation` pd ON pd.program_id = p.id | |
INNER JOIN `department` d ON d.deptID = pd.department_id | |
INNER JOIN `semesters` s ON s.semID = b.semID | |
LEFT JOIN `batch_course_type` bct ON bct.id = b.patternID | |
".($where ? " WHERE ".implode(' AND ',$where) : "")." | |
GROUP BY $groupBy;"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getStudentAcademicStatus($studentId) | |
{ | |
$academicDetails = null; | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT spa.academic_status , g.properties from student_program_account spa INNER JOIN `groups` g ON g.id = spa.current_batch_id where student_id = ".$studentId.""; | |
try { | |
$academicDetails = $this->executeQueryForObject ( $sql ); | |
} catch ( \Exception $e ) { | |
throw new ProfessionalException ( $e->getCode (), $e->getMessage () ); | |
} | |
return $academicDetails; | |
} | |
public function getCourseTypeFrombatchID($batchID) | |
{ | |
try{ | |
$batchID = $this->realEscapeString($batchID); | |
$sql = "SELECT ct.courseTypeID as id,ct.typeName as name from batches b | |
INNER JOIN `groups` g ON g.id = b.groups_id | |
INNER JOIN program p ON p.id = g.program_id | |
INNER JOIN course_type ct ON ct.courseTypeID = p.course_type_id | |
WHERE b.batchID = $batchID"; | |
return $this->executeQueryForObject($sql); | |
} catch ( \Exception $e ) { | |
throw new ProfessionalException ( $e->getCode (), $e->getMessage () ); | |
} | |
} | |
/** | |
* get batch details | |
* | |
* get all batch details by program id | |
* | |
* @param String $programID Unique program identifier | |
* @return ArrayOfObjects | |
* @throws conditon | |
**/ | |
public function getBatchesByProgramId($programId) | |
{ | |
try{ | |
$programId = $this->realEscapeString($programId); | |
$sql = "SELECT b.batchID from batches b left join `groups` g on g.id = b.groups_id WHERE g.program_id ='$programId'"; | |
$batchIds = $this->executeQueryForList($sql); | |
$batches = []; | |
foreach ($batchIds as $batchId) { | |
$batches[] = $batchId->batchID; | |
} | |
if(count($batches) > 0) | |
{ | |
$condition = " AND b.batchID IN (".implode(",",$batches).") "; | |
} | |
else{ | |
$condition = ""; | |
} | |
$sql2 = "SELECT b.batchID as id, | |
b.batchName as name, | |
b.batchDesc as description, | |
b.batchStartYear as startYear, | |
b.batchEndYear as endYear, | |
b.batchCreateTime as createdDate, | |
b.semID as currentSemId,s.semName,d.deptName,b.batchHide,b.patterncourseID,b.subsideryID,b.campus_typeID,b.isPassOut,b.tcIssueDate,b.stream FROM batches b | |
INNER JOIN semesters s ON b.semID=s.semID | |
INNER JOIN department d ON b.deptID=d.deptID | |
WHERE 1=1 $condition ORDER BY b.batchName"; | |
return $this->executeQueryForList($sql2); | |
}catch ( \Exception $e ) { | |
throw new ProfessionalException ( $e->getCode (), $e->getMessage () ); | |
} | |
} | |
public function getFailedBatchDetailes() | |
{ | |
$sql = "SELECT batchID,deptID,semID FROM batches WHERE batchName='" . Batch::BATCH_FAILED_NAME . "'"; | |
try { | |
$failedBatchDetailes = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $failedBatchDetailes; | |
} | |
} |