Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 189 |
CRAP | |
0.00% |
0 / 4145 |
| SubjectService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 189 |
440232.00 | |
0.00% |
0 / 4145 |
| __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 |
|||
| getSubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| searchSubjects | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 80 |
|||
| getCountOfStudentsEnrolledToASubject | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 9 |
|||
| getSubjectStaffDetailsBySubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getSemSubjects | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getSemElectiveSubjects | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getTutorSubjectIdIfExists | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 11 |
|||
| createTutorSubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
| getSubjectDetailsBySbsId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| getSbsDetailsByBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getSbsDetailsByStaffId | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 22 |
|||
| isSubjectAssignedToBatch | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 13 |
|||
| deleteSubjectById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getPseudoSubjectDetailsById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getPseudoSubjectBatchDetailsById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getPseudoSubjectSbsIdsByStaffId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getPseudoSubjectSbsIdsById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
| getSubjectsByHandlingDepartmentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getSubjectsFromDepartments | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| isPseudoSubjectBySbsId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
| getPseudoSubjectBySbsId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getPseudoSubjectStudentById | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getNumberOfStudentsInAPseudoSubjectByPseudoSubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getSbsIdsBySubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| checkSubjectCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSBSIdBySubjectIdAndStaffIdAndSemId | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 31 |
|||
| getAllSubjectCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getCategoryCodes | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| saveCategoryCode | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
| deleteCategoryCode | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| listPaperTypes | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| savePaperType | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| deletePaperType | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getCourseTypes | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSubjectDetailsOfAbsentees | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 27 |
|||
| updateFinalizePsuedoSubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSubjectCategoryByName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getAllSecondLanguages | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSubjectsByStudent | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 26 |
|||
| getSbsDetailsBysubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectByCourseTypeSemCategory | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
| getSubjectsHavingGradeScheme | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
| getSubjectsByStaffAndBatch | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 25 |
|||
| getSubjectsByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectDetailsByDate | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 18 |
|||
| removeOrUpdateDuplicateSubjects | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 40 |
|||
| getRepeatingSubjectsBySubjectCode | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
| findValidSubjectFromRepeatingSubjects | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 39 |
|||
| updateCorrectSubjectIdToAllRefTables | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 24 |
|||
| checkSubjectAlreadyMappedThenDeleteFromExamSubjectCredit | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| checkSubjectAlreadyMappedThenDeleteFromSBSRelation | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| checkSubjectAlreadyMappedThenDeleteFromInternalMarks | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| checkSubjectAlreadyMappedThenDeleteFromInternalMarksSettings | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| checkSubjectAlreadyMappedThenDeleteFromExamSubjectRegistration | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
| insertIfNotExistSemesterSubjectRelation | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 17 |
|||
| insertIfNotExistDepartmentSubjectRelation | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
| deleteSubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| findCountOfSubjectReferences | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 33 |
|||
| getSubjectsBySubBatch | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 26 |
|||
| getAllSubjectsByCourseTypeId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| searchSubjectByString | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectsByCategoryBatchSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
| getSecondlanguageDetailsByID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSupplementeryExamSubjectBySubjectIDStudentIDandCourseType | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 23 |
|||
| getStudentSubjectIDBySubjectGroupID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| getSubjectBySbsId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectsByRequest | |
0.00% |
0 / 1 |
420.00 | |
0.00% |
0 / 62 |
|||
| searchSubjectCategories | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 29 |
|||
| searchSubjectsWithSubjectCategories | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 29 |
|||
| getAllSubjectHandlingDepartments | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
| getAllHandlingDepartmentSubjectsOfExamRegistration | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 51 |
|||
| getPaperTypeByName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSecondLanguageByName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| insertSubjectFromExcel | |
0.00% |
0 / 1 |
1056.00 | |
0.00% |
0 / 140 |
|||
| getSubjectByCodeAndYear | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
| getAllSubjectsByDepartmentAndSemester | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 20 |
|||
| getAllSyllabusYearsByDepartmentIds | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 13 |
|||
| getAllSubjectGroups | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
| getSubjectGroupSubjectsByBatchSem | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 27 |
|||
| getSubjectsBySem | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| getBasicSubjectDetailsBySubjectId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| getAllCourseMaterials | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 18 |
|||
| copyCourseMaterials | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
| getSubjectToAssignCredits | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 42 |
|||
| saveSubjectsCredit | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 40 |
|||
| getSubjectGroupSubjectType | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 29 |
|||
| getSubjectNames | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getStudentGroupedSubjects | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getStudentGroupedSubjectsSyllabusName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 20 |
|||
| getGroupedSubjectDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getSubjectByCode | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 20 |
|||
| getSubjectsBySemInOrder | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 20 |
|||
| getPseudoSubjectIds | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 24 |
|||
| getSupplySubjectsBySupplyExamRegId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
| getSubjectCategoriesBySubject | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 24 |
|||
| getSubjectListByBatchIdAndSemId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 21 |
|||
| getSubjectInternalExternalStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getBatchSubjectCategoryDetails | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 38 |
|||
| getSbsDetailsByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| addBatchSemSubjectCategoryRelation | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 23 |
|||
| getSubjectByBatchIDAndSubjectCode | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getDistinctSubjectCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getSubjectCategoryBySubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
| getMarklistSubjectGroup | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 38 |
|||
| getBatchSemGroupedSubjectDetails | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 40 |
|||
| getSubjectListBySbs | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
| getSecondLanguageBySubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 21 |
|||
| copyBatchSemSubjectCategoryRelation | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 32 |
|||
| getSubjectsByBatchAndSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| mapSemesterSubjectsToImportMarks | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 32 |
|||
| getSbsDetailsBysubjectBatchAndSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getConcatenatedSubjectNameBySubjectIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 7 |
|||
| getSecondLanguageDetailsBySubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
| getSecondLanguagesBySubjectIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
| getSubjectDetailsBySubjectIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
| getStudentSecLangExamSubjectByRequest | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 25 |
|||
| getAllSubjectsByRequest | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 33 |
|||
| getSyllabusYearOfSbsSubjects | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 16 |
|||
| getSubjectDetailsByDeptIdSemIdCourseTypeId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
| getSbsSubjectSyllabusYearByDeptIdSemIdCourseTypeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSubjectToAssignInternalMarkSettings | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 39 |
|||
| saveInternalMarkSettings | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
| getAllSubjectsByBatchIdAndSemId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 22 |
|||
| getOpenCourseSubjectsByRequest | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
| getOpenCourseSubjectsBatchesDetailsByRequest | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
| getOpenCourseSubjectsStudentsMarksDetailsByRequest | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 20 |
|||
| getNormalisedMarks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
| getNormalisedMarksOfPseudoSubject | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getSubjectPaperTypeDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getExamSubjectsByExamRegistrationRequest | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 51 |
|||
| getSubjectsByStaffBatchSem | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 29 |
|||
| getSubjectsByStaffIdAndBatchId | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 31 |
|||
| subjectCreditDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectByCourseTypeSemIdAndBatchStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getRegularExamSubjectsByStudentIdAndRegId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 35 |
|||
| getRegularExamSubjectsByStudentIdAndExamRegId | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 56 |
|||
| getExamSubjectsByExamRegistrationAndDepartment | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 33 |
|||
| getSubjectCreditDetailsByRequest | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 23 |
|||
| getSubjectsPatternIdAndYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 27 |
|||
| getDepartmentWiseubjectDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 29 |
|||
| getStudentSecLangAndElective | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 37 |
|||
| getAllSubjectsByHandlingDepartmentId | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 19 |
|||
| getSubjectCategoryBySubjectId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
| getSubjectInstitutionalAverage | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 19 |
|||
| saveSubjectInstitutionalAverage | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
| getHallTicketSubjectCategory | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 19 |
|||
| saveHallTicketSubjectCategory | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 31 |
|||
| assignSelectedSubjectGroups | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
| deleteSelectedAssignSubjectGroups | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getStudentAppliedSubjectDetails | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 59 |
|||
| getAllExamSubjectByRequest | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 19 |
|||
| getCommonSubjectsWithBatches | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 21 |
|||
| getAllSubjectByRequest | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 13 |
|||
| getAllSubjectCategoryUsedInABatch | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| getCategorySubjectByRequest | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
| getInternalSubjectsBySemInOrder | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 33 |
|||
| getDistinctExamRegistrationSubjectsByCourse | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectByExamDateBatchRequest | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| getDeptWiseSubjectDetails | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 28 |
|||
| getSubjectByBatchIDSubjectCodeRequest | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
| getSubjectMaxMarkBatchExamMarkDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
| getSubjectsByExamRegistration | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 23 |
|||
| getSubjectByStaffRequest | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 49 |
|||
| getGroupSubjectsByBatchSubject | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 22 |
|||
| getSubjectsOfSemester | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
| getSyllabusUploadedDetailsBySubjectRequest | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 65 |
|||
| saveQuestionBackSyllabysSettings | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
| saveQuestionBackSyllabusResourceId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
| getSubjectsAssignedWithSecondLanguageAndCbeRequestStatus | |
0.00% |
0 / 1 |
240.00 | |
0.00% |
0 / 151 |
|||
| getSubjectByName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getSbsRelationBySubjectName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 7 |
|||
| getAllSubjectsWithSyllabusCodeByDepartmentAndSemester | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 20 |
|||
| getAllSubjectWithSyllabusCodeByRequest | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
| searchSubjectByStringWithSyllabusCode | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getSubjectDetailsBySbsIdWithEvaluations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 33 |
|||
| getStudentExamSubjectsForRegistration | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 65 |
|||
| getAllSecApplications | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 23 |
|||
| createSecApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 26 |
|||
| updateSecApplication | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 26 |
|||
| replaceSubjectsByBatchSemSubject | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 88 |
|||
| getQuestionBackSyllabusResourceId | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 12 |
|||
| getSubjectEcGroupSubjectsByBatchSem | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 33 |
|||
| getStudentMinorHonoursPseudoSubjectBasketName | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 25 |
|||
| getSubjectDetailsByClusterID | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 7 |
|||
| getAllSubjectCategoriesv4 | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| <?php | |
| namespace com\linways\core\ams\professional\service; | |
| use TheSeer\Tokenizer\Exception; | |
| use Elasticsearch\Endpoints\Indices\Alias\Delete; | |
| use com\linways\core\ams\professional\dto\Subject; | |
| use com\linways\core\ams\professional\util\CommonUtil; | |
| use com\linways\core\ams\professional\constant\ExamType; | |
| use com\linways\core\ams\professional\constant\PaperTypes; | |
| use com\linways\core\ams\professional\dto\SettingsConstents; | |
| use com\linways\core\ams\professional\service\CommonService; | |
| use com\linways\core\ams\professional\service\StudentService; | |
| use com\linways\core\ams\professional\constant\SubjectConstants; | |
| use com\linways\core\ams\professional\mapper\SubjectServiceMapper; | |
| use com\linways\core\ams\professional\request\SearchSubjectRequest; | |
| use com\linways\core\ams\professional\response\SearchSubjectResponse; | |
| use com\linways\core\ams\professional\exception\ProfessionalException; | |
| use com\linways\core\ams\professional\request\GetPseudoSubjectIdRequest; | |
| use com\linways\core\ams\professional\request\GetSubjectCategoriesRequest; | |
| use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants; | |
| use com\linways\core\ams\professional\request\GetSubjectsThatNotAssignedToFacultyRequest; | |
| use com\linways\core\ams\professional\request\SearchSubjectsWithSubjectCategoriesRequest; | |
| use com\linways\core\ams\professional\response\GetCountOfStudentsEnrolledInSubjectResponse; | |
| use com\linways\core\ams\professional\service\BatchService; | |
| use DateTime; | |
| use stdClass; | |
| class SubjectService extends BaseService | |
| { | |
| /** | |
| * @var null | |
| */ | |
| private static $_instance = null; | |
| /** | |
| * @var array | |
| */ | |
| private $mapper = []; | |
| /** | |
| * Subject table referring tables | |
| * @var array | |
| */ | |
| private $refSubjectsTablesWithSubjectIDColumn = [ | |
| 'aprove_normalise_mark', | |
| 'batchMasterTimetableHour', | |
| 'batch_assignment', | |
| 'batch_timetable', | |
| 'batch_timetable_coursefile', | |
| 'batchwise_assignment_rules', | |
| 'bulk_add_feedback_about_student', | |
| 'committee', | |
| 'course', | |
| 'course_materials', | |
| 'course_objective', | |
| 'course_objective_question_paper', | |
| 'dynamicfeedback_student_courseselect', | |
| 'ebook_info', | |
| 'exam', | |
| 'examEnrollmentFees', | |
| 'exam_cancelled', | |
| 'exam_controller_qp_staff', | |
| 'exam_reg_studentsubject', | |
| 'exam_registration_subject_fees', | |
| 'exam_subjectcredit', | |
| 'gracemarks_student_marks', | |
| 'gracemarks_student_marks_temp', | |
| 'internal_assessment', | |
| 'internal_assessment_column_status', | |
| 'internal_assessment_student_column_mark', | |
| 'internal_marks', | |
| 'internal_marks_edit_submitted', | |
| 'internal_marks_settings', | |
| 'internal_marks_submitted', | |
| 'labExperiment', | |
| 'labStudentTemplateColumnMark', | |
| 'lab_experiments', | |
| 'messageRecipeints', | |
| 'message_batch', | |
| 'nba_aggr_formula', | |
| 'nba_course_outcome', | |
| 'assessment_structure', | |
| 'assessment_questions', | |
| 'nba_map_extra_activities_to_course_outcome', | |
| 'nba_sub_aggr_formula', | |
| 'nba_subject_tree_mapping', | |
| 'normalise_marks', | |
| 'question_paper_assignments', | |
| 'question_paper_bank', | |
| 'question_paper_module_weightages', | |
| 'question_paper_pool', | |
| 'question_paper_sections', | |
| 'quiz', | |
| 'quiz_subject_questions', | |
| 'quiz_type', | |
| 'sbs_relation', | |
| 'sessional_marks_settings', | |
| 'student_marks', | |
| 'universityExams', | |
| 'universityMarks', | |
| 'university_examcredits', | |
| 'university_studentgrade', | |
| 'exam_examReg_subject_answerSheet_group', | |
| 'exam_examReg_subject_answerSheet_group_config', | |
| 'exam_examReg_subject_valuation_staff' | |
| ]; | |
| /** | |
| * Subject table referring tables | |
| * @var array | |
| */ | |
| private $refSubjectsTablesWithSubject_IDColumn = [ | |
| 'exam_subject_grading_scheme', | |
| 'nba_co_attainment', | |
| 'nba_co_attainment_rules', | |
| 'nba_po_attainment_node_assessment', | |
| 'nba_po_attainment_subject', | |
| 'nba_rubrics_to_assessment_mapping', | |
| 'nba_subject_assessment_co_value', | |
| 'nba_subject_assessment_po_value', | |
| 'nba_subject_node_co_value', | |
| 'nba_subject_node_po_value', | |
| 'nba_university_exam_co_mapping_rules', | |
| 'normalization_rule3_subject' | |
| ]; | |
| private $refSubjectsTableWithSubjects_IDColumn = [ | |
| 'subjectGroups_subjects' | |
| ]; | |
| /** | |
| * Locked down the constructor | |
| * Prevent any outside instantiation of this class | |
| * | |
| * SubjectService constructor. | |
| */ | |
| private function __construct() | |
| { | |
| $this->mapper = SubjectServiceMapper::getInstance()->getMapper(); | |
| } | |
| /** | |
| * Prevent any object or instance of that class to be cloned | |
| * Prevent any copy of this object | |
| * @author jithinvijayan | |
| */ | |
| private function __clone() | |
| { | |
| } | |
| /** | |
| * Have a single globally accessible static method | |
| * | |
| * @return SubjectService|null | |
| * @author jithinvijayan | |
| */ | |
| public static function getInstance() | |
| { | |
| if (!is_object(self::$_instance)) | |
| self::$_instance = new self(); | |
| return self::$_instance; | |
| } | |
| /** | |
| * Get Subject Details | |
| * @param int $subjectId | |
| * @return object $subject | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubject($subjectId) | |
| { | |
| $subject = NULL; | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sql = "SELECT subjectID as id, subjectName as name, subjectDesc as description, syllabusName, subjectPriority as priority, hdl_deptID as hdlDeptId, paperTypeId, subjectcatID, isTheory, no_of_modules, syllabusYear, secondLangaugeId, courseTypeID, universityAllottedHours | |
| FROM subjects WHERE subjectID = " . $subjectId; | |
| try { | |
| $subject = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subject; | |
| } | |
| /** | |
| * Undocumented function | |
| * | |
| * @param SearchSubjectRequest $searchSubjectRequest | |
| * @return SearchSubjectResponse | |
| * @throws ProfessionalException | |
| */ | |
| public function searchSubjects(SearchSubjectRequest $searchSubjectRequest) | |
| { | |
| $searchSubjectRequest = $this->realEscapeObject($searchSubjectRequest); | |
| $subjectDetails = new SearchSubjectResponse(); | |
| $condition = ""; | |
| if (empty($searchSubjectRequest)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_PARAMETER, 'Empty parameter given to function'); | |
| } | |
| $sqlCount = 'SELECT | |
| COUNT(sub.subjectID) AS totalRecord | |
| FROM | |
| subjects sub | |
| INNER JOIN | |
| sbs_relation sbs ON sbs.subjectID = sub.subjectID | |
| INNER JOIN | |
| sd_relation sd ON sd.subjectID = sub.subjectID | |
| INNER JOIN | |
| subject_sem_relation ssr ON ssr.subjectID = sub.subjectID | |
| AND ssr.subjectID = sd.subjectID | |
| INNER JOIN | |
| department d ON d.deptID = sub.hdl_deptID | |
| INNER JOIN | |
| staffaccounts sta ON sta.staffID = sbs.staffID | |
| INNER JOIN | |
| batches bat ON bat.batchID = sbs.batchID | |
| WHERE | |
| sub.subjectID > 0'; | |
| $sql = 'SELECT DISTINCT | |
| sub.subjectID as subjectId, sub.subjectName, sub.subjectDesc, sub.syllabusName,sub.subjectcatID, sub.paperTypeId,sub.secondLangaugeId,GROUP_CONCAT( DISTINCT sta.staffName ) as staffNames,sub.subjectPriority | |
| FROM | |
| subjects sub | |
| INNER JOIN | |
| sbs_relation sbs ON sbs.subjectID = sub.subjectID | |
| INNER JOIN | |
| sd_relation sd ON sd.subjectID = sub.subjectID | |
| INNER JOIN | |
| subject_sem_relation ssr ON ssr.subjectID = sub.subjectID | |
| AND ssr.subjectID = sd.subjectID AND sbs.semID = ssr.semID | |
| INNER JOIN | |
| department d ON d.deptID = sub.hdl_deptID | |
| INNER JOIN | |
| staffaccounts sta ON sta.staffID = sbs.staffID | |
| INNER JOIN | |
| batches bat ON bat.batchID = sbs.batchID | |
| WHERE | |
| sub.subjectID > 0'; | |
| // if($searchSubjectRequest->name) | |
| // { | |
| // $condition .=" AND sub.subjectName like '%$searchSubjectRequest->name%' "; | |
| // } | |
| // if($searchSubjectRequest->desc) | |
| // { | |
| // $condition .=" AND sub.subjectDesc like '%$searchSubjectRequest->desc%' "; | |
| // } | |
| // if($searchSubjectRequest->type) | |
| // { | |
| // $condition .=" AND sub.paperTypeId ='$searchSubjectRequest->type' "; | |
| // } | |
| // if($searchSubjectRequest->syllabusName) | |
| // { | |
| // $condition .=" AND sub.syllabusName like '%$searchSubjectRequest->syllabusName%' "; | |
| // } | |
| if ($searchSubjectRequest->id) { | |
| $condition .= " AND sub.subjectID='$searchSubjectRequest->id' "; | |
| } | |
| if (!$searchSubjectRequest->showHiddenSubjects) { | |
| $condition .= " AND sub.hide = '0' "; | |
| } | |
| if ($searchSubjectRequest->subjectCategoryIdList) { | |
| $condition .= " AND sub.subjectcatID IN (" . (implode(',', $searchSubjectRequest->subjectCategoryIdList) ? implode(',', $searchSubjectRequest->subjectCategoryIdList) : $searchSubjectRequest->subjectCategoryIdList) . ") "; | |
| } | |
| if ($searchSubjectRequest->batchID) { | |
| $condition .= " AND sbs.batchID ='$searchSubjectRequest->batchID' "; | |
| } | |
| if ($searchSubjectRequest->semID) { | |
| $condition .= " AND ssr.semID ='$searchSubjectRequest->semID' "; | |
| } | |
| if ($searchSubjectRequest->excludePseudoSubjects) { | |
| $condition .= " AND sbs.isPseudosubject = 0 "; | |
| } | |
| // if($searchSubjectRequest->ids != NULL && count($searchSubjectRequest->ids >0)) | |
| // { | |
| // $condition .=" AND sub.subjectID IN (".implode(',', $searchSubjectRequest->ids).") "; | |
| // } | |
| // if($searchSubjectRequest->deptId) | |
| // { | |
| // $condition .=" AND sd.deptID='$searchSubjectRequest->deptId' "; | |
| // } | |
| // if($searchSubjectRequest->category) | |
| // { | |
| // $condition .=" AND sub.subjectcatID = '$searchSubjectRequest->category' "; | |
| // } | |
| // if($searchSubjectRequest->hdl_deptID) | |
| // { | |
| // $condition .=" AND sub.hdl_deptID='$searchSubjectRequest->hdl_deptID' "; | |
| // } | |
| // if($searchSubjectRequest->syllabusYear) | |
| // { | |
| // $condition .=" AND sub.syllabusYear='$searchSubjectRequest->syllabusYear' "; | |
| // } | |
| // if($searchSubjectRequest->courseTypeID) | |
| // { | |
| // $condition .=" AND sub.courseTypeID ='$searchSubjectRequest->courseTypeID' "; | |
| // } | |
| $condition .= " GROUP BY sub.subjectID "; | |
| if ($searchSubjectRequest->sortBy) { | |
| $condition .= " order by $searchSubjectRequest->sortBy $searchSubjectRequest->sortOrder "; | |
| } | |
| $sqlCount .= $condition; | |
| $sql .= $condition; | |
| if (!$searchSubjectRequest->export) { | |
| $sql .= " LIMIT $searchSubjectRequest->startIndex,$searchSubjectRequest->endIndex"; | |
| } | |
| try { | |
| $subjectDetails->totalRecords = $this->executeQueryForObject($sqlCount)->totalRecord; | |
| $subjectDetails->subjects = $this->executeQueryForList($sql, $this->mapper[SubjectServiceMapper::SEARCH_SUBJECTS]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Gives the count of students learning a subject in a particular batch. | |
| * | |
| * @param GetCountOfStudentsEnrolledInSubjectRequest $request | |
| * @return void | |
| */ | |
| public function getCountOfStudentsEnrolledToASubject($request) | |
| { | |
| $subjectDetails = $this->getSubject($request->subjectId); | |
| $subjectResponse = new GetCountOfStudentsEnrolledInSubjectResponse(); | |
| $subjectResponse->subjectId = $subjectDetails->id; | |
| $subjectResponse->subjectName = $subjectDetails->name; | |
| $subjectResponse->subjectDescription = $subjectDetails->description; | |
| $subjectResponse->studentCount = count(StudentService::getInstance()->getAllStudentsByBatchIdSemIdSubjectId($request->batchId, $request->semId, $request->subjectId)); | |
| return $subjectResponse; | |
| } | |
| /** | |
| * @param $subjectId | |
| * @param $batchId | |
| * @param $semId | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectStaffDetailsBySubject($subjectId, $batchId, $semId) | |
| { | |
| $sql = "SELECT sa.staffCode, sa.staffName, sbs.sbsID, sub.subjectName, sub.subjectDesc ,sa.isResigned FROM staffaccounts sa,sbs_relation sbs,subjects sub WHERE sbs.subjectID=$subjectId AND sbs.batchID=$batchId AND sbs.semID=$semId AND sa.staffID=sbs.staffID and sbs.subjectID=sub.subjectID"; | |
| try { | |
| $subjectDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Get subjects in a sem | |
| * @param int $batchId | |
| * @param int $semId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSemSubjects($batchId, $semId) | |
| { | |
| $sql = "select sr.subjectID, sub.subjectName,sub.subjectDesc,sub.subjectcatID,sub.secondLangaugeId from sbs_relation sr inner join subjects sub on sub.subjectID = sr.subjectID where sr.batchID = $batchId and sr.semID=$semId and sub.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") group by sr.subjectID order by sr.subjectID"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get elective subjects in a sem | |
| * @param int $batchId | |
| * @param int $semId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSemElectiveSubjects($batchId, $semId) | |
| { | |
| $sql = "select sp.paperTypeName,sa.staffName,sr.subjectID, sub.subjectName,sub.subjectDesc from sbs_relation sr inner join subjects sub on sub.subjectID = sr.subjectID INNER join staffaccounts sa on sa.staffID=sr.staffID INNER join subjectPaperType sp on sp.id=sub.paperTypeId where sr.batchID = $batchId and sr.semID=$semId AND sp.paperTypeName=\"" . PaperTypes::ELECTIVE . "\" group by sr.subjectID order by sr.subjectID"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * To get the id of the subject TUTOR | |
| * @return boolean | |
| * @throws ProfessionalException | |
| */ | |
| public function getTutorSubjectIdIfExists() | |
| { | |
| $sql = " select subjectID from subjects where deptID=0 and subjectName =\"" . Subject::TUTOR_SUBJECT . "\" "; | |
| try { | |
| $subjectId = $this->executeQueryForObject($sql)->subjectID; | |
| if ($subjectId) | |
| return $subjectId; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return false; | |
| } | |
| /** | |
| * Create a subject named TUTOR | |
| * @return \com\linways\base\dto\MySqlResult | |
| * @throws ProfessionalException | |
| */ | |
| public function createTutorSubject() | |
| { | |
| $sql = "insert into subjects (subjectName, subjectDesc, deptID, syllabusName, hdl_deptID, hide) value(\"" . Subject::TUTOR_SUBJECT . "\",\"" . Subject::TUTOR_SUBJECT . "\",0,\"" . Subject::TUTOR_SUBJECT . "\",0,1)"; | |
| try { | |
| return $this->executeQuery($sql, true); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get subject and staff details by sbs id | |
| * @param int $sbsId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectDetailsBySbsId($sbsId) | |
| { | |
| $sbsId = $this->realEscapeString($sbsId); | |
| $subjectDetails = null; | |
| $sql = "SELECT sa.staffID, | |
| sa.staffCode, | |
| sa.staffName, | |
| sbs.sbsID, | |
| sub.subjectID, | |
| sub.subjectName, | |
| sub.syllabusName, | |
| sub.subjectDesc as description, | |
| bth.batchName, | |
| sem.semName, | |
| dept.deptName, | |
| sub.universityAllottedHours, | |
| sbs.semID, | |
| sbs.batchID FROM staffaccounts sa | |
| INNER JOIN sbs_relation sbs ON sa.staffID=sbs.staffID | |
| INNER JOIN subjects sub ON sbs.subjectID=sub.subjectID | |
| INNER JOIN batches bth ON bth.batchID=sbs.batchID | |
| INNER JOIN semesters sem ON sem.semID=bth.semID | |
| INNER JOIN department dept ON dept.deptID=bth.deptID WHERE sbs.sbsID=$sbsId"; | |
| try { | |
| $subjectDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), | |
| $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Get assigned sbs details of a batch by batchId and semId | |
| * @param int $batchId | |
| * @param int $semId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsDetailsByBatch($batchId, $semId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $sbsDetails = []; | |
| $sql_sbs = "select distinct sbs.batchID, sbs.sbsID, sub.syllabusName, sub.subjectName, sbs.sbsID, sa.staffCode, sa.staffName, sub.subjectDesc, sbs.csID, sbs.subjectID, sa.staffID, sb.psID, sb.subbatchID from sbs_relation sbs INNER JOIN subjects sub ON sub.subjectID=sbs.subjectID INNER JOIN staffaccounts sa ON sa.staffID=sbs.staffID LEFT JOIN subbatch_sbs ss ON ss.sbsID=sbs.sbsID LEFT JOIN subbatches sb ON sb.subbatchID=ss.subbatchID where sbs.batchID=\"$batchId\" and sbs.semID=\"$semId\" GROUP BY sbs.sbsID ORDER BY sub.subjectID ASC, sbs.sbsID ASC, sb.subbatchID DESC"; | |
| try { | |
| $sbsDetails = $this->executeQueryForList($sql_sbs); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $sbsDetails; | |
| } | |
| /** | |
| * Get assigned sbs details of a batch by batchId and semId | |
| * @param int $batchId | |
| * @param int $semId | |
| * @param int $staffId | |
| * @param int $subjectId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsDetailsByStaffId($batchId, $semId, $staffId, $subjectId = null) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $staffId = $this->realEscapeString($staffId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sbsDetails = null; | |
| $sql = "select sbs.batchID, sbs.sbsID, sub.subjectName, sbs.sbsID, sa.staffCode, sa.staffName, sub.subjectDesc, sbs.csID, sbs.subjectID from sbs_relation sbs, subjects sub, staffaccounts sa where sub.subjectID=sbs.subjectID AND sa.staffID=sbs.staffID AND sbs.batchID=\"$batchId\" AND sbs.semID=\"$semId\" AND sbs.staffID=$staffId "; | |
| if ($subjectId) { | |
| $sql .= "AND sbs.subjectID=$subjectId "; | |
| } | |
| $sql .= "ORDER BY sub.subjectID ASC, sbs.sbsID ASC"; | |
| try { | |
| if ($subjectId) { | |
| $sbsDetails = $this->executeQueryForObject($sql); | |
| } else { | |
| $sbsDetails = $this->executeQueryForList($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $sbsDetails; | |
| } | |
| /** | |
| * check whether a subject is assigned to a batch | |
| * @param int $subjectId | |
| * @return boolean | |
| * @throws ProfessionalException | |
| */ | |
| public function isSubjectAssignedToBatch($subjectId) | |
| { | |
| $isAssigned = false; | |
| $sql = "SELECT count(sbsID) AS batchCound FROM sbs_relation WHERE subjectID=$subjectId"; | |
| try { | |
| $batchCound = $this->executeQueryForObject($sql)->batchCound; | |
| if ($batchCound) { | |
| $isAssigned = true; | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $isAssigned; | |
| } | |
| /** | |
| * delete subject by id | |
| * @param int $subjectId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function deleteSubjectById($subjectId) | |
| { | |
| $sql_sd = "DELETE FROM sd_relation WHERE subjectID=$subjectId"; | |
| $sql_ss = "DELETE FROM subject_sem_relation WHERE subjectID=$subjectId"; | |
| $sql_sub = "DELETE FROM subjects WHERE subjectID=$subjectId"; | |
| try { | |
| $this->executeQueryForObject($sql_sd); | |
| $this->executeQueryForObject($sql_ss); | |
| return $this->executeQueryForObject($sql_sub); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get pseudo subject details by id | |
| * @param int $suSubId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectDetailsById($suSubId) | |
| { | |
| $pseudoSubjectDetails = NULL; | |
| $sql = "SELECT distinct psub.pseudosubjectID, psub.subjectName, dept.deptName, GROUP_CONCAT(DISTINCT sa.staffName) AS staffName, sbs.subjectID, sbs.semID, sbs.batchID FROM pseudosubjects psub LEFT JOIN pseudosubjects_sbs psbs ON psbs.pseudosubjectID=psub.pseudosubjectID LEFT JOIN department dept ON dept.deptID=psub.hdl_deptID LEFT JOIN sbs_relation sbs ON sbs.sbsID=psbs.sbsID LEFT JOIN staffaccounts sa ON sa.staffID=sbs.staffID WHERE psub.pseudosubjectID=$suSubId"; | |
| try { | |
| $pseudoSubjectDetails = $this->executeQueryForObject($sql, FALSE, $this->mapper[SubjectServiceMapper::GET_PSEUDO_SUBJECT_BY_ID]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $pseudoSubjectDetails; | |
| } | |
| /** | |
| * get pseudo subject details by id | |
| * @param int $suSubId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectBatchDetailsById($suSubId) | |
| { | |
| $pseudoSubjectDetails = NULL; | |
| $sql = "SELECT sr.batchID,ps.pseudosubjectID, ps.subjectName, dp.deptName, dp.departmentDesc, sr.subjectID, sr.semID, sm.semName FROM pseudosubjects_sbs pss INNER JOIN pseudosubjects ps ON ps.pseudosubjectID=pss.pseudosubjectID INNER JOIN sbs_relation sr ON sr.sbsID=pss.sbsID INNER JOIN batches bt ON bt.batchID=sr.batchID INNER JOIN semesters sm ON sm.semID=sr.semID INNER JOIN department dp ON dp.deptID=bt.deptID WHERE ps.pseudosubjectID=$suSubId"; | |
| try { | |
| $pseudoSubjectDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $pseudoSubjectDetails; | |
| } | |
| /** | |
| * get pseudo subject related sbsId | |
| * @param int $suSubId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectSbsIdsByStaffId($suSubId, $staffId) | |
| { | |
| $suSubId = $this->realEscapeString($suSubId); | |
| $staffId = $this->realEscapeString($staffId); | |
| $sql = "SELECT group_concat(ss.sbsID) as sbsIDs FROM subbatch_sbs ss INNER JOIN subbatches sub ON sub.subbatchID=ss.subbatchID inner join sbs_relation sr ON sr.sbsID=ss.sbsID WHERE sub.psID=$suSubId AND sr.staffID=$staffId"; | |
| try { | |
| return $this->executeQueryForObject($sql)->sbsIDs; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get pseudo subject related sbsId | |
| * @param int $suSubId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectSbsIdsById($suSubId) | |
| { | |
| $sql = "SELECT group_concat(sbsID) as sbsIDs FROM pseudosubjects_sbs WHERE pseudosubjectID=$suSubId"; | |
| try { | |
| return $this->executeQueryForObject($sql)->sbsIDs; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * This service is used to find the subjects assigned to running semesters by handling department | |
| * Get subject details by handling department | |
| * | |
| * @param int $hdl_deptId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectsByHandlingDepartmentId($hdl_deptId) | |
| { | |
| $hdl_deptId = $this->realEscapeString($hdl_deptId); | |
| $sql = "SELECT sub.subjectID, subjectName, subjectDesc, syllabusName, sbs.batchID, sbs.semID | |
| FROM sbs_relation sbs | |
| INNER JOIN batches bat ON sbs.batchID = bat.batchID AND sbs.semID = bat.semID | |
| INNER JOIN subjects sub ON sub.subjectID = sbs.subjectID | |
| WHERE hdl_deptID = '$hdl_deptId' AND sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\")"; | |
| try { | |
| $subjectDetails = $this->executeQueryForList($sql, $this->mapper[SubjectServiceMapper::GET_SUBJECTS_BY_DEPARTMENT]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Returns subjects under a department | |
| * | |
| * @param $departmentId | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author jithinvijayan | |
| */ | |
| public function getSubjectsFromDepartments($departmentId) | |
| { | |
| $sql = "SELECT subjectID as id, subjectName as code, subjectDesc as name, syllabusName,syllabusYear | |
| FROM subjects | |
| WHERE hdl_deptID = $departmentId AND subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\")"; | |
| try { | |
| $response = $this->executeQueryForList($sql); | |
| $response = CommonUtil::decodeHtmlSpecialChars($response); | |
| return $response; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * check sbsid is belongs to pseudo subject | |
| * @param int $sbsId | |
| * @return boolean | |
| * @throws ProfessionalException | |
| */ | |
| public function isPseudoSubjectBySbsId($sbsId) | |
| { | |
| $sbsId = $this->realEscapeString($sbsId); | |
| $sql = "SELECT pseudosubjectID as psId FROM pseudosubjects_sbs WHERE sbsID=$sbsId"; | |
| try { | |
| $psId = $this->executeQueryForObject($sql)->psId; | |
| if ($psId) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get pseudo subject details by sbsId | |
| * @param int $sbsId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectBySbsId($sbsId) | |
| { | |
| $sbsId = $this->realEscapeString($sbsId); | |
| $sql = "SELECT ps.* FROM pseudosubjects ps INNER JOIN pseudosubjects_sbs psb ON psb.pseudosubjectID=ps.pseudosubjectID WHERE psb.sbsID='$sbsId'"; | |
| try { | |
| return $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get pseudo subject students by pseudo subject id | |
| * @param int $pssubId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectStudentById($pssubId) | |
| { | |
| $pssubId = $this->realEscapeString($pssubId); | |
| $sql = "SELECT t1.studentID, t2.studentName, t2.rollNo, t2.studentAccount, t2.regNo, t3.batchName, t3.batchID, t4.deptName FROM pseudosubjects_students t1, studentaccount t2, batches t3, department t4 WHERE t1.studentID = t2.studentID AND t3.batchID = t2.batchID AND t4.deptID = t3.deptID AND t1.pseudosubjectID=$pssubId order by t3.batchName, t2.rollNo"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Undocumented function | |
| * | |
| * @param [type] $pssubId | |
| * @return void | |
| */ | |
| public function getNumberOfStudentsInAPseudoSubjectByPseudoSubjectId($pssubId) | |
| { | |
| $pssubId = $this->realEscapeString($pssubId); | |
| $sql = "SELECT count(t1.studentID) as totalRecords FROM pseudosubjects_students t1 | |
| INNER JOIN studentaccount t2 ON t1.studentID = t2.studentID | |
| WHERE t1.pseudosubjectID=$pssubId"; | |
| try { | |
| $totalRecords = $this->executeQueryForObject($sql)->totalRecords; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $totalRecords; | |
| } | |
| /** | |
| * To get subject details by subjectId | |
| * @param int $subjectId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsIdsBySubjectId($subjectId) | |
| { | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sql = "select group_concat(sbsID) as sbsId from sbs_relation sbs inner join batches bat on sbs.batchID = bat.batchID and sbs.semID = bat.semID inner join subjects sub on sub.subjectID = sbs.subjectID where sub.subjectID = $subjectId"; | |
| try { | |
| $subjectDetails = $this->executeQueryForObject($sql)->sbsId; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Check whether a subject is of given category | |
| * @param int $subjectId | |
| * @param string $subjectcatID | |
| * @return int | |
| * @throws ProfessionalException | |
| */ | |
| public function checkSubjectCategory($subjectId, $subjectcatID) | |
| { | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $subjectcatID = $this->realEscapeString($subjectcatID); | |
| $sql = "SELECT IF(s.subjectcatID = '" . $subjectcatID . "' || subc.parentID = '" . $subjectcatID . "', 1, 0) as flag FROM subjects s INNER JOIN subject_category subc ON subc.subjectcatID = s.subjectcatID WHERE s.subjectID = " . $subjectId . ""; | |
| try { | |
| return $this->executeQueryForObject($sql)->flag; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Return sbs id by staff id, subject id and batch id | |
| * @param integer $subjectId | |
| * @param integer $batchId | |
| * @param integer $staffId | |
| * @return integer|null | |
| * @throws ProfessionalException | |
| */ | |
| public function getSBSIdBySubjectIdAndStaffIdAndSemId($subjectId, $batchId, $staffId, $semId =null) | |
| { | |
| $sbsid = null; | |
| $batchId = $this->realEscapeString($batchId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $staffId = $this->realEscapeString($staffId); | |
| $semId = $this->realEscapeString($semId); | |
| $joinCondition =""; | |
| $semester = ""; | |
| if (empty($batchId)) | |
| throw new ProfessionalException(ProfessionalException::INVALID_BATCH_ID, "Invalid batch id"); | |
| if (empty($subjectId)) | |
| throw new ProfessionalException(ProfessionalException::INVALID_SUBJECT_ID, "Invalid subject id"); | |
| if (empty($staffId)) | |
| throw new ProfessionalException(ProfessionalException::INVALID_STAFF_ID, "Invalid staff id"); | |
| if(empty($semId)) { | |
| $joinCondition = " AND sb.semID = b.semID"; | |
| } | |
| else { | |
| $semester = " AND sb.semID = $semId"; | |
| } | |
| $sql = "SELECT sbsID FROM sbs_relation sb | |
| INNER JOIN batches b ON b.batchID = sb.batchID $joinCondition | |
| WHERE sb.batchID=$batchId AND subjectID=$subjectId AND staffID=$staffId $semester"; | |
| try { | |
| $result = $this->executeQueryForObject($sql); | |
| $sbsid = $result->sbsID; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $sbsid; | |
| } | |
| // ProfessionalIntegration | |
| /** | |
| * Method for getting all subject categories | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| * @author Ranjith Balachandran | |
| */ | |
| public function getAllSubjectCategories() | |
| { | |
| $sql = ''; | |
| $subjectCatDetails = []; | |
| try { | |
| $sql = "SELECT subjectcatID AS subjectCatId, subjectcatName AS categoryName, subjectcatPriority, code, parentID AS parentId FROM subject_category"; | |
| $subjectCatDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectCatDetails; | |
| } | |
| /** | |
| * Method for getting all category codes | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| * @author Ranjith Balachandran | |
| */ | |
| public function getCategoryCodes() | |
| { | |
| $categoryDetails = []; | |
| try { | |
| $sql = "SELECT sc.subjectcatName AS categoryName, cc.categoryCode,ct.typeName,ct.courseTypeID AS courseTypeId,sc.subjectcatID AS subjectCatId,cc.id AS categoryCodeId FROM subject_category sc INNER JOIN categoryCode cc ON sc.subjectcatID = cc.subject_category_id INNER JOIN course_type ct ON ct.courseTypeID = cc.course_type_id"; | |
| $categoryDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $categoryDetails; | |
| } | |
| /** | |
| * Method for saving category code | |
| * @param unknown $categoryName | |
| * @param unknown $courseTypeId | |
| * @param unknown $categoryId | |
| * @param unknown $categoryCodeId | |
| * @throws ProfessionalException | |
| * @author Ranjith Balachandran | |
| */ | |
| public function saveCategoryCode($categoryName, $courseTypeId, $categoryId, $categoryCodeId = null) | |
| { | |
| $sql = ''; | |
| $categoryName = $this->realEscapeString($categoryName); | |
| $courseTypeId = $this->realEscapeString($courseTypeId); | |
| $categoryId = $this->realEscapeString($categoryId); | |
| $categoryCodeId = $this->realEscapeString($categoryCodeId); | |
| if ($categoryCodeId) { | |
| $sql = "UPDATE categoryCode SET categoryCode = '$categoryName', subject_category_id = '$categoryId', course_type_id = '$courseTypeId' WHERE id = $categoryCodeId"; | |
| } else { | |
| $sql = "INSERT INTO categoryCode (subject_category_id,course_type_id,categoryCode) VALUES ('$categoryId','$courseTypeId','$categoryName')"; | |
| } | |
| try { | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Method for deleting category Code | |
| * @param unknown $categoryCodeId | |
| * @throws ProfessionalException | |
| * @author Ranjith Balachandran | |
| */ | |
| public function deleteCategoryCode($categoryCodeId) | |
| { | |
| $categoryCodeId = $this->realEscapeString($categoryCodeId); | |
| $sql = "DELETE FROM categoryCode WHERE id = " . $categoryCodeId . ""; | |
| try { | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Method for getting paperTypes | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| * @author Ranjith Balachandran | |
| */ | |
| public function listPaperTypes() | |
| { | |
| $paperTypes = []; | |
| try { | |
| $sql = "SELECT id AS paperTypeId, paperTypeName, paperTypeCode FROM subjectPaperType"; | |
| $paperTypes = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $paperTypes; | |
| } | |
| /** | |
| * method for adding paperType | |
| * @param unknown $paperTypeName | |
| * @param unknown $paperTypeCode | |
| * @param unknown $paperTypeId | |
| * @throws ProfessionalException | |
| * @author Ranjith Balachandran | |
| */ | |
| public function savePaperType($paperTypeName, $paperTypeCode, $paperTypeId = null) | |
| { | |
| $paperTypeName = $this->realEscapeString($paperTypeName); | |
| $paperTypeCode = $this->realEscapeString($paperTypeCode); | |
| $paperTypeId = $this->realEscapeString($paperTypeId); | |
| if ($paperTypeId) { | |
| $sql = "UPDATE subjectPaperType SET paperTypeName = '" . $paperTypeName . "', paperTypeCode = '" . $paperTypeCode . "' WHERE id = " . $paperTypeId . ""; | |
| } else { | |
| $sql = "INSERT INTO subjectPaperType (paperTypeName, paperTypeCode) VALUES ('" . $paperTypeName . "','" . $paperTypeCode . "')"; | |
| } | |
| try { | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Method for deleting paper Types | |
| * @param unknown $paperTypeId | |
| * @throws ProfessionalException | |
| * @author RanjithBalachandran | |
| */ | |
| public function deletePaperType($paperTypeId) | |
| { | |
| $paperTypeId = $this->realEscapeString($paperTypeId); | |
| $sql = "DELETE FROM subjectPaperType WHERE id = " . $paperTypeId . ""; | |
| try { | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getCourseTypes() | |
| { | |
| $courseTypes = []; | |
| $sql = "SELECT courseTypeID, typeName, typeDesc, sec_lang, markgrade, extval_required, course_Type, courseTypeFlag FROM course_type"; | |
| try { | |
| $courseTypes = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $courseTypes; | |
| } | |
| /** | |
| * Method to get subject details of the faculty who confirmed an attendance. | |
| * @param unknown $batchId | |
| * @param unknown $subbatchId | |
| * @param unknown $semId | |
| * @param unknown $hour | |
| * @param date $attendanceDate | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectDetailsOfAbsentees($batchId, $subbatchId, $semId, $hour, $attendanceDate) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $subbatchId = $this->realEscapeString($subbatchId); | |
| $semId = $this->realEscapeString($semId); | |
| $hour = $this->realEscapeString($hour); | |
| $attendanceDate = $this->realEscapeString($attendanceDate); | |
| $sql = ""; | |
| $sql = "SELECT | |
| sub.subjectID, sub.subjectName, sub.subjectDesc | |
| FROM | |
| attendance_confirm ac | |
| INNER JOIN | |
| sbs_relation sbs ON sbs.sbsID = ac.sbsID AND ac.batchID = '$batchId' | |
| AND ac.semID = '$semId' | |
| AND ac.subbatchID = '$subbatchId' | |
| AND ac.hour = '$hour' | |
| AND ac.attendanceDate = '$attendanceDate' | |
| INNER JOIN | |
| subjects sub ON sub.subjectID = sbs.subjectID"; | |
| $subjectDetails = null; | |
| try { | |
| $subjectDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Update pseudosubject isFinalize flag | |
| * @param int $psId | |
| * @param int $finalise | |
| * @return \com\linways\base\dto\MySqlResult | |
| * @throws ProfessionalException | |
| */ | |
| public function updateFinalizePsuedoSubject($psId, $finalise) | |
| { | |
| $psId = $this->realEscapeString($psId); | |
| $finalise = $this->realEscapeString($finalise); | |
| try { | |
| $sql = "update pseudosubjects set isFinalized = " . $finalise . " where pseudosubjectID = $psId"; | |
| return $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getSubjectCategoryByName($category) | |
| { | |
| $category = $this->realEscapeString($category); | |
| $subjectCatDetails = null; | |
| try { | |
| $sql = "SELECT subjectcatID AS subjectCatId, subjectcatName AS categoryName FROM subject_category WHERE subjectcatName = '" . $category . "'"; | |
| $subjectCatDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectCatDetails; | |
| } | |
| /** | |
| * Get all second languages created | |
| * @return Array $secondLanguages | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getAllSecondLanguages() | |
| { | |
| $secondLanguages = []; | |
| try { | |
| $sql = "SELECT secondlangaugeID, secondLangaugeName, secondLangaugedesc, showforadmission, secondLangaugeCode FROM secondLangauge"; | |
| $secondLanguages = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $secondLanguages; | |
| } | |
| /** | |
| * Method to get all subjects learnt by a student of a batch in a particular semester. | |
| * @param unknown $studentId | |
| * @param unknown $batchId | |
| * @param unknown $semId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| * @author gadheyan | |
| */ | |
| public function getSubjectsByStudent($studentId, $batchId, $semId) | |
| { | |
| $subjectList = null; | |
| $studentId = $this->realEscapeString($studentId); | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $sql = ""; | |
| $sql = " SELECT DISTINCT sub.subjectID as subjectId,sub.subjectName,sub.subjectDesc, ssbs.subbatchID, sub.subjectcatID,sub.syllabusName,sub.secondLangaugeId FROM | |
| pseudosubjects_students pss | |
| INNER JOIN pseudosubjects_sbs psbs ON psbs.pseudosubjectID = pss.pseudosubjectID AND pss.studentID = $studentId | |
| INNER JOIN sbs_relation sbs ON sbs.sbsID=psbs.sbsID AND sbs.batchID = $batchId AND sbs.semID = $semId | |
| INNER JOIN subjects sub ON sbs.subjectID = sub.subjectID | |
| INNER JOIN subbatch_sbs ssbs ON (sbs.sbsID = ssbs.sbsID) WHERE sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") UNION | |
| SELECT DISTINCT sub.subjectID as subjectId,sub.subjectName,sub.subjectDesc , sbsbs.subbatchID, sub.subjectcatID,sub.syllabusName,sub.secondLangaugeId FROM subbatch_student sbst | |
| INNER JOIN subbatch_sbs sbsbs ON sbsbs.subbatchID = sbst.subbatchID AND sbst.studentID = $studentId | |
| INNER JOIN sbs_relation sbs ON sbsbs.sbsID = sbs.sbsID AND sbs.batchID = $batchId AND sbs.semID = $semId | |
| INNER JOIN subjects sub ON sub.subjectID = sbs.subjectID WHERE sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") UNION | |
| SELECT DISTINCT sub.subjectID as subjectId,sub.subjectName,sub.subjectDesc, null, sub.subjectcatID,sub.syllabusName,sub.secondLangaugeId FROM subjects sub | |
| INNER JOIN sbs_relation sbs ON sbs.subjectID = sub.subjectID | |
| WHERE sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") AND sbs.sbsID NOT IN (SELECT sbsID FROM subbatch_sbs) AND sbs.batchID = $batchId AND sbs.semID = $semId AND sbs.isPseudosubject = 0"; | |
| try { | |
| $subjectList = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectList; | |
| } | |
| /** | |
| * Get assigned sbs details of a subject | |
| * @param int $subjectId | |
| * @param int $semId | |
| * @param int $batchId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsDetailsBysubjectId($subjectId, $semId, $batchId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sql = "select sa.staffID, sbs.batchID, sbs.sbsID, sub.subjectName, sbs.sbsID, sa.staffCode, sa.staffName, sub.subjectDesc, sbs.csID, sbs.subjectID from sbs_relation sbs, subjects sub, staffaccounts sa where sub.subjectID=sbs.subjectID AND sa.staffID=sbs.staffID AND sbs.batchID=\"$batchId\" AND sbs.semID=\"$semId\" AND sbs.subjectID=$subjectId ORDER BY sub.subjectID ASC, sbs.sbsID ASC"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectByCourseTypeSemCategory($courseTypeId, $semId, $batchStartYear, $subjectCategory = NULL) | |
| { | |
| $courseTypeId = (int) $this->realEscapeString($courseTypeId); | |
| $semId = (int) $this->realEscapeString($semId); | |
| $batchStartYear = (int) $this->realEscapeString($batchStartYear); | |
| $subjectCategory = (int) $this->realEscapeString($subjectCategory); | |
| $sqlCondition = null; | |
| $subjects = []; | |
| if ($subjectCategory) { | |
| $sqlCondition = " AND s.subjectcatID = '$subjectCategory' "; | |
| } | |
| // $sql = "SELECT subjectID, subjectName, subjectDesc, isTheory, deptID FROM subjects WHERE courseTypeID = '$courseTypeId' AND semID = '$semId' $sqlCondition ORDER BY subjectPriority ASC, subjectName ASC"; | |
| $sql = "SELECT s.subjectID, s.syllabusName, s.subjectName, s.subjectDesc, s.isTheory, s.deptID FROM subjects s INNER JOIN sbs_relation sbs ON (s.subjectID = sbs.subjectID) INNER JOIN batches b ON (b.batchID = sbs.batchID) WHERE s.courseTypeID = '$courseTypeId' AND sbs.semID = '$semId' AND b.batchStartYear = '$batchStartYear' $sqlCondition GROUP BY sbs.subjectID"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectsHavingGradeScheme($courseTypeId, $semId, $subjectCategory = NULL) | |
| { | |
| $courseTypeId = (int) $this->realEscapeString($courseTypeId); | |
| $semId = (int) $this->realEscapeString($semId); | |
| $subjectCategory = (int) $this->realEscapeString($subjectCategory); | |
| $sqlCondition = null; | |
| $subjects = []; | |
| if ($subjectCategory) { | |
| $sqlCondition = " AND s.subjectcatID = '$subjectCategory' "; | |
| } | |
| $sql = "SELECT s.subjectID, s.subjectName, s.subjectDesc, s.isTheory, s.deptID, esgs.grade_scheme_id AS schemeId FROM subjects s INNER JOIN exam_subject_grading_scheme esgs ON (s.subjectID = esgs.subject_id) WHERE s.courseTypeID = '$courseTypeId' AND s.semID = '$semId' $sqlCondition ORDER BY s.subjectPriority ASC, s.subjectName ASC"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get all subject teaching by a staff in a batch | |
| * @param Integer $staffId | |
| * @param Integer $batchId | |
| * @return Array $subjects | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectsByStaffAndBatch($staffId = false, $batchId) | |
| { | |
| $staffId = (int) $this->realEscapeString($staffId); | |
| $batchId = (int) $this->realEscapeString($batchId); | |
| $condition = ""; | |
| if ($staffId) { | |
| $condition .= " sbs.staffID = '$staffId' AND"; | |
| } | |
| if ($batchId) { | |
| $condition .= " sbs.batchID = '$batchId' AND"; | |
| } | |
| $subjects = []; | |
| $sql = "SELECT s.subjectID, s.subjectName, s.subjectDesc, s.isTheory, s.deptID | |
| FROM subjects s | |
| INNER JOIN sbs_relation sbs ON (s.subjectID = sbs.subjectID) | |
| INNER JOIN batches b ON sbs.batchID = b.batchID AND b.semID = sbs.semID | |
| LEFT JOIN department dept ON dept.deptID = b.deptID | |
| WHERE $condition b.isPassOut = 0 AND dept.deptShow = 1"; | |
| $sql .= " ORDER BY s.subjectPriority ASC, s.subjectName ASC"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get all subjects in a batch | |
| * @param Integer $batchId | |
| * @return Array $subjects | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectsByBatchId($batchId) | |
| { | |
| $batchId = (int) $this->realEscapeString($batchId); | |
| $subjects = []; | |
| $sql = "SELECT s.subjectID, s.subjectName, s.syllabusName, s.subjectDesc, sbs.sbsID, sbs.batchID, sbs.semID, sem.semName FROM subjects s INNER JOIN sbs_relation sbs ON (s.subjectID = sbs.subjectID) INNER JOIN semesters sem ON (sbs.semID = sem.semID) WHERE sbs.batchID = '$batchId' GROUP BY s.subjectID ORDER BY sbs.semID ASC, s.subjectPriority ASC"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param string $date | |
| * @param int $batchID | |
| * @param int $semID | |
| * @param string $hour | |
| * to get distict list of subject for a date | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectDetailsByDate($date, $batchID, $semID, $hour) | |
| { | |
| $date = $this->realEscapeString($date); | |
| $batchID = $this->realEscapeString($batchID); | |
| $semID = $this->realEscapeString($semID); | |
| $hour = $this->realEscapeString($hour); | |
| $sql = "select a.hour ,a.batchId, a.sbsID, sb.subjectID ,sub.subjectName, sub.subjectDesc, sb.sbsID, staff.staffName, staff.staffCode | |
| from attendance_confirm a | |
| inner join sbs_relation sb on a.sbsID = sb.sbsId | |
| inner join staffaccounts staff on staff.staffID = sb.staffID | |
| left join subjects sub on sb.subjectID = sub.subjectID | |
| where a.attendanceDate='$date' and a.hour='$hour' and a.batchId='$batchID' and a.semID='$semID' group by sb.subjectID,a.hour;"; | |
| try { | |
| $SubjectDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $SubjectDetails; | |
| } | |
| /** | |
| * @param bool $removeDuplicate | |
| * @return bool | |
| * @throws ProfessionalException | |
| */ | |
| public function removeOrUpdateDuplicateSubjects($removeDuplicate = true) | |
| { | |
| $duplicateSubjects = []; | |
| /* | |
| * STEP 1: | |
| * | |
| * fetching duplicate subjects code | |
| */ | |
| $sql = "SELECT DISTINCT subjectName from subjects | |
| WHERE subjectName IN ( | |
| SELECT subjectName FROM subjects GROUP BY subjectName HAVING count(subjectName)>1)"; | |
| try { | |
| $duplicateSubjects = $this->executeQueryForList($sql); | |
| foreach ($duplicateSubjects as $duplicateSubject) { | |
| $this->beginTransaction(); | |
| /* | |
| * STEP 2: | |
| * | |
| * With duplicate subject code, fetching all subjects with same subject code | |
| */ | |
| $repeatingSubjects = $this->getRepeatingSubjectsBySubjectCode($duplicateSubject->subjectName); | |
| /* | |
| * STEP 3: | |
| * | |
| * Finding valid subject to retain | |
| */ | |
| $validSubject = $this->findValidSubjectFromRepeatingSubjects($repeatingSubjects); | |
| if (empty($validSubject)) { | |
| throw new ProfessionalException("VALID_SUBJECT_NOT_FOUND", "Couldn't find a valid subject"); | |
| } | |
| /* | |
| * STEP 4: | |
| * | |
| * Adding semester subject relation of valid subject | |
| */ | |
| $this->insertIfNotExistSemesterSubjectRelation($validSubject); | |
| /* | |
| * STEP 5: | |
| * | |
| * Adding department subject relation of valid subject | |
| */ | |
| $this->insertIfNotExistDepartmentSubjectRelation($validSubject); | |
| foreach ($repeatingSubjects as $repeatingSubject) { | |
| /* | |
| * STEP 5: | |
| * | |
| * Skipping retained subject from duplicate subjects | |
| */ | |
| if ($validSubject->id === $repeatingSubject->id) { | |
| continue; | |
| } | |
| /* | |
| *STEP 6.1: | |
| * Deleting repeating subjects under same batch and semester as correct subject from | |
| * exam_subjectcredit table | |
| */ | |
| $this->checkSubjectAlreadyMappedThenDeleteFromExamSubjectCredit($validSubject, $repeatingSubject); | |
| /* | |
| * STEP 6.2: | |
| * Deleting repeating subjects under same batch and semester as correct subject from | |
| * sbs_relation table | |
| */ | |
| $this->checkSubjectAlreadyMappedThenDeleteFromSBSRelation($validSubject, $repeatingSubject); | |
| /* | |
| * STEP 6.3: | |
| * Deleting repeating subjects under same batch and semester as correct subject from | |
| * internal_marks table | |
| */ | |
| $this->checkSubjectAlreadyMappedThenDeleteFromInternalMarks($validSubject, $repeatingSubject); | |
| /* | |
| * STEP 6.3: | |
| * Deleting repeating subjects under same batch and semester as correct subject from | |
| * internal_marks_settings table | |
| */ | |
| $this->checkSubjectAlreadyMappedThenDeleteFromInternalMarksSettings($validSubject, $repeatingSubject); | |
| /* | |
| * STEP 6.4: | |
| * Deleting repeating subjects under same batch and semester as correct subject from | |
| * exam_reg_studentsubject table | |
| */ | |
| $this->checkSubjectAlreadyMappedThenDeleteFromExamSubjectRegistration($validSubject, $repeatingSubject); | |
| /* | |
| * STEP 7: | |
| * | |
| * Updating subject id of deleting subjects with retained subject id | |
| */ | |
| $this->updateCorrectSubjectIdToAllRefTables($validSubject, $repeatingSubject); | |
| /* | |
| * STEP 7: | |
| * | |
| * Adding semester subject relation of deleting subject | |
| */ | |
| $this->insertIfNotExistSemesterSubjectRelation($repeatingSubject); | |
| /* | |
| * STEP 8: | |
| * | |
| * Adding department subject relation of deleting subject | |
| */ | |
| $this->insertIfNotExistDepartmentSubjectRelation($repeatingSubject); | |
| /* | |
| * STEP 9: | |
| * | |
| * Deleting duplicate subjects | |
| */ | |
| if ($removeDuplicate) { | |
| $this->deleteSubject($repeatingSubject); | |
| } | |
| } | |
| $this->commit(); | |
| } | |
| } catch (\Exception $e) { | |
| $this->rollBack(); | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return true; | |
| } | |
| /** | |
| * @param $subjectCode | |
| * @return Subject[]|Object | |
| * @throws ProfessionalException | |
| */ | |
| private function getRepeatingSubjectsBySubjectCode($subjectCode) | |
| { | |
| //TODO: Change subject name to syllabus name | |
| $sql = "SELECT * FROM subjects WHERE subjectName='$subjectCode'"; | |
| try { | |
| return $subjects = $this->executeQueryForList($sql, $this->mapper[SubjectServiceMapper::GET_SUBJECTS]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Finding which subject to be keep in the database. | |
| * Validity of subject determining by calculating how much required subject properties are not empty. | |
| * @param Subject[] $repeatingSubjects | |
| * @param bool $retainMostReferredSubject | |
| * @return Subject | |
| * @throws ProfessionalException | |
| */ | |
| private function findValidSubjectFromRepeatingSubjects($repeatingSubjects, $retainMostReferredSubject = true) | |
| { | |
| $validSubject = null; | |
| $validSubjectPercentage = 0; | |
| $numberOfReferences = 0; | |
| /** | |
| * TODO: Assign priorities to the required fields, thereby calculate percentage | |
| * This array elements $requiredFields should be the Subject class properties. | |
| */ | |
| $requiredFields = ['courseTypeId', 'secondLanguageId', 'isTheory', 'subjectCategoryId', 'hdlDeptId', 'priority', 'syllabusYear']; | |
| $percentageIterator = 100 / count($requiredFields); | |
| foreach ($repeatingSubjects as $subject) { | |
| if ($subject instanceof Subject) { | |
| $count = 0; | |
| $percentageOfValid = 0; | |
| if (empty($subject->semId)) { | |
| continue; | |
| } | |
| foreach ($requiredFields as $field) { | |
| if (property_exists("com\linways\core\ams\professional\dto\Subject", $field)) { | |
| if ($subject->{$field} !== null || $subject->{$field} !== "") { | |
| $percentageOfValid += $percentageIterator; | |
| } | |
| } else { | |
| throw new ProfessionalException("OBJECT_PROPERTY_NOT_FOUND", "Each required fields should be the property of com\linways\core\ams\professional\dto\Subject"); | |
| } | |
| } | |
| if ($retainMostReferredSubject) { | |
| $count = $this->findCountOfSubjectReferences($subject); | |
| if ($count > $numberOfReferences && $percentageOfValid >= $validSubjectPercentage) { | |
| $validSubject = $subject; | |
| $validSubjectPercentage = $percentageOfValid; | |
| $numberOfReferences = $count; | |
| } | |
| } else if ($percentageOfValid > $validSubjectPercentage) { | |
| $validSubject = $subject; | |
| $validSubjectPercentage = $percentageOfValid; | |
| } | |
| } else { | |
| throw new ProfessionalException("INVALID_ARGUMENT", "Argument must be the instance of com\linways\core\ams\professional\dto\Subject"); | |
| } | |
| } | |
| return $validSubject; | |
| } | |
| /** | |
| * Updating deleting subjects id's with retained subject id | |
| * @param Subject $correctSubject | |
| * @param $subjectToDelete | |
| * @throws \Exception | |
| */ | |
| private function updateCorrectSubjectIdToAllRefTables($correctSubject, $subjectToDelete) | |
| { | |
| try { | |
| /** | |
| * update subjectID ref columns | |
| */ | |
| foreach ($this->refSubjectsTablesWithSubjectIDColumn as $subjectIdRefTable) { | |
| $sqlToUpdate = "UPDATE $subjectIdRefTable | |
| SET subjectID = $correctSubject->id | |
| WHERE subjectID=$subjectToDelete->id"; | |
| $this->executeQuery($sqlToUpdate); | |
| } | |
| /** | |
| * Some tables using subject_ID instead of subjectID, Here updating such tables | |
| * update subject_ID ref columns | |
| */ | |
| foreach ($this->refSubjectsTablesWithSubject_IDColumn as $subjectIdRefTable) { | |
| $sqlToUpdate = "UPDATE $subjectIdRefTable | |
| SET subject_ID = $correctSubject->id | |
| WHERE subject_ID=$subjectToDelete->id"; | |
| $this->executeQuery($sqlToUpdate); | |
| } | |
| foreach ($this->refSubjectsTableWithSubjects_IDColumn as $subjectIdRefTable) { | |
| $sqlToUpdate = "UPDATE $subjectIdRefTable | |
| SET subjects_id = $correctSubject->id | |
| WHERE subjects_id=$subjectToDelete->id"; | |
| $this->executeQuery($sqlToUpdate); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $correctSubject | |
| * @param $subjectToDelete | |
| * @throws ProfessionalException | |
| */ | |
| private function checkSubjectAlreadyMappedThenDeleteFromExamSubjectCredit($correctSubject, $subjectToDelete) | |
| { | |
| $sql = "SELECT DISTINCT batchID as batchId,semID as semId,credit | |
| FROM exam_subjectcredit WHERE subjectID = $correctSubject->id"; | |
| try { | |
| $subjectMappings = $this->executeQueryForList($sql); | |
| foreach ($subjectMappings as $subjectMapping) { | |
| $sql = "DELETE FROM exam_subjectcredit | |
| WHERE subjectID = $subjectToDelete->id AND batchID = $subjectMapping->batchId | |
| AND semID = $subjectMapping->semId AND credit=$subjectMapping->credit"; | |
| $this->executeQuery($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $correctSubject | |
| * @param $subjectToDelete | |
| * @throws ProfessionalException | |
| */ | |
| public function checkSubjectAlreadyMappedThenDeleteFromSBSRelation($correctSubject, $subjectToDelete) | |
| { | |
| $sql = "SELECT DISTINCT batchID as batchId,semID as semId,staffID as staffId | |
| FROM sbs_relation WHERE subjectID = $correctSubject->id"; | |
| try { | |
| $subjectMappings = $this->executeQueryForList($sql); | |
| foreach ($subjectMappings as $subjectMapping) { | |
| $sql = "DELETE FROM sbs_relation | |
| WHERE subjectID = $subjectToDelete->id AND batchID = $subjectMapping->batchId | |
| AND semID = $subjectMapping->semId AND staffID=$subjectMapping->staffId"; | |
| $this->executeQuery($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $correctSubject | |
| * @param $subjectToDelete | |
| * @throws ProfessionalException | |
| */ | |
| public function checkSubjectAlreadyMappedThenDeleteFromInternalMarks($correctSubject, $subjectToDelete) | |
| { | |
| $sql = "SELECT DISTINCT batchID as batchId,semID as semId | |
| FROM internal_marks WHERE subjectID = $correctSubject->id"; | |
| try { | |
| $subjectMappings = $this->executeQueryForList($sql); | |
| foreach ($subjectMappings as $subjectMapping) { | |
| $sql = "DELETE FROM internal_marks | |
| WHERE subjectID = $subjectToDelete->id AND batchID = $subjectMapping->batchId | |
| AND semID = $subjectMapping->semId"; | |
| $this->executeQuery($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $correctSubject | |
| * @param $subjectToDelete | |
| * @throws ProfessionalException | |
| */ | |
| public function checkSubjectAlreadyMappedThenDeleteFromInternalMarksSettings($correctSubject, $subjectToDelete) | |
| { | |
| $sql = "SELECT DISTINCT batchID as batchId,semID as semId | |
| FROM internal_marks_settings WHERE subjectID = $correctSubject->id"; | |
| try { | |
| $subjectMappings = $this->executeQueryForList($sql); | |
| foreach ($subjectMappings as $subjectMapping) { | |
| $sql = "DELETE FROM internal_marks_settings | |
| WHERE subjectID = $subjectToDelete->id AND batchID = $subjectMapping->batchId | |
| AND semID = $subjectMapping->semId"; | |
| $this->executeQuery($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $correctSubject | |
| * @param $subjectToDelete | |
| * @throws ProfessionalException | |
| */ | |
| public function checkSubjectAlreadyMappedThenDeleteFromExamSubjectRegistration($correctSubject, $subjectToDelete) | |
| { | |
| $sql = "SELECT DISTINCT examregID as examRegId | |
| FROM exam_reg_studentsubject WHERE subjectID = $correctSubject->id"; | |
| try { | |
| $subjectMappings = $this->executeQueryForList($sql); | |
| foreach ($subjectMappings as $subjectMapping) { | |
| $sql = "DELETE FROM exam_reg_studentsubject | |
| WHERE subjectID = $subjectToDelete->id AND examregID = $subjectMapping->examRegId"; | |
| $this->executeQuery($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Adding semester subject relation | |
| * @param Subject $subject | |
| * @throws \Exception | |
| */ | |
| private function insertIfNotExistSemesterSubjectRelation($subject) | |
| { | |
| try { | |
| if (!empty($subject) && !empty($subject->semId)) { | |
| //Checking semester subject relation already added | |
| $sqlExist = "SELECT id FROM subject_sem_relation | |
| WHERE subjectID = $subject->id AND semID = $subject->semId"; | |
| $existResp = $this->executeQueryForObject($sqlExist)->id; | |
| if (empty($existResp)) { | |
| //If semester subject relation not added, inserting new semester subject relation | |
| $sqlInsert = "INSERT INTO `subject_sem_relation` | |
| (`subjectID`, `semID`, `created_by`, `created_date`, `updated_by`, `updated_date`) | |
| VALUES ('$subject->id', $subject->semId, '0', utc_timestamp(), '0', utc_timestamp());"; | |
| $this->executeQuery($sqlInsert); | |
| } | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Adding subject department relation | |
| * @param Subject $subject | |
| * @return void | |
| * @throws \Exception | |
| */ | |
| private function insertIfNotExistDepartmentSubjectRelation($subject) | |
| { | |
| try { | |
| if (!empty($subject)) { | |
| //Checking department subject relation already added | |
| $sqlExist = "SELECT id FROM sd_relation | |
| WHERE subjectID=$subject->id AND deptID = $subject->deptId"; | |
| $sdRelationId = $this->executeQueryForObject($sqlExist)->id; | |
| if (empty($sdRelationId)) { | |
| //If department subject relation not added, inserting new semester subject relation | |
| $sqlInsert = "INSERT INTO `sd_relation` (`subjectID`, `deptID`, `createdBy`, `createdDate`, | |
| `updatedBy`, `updatedDate`) | |
| VALUES ($subject->id,$subject->deptId , '0', utc_timestamp(), '0', utc_timestamp());"; | |
| $this->executeQuery($sqlInsert); | |
| } | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param Subject $subject | |
| * @throws \Exception | |
| */ | |
| private function deleteSubject($subject) | |
| { | |
| $deleteSubSemSql = "DELETE FROM subject_sem_relation WHERE subjectID = '$subject->id'"; | |
| $deleteTeachingDeptSql = "DELETE FROM sd_relation WHERE subjectID = '$subject->id'"; | |
| $deleteSubjectSql = "DELETE FROM subjects WHERE subjectId = '$subject->id'"; | |
| try { | |
| $this->executeQuery($deleteSubSemSql); | |
| $this->executeQuery($deleteTeachingDeptSql); | |
| $this->executeQuery($deleteSubjectSql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Calculating how much subject references occurred in the database | |
| * @param Subject $subject | |
| * @return int | |
| * @throws ProfessionalException | |
| */ | |
| private function findCountOfSubjectReferences(Subject $subject) | |
| { | |
| $count = 0; | |
| $totalReferences = 0; | |
| try { | |
| foreach ($this->refSubjectsTablesWithSubjectIDColumn as $subjectIdRefTable) { | |
| $sqlToUpdate = "SELECT COUNT(*) as totalReferences FROM $subjectIdRefTable | |
| WHERE subjectID=$subject->id"; | |
| $count = (int) $this->executeQueryForObject($sqlToUpdate)->totalReferences; | |
| if ($count > 0) { | |
| ++$totalReferences; | |
| } | |
| } | |
| /** | |
| * Some tables using subject_ID instead of subjectID, Here updating such tables | |
| * update subject_ID ref columns | |
| */ | |
| foreach ($this->refSubjectsTablesWithSubject_IDColumn as $subjectIdRefTable) { | |
| $sqlToUpdate = "SELECT COUNT(*) as totalReferences FROM $subjectIdRefTable | |
| WHERE subject_ID=$subject->id"; | |
| $count = (int) $this->executeQueryForObject($sqlToUpdate)->totalReferences; | |
| if ($count > 0) { | |
| ++$totalReferences; | |
| } | |
| } | |
| foreach ($this->refSubjectsTableWithSubjects_IDColumn as $subjectIdRefTable) { | |
| $sqlToUpdate = "SELECT COUNT(*) as totalReferences FROM $subjectIdRefTable | |
| WHERE subjects_id=$subject->id"; | |
| $count = (int) $this->executeQueryForObject($sqlToUpdate)->totalReferences; | |
| if ($count > 0) { | |
| ++$totalReferences; | |
| } | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $totalReferences; | |
| } | |
| /** | |
| * Fetch subjects of sub batch from the database | |
| * @param array $subject //Subject | |
| * @return array | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectsBySubBatch($subject) | |
| { | |
| $batchID = $subject['batchID']; | |
| $semID = $subject['semID']; | |
| $subbatchID = $subject['subbatchID']; | |
| $tutorSub = $subject['tutorSub']; | |
| $subjectCatId = $subject['subjectCatId']; | |
| $sqlTutor = ""; | |
| if (!$tutorSub) { | |
| $sqlTutor = " and t3.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") "; | |
| } | |
| $cond = ""; | |
| if ($subjectCatId) { | |
| $cond = " AND t3.subjectcatID='$subjectCatId' "; | |
| } | |
| if ($subbatchID) { | |
| $sql = "SELECT DISTINCT t3.subjectID AS subjectId, t3.subjectName AS subjectName , t3.subjectDesc AS subjectDesc, t3.syllabusName AS syllabusName FROM sbs_relation t1, staffaccounts t2, subjects t3, subbatch_sbs ss WHERE t1.staffID=t2.staffID AND t1.subjectID=t3.subjectID AND ss.sbsID=t1.sbsID AND t1.batchID=" . $batchID . " and t1.semID=" . $semID . " and ss.subbatchID=" . $subbatchID . " " . $sqlTutor . " $cond ORDER BY subjectID ASC"; | |
| } else { | |
| $sql = "SELECT DISTINCT t3.subjectID AS subjectId, t3.subjectName AS subjectName , t3.subjectDesc AS subjectDesc, t3.syllabusName AS syllabusName FROM sbs_relation t1, staffaccounts t2, subjects t3 WHERE t1.staffID=t2.staffID AND t1.subjectID=t3.subjectID AND t1.batchID=\"" . $batchID . "\" and t1.semID=" . $semID . " " . $sqlTutor . " $cond ORDER BY subjectID ASC"; | |
| } | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param $courseTypeId | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getAllSubjectsByCourseTypeId($courseTypeId) | |
| { | |
| $courseTypeId = (int) $this->realEscapeString($courseTypeId); | |
| if (empty($courseTypeId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_COURSE_TYPE_ID, "Invalid course type details given"); | |
| } | |
| $sql = "SELECT DISTINCT subjectID as id, subjectName as name,subjectDesc description | |
| FROM subjects s | |
| INNER JOIN course_type ct on s.courseTypeID = ct.courseTypeID | |
| WHERE ct.courseTypeID = $courseTypeId"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $name | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function searchSubjectByString($name) | |
| { | |
| $name = $this->realEscapeString($name); | |
| $sql = "SELECT * FROM(SELECT CONCAT(subjectName,' ',subjectDesc) AS name FROM subjects) AS subjectName WHERE name LIKE '%$name%'"; | |
| try { | |
| $response = $this->executeQueryForList($sql); | |
| $response = CommonUtil::decodeHtmlSpecialChars($response); | |
| return $response; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $batchId | |
| * @param $semId | |
| * @param $subjectCategory | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectsByCategoryBatchSem($batchId, $semId, $subjectCategory) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectCategory = $this->realEscapeString($subjectCategory); | |
| $subjects = []; | |
| $sql = "SELECT DISTINCT s.subjectName, s.subjectDesc FROM sbs_relation sbs INNER JOIN subjects s ON (s.subjectID = sbs.subjectID) INNER JOIN subject_category sc ON (sc.subjectcatID = s.subjectcatID) WHERE sc.subjectcatName = '$subjectCategory' AND sbs.batchID = $batchId AND sbs.semID = $semId "; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param $secondLanguageID | |
| */ | |
| public function getSecondlanguageDetailsByID($secondLanguageID) | |
| { | |
| $secondLanguageID = $this->realEscapeString($secondLanguageID); | |
| $sql = "select secondlangaugeID, secondLangaugeName, secondLangaugedesc, showforadmission, secondLangaugeCode from secondLangauge where secondlangaugeID='$secondLanguageID'; "; | |
| try { | |
| $secondLanguage = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $secondLanguage; | |
| } | |
| /** | |
| * get supplementery exams of a student | |
| * | |
| * @param [type] $studentID | |
| * @param [type] $semID | |
| * @param [type] $subjectID | |
| * @param [type] $courseType | |
| * @return void | |
| */ | |
| public function getSupplementeryExamSubjectBySubjectIDStudentIDandCourseType($studentID, $semID, $courseType) | |
| { | |
| if ($courseType == "UG") | |
| $markTable = "exammarks_external"; | |
| elseif ($courseType == "PG") | |
| $markTable = "externalexammarks_finalized"; | |
| $sql = "SELECT | |
| esss.id,es.supplyDesc,e.examID,e.examName,e.subjectID,e.examTotalMarks,sub.subjectName,em.mark,sub.subjectDesc,intr.internalMarks, ims.maxInternalMarks,em.id | |
| FROM | |
| exam_supplementary_student_subjects esss | |
| INNER JOIN exam e ON esss.examID = e.examID | |
| inner JOIN exam_supplementary es ON esss.exam_supplementary_id = es.id | |
| inner JOIN internal_marks intr on esss.studentID = intr.studentID and e.subjectID = intr.subjectID and intr.semID = es.semID | |
| inner JOIN internal_marks_settings ims on es.semID = ims.semID and e.subjectID = ims.subjectID and intr.batchID = ims.batchID | |
| left JOIN exammarks_external em ON em.examID = e.examID AND esss.studentID = em.studentID | |
| left JOIN subjects sub ON sub.subjectID = e.subjectID | |
| WHERE esss.studentID= '$studentID' AND es.semID='$semID' group by em.id;"; | |
| try { | |
| $supplementery = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $supplementery; | |
| } | |
| /** | |
| * get subjectId of specific subject group of a student | |
| * | |
| * @param [type] $studentID | |
| * @param [type] $batchId | |
| * @param [type] $semId | |
| * @param [type] $subjectgroupId | |
| * @return [type] $subjectId | |
| * | |
| */ | |
| public function getStudentSubjectIDBySubjectGroupID($studentId, $batchId, $semId, $subjectgroupId) | |
| { | |
| $studentId = $this->realEscapeString($studentId); | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectgroupId = $this->realEscapeString($subjectgroupId); | |
| $sql = ""; | |
| $sql = " SELECT sublist.subjectID from (SELECT DISTINCT sub.subjectID as subjectId,sub.subjectName,sub.subjectDesc, ssbs.subbatchID, sub.subjectcatID FROM | |
| pseudosubjects_students pss | |
| INNER JOIN pseudosubjects_sbs psbs ON psbs.pseudosubjectID = pss.pseudosubjectID AND pss.studentID = $studentId | |
| INNER JOIN sbs_relation sbs ON sbs.sbsID=psbs.sbsID AND sbs.batchID = $batchId AND sbs.semID = $semId | |
| INNER JOIN subjects sub ON sbs.subjectID = sub.subjectID | |
| INNER JOIN subbatch_sbs ssbs ON (sbs.sbsID = ssbs.sbsID) WHERE sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") | |
| UNION | |
| SELECT DISTINCT sub.subjectID as subjectId,sub.subjectName,sub.subjectDesc , sbsbs.subbatchID, sub.subjectcatID FROM subbatch_student sbst | |
| INNER JOIN subbatch_sbs sbsbs ON sbsbs.subbatchID = sbst.subbatchID AND sbst.studentID = $studentId | |
| INNER JOIN sbs_relation sbs ON sbsbs.sbsID = sbs.sbsID AND sbs.batchID = $batchId AND sbs.semID = $semId | |
| INNER JOIN subjects sub ON sub.subjectID = sbs.subjectID WHERE sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") | |
| UNION | |
| SELECT DISTINCT sub.subjectID as subjectId,sub.subjectName,sub.subjectDesc, null, sub.subjectcatID FROM subjects sub | |
| INNER JOIN sbs_relation sbs ON sbs.subjectID = sub.subjectID | |
| WHERE sub.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") AND sbs.sbsID NOT IN (SELECT sbsID FROM subbatch_sbs) AND sbs.batchID = $batchId AND sbs.semID = $semId AND sbs.isPseudosubject = 0) as sublist | |
| INNER JOIN subjectGroups_subjects grpsub on grpsub.subjects_id = sublist.subjectId AND grpsub.batches_id = $batchId and grpsub.semesters_id = $semId and grpsub.subjectGroups_id = $subjectgroupId | |
| "; | |
| try { | |
| $subjectId = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectId; | |
| } | |
| /** | |
| * Get subject by sbsId | |
| * @param Integer $sbsId | |
| * @return Object $subjectDetails | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectBySbsId($sbsId) | |
| { | |
| $subjectDetails = null; | |
| $sbsId = $this->realEscapeString($sbsId); | |
| try { | |
| $sql = "SELECT s.subjectID, s.subjectName,s.subjectDesc, s.subjectcatID, sc.subjectcatName, s.subjectDesc, s.deptID FROM subjects s INNER JOIN sbs_relation sbs ON s.subjectID = sbs.subjectID LEFT JOIN subject_category sc on sc.subjectcatID = s.subjectcatID WHERE sbs.sbsID = '$sbsId' "; | |
| $subjectDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * get subjects | |
| * @param com\linways\core\ams\professional\request\SearchSubjectRequest $request | |
| * @param boolean $includeFailedBatch | |
| * @return array | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectsByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $semId = $request->semID; | |
| $batchId = $request->batchId; | |
| $examTypeId = $request->examTypeId; | |
| $subjectCatId = $request->subjectCatId; | |
| $examType = $request->examType; | |
| $examRegId = $request->examRegId; | |
| $subjects = []; | |
| $innerJoinTables = ""; | |
| $whereConditions = ""; | |
| if ($semId || $batchId || $examTypeId || ($examRegId && $examType)) { | |
| $innerJoinTables .= " INNER JOIN | |
| sbs_relation sbsr ON sbsr.subjectID = s.subjectID"; | |
| if ($semId) { | |
| $whereConditions .= " AND sbsr.semID IN ($semId)"; | |
| } | |
| if ($batchId) { | |
| $whereConditions .= " AND sbsr.batchID IN ($batchId)"; | |
| } | |
| if ($examTypeId || ($examRegId && $examType)) { | |
| $innerJoinTables .= " INNER JOIN | |
| exam e ON e.subjectID = s.subjectID | |
| AND e.batchID = sbsr.batchID | |
| AND e.semID = sbsr.semID"; | |
| if ($examTypeId) { | |
| $whereConditions .= " AND e.examTypeID IN ($examTypeId)"; | |
| } | |
| if ($examRegId && $examType) { | |
| if ($examType == ExamType::REGULAR) { | |
| $whereConditions .= " AND e.examregID IN ($examRegId)"; | |
| } else if ($examType == ExamType::SUPPLY) { | |
| $whereConditions .= " AND e.supply_examreg_id IN ($examRegId)"; | |
| } | |
| } | |
| } | |
| } | |
| if ($subjectCatId) { | |
| $whereConditions .= " AND s.subjectcatID IN ($subjectCatId)"; | |
| } | |
| if($request->examDate){ | |
| $whereConditions .= " AND e.examDate IN ('$request->examDate')"; | |
| } | |
| if($request->examTime){ | |
| $whereConditions .= " AND concat(e.examStartTime ,' - ',e.examEndTime) IN ('$request->examTime')"; | |
| } | |
| $sql = "SELECT DISTINCT | |
| s.subjectID AS id, | |
| s.subjectName AS name, | |
| s.subjectDesc AS description, | |
| s.syllabusName | |
| FROM | |
| subjects s | |
| $innerJoinTables | |
| WHERE 1 = 1 $whereConditions ORDER BY s.subjectName ASC"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param GetSubjectCategoriesRequest $request | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function searchSubjectCategories(GetSubjectCategoriesRequest $request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sql = "SELECT DISTINCT sg.id as subjectCategoryId,sg.name as subjectCategoryName,sg.code as categoryCode,sg.priority | |
| FROM subjectGroups sg | |
| INNER JOIN subjectGroups_subjects sgs ON sgs.subjectGroups_id = sg.id | |
| INNER JOIN batches b ON b.batchID = sgs.batches_id | |
| INNER JOIN semesters s ON s.semID = sgs.semesters_id | |
| WHERE 1=1 "; | |
| if (!empty($request->batchId)) { | |
| $sql .= " AND sgs.batches_id =$request->batchId "; | |
| } | |
| if (!empty($request->semesterId)) { | |
| $sql .= " AND sgs.semesters_id = $request->semesterId "; | |
| } | |
| if (!empty($request->subjectCategoryCode)) { | |
| $sql .= " AND sg.code = '$request->subjectCategoryCode' "; | |
| } | |
| if (!empty($request->subjectCategoryId)) { | |
| $sql .= " AND sg.id = $request->subjectCategoryId "; | |
| } | |
| if (!empty($request->subjectId)) { | |
| $sql .= " AND sgs.subjects_id IN ( " . implode(",", $request->subjectIds) . ")"; | |
| } | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param SearchSubjectsWithSubjectCategoriesRequest $request | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function searchSubjectsWithSubjectCategories(SearchSubjectsWithSubjectCategoriesRequest $request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $joinCondition = ""; | |
| $whereCondition = ""; | |
| $tutorConstant = SubjectConstants::TUTOR_SUBJECT; | |
| if (!empty($request->batchId)) { | |
| $joinCondition .= " AND sr.batchID =$request->batchId "; | |
| } | |
| if (!empty($request->semesterId)) { | |
| $joinCondition .= " AND sr.semID=$request->semesterId "; | |
| } | |
| if (!empty($request->subjectIds)) { | |
| $joinCondition .= " AND sr.subjectID IN ( " . implode(",", $request->subjectIds) . ")"; | |
| $whereCondition .= " AND s.subjectID IN ( " . implode(",", $request->subjectIds) . ")"; | |
| } | |
| $sql = "SELECT DISTINCT s.subjectID,s.subjectName,s.subjectDesc, s.syllabusName, sg.id as subjectGroupId,sg.name as subjectGroupName, | |
| sg.code as subjectGroupCode,s.subjectPriority | |
| FROM subjects s | |
| INNER JOIN sbs_relation sr ON sr.subjectID = s.subjectID $joinCondition | |
| LEFT JOIN subjectGroups_subjects sgs ON sgs.subjects_id = s.subjectID AND sgs.batches_id = sr.batchID | |
| AND sgs.semesters_id =sr.semID | |
| LEFT JOIN subjectGroups sg ON sg.id =sgs.subjectGroups_id | |
| WHERE 1=1 AND s.hide=0 AND s.subjectName !='$tutorConstant' $whereCondition"; | |
| try { | |
| return $this->executeQueryForList($sql, $this->mapper[SubjectServiceMapper::SEARCH_SUBJECTS_WITH_CATEGORIES]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param null $subjectId | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getAllSubjectHandlingDepartments($subjectId = NULL) | |
| { | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $condition = null; | |
| if ($subjectId) { | |
| $condition .= " AND s.subjectID = '$subjectId' "; | |
| } | |
| $sql = null; | |
| try { | |
| $sql = "SELECT DISTINCT d.deptID AS id, d.deptName AS name, d.departmentDesc AS description | |
| FROM subjects s | |
| INNER JOIN department d ON s.hdl_deptID = d.deptID $condition ORDER BY d.deptName ASC"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param HandlingDepartmentSubjectRequest $handlingDepartmentSubjectRequest | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author anoop | |
| */ | |
| public function getAllHandlingDepartmentSubjectsOfExamRegistration($handlingDepartmentSubjectRequest) | |
| { | |
| $handlingDepartmentSubjectRequest = $this->realEscapeObject($handlingDepartmentSubjectRequest); | |
| $sql = null; | |
| $sqlCondition = null; | |
| if ($handlingDepartmentSubjectRequest->examRegId) { | |
| $examRegIdString = implode(',', $handlingDepartmentSubjectRequest->examRegId) ? implode(',', $handlingDepartmentSubjectRequest->examRegId) : $handlingDepartmentSubjectRequest->examRegId; | |
| $sqlCondition = " er.examregID IN ($examRegIdString) "; | |
| } else { | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Exam id can not be null'); | |
| } | |
| if ($handlingDepartmentSubjectRequest->semId) { | |
| $semIdString = implode(',', $handlingDepartmentSubjectRequest->semId) ? implode(',', $handlingDepartmentSubjectRequest->semId) : $handlingDepartmentSubjectRequest->semId; | |
| $sqlCondition .= " AND erb.semID IN ($semIdString) "; | |
| } | |
| try { | |
| $sql = "SELECT DISTINCT | |
| s.subjectID, | |
| s.subjectName, | |
| s.subjectDesc, | |
| d.deptID, | |
| d.deptName, | |
| d.departmentDesc, | |
| er.examregID, | |
| er.examregName, | |
| er.examregDesc, | |
| er.examMonth, | |
| er.examYear, | |
| CONCAT(MONTHNAME(CONCAT(er.examYear,'-',er.examMonth,'-','01')),' ',er.examYear) AS examMonthYear, | |
| sbsr.semID | |
| FROM | |
| exam_registration er | |
| INNER JOIN | |
| exam_registration_batches erb ON erb.examregID = er.examregID | |
| INNER JOIN | |
| batches b ON b.batchID = erb.batchID | |
| INNER JOIN | |
| department d ON d.deptID = b.deptID | |
| INNER JOIN | |
| sbs_relation sbsr ON sbsr.batchID = b.batchID | |
| AND sbsr.semID = erb.semID | |
| INNER JOIN | |
| subjects s ON s.subjectID = sbsr.subjectID | |
| AND s.hdl_deptID = d.deptID | |
| WHERE | |
| $sqlCondition"; | |
| $subjects = $this->executeQueryForList($sql, $this->mapper[SubjectServiceMapper::GET_REGULAR_EXAM_REGISTRATION_SUBJECTS_OF_HANDLING_DEPARTMENT]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * | |
| * Method for getting paper type by name | |
| * @param paperTypeName | |
| * @return Object|null $paperType object | |
| * @throws ProfessionalException | |
| * @author Kishan | |
| */ | |
| public function getPaperTypeByName($paperTypeName) | |
| { | |
| $paperType = null; | |
| $paperTypeName = $this->realEscapeObject($paperTypeName); | |
| $sql = "select * from subjectPaperType where paperTypeName = '$paperTypeName'"; | |
| try { | |
| $paperType = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $paperType; | |
| } | |
| /** | |
| * | |
| * Method for getting second language by name | |
| * @param secondLanguageName | |
| * @return Object|null $secondLanguage object | |
| * @throws ProfessionalException | |
| * @author Kishan | |
| */ | |
| public function getSecondLanguageByName($secondLanguageName) | |
| { | |
| $secondLanguage = null; | |
| $secondLanguageName = $this->realEscapeObject($secondLanguageName); | |
| $sql = "SELECT * FROM secondLangauge WHERE secondLangaugeName = '$secondLanguageName'"; | |
| try { | |
| $secondLanguage = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $secondLanguage; | |
| } | |
| /** | |
| * | |
| * Method for inserting subjects from excel | |
| * @param SubjectExcelImport $excelData | |
| * @return array | |
| * @throws ProfessionalException | |
| * | |
| * @author Kishan | |
| */ | |
| public function insertSubjectFromExcel($excelData) | |
| { | |
| $excelData = $this->realEscapeObject($excelData); | |
| $error_arr = array(); | |
| $updateConditions = null; | |
| $insertFields = null; | |
| $insertValues = null; | |
| //$response = null; | |
| if (!$excelData->subjectCode) { | |
| array_push($error_arr, 'Subject Code is mandatory!'); | |
| } | |
| if ($excelData->subjectName) { | |
| $insertFields .= ',subjectDesc'; | |
| $insertValues .= ",'" . $excelData->subjectName . "'"; | |
| $updateConditions .= ",subjectDesc = '" . $excelData->subjectName . "'"; | |
| } | |
| if (($excelData->isTheory == 0 || $excelData->isTheory == 1) && $excelData->isTheory != "") { | |
| $insertFields .= ',isTheory'; | |
| $insertValues .= ',' . $excelData->isTheory; | |
| $updateConditions .= ',isTheory = ' . $excelData->isTheory; | |
| } | |
| if ($excelData->paperType) { | |
| $paperType = SubjectService::getInstance()->getPaperTypeByName($excelData->paperType); | |
| if ($paperType) { | |
| $insertFields .= ',paperTypeId'; | |
| $insertValues .= ',' . $paperType->id; | |
| $updateConditions .= ',paperTypeId = ' . $paperType->id; | |
| } else { | |
| array_push($error_arr, 'Paper Type not found in system'); | |
| } | |
| } | |
| if (!$excelData->syllabusYear) { | |
| array_push($error_arr, 'Syllabus Year is mandatory for ' . $excelData->subjectCode); | |
| } else { | |
| $insertFields .= ',syllabusYear'; | |
| $insertValues .= ',' . $excelData->syllabusYear; | |
| $updateConditions .= ',syllabusYear = ' . $excelData->syllabusYear; | |
| } | |
| if ($excelData->subjectPriority) { | |
| $insertFields .= ',subjectPriority'; | |
| $insertValues .= ',' . $excelData->subjectPriority; | |
| $updateConditions .= ',subjectPriority = ' . $excelData->subjectPriority; | |
| } | |
| if ($excelData->subjectCategory) { | |
| $subjectCategory = SubjectService::getInstance()->getSubjectCategoryByName($excelData->subjectCategory); | |
| if ($subjectCategory) { | |
| $insertFields .= ',subjectcatID'; | |
| $insertValues .= ',' . $subjectCategory->subjectCatId; | |
| $updateConditions .= ',subjectcatID = ' . $subjectCategory->subjectCatId; | |
| } else { | |
| array_push($error_arr, 'Subject Category not found in system'); | |
| } | |
| } | |
| if ($excelData->courseType) { | |
| $courseType = CourseTypeService::getInstance()->getcourseTypeByName($excelData->courseType); | |
| if ($courseType) { | |
| $insertFields .= ',courseTypeID'; | |
| $insertValues .= ',' . $courseType->courseTypeID; | |
| $updateConditions .= ',courseTypeID = ' . $courseType->courseTypeID; | |
| } else { | |
| array_push($error_arr, 'Course Type not found in system'); | |
| } | |
| } | |
| if ($excelData->noOfModules) { | |
| $insertFields .= ',no_of_modules'; | |
| $insertValues .= ',' . $excelData->noOfModules; | |
| $updateConditions .= ',no_of_modules = ' . $excelData->noOfModules; | |
| } | |
| if ($excelData->handlingDepartment) { | |
| $handlingDepartment = DepartmentService::getInstance()->getDepartmentByCode($excelData->handlingDepartment); | |
| if ($handlingDepartment) { | |
| $insertFields .= ',hdl_deptID'; | |
| $insertValues .= ',' . $handlingDepartment->id; | |
| $updateConditions .= ',hdl_deptID = ' . $handlingDepartment->id; | |
| $insertFields .= ',deptID'; | |
| $insertValues .= ',' . $handlingDepartment->id; | |
| $updateConditions .= ',deptID = ' . $handlingDepartment->id; | |
| } else { | |
| array_push($error_arr, 'Department not found in system'); | |
| } | |
| } | |
| if ($excelData->secondLanguage) { | |
| $secondLanguage = SubjectService::getInstance()->getSecondLanguageByName($excelData->secondLanguage); | |
| if ($secondLanguage) { | |
| $insertFields .= ',secondLangaugeId'; | |
| $insertValues .= ',' . $secondLanguage->secondlangaugeID; | |
| $updateConditions .= ',secondLangaugeId = ' . $secondLanguage->secondlangaugeID; | |
| } else { | |
| array_push($error_arr, 'Second language not found in system'); | |
| } | |
| } | |
| $existingSubject = SubjectService::getInstance()->getSubjectByCodeAndYear($excelData->subjectCode, $excelData->syllabusYear); | |
| if ($existingSubject) { | |
| $sql = "UPDATE subjects SET subjectName = '$excelData->subjectCode' " . $updateConditions . " WHERE subjectID = '$existingSubject->subjectID'"; | |
| $subjectID = $existingSubject->subjectID; | |
| } else { | |
| $sql = "INSERT INTO subjects (subjectName $insertFields) VALUES ('$excelData->subjectCode' $insertValues)"; | |
| } | |
| //Checking validation.If required fields are missing in the input excel throw the exception | |
| if (!empty($error_arr)) { | |
| throw new ProfessionalException(ProfessionalException::IMPORT_SUBJECT_VALIDATION_ERROR, "Import subject failed due to validation.please check the exception data to get more details.", $error_arr); | |
| } | |
| //If validation success go ahead with DB updation | |
| try { | |
| $subjectID = $this->executeQueryForObject($sql, true); | |
| if (!$subjectID) { | |
| $subjectID = $existingSubject->subjectID; | |
| } | |
| if (($excelData->semester) && ($subjectID)) { | |
| $sql = "DELETE FROM subject_sem_relation WHERE subjectID = $subjectID"; | |
| $this->executeQueryForObject($sql); | |
| $semNameArr = explode(',', $excelData->semester); | |
| foreach ($semNameArr as $semesterName) { | |
| $semester = SemesterService::getInstance()->getSemesterByName($semesterName); | |
| if ($semester) { | |
| $sql = "INSERT INTO subject_sem_relation (subjectID,semID,created_by,created_date,updated_by,updated_date) values ($subjectID,$semester->id,$excelData->createdBy,utc_timestamp(),$excelData->updatedBy,utc_timestamp())"; | |
| $this->executeQueryForObject($sql); | |
| } else { | |
| array_push($error_arr, 'Semester invalid for ' . $excelData->subjectCode); | |
| } | |
| } | |
| } | |
| if (($excelData->subjectDepartment) && ($subjectID)) { | |
| $sql = "DELETE FROM sd_relation WHERE subjectID = $subjectID"; | |
| $this->executeQueryForObject($sql); | |
| $subjectDepartmentArr = explode(',', $excelData->subjectDepartment); | |
| foreach ($subjectDepartmentArr as $deptName) { | |
| $department = DepartmentService::getInstance()->getDepartmentByCode($deptName); | |
| if ($department) { | |
| $sql = "INSERT INTO sd_relation (subjectID,deptID,createdBy,createdDate,updatedBy,updatedDate) values ($subjectID,$department->id,$excelData->createdBy,utc_timestamp(),$excelData->updatedBy,utc_timestamp())"; | |
| $this->executeQueryForObject($sql); | |
| } else { | |
| array_push($error_arr, 'Department invalid for ' . $excelData->subjectCode); | |
| } | |
| } | |
| } | |
| //Checking validation.If required fields are missing in the input excel throw the exception | |
| if (!empty($error_arr)) { | |
| throw new ProfessionalException(ProfessionalException::IMPORT_SUBJECT_VALIDATION_ERROR, "Import subject failed due to validation.please check the exception data to get more details.", $error_arr); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage(), $error_arr); | |
| } | |
| return $error_arr; | |
| } | |
| /** | |
| * | |
| * Method for fetching the subject with subject code and syllabus year | |
| * @param subjectCode, syllabusYear | |
| * @return Object|null | |
| * @throws ProfessionalException | |
| * | |
| * @author Kishan | |
| */ | |
| public function getSubjectByCodeAndYear($subjectCode, $syllabusYear = null ) | |
| { | |
| $subject = null; | |
| $subjectCode = $this->realEscapeObject($subjectCode); | |
| $syllabusYear = $this->realEscapeObject($syllabusYear); | |
| $condition=""; | |
| if($syllabusYear){ | |
| $condition .= " AND syllabusYear = '$syllabusYear'"; | |
| } | |
| $sql = "select * from subjects where subjectName = '$subjectCode' $condition"; | |
| try { | |
| $subject = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subject; | |
| } | |
| /** | |
| * Get all subjects by department id and semester id | |
| * | |
| * @param $departmentId | |
| * @param $semesterId | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author jithinvijayan | |
| */ | |
| public function getAllSubjectsByDepartmentAndSemester($departmentId = null, $semesterId = null) | |
| { | |
| $condition = ""; | |
| if (!empty($departmentId)) { | |
| $condition .= " AND sdr.deptID = $departmentId "; | |
| } | |
| if (!empty($semesterId)) { | |
| $condition .= " AND ssr.semID = $semesterId "; | |
| } | |
| $sql = "SELECT DISTINCT s.subjectID as id, s.subjectName as name, s.subjectDesc as description | |
| FROM subjects s | |
| INNER JOIN sd_relation sdr ON sdr.subjectID = s.subjectID | |
| INNER JOIN subject_sem_relation ssr ON ssr.subjectID = s.subjectID | |
| WHERE s.hide=0 $condition | |
| ORDER BY s.subjectName "; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * returns subjects syllabus years by department ids. | |
| * | |
| * @param $departmentIds | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author jithinvijayan | |
| */ | |
| public function getAllSyllabusYearsByDepartmentIds($departmentIds) | |
| { | |
| if (count($departmentIds) === 0) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_DEPARTMENT_IDS, "Select at least one department to continue"); | |
| } | |
| try { | |
| $sql = "SELECT DISTINCT syllabusYear | |
| FROM subjects WHERE hdl_deptID IN (" . implode(",", $departmentIds) . ") | |
| AND hide=0 AND isSubjectHide=0 AND syllabusYear IS NOT NULL"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author jithinvijayan | |
| */ | |
| public function getAllSubjectGroups() | |
| { | |
| $sql = "SELECT id,name,code FROM subjectGroups ORDER BY name"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $batchId | |
| * @param $semId | |
| * @param int $groupId | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectGroupSubjectsByBatchSem($batchId, $semId, $groupId = 0) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $groupId = $this->realEscapeString($groupId); | |
| try { | |
| $sql = "SELECT | |
| sgs.id, | |
| sgs.subjectGroups_id AS subjectGroupId, | |
| sgs.batches_id AS batchId, | |
| sgs.semesters_id AS semId, | |
| sgs.subjects_id AS subjectId, | |
| ecscg.id AS ec_subCatGroupId, | |
| ecscg.name AS ec_subCatName, | |
| ecscg.description AS ec_subCatDesc | |
| FROM | |
| subjectGroups_subjects sgs | |
| LEFT JOIN ec_subject_category_group ecscg ON ecscg.id = sgs.ec_subject_cat_group_id | |
| WHERE | |
| sgs.batches_id = " . $batchId . " | |
| AND sgs.semesters_id = " . $semId . " | |
| AND sgs.subjectGroups_id = " . ($groupId ? $groupId : 0) . " | |
| ORDER BY sgs.id"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get subject details in a sem of a batch | |
| * @param int $semId | |
| * @param int $batchId | |
| * @return $objectList[] | |
| * @throws AMSException | |
| */ | |
| public function getSubjectsBySem($semId, $batchId,$subCatId = NULL) | |
| { | |
| $cond = ''; | |
| if($subCatId) | |
| $cond .= " AND t2.subjectcatID = $subCatId "; | |
| $sql = "SELECT DISTINCT(t1.subjectID) as id, | |
| t2.subjectName as name, | |
| t2.subjectDesc as description, | |
| t2.syllabusName,t2.subjectPriority as priority, | |
| t2.hdl_deptID as hdlDeptId from sbs_relation t1, subjects t2 where t2.subjectID=t1.subjectID and t2.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") and t1.batchID=$batchId and t1.semID=$semId $cond "; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $subjectId | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getBasicSubjectDetailsBySubjectId($subjectId) | |
| { | |
| $subjectId = $this->realEscapeString($subjectId); | |
| if (empty($subjectId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_SUBJECT_ID, "Invalid subject details given"); | |
| } | |
| $sql = "SELECT subjectID as subjectId,subjectName FROM subjects | |
| WHERE subjectID = $subjectId"; | |
| try { | |
| $response = $this->executeQueryForObject($sql); | |
| $response = CommonUtil::decodeHtmlSpecialChars($response); | |
| return $response; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $request | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author jithinvijayan | |
| * @deprecated | |
| */ | |
| public function getAllCourseMaterials($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $currentStaff = $request->currentStaffID ? ", IF(sa.staffID=" . $request->currentStaffID . ",'Me', sa.staffName) as staffName " : ", sa.staffName "; | |
| $condition = $request->currentStaffID ? " and cm.staffID <> " . $request->currentStaffID . " " : ""; | |
| $condition .= $request->subjectID ? " and cm.subjectID=" . $request->subjectID . " " : ""; | |
| $condition .= $request->documentID ? " and cm.materialID=" . $request->documentID . " " : ""; | |
| $sql = "SELECT cm.materialID, cm.materialName, cm.materialUploadtime, cm.materialTopic, cm.materialDocPath, | |
| cm.materialPdfPath, cm.materialImgPath, cm.materialSwfPath, cm.materialDesc, cm.batchID, cm.subjectID, | |
| cm.semID $currentStaff | |
| FROM course_material cm | |
| INNER JOIN staffaccounts sa ON sa.staffID=cm.staffID | |
| where cm.sharedoc=1 $condition ;"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $request | |
| * @param $oldCourseMaterial | |
| * @return bool | |
| * @throws ProfessionalException | |
| */ | |
| public function copyCourseMaterials($request, $oldCourseMaterial) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $oldCourseMaterial = $this->realEscapeObject($oldCourseMaterial); | |
| try { | |
| $sql = "INSERT INTO course_material (materialName,materialDocPath,materialPdfPath,materialImgPath, | |
| materialSwfPath,materialDesc,materialTopic,staffID,batchID,subjectID,semID) | |
| VALUES('$oldCourseMaterial->materialName','$oldCourseMaterial->materialDocPath', | |
| '$oldCourseMaterial->materialPdfPath','$oldCourseMaterial->materialImgPath', | |
| '$oldCourseMaterial->materialSwfPath','$oldCourseMaterial->materialDesc', | |
| '$oldCourseMaterial->materialTopic','$request->currentStaffID','$request->batchID', | |
| '$request->subjectID','$request->semID')"; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return true; | |
| } | |
| /** | |
| * Get subjects to assign credits - subject-wise | |
| * @param $request | |
| * @return Object|null | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectToAssignCredits($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sqlCondition = null; | |
| if ($request->subjectCategory) { | |
| $sqlCondition = " AND s.subjectcatID = '$request->subjectCategory' "; | |
| } | |
| $sql = null; | |
| $subjects = null; | |
| try { | |
| $sql = "SELECT | |
| s.subjectID AS id, | |
| s.subjectName AS name, | |
| s.subjectDesc AS description, | |
| s.isTheory, | |
| esc.excludeSubjectFromTotal, | |
| esc.isInternal, | |
| esc.isExternal, | |
| esc.subjectType, | |
| esc.credit | |
| FROM | |
| subjects s | |
| INNER JOIN | |
| sbs_relation sbs ON (s.subjectID = sbs.subjectID) | |
| INNER JOIN | |
| batches b ON (b.batchID = sbs.batchID) | |
| LEFT JOIN | |
| exam_subjectcredit esc ON (esc.batchID = sbs.batchID | |
| AND esc.semID = sbs.semID | |
| AND esc.subjectID = sbs.subjectID) | |
| WHERE | |
| b.batchStartYear = '$request->batchStartYear' | |
| AND sbs.semID = '$request->semId' | |
| AND b.courseTypeID = '$request->courseTypeId' | |
| $sqlCondition | |
| GROUP BY s.subjectID | |
| ORDER BY s.subjectName ASC, s.subjectDesc ASC"; | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param $subject | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function saveSubjectsCredit($subject) | |
| { | |
| $subject = $this->realEscapeObject($subject); | |
| $sql = null; | |
| $subject->isInternal = $subject->isInternal == 'true' ? 1 : 0; | |
| $subject->isExternal = $subject->isExternal == 'true' ? 1 : 0; | |
| $subject->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal == 'true' ? 1 : 0; | |
| $subject->hideGrade = 0; | |
| $subject->subjectOrder = 'NULL'; | |
| try { | |
| $sql = "INSERT INTO exam_subjectcredit (batchID, semID, subjectID, credit, isInternal, isExternal, hideGrade, excludeSubjectFromTotal, subjectType, subjectOrder) | |
| SELECT | |
| sbs.batchID, sbs.semID, sbs.subjectID, | |
| '$subject->credit', | |
| '$subject->isInternal', | |
| '$subject->isExternal', | |
| '$subject->hideGrade', | |
| '$subject->excludeSubjectFromTotal', | |
| '$subject->subjectType', | |
| $subject->subjectOrder | |
| FROM | |
| sbs_relation sbs | |
| INNER JOIN | |
| batches b ON (b.batchID = sbs.batchID) | |
| WHERE | |
| b.batchStartYear = '$subject->batchStartYear' | |
| AND sbs.semID = '$subject->semId' | |
| AND b.courseTypeID = '$subject->courseTypeId' | |
| AND sbs.subjectID = '$subject->id' | |
| ON DUPLICATE KEY UPDATE | |
| credit = VALUES(credit), | |
| isInternal = VALUES(isInternal), | |
| isExternal = VALUES(isExternal), | |
| hideGrade = VALUES(hideGrade), | |
| excludeSubjectFromTotal = VALUES(excludeSubjectFromTotal), | |
| subjectType = VALUES(subjectType)"; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @return List of Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectGroupSubjectType($id = NULL) | |
| { | |
| $id = $this->realEscapeObject($id); | |
| $sqlCondition = ""; | |
| if ($id) { | |
| $sqlCondition .= " AND sg.id = $id "; | |
| } | |
| $sql = "SELECT | |
| sg.id, | |
| sg.name, | |
| GROUP_CONCAT(DISTINCT esc.subjectType) AS subjectTypes | |
| FROM | |
| subjectGroups sg | |
| INNER JOIN subjectGroups_subjects sgs ON | |
| sgs.subjectGroups_id = sg.id | |
| INNER JOIN exam_subjectcredit esc ON | |
| esc.batchID = sgs.batches_id | |
| AND esc.semID = sgs.semesters_id | |
| AND esc.subjectID = sgs.subjects_id | |
| WHERE | |
| sg.id = sg.id | |
| $sqlCondition | |
| GROUP BY | |
| sg.id"; | |
| try { | |
| return $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getSubjectNames($subjectIdStr) | |
| { | |
| $sql = ''; | |
| $subjectNames = []; | |
| $subjectIdStr = $this->realEscapeString($subjectIdStr); | |
| try { | |
| $sql = "SELECT s.subjectDesc as subjectDesc,s.subjectName as subjectName,s.syllabusName,s.subjectID as subjectId FROM subjects s WHERE s.subjectID IN ($subjectIdStr)"; | |
| $subjectNames = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new AutonomousException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectNames; | |
| } | |
| public function getStudentGroupedSubjects($batchId, $semId, $studentId) | |
| { | |
| $sql = null; | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $studentId = $this->realEscapeString($studentId); | |
| $studentGroupedSubjects = null; | |
| try { | |
| $sql = "SELECT GROUP_CONCAT(su.subjectName ORDER BY sg.priority ASC SEPARATOR ', ') AS subjectGroups FROM subjects su INNER JOIN exam_reg_studentsubject erss ON erss.subjectID = su.subjectID INNER JOIN subjectGroups_subjects sgs ON erss.subjectID = sgs.subjects_id INNER JOIN subjectGroups sg ON sg.id = sgs.subjectGroups_id WHERE sgs.batches_id = $batchId AND sgs.semesters_id = $semId AND erss.studentID = $studentId AND sgs.subjectGroups_id IS NOT NULL ORDER BY sg.priority ASC"; | |
| $studentGroupedSubjects = $this->executeQueryForObject($sql)->subjectGroups; | |
| } catch (\Exception $e) { | |
| throw new AutonomousException($e->getCode(), $e->getMessage()); | |
| } | |
| return $studentGroupedSubjects; | |
| } | |
| public function getStudentGroupedSubjectsSyllabusName($batchId, $semId, $studentId, $syllabusAndSubjectCode = false) | |
| { | |
| $sql = null; | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $studentId = $this->realEscapeString($studentId); | |
| $studentGroupedSubjects = null; | |
| $concatString = null; | |
| if ($syllabusAndSubjectCode) { | |
| $concatString = "GROUP_CONCAT(CONCAT(su.subjectName,'(',su.syllabusName,')') ORDER BY sg.priority ASC SEPARATOR ', ')"; | |
| } else { | |
| $concatString = "GROUP_CONCAT(su.syllabusName ORDER BY sg.priority ASC SEPARATOR ', ')"; | |
| } | |
| try { | |
| $sql = "SELECT $concatString AS subjectGroups FROM subjects su INNER JOIN exam_reg_studentsubject erss ON erss.subjectID = su.subjectID INNER JOIN subjectGroups_subjects sgs ON erss.subjectID = sgs.subjects_id INNER JOIN subjectGroups sg ON sg.id = sgs.subjectGroups_id WHERE sgs.batches_id = $batchId AND sgs.semesters_id = $semId AND erss.studentID = $studentId AND sgs.subjectGroups_id IS NOT NULL ORDER BY sg.priority ASC"; | |
| $studentGroupedSubjects = $this->executeQueryForObject($sql)->subjectGroups; | |
| } catch (\Exception $e) { | |
| throw new AutonomousException($e->getCode(), $e->getMessage()); | |
| } | |
| return $studentGroupedSubjects; | |
| } | |
| public function getGroupedSubjectDetails($batchId, $semId, $subjectId) | |
| { | |
| $sql = null; | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $subjectGroupDetails = null; | |
| try { | |
| $sql = "SELECT sgs.subjectGroups_id AS subjectGroupId, sg.name AS groupName FROM subjectGroups_subjects sgs INNER JOIN subjectGroups sg ON sgs.subjectGroups_id = sg.id WHERE sgs.batches_id = " . $batchId . " AND sgs.semesters_id = " . $semId . " AND sgs.subjects_id = " . $subjectId . ""; | |
| $subjectGroupDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new AutonomousException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectGroupDetails; | |
| } | |
| /** | |
| * @param $subjectCode | |
| * @param $courseTypeId | |
| * @return mixed | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectByCode($subjectCode, $subjectDesc = null) | |
| { | |
| $subjects = []; | |
| $sql = "SELECT subjectID, subjectName, subjectDesc, semID, courseTypeID FROM subjects WHERE subjectName ='$subjectCode'"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| if (count($subjects) > 1) { | |
| $sql = "SELECT subjectID, subjectName, subjectDesc, semID FROM subjects WHERE subjectName ='$subjectCode' AND subjectDesc = '$subjectDesc'"; | |
| $subjects = $this->executeQueryForList($sql); | |
| if (count($subjects) > 1) { | |
| return null; | |
| } else { | |
| return $subjects[0]; | |
| } | |
| return null; | |
| } | |
| return $subjects[0]; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get subject details in a sem of a batch in order | |
| * @param int $semId | |
| * @param int $batchId | |
| * @throws AMSException | |
| * @return $objectList[] | |
| */ | |
| public function getSubjectsBySemInOrder($semId, $batchId) | |
| { | |
| $sql = "SELECT DISTINCT(t1.subjectID) as id, | |
| t2.subjectName as name, | |
| t2.subjectDesc as description, | |
| t2.syllabusName,t2.subjectPriority as priority, | |
| t2.hdl_deptID as hdlDeptId | |
| from sbs_relation t1 | |
| inner join subjects t2 | |
| on t2.subjectID=t1.subjectID | |
| left join exam_subjectcredit esc | |
| on esc.subjectID=t2.subjectID AND esc.subjectID = t1.subjectID AND esc.batchID = t1.batchID AND esc.semID = t1.semID | |
| where t2.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") | |
| and t1.batchID='$batchId' | |
| and t1.semID='$semId' | |
| order by esc.subjectOrder ASC"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| } | |
| } | |
| /** | |
| * @param GetPseudoSubjectIdRequest $request | |
| * @return array|object | |
| * @throws ProfessionalException | |
| */ | |
| public function getPseudoSubjectIds(GetPseudoSubjectIdRequest $request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sql = "SELECT ps.pseudoSubjectID as id FROM pseudosubjects ps | |
| INNER JOIN pseudosubjects_sbs p on ps.pseudosubjectID = p.pseudosubjectID | |
| INNER JOIN sbs_relation sr on p.sbsID = sr.sbsID | |
| WHERE 1=1 "; | |
| if (!empty($request->batchId)) { | |
| $sql .= " AND sr.batchID =$request->batchId "; | |
| } | |
| if (!empty($request->semesterId)) { | |
| $sql .= " AND sr.semID =$request->semesterId "; | |
| } | |
| if (!empty($request->subjectId)) { | |
| $sql .= " AND sr.subjectID = $request->subjectId"; | |
| } | |
| if (!empty($request->staffId)) { | |
| $sql .= " AND sr.staffID = $request->staffId"; | |
| } | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Method for getting supply subjects by supplyexam reg id,batch,sem | |
| * @param unknown $subjectList | |
| * @throws ProfessionalException | |
| * @return unknown | |
| * @author Sibin | |
| */ | |
| public function getSupplySubjectsBySupplyExamRegId($examRegId,$batchId,$semId) | |
| { | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| try{ | |
| $sql = "SELECT DISTINCT(e.subjectID) as id, | |
| s.subjectName as name, | |
| s.subjectDesc as description, | |
| s.syllabusName, | |
| s.subjectPriority as priority | |
| from exam e | |
| inner join subjects s | |
| on s.subjectID= e.subjectID | |
| inner join exam_subjectcredit esc | |
| on esc.subjectID=s.subjectID | |
| where e.supply_examreg_id='$examRegId' | |
| and e.batchID='$batchId' | |
| and e.semID='$semId' | |
| order by esc.subjectOrder ASC,s.subjectDesc ASC;"; | |
| $subjectList = $this->executeQueryForList($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $subjectList; | |
| } | |
| /** | |
| * Method for getting subject categories of subjects given | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| * @author sibin | |
| */ | |
| public function getSubjectCategoriesBySubject($subjects) | |
| { | |
| $subjectIds=""; | |
| $sql = ''; | |
| $subjectCatDetails = []; | |
| foreach($subjects as $subject){ | |
| if($subjectIds){ | |
| $subjectIds = $subjectIds.",".$subject; | |
| } | |
| else{ | |
| $subjectIds =$subject; | |
| } | |
| } | |
| try { | |
| $sql = "SELECT distinct(s.subjectcatID) as id ,sc.subjectcatName as name | |
| from subjects s | |
| inner join subject_category sc | |
| on sc.subjectcatID = s.subjectcatID | |
| where s.subjectID IN($subjectIds)"; | |
| $subjectCatDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectCatDetails; | |
| } | |
| /** | |
| * Get all subjects from assign rules | |
| * @param mixed $batchId, $semId | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectListByBatchIdAndSemId($batchId, $semId) | |
| { | |
| try { | |
| $sql = "SELECT distinct(ss.subjectID) as subjectId, | |
| ss.subjectName , | |
| ss.syllabusName , | |
| ss.subjectDesc | |
| from sbs_relation sr | |
| INNER JOIN subjects ss ON (sr.subjectID = ss.subjectID ) | |
| INNER JOIN exam_subjectcredit esc ON (sr.subjectID = esc.subjectID | |
| and sr.batchID = esc.batchID | |
| and sr.semID = esc.semID ) | |
| WHERE esc.isInternal = 1 | |
| AND sr.batchID = $batchId | |
| AND sr.semID =$semId | |
| ORDER BY esc.subjectOrder asc,ss.subjectID asc"; | |
| $subjectDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * @return List of Object | |
| * get internal subjects | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectInternalExternalStatus($batchId, $semId, $subjectId) | |
| { | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| try{ | |
| $sql = "SELECT isInternal FROM exam_subjectcredit where subjectID =$subjectId and batchID =$batchId and semID =$semId"; | |
| $subject = $this->executeQueryForList($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $subject[0]; | |
| } | |
| public function getBatchSubjectCategoryDetails($batchId, $semId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| try{ | |
| $sql = "SELECT | |
| bsscr.id, | |
| bsscr.batchID AS batchId, | |
| bsscr.semID AS semId, | |
| bsscr.subjectID AS subjectId, | |
| bsscr.subjectcatID AS subjectcatId, | |
| bsscr.subject_cat_group_id AS subjectCatGroupId, | |
| scg.name AS subCatGroupName, | |
| sc.code, | |
| sc.subjectcatName, | |
| sc.subjectcatCode, | |
| sc.subjectcatPriority, | |
| sc.use_bring_value AS useBringValue, | |
| sc.parentID AS parentId, | |
| sc.canShow | |
| FROM | |
| batch_sem_subjectCategory_relation bsscr | |
| INNER JOIN subject_category sc ON | |
| sc.subjectcatID = bsscr.subjectcatID | |
| LEFT JOIN ec_subject_category_group scg ON | |
| scg.id = bsscr.subject_cat_group_id | |
| WHERE | |
| bsscr.semID = $semId | |
| AND bsscr.batchID = $batchId"; | |
| $subjectCategory = $this->executeQueryForList($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| $categoryDetails = []; | |
| foreach ($subjectCategory as $subjectCat) { | |
| $categoryDetails[$subjectCat->subjectId] = $subjectCat; | |
| } | |
| return $categoryDetails; | |
| } | |
| /** | |
| * Get assigned sbs details of batchId | |
| * @param int $batchId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsDetailsByBatchId($batchId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $sbsDetails = []; | |
| $sql_sbs = "SELECT ss.subjectName,sr.subjectID,ss.subjectDesc,sr.semID , bss.subjectcatID, sc.subjectcatName from sbs_relation sr | |
| inner JOIN subjects ss ON (sr.subjectID = ss.subjectID ) | |
| INNER JOIN exam_subjectcredit esc ON esc.batchID = sr.batchID and esc.semID = sr.semID and esc.subjectID = sr.subjectID | |
| left JOIN batch_sem_subjectCategory_relation bss ON (bss.batchID = sr.batchID and sr .semID = bss .semID and sr. subjectID = bss.subjectID) LEFT JOIN subject_category sc on (sc.subjectcatID = bss.subjectcatID) WHERE sr.batchID = $batchId order by sr.semID asc"; | |
| try { | |
| $sbsDetails = $this->executeQueryForList($sql_sbs); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $sbsDetails; | |
| } | |
| /** | |
| * Get assigned sbs details of batchId | |
| * @param int $batchId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function addBatchSemSubjectCategoryRelation($batchId, $subjectList) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $subjectList = $this->realEscapeObject($subjectList); | |
| foreach ( $subjectList as $subject){ | |
| $semId = $subject['semId']; | |
| $subjectId = $subject['subjectId']; | |
| $subjectCatId = $subject['subjectCatId']; | |
| $subjectCatId = $subjectCatId ? $subjectCatId : "NULL"; | |
| $sql_subcat = "SELECT subjectID from batch_sem_subjectCategory_relation WHERE subjectID = $subjectId and batchID = $batchId and semID =$semId"; | |
| try { | |
| $subjectCategory = $this->executeQueryForList($sql_subcat); | |
| if ( $subjectCategory) { | |
| $sql = "UPDATE batch_sem_subjectCategory_relation set subjectcatID=$subjectCatId WHERE subjectID = $subjectId and batchID = $batchId and semID =$semId "; | |
| } | |
| else{ | |
| $sql = "INSERT INTO batch_sem_subjectCategory_relation (batchID, semID, subjectID, subjectcatID) VALUES($batchId, $semId, $subjectId, $subjectCatId)"; | |
| } | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| } | |
| /** | |
| * Get subject details by batchId and subjectCode | |
| * @param int $subjectCode | |
| * @param int $batchId | |
| */ | |
| public function getSubjectByBatchIDAndSubjectCode($subjectCode,$batchId) | |
| { | |
| $sql = "SELECT DISTINCT ss.subjectID, ss.subjectName, ss.subjectDesc, sr.semID, ss.courseTypeID from subjects ss inner join sbs_relation sr on (ss.subjectID = sr.subjectID ) where ss.subjectName = '$subjectCode' and sr.batchID ='$batchId'; | |
| "; | |
| try { | |
| $subjects = $this->executeQueryForObject($sql); | |
| return $subjects; | |
| } catch (\Exception $e) { | |
| } | |
| } | |
| /** | |
| * Get distinct Subject categpry from batch sem category relation; | |
| * @param int $semID | |
| * @param int $batchId | |
| */ | |
| public function getDistinctSubjectCategory($batchID, $semID) | |
| { | |
| $sql = "SELECT bsscr.subjectcatID, sc.subjectcatName, bsscr.subjectID from batch_sem_subjectCategory_relation bsscr INNER JOIN subject_category sc on (bsscr.subjectcatID = sc.subjectcatID ) WHERE bsscr.batchID =$batchID and bsscr.semID =$semID; | |
| "; | |
| try { | |
| $subjectCatList = $this->executeQueryForList($sql); | |
| return $subjectCatList; | |
| } catch (\Exception $e) { | |
| } | |
| } | |
| /** | |
| * Get distinct Subject categpry from batch sem category relation; | |
| * @param int $semID | |
| * @param int $batchId | |
| */ | |
| public function getSubjectCategoryBySubject($batchId, $semId, $subjectId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sql = "SELECT bsscr.subjectcatID, sc.subjectcatName, bsscr.subjectID | |
| from batch_sem_subjectCategory_relation bsscr INNER JOIN subject_category sc on (bsscr.subjectcatID = sc.subjectcatID ) | |
| WHERE bsscr.batchID ='$batchId' | |
| and bsscr.semID ='$semId' | |
| and bsscr.subjectID ='$subjectId'"; | |
| try { | |
| $subjectCatList = $this->executeQueryForObject($sql); | |
| return $subjectCatList; | |
| } catch (\Exception $e) { | |
| } | |
| } | |
| /** | |
| * @return List of Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getMarklistSubjectGroup($batchId, $semId = NULL) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $sqlCondition = ""; | |
| if ($semId) { | |
| $sqlCondition .= " AND mgs.semID = $semId "; | |
| } | |
| $sql = "SELECT | |
| mgsd.id, | |
| mgsd.subjectCode, | |
| mgsd.subjectTitle, | |
| mgs.subjects_id AS subjectId, | |
| mgs.semID AS semId, | |
| mgs.isPractical | |
| FROM | |
| marklist_group_subjects mgs | |
| INNER JOIN marklist_group_subjects_details mgsd ON | |
| mgsd.id = mgs.marklist_group_subjects_details_id | |
| WHERE | |
| mgs.batchID = $batchId | |
| $sqlCondition"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| $subjectGroups = []; | |
| foreach ($subjects as $subject) { | |
| $subjectGroups[$subject->id]->id = $subject->id; | |
| $subjectGroups[$subject->id]->subjectCode = $subject->subjectCode; | |
| $subjectGroups[$subject->id]->subjectTitle = $subject->subjectTitle; | |
| $subjectGroups[$subject->id]->semId = $subject->semId; | |
| $subjectGroups[$subject->id]->subjects[$subject->subjectId]->subjectId = $subject->subjectId; | |
| $subjectGroups[$subject->id]->subjects[$subject->subjectId]->isPractical = $subject->isPractical; | |
| $subjectGroups[$subject->id]->subjectIds[$subject->subjectId] = $subject->subjectId; | |
| } | |
| return $subjectGroups; | |
| } | |
| public function getBatchSemGroupedSubjectDetails($batchId, $semId) | |
| { | |
| $sql = null; | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectGroupDetails = null; | |
| if(empty($batchId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Batch can not be null'); | |
| } | |
| if(empty($semId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Semester can not be null'); | |
| } | |
| try { | |
| $sql = "SELECT | |
| sgs.subjects_id AS subjectId, | |
| sgs.subjectGroups_id AS subjectGroupId, | |
| sg.priority AS groupPriority, | |
| sg.code AS groupCode, | |
| sg.name AS groupName | |
| FROM | |
| subjectGroups_subjects sgs | |
| INNER JOIN subjectGroups sg ON | |
| sgs.subjectGroups_id = sg.id | |
| WHERE | |
| sgs.batches_id = $batchId | |
| AND sgs.semesters_id = $semId"; | |
| $subjects = $this->executeQueryForList($sql); | |
| foreach ($subjects as $subject) { | |
| if (!$subject->subjectGroupId) continue; | |
| $subjectGroups[$subject->subjectGroupId]->id = $subject->subjectGroupId; | |
| $subjectGroups[$subject->subjectGroupId]->subjectCode = $subject->groupCode; | |
| $subjectGroups[$subject->subjectGroupId]->subjectTitle = $subject->groupName; | |
| $subjectGroups[$subject->subjectGroupId]->semId = $semId; | |
| $subjectGroups[$subject->subjectGroupId]->subjects[$subject->subjectId]->subjectId = $subject->subjectId; | |
| $subjectGroups[$subject->subjectGroupId]->subjectIds[$subject->subjectId] = $subject->subjectId; | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectGroups; | |
| } | |
| /** | |
| * Get all subjects from assign rules | |
| * @param mixed $batchId, $semId | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectListBySbs($batchId, $semId) | |
| { | |
| try { | |
| $sql = "SELECT distinct(ss.subjectID) as subjectId, | |
| ss.subjectName , | |
| ss.syllabusName , | |
| ss.subjectDesc | |
| from sbs_relation sr | |
| INNER JOIN subjects ss ON (sr.subjectID = ss.subjectID ) | |
| WHERE sr.batchID = $batchId | |
| AND sr.semID =$semId | |
| ORDER BY ss.subjectID asc"; | |
| $subjectDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * | |
| * Method for getting second language by subjectid | |
| * @param subjectId | |
| * @return Object|null $secondLanguage object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSecondLanguageBySubjectId($subjectId) | |
| { | |
| $secondLanguage = null; | |
| $subjectId = $this->realEscapeObject($subjectId); | |
| $sql = "SELECT | |
| sl.secondlangaugeID AS id, | |
| sl.secondLangaugeName AS name, | |
| sl.secondLangaugedesc AS description, | |
| sl.secondLangaugeCode AS code | |
| FROM | |
| subjects s | |
| INNER JOIN secondLangauge sl ON | |
| sl.secondLangaugeId = s.secondLangaugeId | |
| WHERE | |
| s.subjectID = $subjectId"; | |
| try { | |
| $secondLanguage = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $secondLanguage; | |
| } | |
| /** | |
| * Get assigned sbs details of batchId | |
| * @param int $batchId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function copyBatchSemSubjectCategoryRelation($batchId, $batch) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $batch = $this->realEscapeObject($batch); | |
| $subjectData = []; | |
| $semIds = implode(', ', $batch->selectedSem); ; | |
| $sql_subcat = "SELECT * from batch_sem_subjectCategory_relation WHERE batchID = $batchId and semID IN ($semIds)"; | |
| try { | |
| $subjectCategory = $this->executeQueryForList($sql_subcat); | |
| if (empty($subjectCategory)){ | |
| return 2; | |
| } | |
| foreach ($subjectCategory as $subject){ | |
| $sql_subcat = "SELECT subjectID from batch_sem_subjectCategory_relation WHERE batchID = $batch->toBatchId and subjectID =$subject->subjectID and semID =$subject->semID"; | |
| $checkingEntry = $this->executeQueryForList($sql_subcat); | |
| if (!$checkingEntry){ | |
| $checkingSubject = $this->getSbsDetailsBysubjectBatchAndSem($subject->subjectID , $subject->semID, $batch->toBatchId); | |
| if ($checkingSubject){ | |
| if (empty($subject->subject_cat_group_id)) $subject->subject_cat_group_id = "NULL"; | |
| $insertQuerry = "INSERT INTO batch_sem_subjectCategory_relation (batchID, semID, subjectID, subjectcatID, subject_cat_group_id) VALUES($batch->toBatchId, $subject->semID, $subject->subjectID , $subject->subjectcatID, $subject->subject_cat_group_id)"; | |
| $this->executeQuery($insertQuerry); | |
| } | |
| else{ | |
| $subjectDetails = $this->getSubject($subject->subjectID); | |
| $subjectData[$subject->semID]->subject[$subject->subjectID] = $subjectDetails ; | |
| } | |
| } | |
| } | |
| return $subjectData; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get subject details in a sem of a batch | |
| * @param int $request | |
| * @return $subjectList[] | |
| */ | |
| public function getSubjectsByBatchAndSem($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sql = "SELECT DISTINCT(t1.subjectID) as id, | |
| t2.subjectName as name, | |
| t2.subjectDesc as description, | |
| t2.syllabusName,t2.subjectPriority as priority, | |
| e.examID, | |
| mss.mappedSemId, | |
| mss.mappedSubjectId | |
| from sbs_relation t1 | |
| inner join subjects t2 | |
| on t2.subjectID=t1.subjectID | |
| inner join exam_subjectcredit esc | |
| on esc.subjectID=t2.subjectID and esc.batchID = t1.batchID and esc.semID = t1.semID | |
| left join mapped_semester_subjects mss | |
| on mss.batchId = t1.batchID and mss.semId = t1.semID and mss.subjectId = t1.subjectID | |
| inner join exam e on e.subjectID = t1.subjectID and e.batchID = t1.batchID and e.semID = t1.semID | |
| where t2.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") | |
| and t1.batchID='$request->batchId' | |
| and t1.semID='$request->semId' | |
| and esc.isInternal = '$request->isInternal' | |
| and esc.isExternal = '$request->isExternal' | |
| and e.examregID is NOT NULL | |
| order by esc.subjectOrder ASC,t2.subjectDesc ASC"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * map subjects of a sem with previous sem to import marks | |
| * @param $request | |
| */ | |
| public function mapSemesterSubjectsToImportMarks($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $subject = $request->subject; | |
| $result = false; | |
| //check if IsExist | |
| $isExistSql = "SELECT id,mappedSubjectId from mapped_semester_subjects | |
| WHERE batchId = '$request->batchId' | |
| AND semId = '$request->semId' | |
| AND subjectId = '$subject->id' | |
| AND mappedSemId = '$subject->mappingSemId'"; | |
| try { | |
| $isExist = $this->executeQueryForObject($isExistSql); | |
| } catch (\Exception $e) { | |
| } | |
| //if exists the update | |
| if($isExist){ | |
| $sql = "UPDATE mapped_semester_subjects set mappedSubjectId = $subject->mappedSubjectId ,updated_by = $request->createdBy | |
| WHERE batchId = '$request->batchId' | |
| AND semId = '$request->semId' | |
| AND subjectId = '$subject->id' | |
| AND mappedSemId = '$subject->mappingSemId'"; | |
| } | |
| else{ | |
| $sql = "INSERT into mapped_semester_subjects(batchId,semId,subjectId,mappedSemId,mappedSubjectId,created_by,updated_by) | |
| values($request->batchId,$request->semId,$subject->id,$subject->mappingSemId,$subject->mappedSubjectId,$request->createdBy,$request->createdBy)"; | |
| } | |
| try { | |
| $this->executeQueryForObject($sql); | |
| $result = true; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $result; | |
| } | |
| /** | |
| * Get assigned sbs details of a subject | |
| * @param int $subjectId | |
| * @param int $semId | |
| * @param int $batchId | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsDetailsBysubjectBatchAndSem($subjectId, $semId, $batchId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sql = "SELECT sbs.sbsID,sbs.staffID,sbs.batchID,sbs.subjectID,sbs.csID,sbs.semID,sbs.isPseudosubject | |
| from sbs_relation sbs where sbs.batchID='$batchId' AND sbs.semID='$semId' AND sbs.subjectID='$subjectId' order by sbs.sbsID ASC"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Return concatenated subject name separated by commas | |
| * @param $subjectIds | |
| * @return mixed | |
| * @throws ProfessionalException | |
| */ | |
| public function getConcatenatedSubjectNameBySubjectIds($subjectIds){ | |
| $sql = "SELECT GROUP_CONCAT(subjectName)as name FROM subjects WHERE subjectID IN (" . implode(",", $subjectIds) . ")"; | |
| try { | |
| return $this->executeQueryForObject($sql)->name; | |
| } catch (Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Method for getting second language by subjectid | |
| * @param subjectId | |
| * @return Object|null $secondLanguage object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSecondLanguageDetailsBySubjectId($subjectId) | |
| { | |
| $secondLanguage = null; | |
| $subjectId = $this->realEscapeObject($subjectId); | |
| $sql = "SELECT | |
| sl.secondlangaugeID AS id, | |
| sl.secondLangaugeName AS name, | |
| sl.secondLangaugedesc AS description, | |
| sl.secondLangaugeCode AS code, | |
| s.subjectID as subjectId, | |
| s.subjectName, | |
| s.subjectDesc, | |
| CONCAT(sl.secondLangaugeName,' - ',s.subjectDesc) as secLangName | |
| FROM | |
| subjects s | |
| INNER JOIN secondLangauge sl ON | |
| sl.secondLangaugeId = s.secondLangaugeId | |
| WHERE | |
| s.subjectID = $subjectId"; | |
| try { | |
| $secondLanguage = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $secondLanguage; | |
| } | |
| /** | |
| * | |
| * Method for getting second languages by subjectids | |
| * @param subjectIds | |
| * @throws ProfessionalException | |
| */ | |
| public function getSecondLanguagesBySubjectIds($subjectIds) | |
| { | |
| $secondLanguages = null; | |
| $subjectIds = $this->realEscapeString($subjectIds); | |
| $sql = "SELECT | |
| sl.secondlangaugeID AS id, | |
| sl.secondLangaugeName AS name, | |
| sl.secondLangaugedesc AS description, | |
| sl.secondLangaugeCode AS code, | |
| s.subjectID as subjectId, | |
| s.subjectName, | |
| s.subjectDesc | |
| FROM | |
| subjects s | |
| INNER JOIN secondLangauge sl ON | |
| sl.secondLangaugeId = s.secondLangaugeId | |
| WHERE | |
| s.subjectID IN($subjectIds) | |
| order by s.subjectName"; | |
| try { | |
| $secondLanguages = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $secondLanguages; | |
| } | |
| /** | |
| * | |
| * Method for getting second languages by subjectids | |
| * @param subjectIds | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectDetailsBySubjectIds($subjectIds) | |
| { | |
| $subjects = null; | |
| $subjectIds = $this->realEscapeString($subjectIds); | |
| $sql = "SELECT | |
| s.subjectID as subjectId, | |
| s.subjectName, | |
| s.subjectDesc | |
| FROM | |
| subjects s | |
| WHERE | |
| s.subjectID IN($subjectIds) | |
| order by s.subjectName"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * | |
| * Method for getting second language,open course subjects by student | |
| * @param subjectIds | |
| * @throws ProfessionalException | |
| */ | |
| public function getStudentSecLangExamSubjectByRequest($request) | |
| { | |
| $subjects = null; | |
| $request = $this->realEscapeObject($request); | |
| $condition = ""; | |
| if($request->secondLangFlag){ | |
| $condition = "mcs.secondLangFlag = 1"; | |
| } | |
| else if($request->openCourseFlag){ | |
| $condition = "mcs.openCourseFlag = 1"; | |
| } | |
| $sql = "SELECT distinct e.examID,sa.studentID,ersc.examregID,erss.subjectID,bsscr.subjectcatID,mcs.secondLangFlag,mcs.openCourseFlag from exam_reg_studentchallan ersc | |
| INNER JOIN exam_reg_studentsubject erss ON ersc.examregID = erss.examregID AND ersc.studentID = erss.studentID | |
| INNER JOIN batch_sem_subjectCategory_relation bsscr ON bsscr.subjectID = erss.subjectID | |
| INNER JOIN studentaccount sa ON sa.studentID=ersc.studentID AND sa.batchID = bsscr.batchID | |
| INNER JOIN marklist_categorize_subjects mcs ON mcs.batches_id = bsscr.batchID AND mcs.subject_category_id = bsscr.subjectcatID | |
| INNER JOIN exam e ON e.batchID = bsscr.batchID AND e.semID = bsscr.semID AND e.subjectID = bsscr.subjectID AND e.examregID IS NOT NULL | |
| WHERE ersc.examregID= '$request->examRegId' and ersc.studentID= '$request->studentId' and ersc.paid=1 | |
| and bsscr.batchID= '$request->selectedBatchId' and bsscr.semID= '$request->selectedSemId' and $condition"; | |
| try { | |
| $subjects = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Method for getting all subjects by request | |
| * @throws ProfessionalException | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @author Sibin | |
| */ | |
| public function getAllSubjectsByRequest($request) | |
| { | |
| $sql = ''; | |
| $subjectList = []; | |
| $request = $this->realEscapeObject($request); | |
| try { | |
| $sql = "SELECT | |
| distinct sbs.subjectID as id, | |
| sub.subjectName AS subjectName, | |
| sub.subjectDesc AS description, | |
| CONCAT(sub.subjectName ,' ',sub.subjectDesc) as name, | |
| sub.syllabusYear, | |
| sbs.semID | |
| FROM | |
| sbs_relation sbs | |
| INNER JOIN | |
| subjects sub ON sub.subjectID = sbs.subjectID | |
| WHERE 1=1 "; | |
| if (!empty($request->batchId)) { | |
| $sql .= " AND sbs.batchID = '$request->batchId' "; | |
| } | |
| if (!empty($request->semId)) { | |
| $sql .= " AND sbs.semID = '$request->semId' "; | |
| } | |
| if (!empty($request->syllabusYear)) { | |
| $sql .= " AND sub.syllabusYear = '$request->syllabusYear' "; | |
| } | |
| $sql .= " ORDER BY sub.subjectID"; | |
| $subjectList = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectList; | |
| } | |
| /** | |
| * method to get syllabus year of subjects taught by staff | |
| * | |
| * @param $batchID ,$semID | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSyllabusYearOfSbsSubjects($batchID,$semID) | |
| { | |
| try { | |
| $sql = "SELECT DISTINCT | |
| subj.syllabusYear | |
| FROM | |
| subjects subj | |
| INNER JOIN | |
| sbs_relation sbs ON subj.subjectID = sbs.subjectID | |
| WHERE | |
| sbs.batchID = $batchID AND sbs.semID = $semID | |
| ORDER BY subj.syllabusYear DESC "; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * method to get Subject details | |
| * @param $deptID,$semID,$courseTypeID | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectDetailsByDeptIdSemIdCourseTypeId($deptID,$semID,$courseTypeID, $syllabusYear = NULL) | |
| { | |
| try { | |
| if($syllabusYear){ | |
| $sql = "SELECT DISTINCT sbs.subjectID, sbs.subjectName, sbs.subjectDesc,sbs.syllabusYear, sbs.syllabusName FROM subjects sbs | |
| INNER JOIN sd_relation sdr ON sdr.subjectId = sbs.subjectId | |
| INNER JOIN subject_sem_relation ssr ON ssr.subjectId = sbs.subjectId WHERE sbs.hide=0 AND sdr.deptID = ".$deptID." AND ssr.semID = \"".$semID."\" and (sbs.courseTypeID = ".$courseTypeID." OR sbs.courseTypeID = 0 OR sbs.courseTypeID IS NULL) AND sbs.syllabusYear = $syllabusYear order by sbs.subjectName"; | |
| } | |
| else{ | |
| $sql = "SELECT DISTINCT sbs.subjectID, sbs.subjectName, sbs.subjectDesc,sbs.syllabusYear, sbs.syllabusName FROM subjects sbs | |
| INNER JOIN sd_relation sdr ON sdr.subjectId = sbs.subjectId | |
| INNER JOIN subject_sem_relation ssr ON ssr.subjectId = sbs.subjectId WHERE sbs.hide=0 AND sdr.deptID = ".$deptID." AND ssr.semID = \"".$semID."\" and (sbs.courseTypeID = ".$courseTypeID." OR sbs.courseTypeID = 0 OR sbs.courseTypeID IS NULL) order by sbs.subjectName"; | |
| } | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * method to get sbs Syllabus Year of Subjects | |
| * @param $deptID,$semID,$courseTypeID | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSbsSubjectSyllabusYearByDeptIdSemIdCourseTypeId($deptID,$semID,$courseTypeID) | |
| { | |
| try { | |
| $sql = "SELECT DISTINCT sbs.syllabusYear FROM subjects sbs | |
| INNER JOIN sd_relation sdr ON sdr.subjectId = sbs.subjectId | |
| INNER JOIN subject_sem_relation ssr ON ssr.subjectId = sbs.subjectId WHERE sbs.hide=0 AND sdr.deptID = ".$deptID." AND ssr.semID = \"".$semID."\" and (sbs.courseTypeID = ".$courseTypeID." OR sbs.courseTypeID = 0 OR sbs.courseTypeID IS NULL) order by sbs.subjectName"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get subjects to assign internal mark settings - subject-category-wise | |
| * @param $request | |
| * @return Object|null | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectToAssignInternalMarkSettings($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sqlCondition = null; | |
| if ($request->subjectCategory) { | |
| $sqlCondition = " AND s.subjectcatID = '$request->subjectCategory' "; | |
| } | |
| $sql = null; | |
| $subjects = null; | |
| try { | |
| $sql = "SELECT | |
| s.subjectID AS id, | |
| s.subjectName AS name, | |
| s.subjectDesc AS description, | |
| s.isTheory, | |
| ims.maxInternalMarks, | |
| b.batchID , | |
| b.batchName | |
| FROM | |
| subjects s | |
| INNER JOIN | |
| sbs_relation sbs ON (s.subjectID = sbs.subjectID) | |
| INNER JOIN | |
| batches b ON (b.batchID = sbs.batchID) | |
| LEFT JOIN | |
| internal_marks_settings ims ON (ims.batchID = sbs.batchID | |
| AND ims.semID = sbs.semID | |
| AND ims.subjectID = sbs.subjectID) | |
| WHERE | |
| b.batchStartYear = '$request->batchStartYear' | |
| AND sbs.semID = '$request->semId' | |
| AND b.courseTypeID = '$request->courseTypeId' | |
| $sqlCondition | |
| ORDER BY s.subjectName ASC, s.subjectDesc ASC"; | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param $batchId, $semId, $subjectId, $maxInternalMark | |
| * @throws ProfessionalException | |
| */ | |
| public function saveInternalMarkSettings($batchId, $semId, $subjectId, $maxInternalMark) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $maxInternalMark = $this->realEscapeString($maxInternalMark); | |
| $sql = null; | |
| try { | |
| $sql = " INSERT INTO | |
| internal_marks_settings (batchID, semID, subjectID, maxInternalMarks)VALUES ($batchId, $semId, $subjectId, $maxInternalMark) ON DUPLICATE KEY UPDATE maxInternalMarks = VALUES(maxInternalMarks)"; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get all subjects from assign rules | |
| * @param mixed $batchId, $semId | |
| * @throws ProfessionalException | |
| */ | |
| public function getAllSubjectsByBatchIdAndSemId($batchId, $semId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| try { | |
| $sql = "SELECT t2.subjectID as id, | |
| t2.subjectName as name, | |
| t2.subjectDesc as description, | |
| t2.syllabusName,t2.subjectPriority as priority, | |
| t2.hdl_deptID as hdlDeptId , | |
| t1.staffId | |
| from sbs_relation t1 | |
| inner join subjects t2 | |
| on t2.subjectID=t1.subjectID | |
| where t1.batchID='$batchId' | |
| and t1.semID='$semId' | |
| order by t2.subjectDesc ASC"; | |
| $subjectDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Get opencorse subjects by request | |
| * @param $request | |
| * @throws ProfessionalException | |
| */ | |
| public function getOpenCourseSubjectsByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| try { | |
| $sql = "SELECT sbs.subjectID as id,s.subjectName as name,s.subjectDesc,concat(s.subjectName,' [ ',s.subjectDesc,' ]') as displayName from batches b | |
| INNER JOIN sbs_relation sbs ON sbs.batchID = b.batchID | |
| INNER JOIN subjects s ON s.subjectID = sbs.subjectID | |
| where b.batchStartYear = '$request->batchStartYear' and b.courseTypeID = '$request->courseTypeId' AND sbs.semID = '$request->semId' AND sbs.isPseudosubject=1 | |
| group by sbs.subjectID | |
| order by sbs.subjectID ASC"; | |
| $subjectList = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectList; | |
| } | |
| /** | |
| * Get opencorse subjects by request | |
| * @param $request | |
| * @throws ProfessionalException | |
| */ | |
| public function getOpenCourseSubjectsBatchesDetailsByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $result =[]; | |
| try { | |
| $sql = "SELECT erb.examregID as examRegId,sbs.batchID,b.batchName,sbs.subjectID,s.subjectName,s.subjectDesc,e.examID from batches b | |
| INNER JOIN sbs_relation sbs ON sbs.batchID = b.batchID | |
| INNER JOIN subjects s ON s.subjectID = sbs.subjectID | |
| INNER JOIN exam_registration_batches erb ON erb.batchID = sbs.batchID AND erb.semID = sbs.semID | |
| INNER JOIN exam e ON e.batchID = sbs.batchID AND e.semID = sbs.semID AND e.subjectID =sbs.subjectID AND e.examregID IS NOT NULL | |
| where b.batchStartYear = '$request->batchStartYear' and b.courseTypeID = '$request->courseTypeId' | |
| AND sbs.semID = '$request->semId' AND sbs.isPseudosubject=1 AND sbs.subjectID IN ($request->subjectIds) | |
| group by sbs.batchID | |
| order by sbs.subjectID,b.batchID ASC"; | |
| $result = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $result; | |
| } | |
| /** | |
| * get OpenCourse Subjects Student Marks Details By Request | |
| * @param $request | |
| * @throws ProfessionalException | |
| */ | |
| public function getOpenCourseSubjectsStudentsMarksDetailsByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $result = []; | |
| try { | |
| $sql = "SELECT ee.studentID,sa.regNo,sa.studentName,sa.batchID,b.batchName,ee.mark as externalMark,e.examTotalMarks as externalMaxMark,im.internalMarks as internalMark , | |
| ims.maxInternalMarks as internalMaxMark,(ee.mark + im.internalMarks) as totalMark,(e.examTotalMarks + ims.maxInternalMarks) as totalMaxMark from exammarks_external ee | |
| INNER JOIN studentaccount sa ON sa.studentID = ee.studentID | |
| INNER JOIN exam e ON e.examID = ee.examID | |
| INNER JOIN exam_reg_studentsubject ers ON ers.studentID = ee.studentID AND ers.examregID = e.examregID AND ers.subjectID = e.subjectID | |
| INNER JOIN batches b ON b.batchID = e.batchID | |
| LEFT JOIN internal_marks_settings ims ON ims.batchID = e.batchID AND ims.semID = e.semID AND ims.subjectID = e.subjectID | |
| LEFT JOIN internal_marks im ON im.studentID = ee.studentID AND im.batchID = e.batchID AND im.semID = e.semID AND im.subjectID =e.subjectID | |
| WHERE ee.examID IN($request->examIds) | |
| order by sa.regNo ASC"; | |
| $result = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $result; | |
| } | |
| /** Get assigned sbs details of a subject | |
| * @param int $subjectId | |
| * @param int $semId | |
| * @param int $batchId | |
| * @throws ProfessionalException | |
| */ | |
| public function getNormalisedMarks($subjectId, $semId, $batchId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $sql = "SELECT | |
| sa.studentID, sa.studentName,nm.markID, nm.marksObtained, nm.studentID,nm.normalisedMark,sa.rollNo,sa.regNo,sa.studentAccount, | |
| (nm.normalisedMark - nm.marksObtained) as addedMarks | |
| FROM normalise_marks nm | |
| INNER JOIN studentaccount sa ON nm.studentID=sa.studentID | |
| WHERE nm.batchID='$batchId' AND nm.subjectID = '$subjectId' AND nm.semID = '$semId' | |
| ORDER BY sa.rollNo;"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get student normalised marks by pseudo subjectId | |
| * @param int $pseudoSubjectId | |
| * @throws ProfessionalException | |
| */ | |
| public function getNormalisedMarksOfPseudoSubject($pseudoSubjectId) | |
| { | |
| $pseudoSubjectId = $this->realEscapeString($pseudoSubjectId); | |
| $sql = "select std.studentID, std.studentName,nm.markID, nm.marksObtained, nm.studentID,nm.normalisedMark,std.rollNo,std.regNo,std.studentAccount ,(nm.normalisedMark - nm.marksObtained) as addedMarks from sbs_relation sbs | |
| inner join pseudosubjects_sbs psbs on psbs.sbsID = sbs.sbsID | |
| inner join pseudosubjects_students pstd on pstd.pseudosubjectID = psbs.pseudosubjectID | |
| inner join normalise_marks nm on nm.studentID = pstd.studentID and nm.subjectID = sbs.subjectID and nm.batchID = sbs.batchID and nm.semID = sbs.semID | |
| inner join studentaccount std on std.studentID = pstd.studentID | |
| where psbs.pseudosubjectID = '$pseudoSubjectId';"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get subject paper type by subjectId | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectPaperTypeDetails($subjectId) | |
| { | |
| $subjectDetail = []; | |
| try { | |
| $sql = "SELECT st.id AS paperTypeId, st.paperTypeName, st.paperTypeCode, s.subjectName ,s.subjectDesc ,s.syllabusYear FROM subjectPaperType st inner join subjects s on (st.id = s.paperTypeId ) where s.subjectID =$subjectId; | |
| "; | |
| $subjectDetail = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetail; | |
| } | |
| /** | |
| * @author Sibin | |
| * get Exams Subjects By ExamRegistration | |
| */ | |
| public function getExamSubjectsByExamRegistrationRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $examRegField = $request->isSupply ? "supply_examreg_id" : "examregID"; | |
| $whereConditions = $groupBy = ""; | |
| if ($request->examRegId) { | |
| $whereConditions .= " AND e.$examRegField IN ($request->examRegId)"; | |
| } | |
| if ($request->semId) { | |
| $whereConditions .= " AND e.semID IN ($request->semId)"; | |
| } | |
| if ($request->batchId) { | |
| $whereConditions .= " AND e.batchID IN ($request->batchId)"; | |
| } | |
| if ($request->examDate) { | |
| $whereConditions .= " AND e.examDate IN ('$request->examDate')"; | |
| } | |
| if($request->examDateFrom){ | |
| $whereConditions .= " AND e.examDate >= '$request->examDateFrom' "; | |
| } | |
| if ($request->examDateTo) { | |
| $whereConditions .= " AND e.examDate <= '$request->examDateTo' "; | |
| } | |
| if($request->groupBySubject){ | |
| $groupBy = " GROUP BY s.subjectID "; | |
| } | |
| if($request->groupByExmDate){ | |
| $groupBy = " GROUP BY e.examDate "; | |
| } | |
| $invalidDate = "0000-00-00"; | |
| $sql = "SELECT distinct | |
| e.subjectID as 'subjectId', | |
| s.subjectName, | |
| s.subjectDesc, | |
| s.subjectPriority, | |
| e.semID as 'semId', | |
| e.examStartTime as startTime, | |
| e.examEndTime as endTime, | |
| IF(e.examDate NOT IN ('$invalidDate'), DATE_FORMAT(e.examDate, \"%d-%m-%Y\"), '-') AS examDate | |
| FROM | |
| exam e | |
| INNER JOIN subjects s ON s.subjectID = e.subjectID | |
| WHERE | |
| 1 = 1 | |
| $whereConditions $groupBy"; | |
| try { | |
| $exams = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getMessage(), $e->getCode()); | |
| } | |
| return $exams; | |
| } | |
| /** | |
| * Get all subject teaching by a staff in a batch in a sem | |
| * @param Integer $staffId | |
| * @param Integer $batchId | |
| * @return Array $subjects | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectsByStaffBatchSem($staffId = false, $batchId , $semId) | |
| { | |
| $staffId = (int) $this->realEscapeString($staffId); | |
| $batchId = (int) $this->realEscapeString($batchId); | |
| $semId = (int) $this->realEscapeString($semId); | |
| $condition = ""; | |
| if ($staffId) { | |
| $condition .= " sbs.staffID = '$staffId' AND"; | |
| } | |
| if ($batchId) { | |
| $condition .= " sbs.batchID = '$batchId' AND"; | |
| } | |
| if ($semId) { | |
| $condition .= " sbs.semID = '$semId' AND"; | |
| } | |
| $subjects = []; | |
| $sql = "SELECT s.subjectID, s.subjectName, s.subjectDesc, s.isTheory, s.deptID | |
| FROM subjects s | |
| INNER JOIN sbs_relation sbs ON (s.subjectID = sbs.subjectID) | |
| INNER JOIN batches b ON sbs.batchID = b.batchID | |
| LEFT JOIN department dept ON dept.deptID = b.deptID | |
| WHERE $condition b.isPassOut = 0 AND dept.deptShow = 1"; | |
| $sql .= " ORDER BY s.subjectPriority ASC, s.subjectName ASC"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get all subject teaching by a staff in a batch | |
| * @param Integer $staffId | |
| * @param Integer $batchId | |
| * @return Array $subjects | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getSubjectsByStaffIdAndBatchId($staffId = false, $batchId,$deptId = NULL) | |
| { | |
| $staffId = (int) $this->realEscapeString($staffId); | |
| $batchId = (int) $this->realEscapeString($batchId); | |
| $condition = ""; | |
| if ($staffId) { | |
| $condition .= " sbs.staffID = '$staffId' AND"; | |
| } | |
| if ($batchId) { | |
| $condition .= " sbs.batchID = '$batchId' AND"; | |
| } | |
| if ($deptId){ | |
| $condition .= " b.deptID = '$deptId' AND"; | |
| } | |
| $subjects = []; | |
| $sql = "SELECT s.subjectID, s.subjectName, s.subjectDesc, s.isTheory, s.deptID, sbs.batchID, b.batchName, b.batchID, sbs.semID as currentSemId, sem.semName, group_concat(distinct(sb.subbatchID)) as subbatches | |
| FROM subjects s | |
| INNER JOIN sbs_relation sbs ON (s.subjectID = sbs.subjectID) | |
| LEFT JOIN subbatch_sbs ssbs ON ssbs.sbsID = sbs.sbsID | |
| LEFT JOIN subbatches sb ON sb.subbatchID = ssbs.subbatchID | |
| INNER JOIN batches b ON sbs.batchID = b.batchID AND b.semID = sbs.semID | |
| LEFT JOIN department dept ON dept.deptID = b.deptID | |
| INNER JOIN semesters sem ON sem.semID = sbs.semID | |
| WHERE $condition b.isPassOut = 0 AND dept.deptShow = 1 AND sbs.isPseudoSubject = 0"; | |
| $sql .= " group by s.subjectID ORDER BY s.subjectPriority ASC, s.subjectName ASC"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| public function subjectCreditDetails($batchId,$semId){ | |
| $batchId = (int) $this->realEscapeString($batchId); | |
| $semId = (int) $this->realEscapeString($semId); | |
| $subjectCreditDetails = null; | |
| $sql = "SELECT subjectID FROM exam_subjectcredit WHERE batchID = $batchId AND semID = $semId AND excludeSubjectFromTotal = 1"; | |
| try { | |
| $subjectCreditDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectCreditDetails; | |
| } | |
| /** | |
| * Get all subjects by courseType, sem and batchStartYear | |
| */ | |
| public function getSubjectByCourseTypeSemIdAndBatchStartYear($courseTypeId, $semId, $batchStartYear) | |
| { | |
| $courseTypeId = (int) $this->realEscapeString($courseTypeId); | |
| $semId = (int) $this->realEscapeString($semId); | |
| $batchStartYear = (int) $this->realEscapeString($batchStartYear); | |
| $sqlCondition = null; | |
| $subjects = []; | |
| $sql = "SELECT s.subjectID, s.syllabusName, s.subjectName, s.subjectDesc, s.isTheory, s.deptID FROM subjects s INNER JOIN sbs_relation sbs ON (s.subjectID = sbs.subjectID) INNER JOIN batches b ON (b.batchID = sbs.batchID) WHERE b.courseTypeID = '$courseTypeId' AND sbs.semID = '$semId' AND b.batchStartYear = '$batchStartYear' GROUP BY sbs.subjectID"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * get registered regular exam subjects by student id and exam reg id | |
| */ | |
| public function getRegularExamSubjectsByStudentIdAndRegId($studentId, $examRegId , $semId = NULL) | |
| { | |
| global $COLLEGE_CODE; | |
| $sql = null; | |
| $studentId = $this->realEscapeString($studentId); | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $semId = $this->realEscapeString($semId); | |
| $condition = ""; | |
| if($semId){ | |
| $condition = " AND esc.semID = $semId"; | |
| } | |
| $regExamSubjects = []; | |
| $sql = "SELECT | |
| s.subjectID, | |
| s.subjectName, | |
| s.subjectDesc, | |
| s.syllabusName, | |
| s.subjectPriority | |
| FROM | |
| exam_reg_studentsubject ers | |
| INNER JOIN | |
| subjects s ON s.subjectID = ers.subjectID | |
| INNER JOIN studentaccount sa ON sa.studentID = ers.studentID | |
| INNER JOIN exam_subjectcredit esc ON sa.batchID = esc.batchID AND ers.subjectID = esc.subjectID | |
| WHERE | |
| ers.examregID = $examRegId | |
| AND | |
| ers.studentID = $studentId $condition | |
| ORDER BY esc.subjectOrder ASC"; | |
| try { | |
| $regExamSubjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $regExamSubjects; | |
| } | |
| /** | |
| * get registered regular exam subjects by student id and exam reg id | |
| * | |
| */ | |
| public function getRegularExamSubjectsByStudentIdAndExamRegId($studentId, $examRegId) | |
| { | |
| global $COLLEGE_CODE; | |
| $sql = null; | |
| $studentId = $this->realEscapeString($studentId); | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $regExamSubjects = []; | |
| $hidePracticalSubject = CommonService::getInstance()->getSettings(SettingsConstents::EXAM_CONTROLLER, SettingsConstents::HIDE_PRACTICAL_SUBJECT_IN_HALL_TICKET); | |
| $courseType = StudentService::getInstance()->getCourseTypeByStudentId($studentId); | |
| $batchCourseType = $courseType->courseType; | |
| if($hidePracticalSubject && $batchCourseType == CourseTypeConstants::UG){ | |
| $sql = "SELECT | |
| s.subjectID, | |
| s.subjectName, | |
| s.subjectDesc, | |
| s.syllabusName, | |
| s.subjectPriority | |
| FROM | |
| exam_reg_studentsubject ers | |
| INNER JOIN | |
| subjects s ON s.subjectID = ers.subjectID | |
| INNER JOIN studentaccount sa ON sa.studentID = ers.studentID | |
| INNER JOIN exam_subjectcredit esc ON sa.batchID = esc.batchID AND ers.subjectID = esc.subjectID | |
| WHERE | |
| ers.examregID = $examRegId | |
| AND | |
| ers.studentID = $studentId | |
| AND | |
| s.isTheory = 1 | |
| ORDER BY esc.subjectOrder ASC"; | |
| } | |
| else{ | |
| $sql = "SELECT | |
| s.subjectID, | |
| s.subjectName, | |
| s.subjectDesc, | |
| s.syllabusName, | |
| s.subjectPriority | |
| FROM | |
| exam_reg_studentsubject ers | |
| INNER JOIN | |
| subjects s ON s.subjectID = ers.subjectID | |
| INNER JOIN studentaccount sa ON sa.studentID = ers.studentID | |
| INNER JOIN exam_subjectcredit esc ON sa.batchID = esc.batchID AND ers.subjectID = esc.subjectID | |
| WHERE | |
| ers.examregID = $examRegId | |
| AND | |
| ers.studentID = $studentId | |
| ORDER BY esc.subjectOrder ASC"; | |
| } | |
| try { | |
| $regExamSubjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $regExamSubjects; | |
| } | |
| /** | |
| * get Exams Subjects By ExamRegistration and depatment | |
| */ | |
| public function getExamSubjectsByExamRegistrationAndDepartment($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $whereConditions = ""; | |
| $examRegIdField = $request->isSupply ? "supply_examreg_id" : "examregID"; | |
| if ($request->examRegId) { | |
| $whereConditions .= " AND e.$examRegIdField IN ($request->examRegId)"; | |
| } | |
| if ($request->deptId) { | |
| $whereConditions .= " AND bt.deptID IN ($request->deptId)"; | |
| } | |
| if ($request->batchId) { | |
| $whereConditions .= " AND bt.batchID IN ($request->batchId)"; | |
| } | |
| $sql = "SELECT distinct | |
| e.subjectID as id, | |
| s.subjectName as name, | |
| s.subjectDesc as description, | |
| s.subjectPriority, | |
| e.semID as 'semId' | |
| FROM | |
| exam e | |
| INNER JOIN subjects s ON s.subjectID = e.subjectID | |
| INNER JOIN batches bt ON bt.batchID = e.batchID | |
| WHERE | |
| 1 = 1 | |
| $whereConditions"; | |
| try { | |
| $exams = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getMessage(), $e->getCode()); | |
| } | |
| return $exams; | |
| } | |
| /** | |
| * Get all subjects creit detaiuls by request | |
| */ | |
| public function getSubjectCreditDetailsByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $subjects = []; | |
| $condition = ""; | |
| if($request->subjectId){ | |
| $condition = " AND s.subjectID IN ($request->subjectId)"; | |
| } | |
| try { | |
| if($request->batchId && $request->semId){ | |
| $sql = "SELECT distinct sbs.subjectID, s.syllabusName, s.subjectDesc, s.subjectName , | |
| esc.credit, esc.isInternal, esc.isExternal, esc.hideGrade,esc.excludeSubjectFromTotal,esc.subjectOrder,esc.subjectType | |
| FROM sbs_relation sbs | |
| INNER JOIN subjects s ON s.subjectID= sbs.subjectID | |
| LEFT JOIN exam_subjectcredit esc ON esc.batchID= sbs.batchID AND esc.semID = sbs.semID AND esc.subjectID = sbs.subjectID | |
| WHERE sbs.batchID IN ($request->batchId) AND sbs.semID IN ($request->semId) $condition | |
| ORDER BY s.subjectName ASC"; | |
| $subjects = $this->executeQueryForList($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get subject details by start year and pattern | |
| * @param int $patternId | |
| * @param int $batchStartYear | |
| */ | |
| public function getSubjectsPatternIdAndYear($patternId, $batchStartYear, $semId) | |
| { | |
| $patternId = $this->realEscapeString($patternId); | |
| $batchStartYear = $this->realEscapeString($batchStartYear); | |
| $semId = $this->realEscapeString($semId); | |
| $sql = "SELECT DISTINCT(t1.subjectID) as id, | |
| t2.subjectName as name, | |
| t2.subjectDesc as description, | |
| t2.syllabusName,t2.subjectPriority as priority, | |
| t2.hdl_deptID as hdlDeptId | |
| from sbs_relation t1 | |
| inner join subjects t2 | |
| on t2.subjectID=t1.subjectID | |
| inner join batches bt | |
| on bt.batchID=t1.batchID | |
| inner join exam_subjectcredit esc | |
| on esc.subjectID=t2.subjectID | |
| where t2.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") | |
| and bt.batchStartYear='$batchStartYear' | |
| and bt.patternID='$patternId' | |
| and t1.semID='$semId' | |
| order by esc.subjectOrder ASC"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get department wise subject details | |
| */ | |
| public function getDepartmentWiseubjectDetails($batchStartYear, $deptId, $courseTypeId, $semId) | |
| { | |
| $sql = null; | |
| $batchStartYear = $this->realEscapeString($batchStartYear); | |
| $deptId = $this->realEscapeString($deptId); | |
| $courseTypeId = $this->realEscapeString($courseTypeId); | |
| $semId = $this->realEscapeString($semId); | |
| $regExamSubjects = []; | |
| $sql = "SELECT sr.subjectID, s.subjectName, s.subjectDesc, bt.batchName, es.credit, ims.maxInternalMarks, ex.examTotalMarks | |
| from | |
| batches bt | |
| INNER JOIN | |
| sbs_relation sr ON (sr.batchID = bt.batchID ) | |
| INNER JOIN | |
| subjects s ON (s.subjectID = sr.subjectID) | |
| LEFT JOIN | |
| exam_subjectcredit es ON (es.batchID = sr.batchID AND es.subjectID = sr.subjectID AND es.semID = sr.semID ) | |
| LEFT JOIN | |
| exam ex ON (ex.batchID = sr.batchID AND ex.subjectID = sr.subjectID AND ex.semID = sr.semID and ex.examregID IS NOT NULL) | |
| LEFT JOIN | |
| internal_marks_settings ims ON (ims.batchID = sr.batchID AND ims.subjectID = sr.subjectID AND ims.semID = sr.semID ) | |
| WHERE | |
| bt.batchStartYear = $batchStartYear and bt.courseTypeID = $courseTypeId and bt.deptID IN ($deptId) and sr.semID IN ($semId) GROUP BY sr.subjectID "; | |
| try { | |
| $regExamSubjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $regExamSubjects; | |
| } | |
| /** | |
| * get student sec lang or elective subject | |
| */ | |
| public function getStudentSecLangAndElective($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = ""; | |
| if($request->studentId){ | |
| $condition = " AND pss.studentID = $request->studentId"; | |
| } | |
| $sql = "SELECT | |
| ps.subjectName AS pseudoSubjectName, | |
| ps.courseTypeID AS courseTypeId, | |
| sbsr.subjectID AS subjectId, | |
| sbsr.semID AS semId, | |
| s.subjectDesc AS subjectName, | |
| s.subjectName AS subjectCode, | |
| s.syllabusName | |
| FROM | |
| pseudosubjects ps | |
| INNER JOIN pseudosubjects_students pss ON | |
| pss.pseudosubjectID = ps.pseudosubjectID | |
| INNER JOIN pseudosubjects_sbs pssbs ON | |
| pssbs.pseudosubjectID = ps.pseudosubjectID | |
| AND pssbs.pseudosubjectID = pss.pseudosubjectID | |
| INNER JOIN sbs_relation sbsr ON | |
| sbsr.sbsID = pssbs.sbsID | |
| INNER JOIN subjects s ON | |
| s.subjectID = sbsr.subjectID | |
| WHERE | |
| sbsr.batchID = $request->batchId | |
| AND sbsr.semID = $request->semId | |
| $condition | |
| GROUP BY s.subjectID ;"; | |
| try { | |
| $students = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $students; | |
| } | |
| /** | |
| * This service is used to find the subjects assigned to handling department | |
| * Get subject details by handling department | |
| * | |
| * @param int $hdl_deptId | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getAllSubjectsByHandlingDepartmentId($hdl_deptId) | |
| { | |
| $hdl_deptId = $this->realEscapeString($hdl_deptId); | |
| $sql = "SET SESSION group_concat_max_len = 1000000;"; | |
| $this->executeQuery($sql); | |
| $sql = "SELECT s.subjectID, s.subjectName, s.subjectDesc, s.syllabusName, s.hdl_deptID, concat('[',group_concat( distinct sd.deptID),']') as teachingDepartments | |
| FROM subjects s | |
| LEFT JOIN sd_relation sd ON sd.subjectID = s.subjectID | |
| WHERE s.subjectName NOT IN (\"" . Subject::TUTOR_SUBJECT . "\") "; | |
| if($hdl_deptId){ | |
| $sql = " AND s.hdl_deptID = '$hdl_deptId' "; | |
| } | |
| $sql .= " GROUP BY s.subjectID; "; | |
| try { | |
| $subjectDetails = $this->executeQueryForList($sql, $this->mapper[SubjectServiceMapper::GET_SUBJECTS_BY_DEPARTMENT]); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * get subject category by subject Id | |
| * @param Integer | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectCategoryBySubjectId($subjectId) | |
| { | |
| $subjectId = $this->realEscapeString($subjectId); | |
| try { | |
| $sql = "SELECT distinct(s.subjectcatID) as id ,sc.subjectcatName as name | |
| from subjects s | |
| inner join subject_category sc | |
| on sc.subjectcatID = s.subjectcatID | |
| where s.subjectID = $subjectId"; | |
| return $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get subject institutional average | |
| * @param request | |
| * @return List | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectInstitutionalAverage($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = ''; | |
| if($request->batchId){ | |
| $condition = " AND batchID = $request->batchId"; | |
| } | |
| if($request->semId){ | |
| $condition .= " AND semID = $request->semId"; | |
| } | |
| if($request->subjectId){ | |
| $condition .= " AND subjectID = $request->subjectId"; | |
| } | |
| try { | |
| $sql = "SELECT batchId, semId, subjectId, mark FROM ec_subject_institutional_average WHERE 1 = 1 $condition"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Save subject institutional average | |
| * @param int $batchList | |
| * @throws ProfessionalException | |
| */ | |
| public function saveSubjectInstitutionalAverage($batchList) | |
| { | |
| $batchList = $this->realEscapeObject($batchList); | |
| foreach ( $batchList as $batch){ | |
| try { | |
| $result = $this->getSubjectInstitutionalAverage($batch); | |
| if ( $result) { | |
| $sql = "UPDATE ec_subject_institutional_average set mark = $batch->average WHERE subjectID = $batch->subjectId and batchID = $batch->batchId and semID =$batch->semId "; | |
| } | |
| else{ | |
| $sql = "INSERT INTO ec_subject_institutional_average (batchID, semID, subjectID, mark) VALUES($batch->batchId, $batch->semId, $batch->subjectId, $batch->average)"; | |
| } | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| } | |
| /** | |
| * get subject category of hall ticket | |
| * @param request | |
| * @return List | |
| * @throws ProfessionalException | |
| */ | |
| public function getHallTicketSubjectCategory($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = ''; | |
| if($request->batchId){ | |
| $condition = " AND batchID = $request->batchId"; | |
| } | |
| if($request->examregId){ | |
| $condition .= " AND examregID = $request->examregId"; | |
| } | |
| else if($request->supplyId){ | |
| $condition .= " AND supplyregID = $request->supplyId"; | |
| } | |
| try { | |
| $sql = "SELECT subjectCategory FROM ec_hall_ticket_subject_category WHERE 1 = 1 $condition"; | |
| return $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Save subject category for hall ticket | |
| * @param $request | |
| * @throws ProfessionalException | |
| */ | |
| public function saveHallTicketSubjectCategory($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $examregId = $request->examregId? $request->examregId : NULL; | |
| $supplyId = $request->supplyId? $request->supplyId : NULL; | |
| $batchId = $request->batchId; | |
| $subjectDetails = $request->subjectDetails; | |
| if($subjectDetails){ | |
| $subjectDetails = json_encode($subjectDetails); | |
| }else{ | |
| $subjectDetails = 'null'; | |
| } | |
| $examTypeVar = "examregID"; | |
| $examRegistrationId = $examregId; | |
| if ($supplyId) { | |
| $examRegistrationId = $supplyId; | |
| $examTypeVar = "supplyregID"; | |
| } | |
| $result = $this->getHallTicketSubjectCategory($request); | |
| if ( $result){ | |
| $sql1= " UPDATE ec_hall_ticket_subject_category SET subjectCategory= '$subjectDetails' WHERE $examTypeVar = '$examRegistrationId' AND batchID= '$batchId'"; | |
| } | |
| else{ | |
| $sql1= " INSERT into ec_hall_ticket_subject_category (batchID, $examTypeVar, subjectCategory) | |
| VALUES ('$batchId', '$examRegistrationId', '$subjectDetails')"; | |
| } | |
| try { | |
| return $this->executeQuery($sql1); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function assignSelectedSubjectGroups($request) | |
| { | |
| $sql = null; | |
| $request = $this->realEscapeObject($request); | |
| try { | |
| $deleteAssignSubjectGroups = SubjectService::getInstance()->deleteSelectedAssignSubjectGroups($request); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| try { | |
| $sql = "INSERT INTO subjectGroups_subjects (subjectGroups_id,batches_id,semesters_id,subjects_id,createdBy,createdDate,updatedBy,updatedDate) VALUES " . $request->insertStr . ""; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return true; | |
| } | |
| public function deleteSelectedAssignSubjectGroups($request) | |
| { | |
| $sql = null; | |
| $request = $this->realEscapeObject($request); | |
| $subjectIds = implode(",",$request->selectedSubjects); | |
| try { | |
| $sql = "DELETE FROM subjectGroups_subjects WHERE batches_id = $request->batchId AND semesters_id = $request->semId AND subjects_id IN ($subjectIds)"; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return true; | |
| } | |
| /** | |
| * @param $request | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getStudentAppliedSubjectDetails($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $response=[]; | |
| $joinEsc = ""; | |
| $subjectTypeField= ""; | |
| $condition = ""; | |
| if($request->isSupply){ | |
| $sql = "SELECT | |
| s.subjectID as subjectId, | |
| s.subjectName, | |
| s.syllabusName, | |
| s.subjectDesc, | |
| erss.studentID as studentId | |
| FROM | |
| exam_supplementary_student_details ersc | |
| INNER JOIN | |
| exam_supplementary_student_subjects erss ON erss.studentID = ersc.studentID AND erss.exam_supplementary_id = ersc.exam_supplementary_id | |
| INNER JOIN exam e ON e.examID = erss.examID | |
| INNER JOIN | |
| subjects s ON s.subjectID = e.subjectID | |
| WHERE | |
| erss.exam_supplementary_id = '$request->examRegId' | |
| AND erss.studentID = '$request->studentId' | |
| AND ersc.paid=1 GROUP BY s.subjectID ORDER BY s.subjectName ASC"; | |
| }else{ | |
| if($request->batchId){ | |
| $joinEsc = "INNER JOIN exam_registration_batches erb ON erb.examregID = ersc.examregID AND erb.batchID = $request->batchId | |
| INNER JOIN exam_subjectcredit esc ON esc.subjectID = s.subjectID AND esc.batchID = erb.batchID AND esc.semID = erb.semID"; | |
| $subjectTypeField = " ,esc.subjectType"; | |
| if($request->subjectType){ | |
| $condition .= " AND esc.subjectType IN ('$request->subjectType')"; | |
| } | |
| } | |
| $sql = "SELECT | |
| s.subjectID as subjectId, | |
| s.subjectName, | |
| s.syllabusName, | |
| s.subjectDesc, | |
| erss.studentID as studentId | |
| $subjectTypeField | |
| FROM | |
| exam_reg_studentchallan ersc | |
| INNER JOIN | |
| exam_reg_studentsubject erss ON erss.studentID = ersc.studentID AND erss.examregID = ersc.examregID | |
| INNER JOIN subjects s ON s.subjectID = erss.subjectID | |
| $joinEsc | |
| WHERE | |
| erss.examregID = '$request->examRegId' | |
| AND erss.studentID = '$request->studentId' | |
| $condition | |
| AND ersc.paid=1 GROUP BY s.subjectID ORDER BY s.subjectName ASC"; | |
| } | |
| try { | |
| $response = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * Get all exam subjects by request | |
| */ | |
| public function getAllExamSubjectByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $subjects = []; | |
| try { | |
| if($request->batchId && $request->semId){ | |
| $sql = "SELECT distinct sbs.subjectID, s.syllabusName, s.subjectDesc, s.subjectName , | |
| esc.credit, esc.isInternal, esc.isExternal, esc.hideGrade,esc.excludeSubjectFromTotal,esc.subjectOrder,esc.subjectType | |
| FROM sbs_relation sbs | |
| INNER JOIN subjects s ON s.subjectID= sbs.subjectID | |
| INNER JOIN exam_subjectcredit esc ON esc.batchID= sbs.batchID AND esc.semID = sbs.semID AND esc.subjectID = sbs.subjectID | |
| INNER JOIN exam ex ON ex.batchID= sbs.batchID AND ex.semID = sbs.semID AND ex.subjectID = sbs.subjectID | |
| WHERE sbs.batchID IN ($request->batchId) AND sbs.semID IN ($request->semId) and ex.examregID IS NOT NULL GROUP BY s.subjectID ORDER BY esc.subjectOrder ASC"; | |
| $subjects = $this->executeQueryForList($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get Common Subjects with Batches | |
| * @param $request | |
| * @throw Exception | |
| */ | |
| public function getCommonSubjectsWithBatches($request){ | |
| $request = $this->realEscapeObject($request); | |
| $sql = "SELECT sub.subjectID as id, sub.subjectName as name, sub.subjectDesc as description FROM subjects sub | |
| INNER JOIN sbs_relation sbsr ON sbsr.subjectID = sub.subjectID INNER JOIN batches b ON b.batchID = sbsr.batchID | |
| AND b.semID = sbsr.semID WHERE 1=1 "; | |
| $sqlCond = ""; | |
| if($request->batchIds){ | |
| $sqlCond = " AND b.batchID IN (".implode(",",$request->batchIds).") "; | |
| } | |
| if($request->subjectCatId){ | |
| $sqlCond = " AND sub.subjectCatID ='".$request->subjectCatId."' "; | |
| } | |
| $len = count($request->batchIds); | |
| $grpJoin = " GROUP BY sub.subjectID"; | |
| $sql = $sql.$sqlCond.$grpJoin; | |
| try{ | |
| $batches = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $batches; | |
| } | |
| /** | |
| * get all subjects by request | |
| */ | |
| public function getAllSubjectByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| if($request->courseTypeId) | |
| { | |
| $cond = "AND courseTypeID = '$request->courseTypeId' "; | |
| } | |
| $sql = "select subjectID as id,subjectName as code,subjectDesc as name,hdl_deptID as handlingDepartment,syllabusYear from subjects where hdl_deptID AND hide = 0 $cond"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get all subjects_category in a batch by batchId and semId | |
| */ | |
| public function getAllSubjectCategoryUsedInABatch($batchId,$semId = null) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $sql = "SELECT sc.subjectcatID AS id,sc.subjectcatName AS name FROM sbs_relation sbs | |
| INNER JOIN subjects s ON s.subjectID = sbs.subjectID | |
| INNER JOIN subject_category sc ON sc.subjectcatID = s.subjectcatID | |
| WHERE sbs.batchID = '".$batchId."' ".((int)($semId) ? " AND sbs.semID = '".$semId."' " : '' )." | |
| GROUP BY sc.subjectcatID | |
| ORDER BY sc.subjectcatPriority;"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get category subjects by request | |
| */ | |
| public function getCategorySubjectByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $subjects=[]; | |
| $sql = "SELECT s.subjectID,s.subjectName,s.subjectDesc,esc.semID,concat(sc.subjectcatName,' ',mcs.displayName) AS subCatName FROM marklist_categorize_subjects mcs | |
| INNER JOIN subjects s ON s.subjectcatID = mcs.subject_category_id | |
| INNER JOIN subject_category sc ON sc.subjectcatID = mcs.subject_category_id | |
| INNER JOIN exam_subjectcredit esc ON esc.batchID = mcs.batches_id AND esc.subjectID = s.subjectID | |
| WHERE mcs.id IN ($request->subjectCatId)"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| return $subjects; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * Get internal subject details in a sem of a batch in order | |
| * @param int $request | |
| * @throws AMSException | |
| * @return $objectList[] | |
| */ | |
| public function getInternalSubjectsBySemInOrder($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition =""; | |
| if($request->InternalSubjectsOnly){ | |
| $condition = " AND esc.isInternal = 1 "; | |
| } | |
| if($request->subjectIds){ | |
| $condition = " AND t1.subjectID IN ($request->subjectIds) "; | |
| } | |
| $subjectCreditJoin = "inner"; | |
| if($request->leftJoinSubjectCreditTable){ | |
| $subjectCreditJoin = "left"; | |
| } | |
| $sql = "SELECT DISTINCT(t1.subjectID) as id, | |
| t2.subjectName as name, | |
| t2.subjectDesc as description, | |
| t2.syllabusName,t2.subjectPriority as priority, | |
| t2.hdl_deptID as hdlDeptId | |
| from sbs_relation t1 | |
| inner join subjects t2 | |
| on t2.subjectID=t1.subjectID | |
| $subjectCreditJoin join exam_subjectcredit esc | |
| on esc.subjectID=t2.subjectID AND esc.batchID = t1.batchID AND esc.semID = t1.semID | |
| where t2.subjectName not in (\"" . Subject::TUTOR_SUBJECT . "\") | |
| and t1.batchID='$request->batchId' | |
| and t1.semID='$request->semId' | |
| $condition | |
| order by esc.subjectOrder ASC"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| } | |
| } | |
| /** | |
| * get distict student subjects by examRegId and patternId | |
| */ | |
| public function getDistinctExamRegistrationSubjectsByCourse($examRegId, $patternId) | |
| { | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $patternId = $this->realEscapeString($patternId); | |
| $sql = "SELECT erss.subjectID as subjectId, s.subjectName, s.subjectDesc,s.isTheory, COUNT( DISTINCT ersc.studentID) AS studentCount FROM exam_reg_studentchallan ersc INNER JOIN exam_reg_studentsubject erss ON (ersc.studentID = erss.studentID AND ersc.examregID = erss.examregID) INNER JOIN subjects s ON (s.subjectID = erss.subjectID ) INNER JOIN studentaccount sa ON(sa.studentID = ersc.studentID) INNER JOIN batches b ON(b.batchID = sa.batchID) WHERE ersc.examregID = '$examRegId' AND b.patternID IN ($patternId) AND ersc.paid =1 GROUP BY erss.subjectID;"; | |
| try { | |
| $subjectStudents = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectStudents; | |
| } | |
| /** | |
| * get subjects by exam date and batch | |
| */ | |
| public function getSubjectByExamDateBatchRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = ""; | |
| if($request->batchId){ | |
| $condition .= " AND e.batchID IN ($request->batchId)"; | |
| } | |
| $sql = "SELECT DISTINCT e.subjectID,s.subjectName,s.subjectDesc,e.examDate FROM exam e | |
| INNER JOIN subjects s ON s.subjectID = e.subjectID | |
| WHERE e.examDate ='$request->examDate'"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get department wise subject details | |
| * @param $batchStartYear | |
| * @param $deptId | |
| * @param $courseTypeId | |
| */ | |
| public function getDeptWiseSubjectDetails($batchStartYear, $deptId, $courseTypeId, $semId) | |
| { | |
| $sql = null; | |
| $batchStartYear = $this->realEscapeString($batchStartYear); | |
| $deptId = $this->realEscapeString($deptId); | |
| $courseTypeId = $this->realEscapeString($courseTypeId); | |
| $condition = ''; | |
| if($semId){ | |
| $condition = " and sr.semID IN ($semId)"; | |
| } | |
| $regExamSubjects = []; | |
| $sql = "SELECT sr.subjectID, s.subjectName, s.subjectDesc, bt.batchName | |
| from | |
| batches bt | |
| INNER JOIN | |
| sbs_relation sr ON (sr.batchID = bt.batchID ) | |
| INNER JOIN | |
| subjects s ON (s.subjectID = sr.subjectID) | |
| INNER JOIN | |
| exam_subjectcredit es ON (es.batchID = sr.batchID AND es.subjectID = sr.subjectID AND es.semID = sr.semID ) | |
| WHERE | |
| bt.batchStartYear = $batchStartYear and bt.courseTypeID = $courseTypeId and bt.deptID IN ($deptId) $condition GROUP BY sr.subjectID "; | |
| try { | |
| $regExamSubjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $regExamSubjects; | |
| } | |
| /** | |
| * Get subject details by batchId and subjectCode | |
| * @param request | |
| */ | |
| public function getSubjectByBatchIDSubjectCodeRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition =""; | |
| $condition .= ($request->showSyllabusName)? " AND ss.syllabusName = '$request->syllabusName'" : " AND ss.subjectName = '$request->subjectCode'" ; | |
| $sql = "SELECT DISTINCT ss.subjectID, ss.subjectName, ss.subjectDesc, sr.semID, ss.courseTypeID | |
| from subjects ss | |
| inner join sbs_relation sr on (ss.subjectID = sr.subjectID ) | |
| where 1 = 1 and sr.batchID ='$request->batchId' | |
| $condition"; | |
| try { | |
| $subjects = $this->executeQueryForObject($sql); | |
| return $subjects; | |
| } catch (\Exception $e) { | |
| } | |
| } | |
| /** | |
| * @param $supplyId | |
| * @param $studentId | |
| * @param $semId | |
| * @param $subjectId | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectMaxMarkBatchExamMarkDetails($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $markDetails = ""; | |
| $sql = "SELECT DISTINCT | |
| ims.maxInternalMarks, | |
| e.examTotalMarks AS maxExternalMarks | |
| FROM | |
| exam e | |
| LEFT JOIN | |
| internal_marks_settings ims | |
| ON ims.subjectID = e.subjectID | |
| AND ims.batchID = e.batchID | |
| AND ims.semID = e.semID | |
| WHERE | |
| e.semID = '$request->semId' | |
| AND e.subjectID = '$request->subjectId' | |
| AND e.batchID = '$request->batchId' | |
| AND e.examregID = '$request->examRegId'"; | |
| try { | |
| $markDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $markDetails; | |
| } | |
| /** | |
| * @param $supplyId | |
| * @param $studentId | |
| * @param $semId | |
| * @param $subjectId | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectsByExamRegistration($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = $groupBy = ""; | |
| if($request->examRegId){ | |
| $condition .= $request->isSupply ? " AND e.supply_examreg_id IN ($request->examRegId)" : " AND e.examregID IN ($request->examRegId)"; | |
| } | |
| if($request->staffId){ | |
| $condition .= " AND sbs.staffID IN ($request->staffId)"; | |
| } | |
| if($request->groupBy == "subjectId"){ | |
| $groupBy = " GROUP BY e.subjectID"; | |
| } | |
| $sql = "SELECT s.subjectName,s.subjectDesc,e.examID as examId,e.subjectID as subjectId FROM exam e | |
| INNER JOIN subjects s ON s.subjectID = e.subjectID | |
| INNER JOIN sbs_relation sbs ON sbs.batchID = e.batchID AND sbs.subjectID = e.subjectID AND sbs.semID = e.semID | |
| WHERE 1=1 $condition $groupBy"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * get subjects by staff request | |
| */ | |
| public function getSubjectByStaffRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = ""; | |
| if ($request->staffId) { | |
| $condition .= " AND sbs.staffID IN ($request->staffId)"; | |
| } | |
| if($request->batchStartYear){ | |
| $condition .= " AND b.batchStartYear IN ($request->batchStartYear)"; | |
| } | |
| if($request->semId){ | |
| $condition .= " AND sbs.semID IN ($request->semId)"; | |
| } | |
| if($request->subjectId){ | |
| $condition .= " AND sbs.subjectID IN ($request->subjectId)"; | |
| } | |
| if ($request->batchId) { | |
| $condition .= " AND b.batchID IN ($request->batchId)"; | |
| } | |
| if($request->groupBySubject){ | |
| $groupBy = " GROUP BY sbs.subjectID"; | |
| } | |
| else if ($request->groupByBatch) { | |
| $groupBy = " GROUP BY sbs.batchID"; | |
| } | |
| if($request->subBatchId){ | |
| if ($request->subBatchId) { | |
| $condition .= " AND ssbs.subbatchID IN ($request->subBatchId)"; | |
| } | |
| $sql = "SELECT s.subjectID as subjectId,s.subjectName,s.subjectDesc,b.batchID as batchId,b.batchName,s.syllabusName,CONCAT(s.syllabusName,' ',s.subjectDesc) as nameFormat1,sbs.staffId,sa.staffName | |
| FROM subbatch_sbs ssbs | |
| INNER JOIN sbs_relation sbs ON sbs.sbsID = ssbs.sbsID | |
| INNER JOIN subjects s ON s.subjectID = sbs.subjectID | |
| INNER JOIN batches b ON b.batchID = sbs.batchID | |
| INNER JOIN staffaccounts sa ON sa.staffID = sbs.staffID | |
| WHERE 1=1 $condition $groupBy"; | |
| }else{ | |
| $sql = "SELECT s.subjectID as subjectId,s.subjectName,s.subjectDesc,b.batchID as batchId,b.batchName,s.syllabusName,CONCAT(s.syllabusName,' ',s.subjectDesc) as nameFormat1,sbs.staffId,sa.staffName | |
| FROM sbs_relation sbs | |
| INNER JOIN subjects s ON s.subjectID = sbs.subjectID | |
| INNER JOIN batches b ON b.batchID = sbs.batchID | |
| INNER JOIN staffaccounts sa ON sa.staffID = sbs.staffID | |
| WHERE 1=1 $condition $groupBy"; | |
| } | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $semId | |
| * @param $subjectId | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getGroupSubjectsByBatchSubject($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $subjects = []; | |
| $condition = ""; | |
| if($request->semId){ | |
| if(is_array($request->semId)){ | |
| $request->semId = implode(",",$request->semId); | |
| } | |
| $condition .=" AND semesters_id IN ($request->semId)"; | |
| } | |
| $sql = "SELECT subjectGroups_id from subjectGroups_subjects where subjects_id='$request->subjectId' and batches_id='$request->batchId'"; | |
| try { | |
| $subjectGroupId = $this->executeQueryForObject($sql)->subjectGroups_id; | |
| if($subjectGroupId) | |
| $sql = "SELECT subjectGroups_id as subjectGroupId,subjects_id as subjectId,semesters_id as semId,batches_id as batchId from subjectGroups_subjects where subjectGroups_id='$subjectGroupId' and batches_id='$request->batchId' | |
| $condition"; | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param String | |
| * @author Ajay C | |
| * @return Array | |
| */ | |
| public function getSubjectsOfSemester($studentID,$semester) | |
| { | |
| $sql = "SELECT vas.name FROM student_program_account spa | |
| INNER JOIN `groups` g ON g.id =spa.current_batch_id | |
| INNER JOIN cm_curriculum_syllabus_relation ccsr ON ccsr.cm_curriculum_id =g.cm_curriculum_id | |
| INNER JOIN cm_syllabus_academic_term_settings csats ON csats.cm_syllabus_id = ccsr.cm_syllabus_id | |
| INNER JOIN semesters sr ON sr.termId = csats.academic_term_id | |
| INNER JOIN cm_academic_paper cap ON cap.cm_syllabus_academic_term_settings_id =csats.id | |
| INNER JOIN cm_academic_paper_subjects caps ON caps.cm_academic_paper_id = cap.id | |
| INNER JOIN v4_ams_subject vas ON vas.id = caps.ams_subject_id | |
| WHERE sr.semID ='$semester' AND spa.student_id ='$studentID'"; | |
| try{ | |
| $subjects = $this->executeQueryForList($sql); | |
| }catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * Get subjects and uploaded syllabus | |
| */ | |
| public function getSyllabusUploadedDetailsBySubjectRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sqlCondition = ""; | |
| $joiningQuerry = ""; | |
| if ($request->courseTypeId) { | |
| $sqlCondition .= " AND b.courseTypeID IN ($request->courseTypeId)"; | |
| } | |
| if($request->batchStartYear){ | |
| $sqlCondition .= " AND b.batchStartYear IN ($request->batchStartYear)"; | |
| } | |
| if($request->semId){ | |
| $sqlCondition .= " AND sbs.semID IN ($request->semId)"; | |
| } | |
| if($request->staffId){ | |
| $sqlCondition .= " AND s2.staffID IN ($request->staffId)"; | |
| $joiningQuerry = "INNER JOIN staffaccounts s2 ON | |
| s2.deptID = s.hdl_deptID | |
| INNER JOIN question_bank_syllabus_upload_settings qbsus ON | |
| qbsus.subject_id = s.subjectID AND | |
| qbsus.semester_id = sbs.semID AND | |
| qbsus.course_type_id = b.courseTypeID AND | |
| qbsus.batch_start_year = b.batchStartYear"; | |
| } | |
| else{ | |
| $joiningQuerry = " LEFT JOIN question_bank_syllabus_upload_settings qbsus ON | |
| qbsus.subject_id = s.subjectID AND | |
| qbsus.semester_id = sbs.semID AND | |
| qbsus.course_type_id = b.courseTypeID AND | |
| qbsus.batch_start_year = b.batchStartYear"; | |
| } | |
| $subjects = []; | |
| $sql = "SELECT | |
| s.subjectID, | |
| s.syllabusName, | |
| s.subjectName, | |
| s.subjectDesc, | |
| s.isTheory, | |
| s.deptID, | |
| qbsus.startDate, | |
| qbsus.endDate, | |
| qbsus.resourseId, | |
| lr.path, | |
| lr.storage_object, | |
| qbsus.id AS syllabusSettingsId | |
| FROM | |
| subjects s | |
| INNER JOIN sbs_relation sbs ON | |
| (s.subjectID = sbs.subjectID) | |
| INNER JOIN batches b ON | |
| (b.batchID = sbs.batchID) | |
| $joiningQuerry | |
| LEFT JOIN lin_resource lr ON | |
| lr.id = qbsus.resourseId | |
| WHERE | |
| 1 = 1 | |
| $sqlCondition | |
| GROUP BY | |
| sbs.subjectID"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| /** | |
| * @param $request | |
| * save question bank syllabus settings | |
| */ | |
| public function saveQuestionBackSyllabysSettings($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $createdBy = $_SESSION['adminID']; | |
| $sql = "SELECT * from question_bank_syllabus_upload_settings WHERE course_type_id ='$request->courseTypeId' AND semester_id='$request->semId' AND subject_id = '$request->subjectId' AND batch_start_year = '$request->batchStartYear'"; | |
| try { | |
| $result = $this->executeQueryForList($sql); | |
| if(empty($result)){ | |
| $sql1 = "INSERT INTO question_bank_syllabus_upload_settings(course_type_id,batch_start_year,semester_id, subject_id, startDate,endDate,created_by) VALUES('$request->courseTypeId','$request->batchStartYear','$request->semId','$request->subjectId','$request->startDate','$request->endDate','$createdBy')"; | |
| } | |
| else{ | |
| $sql1 = "UPDATE question_bank_syllabus_upload_settings set startDate = '$request->startDate' , endDate = '$request->endDate', updated_by = '$createdBy' WHERE course_type_id ='$request->courseTypeId' AND semester_id='$request->semId' AND subject_id = '$request->subjectId' AND batch_start_year = '$request->batchStartYear'"; | |
| } | |
| $this->executeQuery($sql1); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $request | |
| * save question bank syllabus settings | |
| */ | |
| public function saveQuestionBackSyllabusResourceId($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $createdBy = $_SESSION['staffID']; | |
| try { | |
| $sql1 = "UPDATE question_bank_syllabus_upload_settings set resourseId = '$request->resourceId', updated_by = '$createdBy' WHERE id = '$request->syllabusSettingsId'"; | |
| $this->executeQuery($sql1); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getSubjectsAssignedWithSecondLanguageAndCbeRequestStatus($studentID,$secondLanguageID,$batchID,$semID) | |
| { | |
| $batchID = $this->realEscapeObject($batchID); | |
| $semID = $this->realEscapeObject($semID); | |
| $secondLanguageID = $this->realEscapeObject($secondLanguageID); | |
| $studentID = $this->realEscapeObject($studentID); | |
| $subjectDetails = new stdClass(); | |
| $normalSubjects = []; | |
| $pseudoSubjects = []; | |
| $otherSBS = []; | |
| $finalizedPseudo = []; | |
| $subjectCodes = []; | |
| try{ | |
| //to check a ps_subject is created for student's secondlanguage | |
| // $sql = "SELECT | |
| // ps.pseudosubjectID, | |
| // p.subjectName, | |
| // ss.subjectID, | |
| // sr.sbsID | |
| // from | |
| // sbs_relation sr | |
| // inner join subjects ss on | |
| // ss.subjectID = sr.subjectID | |
| // inner join pseudosubjects_sbs ps | |
| // on ps.sbsID = sr.sbsID | |
| // inner join pseudosubjects p | |
| // on p.pseudosubjectID = ps.pseudosubjectID | |
| // inner join pseudosubjects_students ps2 | |
| // on ps2.pseudosubjectID = p.pseudosubjectID | |
| // INNER JOIN studentaccount s | |
| // on s.studentID = ps2.studentID | |
| // WHERE | |
| // sr.batchID = '$batchID' | |
| // and sr.semID = '$semID' | |
| // and s.secondlangaugeID = '$secondLanguageID' | |
| // and s.studentID = '$studentID' | |
| // GROUP BY ps.pseudosubjectID"; | |
| // $ps_SecondLanguage = $this->executeQueryForList($sql); | |
| // if(count($ps_SecondLanguage)>0) | |
| // { | |
| // $hasSecondLanguage = true; | |
| // //batch has a secondlanguage ps_subject defined from students secondlanguage | |
| // foreach($ps_SecondLanguage as $index=>$result) | |
| // { | |
| // if($result->pseudosubjectID) | |
| // { | |
| // $sql = "SELECT ps.pseudosubstudentID, | |
| // p.pseudosubjectID , | |
| // p.subjectName, | |
| // ps2.sbsID, | |
| // UPPER(s.subjectDesc) as parentSubName, | |
| // UPPER(s.subjectName) as parentSubCode, | |
| // UPPER(sc.subjectcatName) as subjectCatName, | |
| // UPPER(sc.subjectcatCode) as subjectCatCode | |
| // from pseudosubjects_students ps | |
| // inner join pseudosubjects p on p.pseudosubjectID = ps.pseudosubjectID | |
| // inner join pseudosubjects_sbs ps2 on p.pseudosubjectID = ps2.pseudosubjectID | |
| // inner join sbs_relation sr on sr.sbsID = ps2.sbsID | |
| // inner join subjects s on s.subjectID = sr.subjectID | |
| // inner join subject_category sc on s.subjectcatID = sc.subjectcatID | |
| // where ps.pseudosubjectID ='$result->pseudosubjectID' and studentID = '$studentID'"; | |
| // $secondLangDetails = $this->executeQueryForObject($sql); | |
| // if($secondLangDetails) | |
| // { | |
| // $ps_SecondLanguage[$index] = $secondLangDetails; | |
| // $subjectCodes[] = trim($secondLangDetails->parentSubCode); | |
| // } | |
| // else | |
| // { | |
| // $emptyStudent = new stdClass(); | |
| // $emptyStudent->pseudosubstudentID = ""; | |
| // $emptyStudent->pseudosubjectID = ""; | |
| // $emptyStudent->subjectName = ""; | |
| // $emptyStudent->sbsID = ""; | |
| // $emptyStudent->parentSubName = ""; | |
| // $emptyStudent->parentSubCode = ""; | |
| // $ps_SecondLanguage[$index] = $emptyStudent; | |
| // } | |
| // $otherSBS [] = $secondLangDetails->sbsID; | |
| // } | |
| // else | |
| // { | |
| // error_log('ps_id_empty'); | |
| // } | |
| // } | |
| // } | |
| // else{ | |
| // //batch has no secondlanguage ps_subject defined from students secondlanguage | |
| // } | |
| //check in cbe applications | |
| // | |
| $applications = []; | |
| $sql = "SELECT | |
| ca.id , | |
| ca.name, | |
| cabs.id as cabsId | |
| from | |
| cbe_application_batches_semesters cabs | |
| inner join studentaccount s on | |
| s.batchID = cabs.batch_id | |
| inner join batches b on b.batchID = s.batchID | |
| inner join semesters s2 on s2.semID = b.semID and cabs.semester_id = b.semID | |
| inner join cbe_applications ca on ca.id = cabs.application_id | |
| WHERE s.studentID = $studentID and ca.is_published =1"; | |
| $applicationsOfBatch = $this->executeQueryForList($sql); | |
| if(count($applicationsOfBatch)>0) | |
| { | |
| //has cbe application present for batch | |
| $hasCbeApplication = true; | |
| foreach ($applicationsOfBatch as $application) | |
| { | |
| $sql = "SELECT | |
| p.pseudosubjectID as psId, | |
| UPPER(p.subjectName) as psName, | |
| UPPER(s.syllabusName) as parentSubName | |
| from | |
| cbe_application_batches_semesters cabs | |
| inner join cbe_student_registered_application csra on csra.application_id = cabs.application_id | |
| inner join cbe_subject_assigned_batches csab on csab.application_id = cabs.application_id | |
| inner join pseudosubjects p on p.pseudosubjectID = csab.pseudo_subject_id | |
| left join subject_pseudo_subjects sps on sps.pseudo_subject_id = p.pseudosubjectID | |
| inner join subjects s on s.subjectID = sps.subject_id | |
| inner join pseudosubjects_students pss on pss.studentID = csra.student_id and pss.pseudosubjectID = csab.pseudo_subject_id | |
| WHERE | |
| cabs.id = '$application->cabsId' and csra.student_id = '$studentID' "; | |
| $assignedSubject = $this->executeQueryForObject($sql); | |
| if($assignedSubject) | |
| { | |
| $app = new stdClass(); | |
| $app->psID = $assignedSubject->psId; | |
| $app->psName = $assignedSubject->psName; | |
| $app->parentSubName = $assignedSubject->parentSubName; | |
| $app->category = $assignedSubject->category; | |
| $applications[] = $app; | |
| $otherSBS[]=$assignedSubject->sbsID; | |
| } | |
| else{ | |
| $app = new stdClass(); | |
| $app->psID = ""; | |
| $app->psName = ""; | |
| $app->parentSubName = ""; | |
| $app->category = ""; | |
| $applications[] = $app; | |
| } | |
| } | |
| } | |
| else{ | |
| //no cbe applications present for this batch | |
| } | |
| $subjects = []; | |
| $sql = "SELECT t2.subjectID, | |
| t2.subjectName, | |
| UPPER(t2.subjectDesc) as fullName, | |
| t3.staffID, | |
| t3.staffName, | |
| t1.sbsID, | |
| t2.syllabusName as syllabusCode | |
| FROM sbs_relation t1,subjects t2, staffaccounts t3 | |
| WHERE t1.subjectID = t2.subjectID | |
| AND t1.staffID = t3.staffID | |
| AND t1.csID = 0 AND t1.batchID = " . $batchID . " | |
| AND t1.semID = " . $semID . " ORDER BY t2.subjectName"; | |
| $result = $this->executeQueryForList($sql); | |
| if (count($result) > 0) | |
| { | |
| foreach($result as $row) | |
| { | |
| $row = (Array)$row; | |
| $sql_subbatch_chk = "SELECT t2.subbatchID, | |
| t3.studentID, | |
| t4.subbatchName | |
| FROM sbs_relation t1 | |
| INNER JOIN subbatch_sbs t2 ON t1.sbsID = t2.sbsID | |
| LEFT JOIN subbatch_student t3 ON t2.subbatchID = t3.subbatchID | |
| AND t3.studentID = " . $_SESSION ['studentID'] . " LEFT JOIN subbatches t4 ON t3.subbatchID = t4.subbatchID | |
| WHERE t1.subjectID = " . $row ['subjectID']." | |
| AND t1.semID = " . $semID . " | |
| AND t1.staffID = " . $row ["staffID"] ." | |
| AND t1.batchID = " . $batchID . ""; | |
| $result_subbatch_chk = $this->executeQueryForList($sql_subbatch_chk); | |
| if (count($result_subbatch_chk) > 0) | |
| { | |
| foreach($result_subbatch_chk as $row_subbatch_chk ) | |
| { | |
| $row_subbatch_chk = (Array)$row_subbatch_chk; | |
| if ($row_subbatch_chk["subbatchID"] && $row_subbatch_chk["studentID"]) | |
| { | |
| $subjectDet = new stdClass(); | |
| $subjectDet->subjectID = $row["subjectID"];; | |
| $subjectDet->subjectCode = trim($row["subjectName"]); | |
| $subjectDet->subjectName = $row["fullName"]; | |
| if(! in_array($subjectDet->subjectCode,$subjectCodes)) | |
| { | |
| $subjects [] = $subjectDet; | |
| $subjectCodes[] = $subjectDet->subjectCode; | |
| } | |
| } | |
| } | |
| } | |
| else | |
| { | |
| $sql_chk = "SELECT t2.subbatchID | |
| FROM sbs_relation t1 | |
| INNER JOIN subbatch_sbs t2 ON t1.sbsID = t2.sbsID | |
| WHERE t1.subjectID = " . $row ["subjectID"] . " | |
| AND t1.semID = " . $semID . " | |
| AND t1.batchID = " . $batchID . ""; | |
| $result_chk = $this->executeQueryForList($sql_chk); | |
| if (!count($result_chk)) | |
| { | |
| $subjectDet = new stdClass(); | |
| $subjectDet->subjectID = $row["subjectID"];; | |
| $subjectDet->subjectCode = trim($row["subjectName"]); | |
| $subjectDet->subjectName = $row["fullName"]; | |
| $found = false; | |
| if(! in_array($subjectDet->subjectCode,$subjectCodes)) | |
| { | |
| $subjects [] = $subjectDet; | |
| $subjectCodes[] = $subjectDet->subjectCode; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| /* | |
| $sql = "SELECT | |
| DISTINCT (s.subjectID) , | |
| sr.sbsID , | |
| UPPER(s.subjectName) as subjectCode, | |
| UPPER(s.subjectDesc) as subjectName, | |
| sr.isPseudosubject, | |
| sc.subjectcatName, | |
| sc.subjectcatCode as subjectCatCode | |
| from | |
| sbs_relation sr | |
| inner join subjects s on | |
| s.subjectID = sr.subjectID | |
| inner join subject_category sc on | |
| s.subjectcatID = sc.subjectcatID | |
| where | |
| sr.batchID = '$batchID' | |
| and sr.semID = '$semID' | |
| group by s.subjectID DESC"; | |
| $relations = $this->executeQueryForList($sql); | |
| foreach($relations as $relation) | |
| { | |
| if($relation->isPseudosubject == '0') | |
| { | |
| //normal papers | |
| $normalSubjects[] = $relation; | |
| } | |
| else | |
| { | |
| if(!in_array($relation->sbsID,$otherSBS)) | |
| { | |
| //pseudo subjects but not language | |
| $normalSubjects[] = $relation; | |
| } | |
| } | |
| } | |
| */ | |
| //setting the object to send | |
| $subjectDetails->normalSubjects = $subjects; | |
| // $subjectDetails->hasSecondLanguage = $hasSecondLanguage?$hasSecondLanguage:false; | |
| // $subjectDetails->secondlanguage = $ps_SecondLanguage; | |
| $subjectDetails->hasCbeApplication = $hasCbeApplication?$hasCbeApplication:false; | |
| $subjectDetails->cbeApplications = $applications; | |
| }catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| // public function checkPseudoSubjectsOfSecondLangauge($secondLanguageID,$pseudoSubjects) | |
| // { | |
| // $secondLanguageID = $this->realEscapeObject($secondLanguageID); | |
| // $pseudoSubjects = $this->realEscapeArray($pseudoSubjects); | |
| // try{ | |
| // $sql = "SEL"; | |
| // }catch (\Exception $e) { | |
| // throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| // } | |
| // } | |
| /** | |
| * @param String $subjectName | |
| * For Excel purpose | |
| */ | |
| public function getSubjectByName($subjectName) | |
| { | |
| $subjectName = $this->realEscapeString($subjectName); | |
| try { | |
| $sql = "select s.subjectID, s.subjectName from subjects s where s.subjectName = '$subjectName';"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param Object $request | |
| * For Excel purpose | |
| */ | |
| public function getSbsRelationBySubjectName($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| try { | |
| $sql = "SELECT sr.sbsID FROM sbs_relation sr | |
| INNER JOIN subjects s ON s.subjectID = sr.subjectID | |
| WHERE sr.batchID IN (".implode(',',$request->batchIds).") AND sr.semID = '$request->semId' AND s.subjectName = '$request->subjectName';"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getSubjectCategories(){ | |
| try { | |
| $sql = "SELECT subjectcatID AS id,subjectcatName AS name,subjectcatCode AS code,subjectcatPriority AS `priority` FROM subject_category WHERE canShow = 0;"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $departmentId | |
| * @param $semesterId | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getAllSubjectsWithSyllabusCodeByDepartmentAndSemester($departmentId = null, $semesterId = null) | |
| { | |
| $condition = ""; | |
| if (!empty($departmentId)) { | |
| $condition .= " AND sdr.deptID = $departmentId "; | |
| } | |
| if (!empty($semesterId)) { | |
| $condition .= " AND ssr.semID = $semesterId "; | |
| } | |
| $sql = "SELECT DISTINCT s.subjectID as id, s.syllabusName as name, s.subjectDesc as description | |
| FROM subjects s | |
| INNER JOIN sd_relation sdr ON sdr.subjectID = s.subjectID | |
| INNER JOIN subject_sem_relation ssr ON ssr.subjectID = s.subjectID | |
| WHERE s.hide=0 $condition | |
| ORDER BY s.subjectName "; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param request | |
| * @param $semesterId | |
| * @return array|Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getAllSubjectWithSyllabusCodeByRequest($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| if($request->courseTypeId) | |
| { | |
| $cond = "AND courseTypeID = '$request->courseTypeId' "; | |
| } | |
| $sql = "SELECT subjectID as id, | |
| syllabusName as code, | |
| subjectDesc as name, | |
| hdl_deptID as handlingDepartment, | |
| syllabusYear | |
| from subjects where hdl_deptID $cond"; | |
| try { | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $name | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author Ajay C | |
| */ | |
| public function searchSubjectByStringWithSyllabusCode($name) | |
| { | |
| $name = $this->realEscapeString($name); | |
| $sql = "SELECT * FROM(SELECT CONCAT(syllabusName,' ',subjectDesc) AS name FROM subjects) AS subjectName WHERE name LIKE '%$name%'"; | |
| try { | |
| $response = $this->executeQueryForList($sql); | |
| $response = CommonUtil::decodeHtmlSpecialChars($response); | |
| return $response; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get subject and staff details by sbs id | |
| * @param int $sbsId,SubjectId | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectDetailsBySbsIdWithEvaluations($sbsId,$evalID) | |
| { | |
| $sbsId = $this->realEscapeString($sbsId); | |
| $evalID = $this->realEscapeString($evalID); | |
| $subjectDetails = null; | |
| $sql = "SELECT sa.staffID, | |
| sa.staffCode, | |
| sa.staffName, | |
| sbs.sbsID, | |
| sub.subjectID, | |
| sub.subjectName, | |
| sub.syllabusName, | |
| sub.subjectDesc as description, | |
| bth.batchName, | |
| sem.semName, | |
| dept.deptName, | |
| sub.universityAllottedHours, | |
| sbs.semID, | |
| sbs.batchID FROM staffaccounts sa | |
| INNER JOIN sbs_relation sbs ON sa.staffID=sbs.staffID | |
| INNER JOIN subjects sub ON sbs.subjectID=sub.subjectID | |
| INNER JOIN batches bth ON bth.batchID=sbs.batchID | |
| INNER JOIN semesters sem ON sem.semID=bth.semID | |
| INNER JOIN department dept ON dept.deptID=bth.deptID | |
| INNER JOIN staffeval_stafflist slist on sbs.sbsID = slist.sbsID | |
| WHERE sbs.sbsID=$sbsId"; | |
| try { | |
| $subjectDetails = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), | |
| $e->getMessage()); | |
| } | |
| return $subjectDetails; | |
| } | |
| /** | |
| * Get all subjects that student need to register for exam | |
| * @param Integer $studentID | |
| * @param Integer $batchID | |
| * @param Integer $examregID | |
| * @return Array Exam subject list | |
| * @throws ProfessionalException | |
| * @author Vishnu M | |
| */ | |
| public function getStudentExamSubjectsForRegistration($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $subjects = []; | |
| $studentCondition = ""; | |
| if ($request->studentId) { | |
| $studentCondition .= " AND sa.studentID = '$request->studentId' "; | |
| } | |
| if($request->isTheory){ | |
| $studentCondition .= " AND s.isTheory IN ($request->isTheory)"; | |
| } | |
| $sql = "SELECT | |
| sa.studentID, s.subjectID, s.subjectName, s.subjectDesc,ersf.examfeesAmount as examFees | |
| FROM | |
| subjects s | |
| INNER JOIN | |
| sbs_relation sbs ON s.subjectID = sbs.subjectID | |
| INNER JOIN | |
| exam_registration_subject_fees ersf ON sbs.subjectID = ersf.subjectID | |
| AND ersf.batchID = sbs.batchID | |
| AND ersf.semID = sbs.semID | |
| INNER JOIN | |
| exam_registration_batches erb ON ersf.examregID = erb.examregID | |
| AND ersf.batchID = erb.batchID | |
| AND ersf.semID = erb.semID | |
| INNER JOIN | |
| studentaccount sa ON sa.batchID = erb.batchID | |
| WHERE | |
| ersf.examregID = '$request->examRegId' | |
| AND ersf.batchID = '$request->batchId' | |
| AND ( | |
| sbs.sbsID IN ( | |
| SELECT | |
| psbs.sbsID | |
| FROM | |
| pseudosubjects_sbs psbs | |
| INNER JOIN | |
| pseudosubjects_students ps ON (ps.pseudosubjectID = psbs.pseudosubjectID) | |
| WHERE | |
| psbs.sbsID = sbs.sbsID | |
| AND ps.studentID = sa.studentID UNION SELECT | |
| ssbs.sbsID | |
| FROM | |
| subbatch_sbs ssbs | |
| INNER JOIN | |
| subbatch_student ss ON ssbs.subbatchID = ss.subbatchID | |
| WHERE | |
| ss.studentID = sa.studentID | |
| AND ssbs.sbsID = sbs.sbsID | |
| ) | |
| OR sbs.sbsID NOT IN ( | |
| SELECT | |
| sbsID | |
| FROM | |
| subbatch_sbs | |
| ) | |
| ) | |
| $studentCondition | |
| GROUP BY sa.studentID, sbs.subjectID"; | |
| try { | |
| $subjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjects; | |
| } | |
| function getAllSecApplications() | |
| { | |
| try { | |
| $sql = "SELECT | |
| sa.id, | |
| UPPER(sa.name) as `name`, | |
| `from`, | |
| `to`, | |
| sa.created_by, | |
| sa.updated_by, | |
| sa.description, | |
| count(DISTINCT sb.batch_id) as batchCount | |
| FROM | |
| sec_application sa | |
| left join sec_batches sb | |
| on sb.sec_id = sa.id | |
| group by sa.id | |
| ORDER BY | |
| sa.id DESC;"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| function createSecApplication($applicatioName, $applicationDesc, $fromDate, $toDate) | |
| { | |
| try{ | |
| $applicatioName = $this->realEscapeString($applicatioName); | |
| $applicationDesc = $this->realEscapeString($applicationDesc); | |
| $fromDate = $this->realEscapeString($fromDate); | |
| $toDate = $this->realEscapeString($toDate); | |
| $startDateTime = new DateTime($fromDate); | |
| $startDateTime->setTime(0, 0, 0); | |
| $startDateTime = $startDateTime->format('Y-m-d H:i:s'); | |
| $endDateTime = new DateTime($toDate); | |
| $endDateTime->setTime(23, 59, 59); | |
| $endDateTime = $endDateTime->format('Y-m-d H:i:s'); | |
| $staffID =$_SESSION['adminID']; | |
| $sql = "INSERT INTO `sec_application` (`name`, | |
| `from`, | |
| `to`, | |
| `created_by`, | |
| `updated_by`, | |
| `created_date`, | |
| `updated_date`, | |
| `description`)VALUES ('$applicatioName', '$startDateTime', '$endDateTime', $staffID, $staffID, NOW(), NOW(), '$applicationDesc');"; | |
| return $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function updateSecApplication($editingAppId,$applicatioName, $applicationDesc, $fromDate, $toDate) | |
| { | |
| $editingAppId = $this->realEscapeString($editingAppId); | |
| $applicatioName = $this->realEscapeString($applicatioName); | |
| $applicationDesc = $this->realEscapeString($applicationDesc); | |
| $fromDate =date('Y-m-d', strtotime($this->realEscapeString($fromDate))); | |
| $toDate = date('Y-m-d', strtotime($this->realEscapeString($toDate))); | |
| // $startDateTime = new DateTime($fromDate); | |
| // $startDateTime->format('Y-m-d H:i:s'); | |
| // $endDateTime = new DateTime($toDate); | |
| // $endDateTime->format('Y-m-d H:i:s'); | |
| // $fromDate= $startDateTime->setTime(0, 0, 0); | |
| // $toDate = $endDateTime->setTime(23, 59, 59); | |
| // $fromDate = $fromDate->date; | |
| // $toDate = $toDate->date; | |
| $startDateTime = new DateTime($fromDate); | |
| $startDateTime->setTime(0, 0, 0); | |
| $startDateTime = $startDateTime->format('Y-m-d H:i:s'); | |
| $endDateTime = new DateTime($toDate); | |
| $endDateTime->setTime(23, 59, 59); | |
| $endDateTime = $endDateTime->format('Y-m-d H:i:s'); | |
| try{ | |
| if($startDateTime && $endDateTime) | |
| { | |
| $sql = "UPDATE sec_application sec_application SET `from`='$startDateTime', `to`='$endDateTime', `name` = '$applicatioName', `description`='$applicationDesc' WHERE id = $editingAppId"; | |
| return $this->executeQuery($sql); | |
| } | |
| else | |
| { | |
| return false; | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $request | |
| * @return Object | |
| * @throws ProfessionalException | |
| * @author Sibin C | |
| */ | |
| public function replaceSubjectsByBatchSemSubject($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sql = ""; | |
| $subjects = $request->subjects; | |
| $tableNames1 = array( | |
| 'sbs_relation', | |
| 'exam_subjectcredit', | |
| 'internal_marks_submitted', | |
| 'internal_marks_settings', | |
| 'internal_marks', | |
| 'exam_registration_subject_fees', | |
| 'exam', | |
| 'batch_sem_subjectCategory_relation' | |
| ); | |
| $customIndexes1 = array( | |
| 'SBS RELATION', | |
| 'EXAM SUBJECT CREDIT', | |
| 'INTERNAL MARK SUBMITTED', | |
| 'INTERNAL MARK SETTINGS', | |
| 'INTERNAL MARK', | |
| 'EXAM REG SUBJECT FEE', | |
| 'EXAM', | |
| 'BATCH SUBJECT CATEGORY' | |
| // Add more custom indexes as needed | |
| ); | |
| $tableNames1 = array_combine($customIndexes1, $tableNames1); | |
| $tableNames2 = array('subjectGroups_subjects'); | |
| $customIndexes2 = array( | |
| 'SUBJECT GROUP SUBJECTS', | |
| // Add more custom indexes as needed | |
| ); | |
| $tableNames2 = array_combine($customIndexes2, $tableNames2); | |
| $tableNames3 = array('exam_reg_studentsubject','gracemarks_student_marks'); | |
| $customIndexes3= array( | |
| 'EXAM REG STUDENT SUBJECT', | |
| 'GRACE MARK STUDENT MARKS' | |
| // Add more custom indexes as needed | |
| ); | |
| $tableNames3 = array_combine($customIndexes3, $tableNames3); | |
| $notUpdated =[]; | |
| try { | |
| foreach($subjects as $subject){ | |
| $subject = (object) $subject; | |
| //REPLACE PROCESS FOR new subject assigned subject | |
| if((int)$subject->newSubjectId){ | |
| // for tables1 | |
| $commonCondition = " AND batchID IN ($request->batchId) AND semID IN ($request->semId)"; | |
| $selectCondition = $commonCondition ." AND subjectID in ($subject->newSubjectId)"; | |
| $updateCondition = $commonCondition ." AND subjectID in ($subject->id)"; | |
| foreach($tableNames1 as $key => $table){ | |
| $selectSql = "SELECT * FROM $table WHERE 1=1 $selectCondition"; | |
| $result = $this->executeQueryForList($selectSql); | |
| if(empty($result)){ | |
| $updateSql = "UPDATE $table set subjectID = $subject->newSubjectId WHERE 1=1 $updateCondition"; | |
| $response = $this->executeQuery($updateSql); | |
| }else{ | |
| $notUpdated[$key][]=$subject->name; | |
| } | |
| } | |
| // for tables2 | |
| $commonCondition = " AND batches_id IN ($request->batchId) AND semesters_id IN ($request->semId)"; | |
| $selectCondition = $commonCondition ." AND subjects_id in ($subject->newSubjectId)"; | |
| $updateCondition = $commonCondition ." AND subjects_id in ($subject->id)"; | |
| foreach($tableNames2 as $key => $table){ | |
| $selectSql = "SELECT * FROM $table WHERE 1=1 $selectCondition"; | |
| $result = $this->executeQueryForList($selectSql); | |
| if(empty($result)){ | |
| $updateSql = "UPDATE $table set subjects_id = $subject->newSubjectId WHERE 1=1 $updateCondition"; | |
| $response = $this->executeQuery($updateSql); | |
| }else{ | |
| $notUpdated[$key][]=$subject->name; | |
| } | |
| } | |
| // for tables3 | |
| $commonCondition = " AND studentID in (select studentID from studentaccount where batchID in ($request->batchId))"; | |
| $selectCondition = $commonCondition ." AND subjectID in ($subject->newSubjectId)"; | |
| $updateCondition = $commonCondition ." AND subjectID in ($subject->id)"; | |
| foreach($tableNames3 as $key => $table){ | |
| $selectSql = "SELECT * FROM $table WHERE 1=1 $selectCondition"; | |
| $result = $this->executeQueryForList($selectSql); | |
| if(empty($result)){ | |
| $updateSql = "UPDATE $table set subjectID = $subject->newSubjectId WHERE 1=1 $updateCondition"; | |
| $response = $this->executeQuery($updateSql); | |
| }else{ | |
| $notUpdated[$key][]=$subject->name; | |
| } | |
| } | |
| } | |
| } | |
| $response->notUpdated = $notUpdated; | |
| return $response; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $request | |
| * get question bank syllabus settings | |
| */ | |
| public function getQuestionBackSyllabusResourceId($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| try { | |
| $bathDetails = BatchService::getInstance()->getBatchById($request->batchId); | |
| if($request->subjectId && $request->semId && $bathDetails->startYear && $bathDetails->courseType){ | |
| $sql = "SELECT resourseId FROM question_bank_syllabus_upload_settings WHERE course_type_id = '$bathDetails->courseType' AND batch_start_year = '$bathDetails->startYear' AND semester_id = '$request->semId' AND subject_id = '$request->subjectId'"; | |
| return $this->executeQueryForList($sql); | |
| } | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $batchId | |
| * @param $semId | |
| * @param int $groupId | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getSubjectEcGroupSubjectsByBatchSem($batchId,$subjectIds,$semId = 0) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $semId = $this->realEscapeString($semId); | |
| $subjectIds = $this->realEscapeArray($subjectIds); | |
| if(is_array($subjectIds )){ | |
| $subjectIds = implode(",", $subjectIds); | |
| } | |
| $condition = ""; | |
| if($semId){ | |
| $condition .=" AND sgs.semesters_id = ($semId)"; | |
| } | |
| try { | |
| $sql = "SELECT | |
| sgs.id, | |
| sgs.subjectGroups_id AS subjectGroupId, | |
| sgs.batches_id AS batchId, | |
| sgs.semesters_id AS semId, | |
| sgs.subjects_id AS subjectId, | |
| ecscg.name AS ec_subCatName, | |
| ecscg.description AS ec_subCatDesc | |
| FROM | |
| subjectGroups_subjects sgs | |
| INNER JOIN ec_subject_category_group ecscg ON ecscg.id = sgs.ec_subject_cat_group_id | |
| WHERE | |
| sgs.batches_id IN ($batchId ) | |
| AND sgs.subjects_id IN ($subjectIds) | |
| $condition | |
| ORDER BY sgs.id"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** | |
| * @param $request | |
| * @return Object | |
| * @throws ProfessionalException | |
| */ | |
| public function getStudentMinorHonoursPseudoSubjectBasketName($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $condition = ""; | |
| if($request->studentId){ | |
| $condition .=" AND pss.studentID IN ($request->studentId)"; | |
| } | |
| if($request->shortCourseIds){ | |
| $condition .=" AND er.shortCourse IN ($request->shortCourseIds)"; | |
| } | |
| try { | |
| $sql = "SELECT DISTINCT psg.id, psg.name | |
| FROM pseudo_subject_groups psg | |
| INNER JOIN pseudosubjects ps ON psg.id = ps.pseudo_subject_group_id | |
| INNER JOIN pseudosubjects_students pss ON ps.pseudosubjectID = pss.pseudosubjectID | |
| INNER JOIN subject_pseudo_subjects sps ON ps.pseudosubjectID = sps.pseudo_subject_id | |
| INNER JOIN exam e ON sps.subject_id = e.subjectID | |
| INNER JOIN exam_registration er ON e.examregID = er.examregID | |
| INNER JOIN exam_reg_studentchallan ers ON ers.examregID = er.examregID AND ers.studentID = pss.studentID | |
| INNER JOIN exam_reg_studentsubject erss ON erss.examregID = er.examregID AND erss.studentID = pss.studentID AND erss.subjectID = e.subjectID | |
| WHERE 1=1 AND ers.paid=1 $condition"; | |
| return $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getSubjectDetailsByClusterID($clusterID) | |
| { | |
| try{ | |
| $clusterID = $this->realEscapeObject($clusterID); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| public function getAllSubjectCategoriesv4() | |
| { | |
| $sql = ''; | |
| $subjectCatDetails = []; | |
| try { | |
| $sql = "SELECT id as subjectCatId,name as categoryName,'1' as subjectcatPriority,code,NULL as parentId from cm_subject_types;"; | |
| $subjectCatDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $subjectCatDetails; | |
| } | |
| } |