Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 797 |
| HallTicketsService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 10 |
31862.00 | |
0.00% |
0 / 797 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| getAllHallTickets | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 21 |
|||
| getAllHallTicketsStudentData | |
0.00% |
0 / 1 |
7482.00 | |
0.00% |
0 / 266 |
|||
| getRegisteredStudentSubjectsDetailsForHallTickets | |
0.00% |
0 / 1 |
420.00 | |
0.00% |
0 / 191 |
|||
| setQrContents | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 10 |
|||
| setQrContentsTemplate1 | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 7 |
|||
| setQrContentsTemplate2 | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 11 |
|||
| getStudentAssignedHallsAndSeatForExam | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 27 |
|||
| getRegisteredStudentSubjectsDetailsForEligibilityReport | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 116 |
|||
| getExamEligibilityReport | |
0.00% |
0 / 1 |
2550.00 | |
0.00% |
0 / 146 |
|||
| <?php | |
| namespace com\linways\ec\core\service; | |
| use com\linways\ec\core\request\SearchRuleRequest; | |
| use com\linways\ec\core\service\RuleService; | |
| use com\linways\base\util\MakeSingletonTrait; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| use com\linways\core\ams\professional\service\ReligionService; | |
| use com\linways\core\ams\professional\service\AdmissionService; | |
| use com\linways\core\ams\professional\service\CampusTypeService; | |
| use com\linways\base\util\TwigRenderer; | |
| use com\linways\core\ams\professional\util\PdfUtil; | |
| use com\linways\core\ams\professional\service\CommonService; | |
| use com\linways\ec\core\service\HallTicketsGenerator\HallTicketsGenerator; | |
| use com\linways\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\constant\ShortTermCourseTypeConstants; | |
| use com\linways\ec\core\constant\ShortTermCourseModeConstants; | |
| use com\linways\ec\core\mapper\HallTicketsServiceMapper; | |
| use com\linways\ec\core\service\StudentExamRegistrationService; | |
| use com\linways\core\ams\professional\service\StudentService; | |
| use com\linways\ec\core\constant\SettingsConstants; | |
| use com\linways\core\ams\professional\dto\SettingsConstents; | |
| use com\linways\core\ams\professional\service\examcontroller\CommonExamService AS ProfessionalCommonExamService; | |
| use com\linways\academics\core\service\attendance\AttendanceService; | |
| use com\linways\academics\core\request\attendance\AttendanceTermWiseReport; | |
| class HallTicketsService extends BaseService | |
| { | |
| use MakeSingletonTrait; | |
| private function __construct() { | |
| $this->mapper = HallTicketsServiceMapper::getInstance()->getMapper(); | |
| } | |
| /** | |
| * get All Hall Tickets | |
| * @param $searchRequest | |
| * @return $response | |
| * @author Krishnajith | |
| */ | |
| public function getAllHallTickets($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $request = new \stdClass; | |
| $request->departmentId = $searchRequest->departmentId; | |
| $request->groupId = $searchRequest->groupId; | |
| $request->academicTermId = $searchRequest->academicTermId; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->registerNo = $searchRequest->registerNo; | |
| $request->challanNo = $searchRequest->challanNo; | |
| $request->studentId = $searchRequest->studentId; | |
| $request->examType = $searchRequest->examType; | |
| $request->rollNo = $searchRequest->rollNo; | |
| $request->checkIfNotEnableHallTicketExamAdmin = $searchRequest->checkIfNotEnableHallTicketExamAdmin; | |
| $request->isStudentSideHallTIcketRequest = $searchRequest->isStudentSideHallTIcketRequest; | |
| $programResult = HallTicketsGenerator::getInstance()->getHallTicketsResultData($request); | |
| return $programResult; | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get All Hall Tickets Student Data | |
| * @param $searchRequest | |
| * @return $studentDetails | |
| * @author Krishnajith | |
| */ | |
| public function getAllHallTicketsStudentData($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $blockedSubjectsCountToBlockHallticket = CommonService::getInstance()->getSettings("EXAM_HALL_TICKET", "BLOCKED_SUBJECT_COUNT_TO_BLOCK_HALLTICKET"); | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "BLOCK_STUDENT_SETTINGS_RULE"; | |
| $ruleObj = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $blockedSubjectsCountToBlockHallticket = $ruleObj->blockedSubjectCountToBlockHallTicket ?? 0; | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "HALL_TICKET_RULE"; | |
| $hallTicketRule = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $hallTicketRule = $hallTicketRule ? $hallTicketRule : new \stdClass; | |
| $isCheckFeeDueInStudentSideHallTicket = $hallTicketRule->isCheckFeeDueInStudentSideHallTicket == '1' ? true : false; | |
| $isCheckAttendanceDueInStudentSideHallTicket = $hallTicketRule->isCheckAttendanceDueInStudentSideHallTicket == '1' ? true : false; | |
| $isCheckAttendanceDueInControllerSideHallTicket = $hallTicketRule->isCheckAttendanceDueInControllerSideHallTicket == '1' ? true : false; | |
| $isCheckFeeDueInControllerSideHallTicket = $hallTicketRule->isCheckFeeDueInControllerSideHallTicket == '1' ? true : false; | |
| $request = new \stdClass; | |
| $request->departmentId = $searchRequest->departmentId; | |
| $request->groupId = $searchRequest->groupId; | |
| $request->academicTermId = $searchRequest->academicTermId; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->registerNo = $searchRequest->registerNo; | |
| $request->studentId = $searchRequest->studentId; | |
| $request->rollNo = $searchRequest->rollNo; | |
| $request->orderBy = $searchRequest->orderBy; | |
| $request->excludedCourseTypeIds = $hallTicketRule->excludedCourseTypeIds ? $hallTicketRule->excludedCourseTypeIds : []; | |
| $shortTermCourseTypes = []; | |
| $shortTermCourseTypes[] = ShortTermCourseTypeConstants::MINOR; | |
| $shortTermCourseTypes[] = ShortTermCourseTypeConstants::MAJOR; | |
| $subjectSlotsRes = CommonExamService::getInstance()->getAllSubjectSlots(); | |
| $subjectSlots = []; | |
| foreach($subjectSlotsRes as $slot){ | |
| $subjectSlots[$slot->id] = $slot->name; | |
| } | |
| if($searchRequest->challanNo){ | |
| $challanRequest = new \stdClass; | |
| $challanRequest->challanNo = $searchRequest->challanNo; | |
| $challanRequest->examType = $searchRequest->examType; | |
| $challanDetails = StudentExamRegistrationService::getInstance()->getStudentChallanDetails($challanRequest); | |
| if(empty($challanDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No student found"); | |
| } | |
| $request->studentId = $challanDetails->studentId; | |
| $request->examRegistrationId = $challanDetails->examRegistrationId; | |
| } | |
| $studentDetails = $this->getRegisteredStudentSubjectsDetailsForHallTickets($request); | |
| if(empty($studentDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Students Found"); | |
| } | |
| if(reset($studentDetails)->enableHallTicketExamAdmin != 1 && !$searchRequest->checkIfNotEnableHallTicketExamAdmin){ | |
| throw new ExamControllerException(ExamControllerException::HALL_TICKET_NOT_ENABLED,"Hall ticket issue not enabled by exam controller"); | |
| } | |
| if(reset($studentDetails)->enableHallTicketExamStudent != 1 && $searchRequest->checkIfNotEnableHallTicketExamAdmin){ | |
| throw new ExamControllerException(ExamControllerException::HALL_TICKET_NOT_ENABLED,"Hall ticket not enabled by exam controller"); | |
| } | |
| $showGenderWiseAttendance = false; | |
| if(($isCheckAttendanceDueInStudentSideHallTicket && $searchRequest->isStudentSideHallTIcketRequest) || $isCheckAttendanceDueInControllerSideHallTicket){ | |
| $showGenderWiseAttendance = CommonService::getInstance()->getSettings(SettingsConstants::EXAM_CONTROLLER, "EXAM_REGISTRATION_GENDER_WISE_ATTENDANCE_CHECK"); | |
| } | |
| foreach($studentDetails as $student){ | |
| if($showGenderWiseAttendance){ | |
| if(empty($student->examRegistrationProperties->genderWiseMinimumAttendance)){ | |
| throw new ExamControllerException (ExamControllerException::INVALID_PARAMETERS,"Gender wise attendance rule not added. Please contact exam controller."); | |
| } | |
| if(empty($student->gender) || (strtoupper($student->gender) != 'MALE' && strtoupper($student->gender) != 'FEMALE' && strtoupper($student->studentGender) != 'OTHER') ){ | |
| throw new ExamControllerException (ExamControllerException::INVALID_PARAMETERS,"Gender details not added. Please contact exam controller."); | |
| } | |
| $student->examRegistrationProperties->genderWiseMinimumAttendance = (array) $student->examRegistrationProperties->genderWiseMinimumAttendance; | |
| } | |
| else{ | |
| $showGenderWiseAttendance = false; | |
| } | |
| $student->studentImage = CommonExamService::getInstance()->getStudentProfilePic($student->id); | |
| $student->studentSignature = CommonExamService::getInstance()->getStudentSignPic($student->id); | |
| $student->haveMinAttendance = true; | |
| $student->isAppliedOpenCourse = true; | |
| $student->isEvaluationComplete = true; | |
| $blockedSubjectCount = 0; | |
| array_walk($student->streams, function($stream) use($student){ | |
| $student->streamNames[] = $stream->name; | |
| }); | |
| $student->streamName = implode(" and ",$student->streamNames); | |
| $student->programName = $student->degreeName." - ".$student->streamName; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($student->academicTermOrder,true); | |
| $student->semInRomanLetter = $semesterNames->romanLetter; | |
| $student->semInFullName = $semesterNames->fullName; | |
| $student->semInSemNumber = $semesterNames->semNumber; | |
| $student->academicExamYear = ($student->academicYear + (floor(($student->semInSemNumber - 1) / 2))) ." - ".($student->academicYear + (floor(($student->semInSemNumber - 1) / 2)) + 1); | |
| $student->subjects = array_filter($student->subjects, function ($subject) use($student,$shortTermCourseTypes){ | |
| return !($student->examRegistrationProperties->isShortTermCourse && in_array($student->examRegistrationProperties->shortTermCourseType, $shortTermCourseTypes) && $subject->studentCourseMode == ShortTermCourseModeConstants::MOOC ); | |
| }); | |
| $student->isHallTicketBlocked = false; | |
| $student->blockingMsg = ""; | |
| if($student->blockReasons) { | |
| $blockReasonMsg = "Hall Ticket Blocked "; | |
| foreach($student->blockReasons as $reason){ | |
| $blockReasonMsg .= "<br> * Due to ".$reason->name .". "; | |
| $blockReasonMsg .= $reason->contactPersonName ? "Please contact ".$reason->contactPersonName :""; | |
| $blockReasonMsg .= $reason->contactPersonDecription ? " ".$reason->contactPersonDecription :""; | |
| } | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = $blockReasonMsg; | |
| } | |
| $student->isShowOnlySession = $hallTicketRule->isShowOnlySession ?? false; | |
| foreach($student->subjects as $subKey => $subject){ | |
| if( $searchRequest->removeInternalOnlySubject ){ | |
| if( $subject->isInternal && !$subject->isExternal){ | |
| unset($student->subjects[$subKey]); | |
| continue; | |
| } | |
| } | |
| if( $searchRequest->removeNotTheorySubject ){ | |
| if($subject->classType != 'THEORY'){ | |
| unset($student->subjects[$subKey]); | |
| continue; | |
| } | |
| } | |
| $subject->slot = $subjectSlots[$subject->slotId] ?? ''; | |
| $subject->isInternalFailed = false; | |
| $subject->isExternalFailed = false; | |
| if($subject->subjectMarkDetails->internalResultStatus == 'FAILED'){ | |
| $subject->isInternalFailed = true; | |
| } | |
| if($subject->subjectMarkDetails->externalResultStatus == 'FAILED'){ | |
| $subject->isExternalFailed = true; | |
| } | |
| $subject->isSubjectBlocked = false; | |
| $subject->blockingMsg = ""; | |
| if($subject->blockReasons) { | |
| $blockReasonMsg = "Hall Ticket Blocked "; | |
| foreach($subject->blockReasons as $reason){ | |
| $blockReasonMsg .= "<br> * Due to ".$reason->name .". "; | |
| $blockReasonMsg .= $reason->contactPersonName ? "Please contact ".$reason->contactPersonName :""; | |
| $blockReasonMsg .= $reason->contactPersonDecription ? " ".$reason->contactPersonDecription :""; | |
| } | |
| $subject->isSubjectBlocked = true; | |
| $subject->blockingMsg = $blockReasonMsg; | |
| $blockedSubjectCount ++; | |
| } | |
| $subject->assessmentDate = $subject->assessmentDate ? date("d-m-Y", strtotime($subject->assessmentDate)) : ''; | |
| $subject->assessmentStartTime = $subject->assessmentStartTime ? date("h:i A", strtotime($subject->assessmentStartTime)) : ''; | |
| $subject->session = (!empty($subject->assessmentStartTime) && strtotime($subject->assessmentStartTime) < strtotime("12:00 PM")) ? 'FN' : 'AN'; | |
| $subject->assessmentEndTime = $subject->assessmentEndTime ? date("h:i A", strtotime($subject->assessmentEndTime)) : ''; | |
| if((($isCheckAttendanceDueInStudentSideHallTicket && $searchRequest->isStudentSideHallTIcketRequest) || $isCheckAttendanceDueInControllerSideHallTicket) && $student->examRegistrationProperties->criteriaDuringMinimumAttendance == 'SUBJECT_WISE'){ | |
| if($showGenderWiseAttendance){ | |
| if ( !empty($student->examRegistrationProperties->genderWiseMinimumAttendance)){ | |
| $subject->subjectProperties->minimumAttendancePercentage = $student->examRegistrationProperties->genderWiseMinimumAttendance[strtoupper($student->gender)]; | |
| } | |
| } | |
| $attendanceTermWiseReportRequest = new AttendanceTermWiseReport(); | |
| $attendanceTermWiseReportRequest->studentId = $student->id; | |
| $attendanceTermWiseReportRequest->termId = $student->academicTermId; | |
| $attendanceTermWiseReportRequest->paperSubjectId = $subject->id; | |
| $attendanceTermWiseReportRequest->attendanceClosingDate = $student->examRegistrationBatchProperties->attendanceClosingDate; | |
| $subject->attendanceDetails = reset(AttendanceService::getInstance()->getTermWiseStudentAttendanceConfirmedReport($attendanceTermWiseReportRequest)); | |
| if($subject->subjectProperties->minimumAttendancePercentage > $subject->attendanceDetails->attendancePercentage){ | |
| if($subject->isSubjectBlocked ){ | |
| $subject->blockingMsg .= "<br> * Due to attendance shortage"; | |
| } | |
| else{ | |
| $subject->isSubjectBlocked = true; | |
| $subject->blockingMsg = "Hall Ticket Blocked <br> * Due to attendance shortage"; | |
| } | |
| $blockedSubjectCount ++; | |
| } | |
| } | |
| } | |
| $student->subjects = array_values($student->subjects); | |
| if($blockedSubjectsCountToBlockHallticket && !$student->isHallTicketBlocked){ | |
| if($blockedSubjectCount >= $blockedSubjectsCountToBlockHallticket){ | |
| if($student->isHallTicketBlocked){ | |
| $student->blockingMsg .= "<br> Hall Ticket Blocked"; | |
| } | |
| else{ | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = "Hall Ticket Blocked"; | |
| } | |
| } | |
| } | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($student->academicTermOrder,true); | |
| $student->semInRomanLetter = $semesterNames->romanLetter; | |
| $student->semInFullName = $semesterNames->fullName; | |
| $student->semInSemNumber = $semesterNames->semNumber; | |
| $student->currentDate = date('d-m-Y'); | |
| $student->examMonthYear = date("F Y", strtotime($student->examYear."-".$student->examMonth)); | |
| $student->examMonthName = date("F", strtotime($student->examYear."-".$student->examMonth)); | |
| $student->examRegType = $student->examRegistrationType == "REGULAR" ? "Regular" : "Supplementary"; | |
| $student->qrCodeContents = $this->setQrContents($student,$hallTicketRule); | |
| if((($isCheckAttendanceDueInStudentSideHallTicket && $searchRequest->isStudentSideHallTIcketRequest) || $isCheckAttendanceDueInControllerSideHallTicket) && $student->examRegistrationProperties->criteriaDuringMinimumAttendance == 'SEMESTER_WISE'){ | |
| $minAttendanceForExamReg = json_decode(CommonService::getInstance()->getSettings(SettingsConstents::EXAM_CONTROLLER, SettingsConstents::SEMESTER_EXAM_SETTINGS))->minAttendanceForExamReg; | |
| if($minAttendanceForExamReg->enableDayWiseAttendanceChecking){ | |
| $semWiseRequest = new \stdClass; | |
| $semWiseRequest->studentId = $student->id; | |
| $semWiseRequest->termId = $student->academicTermId; | |
| $semWiseRequest->examRegistrationId = $student->examRegistrationid; | |
| $semWiseRequest->studentGender = $student->gender; | |
| $semWiseRequest->workFlowId = $student->examRegistrationProperties->workFlowId; | |
| $semWiseCriteria = ProfessionalCommonExamService::getInstance()->checkStudentSemesterWiseAttendanceCriteriaForExamRegistration($semWiseRequest); | |
| if ( $semWiseCriteria->workflowId && $semWiseCriteria->eligibleForCondonation && !$semWiseCriteria->eligibleToApplyByDayWiseAttendance && !$examRegistration->isApplied && !$examRegistration->isRegistered){ | |
| $examRegistration->redirectToWorkFlowModule = 1; | |
| } | |
| if ( !$semWiseCriteria->eligibleToApplyByDayWiseAttendance && !$semWiseCriteria->isCondonationApproved){ | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = "Hall Ticket Blocked <br> * Due to attendance shortage"; | |
| } | |
| } | |
| else{ | |
| $attendanceTermWiseReportRequest = new AttendanceTermWiseReport(); | |
| $attendanceTermWiseReportRequest->studentId = $student->id; | |
| $attendanceTermWiseReportRequest->termId = $student->academicTermId; | |
| $student->attendanceDetails = reset(AttendanceService::getInstance()->getTermWiseStudentAttendanceConfirmedReport($attendanceTermWiseReportRequest)); | |
| if($student->examRegistrationProperties->minimumAttendancePercentage > $student->attendanceDetails->attendancePercentage){ | |
| if($student->isHallTicketBlocked){ | |
| $student->blockingMsg .= "<br> * Due to attendance shortage"; | |
| } | |
| else{ | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = "Hall Ticket Blocked <br> * Due to attendance shortage"; | |
| } | |
| } | |
| } | |
| } | |
| if(($isCheckFeeDueInStudentSideHallTicket && $searchRequest->isStudentSideHallTIcketRequest) || $isCheckFeeDueInControllerSideHallTicket){ | |
| // This is a curl call | |
| $curl = curl_init(); | |
| $domain = ""; | |
| if ($_SERVER['HTTP_HOST'] != 'localhost') { | |
| $domain = rtrim($_SERVER['HTTP_HOST']); | |
| } | |
| if (getenv("DEBUG") !== "true") { | |
| $handlerUrl = "https://" . $domain . "/fm/api/v1/my-fee/".$student->id; | |
| } else { | |
| $handlerUrl = "http://localhost/fm/api/v1/my-fee/".$student->id; | |
| } | |
| $header = $GLOBALS['_SERVER']['REDIRECT_HTTP_AUTHORIZATION']; | |
| $headers = array( | |
| 'Content-Type:application/json', | |
| 'Authorization:' . $header | |
| ); | |
| // Query parameters | |
| $queryParams = array( | |
| 'studentId' => $student->id | |
| ); | |
| $queryString = $queryParams ? http_build_query($queryParams) : ''; | |
| curl_setopt($curl, CURLOPT_URL, $handlerUrl . '?' . $queryString); | |
| curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); | |
| $curl_response = curl_exec($curl); | |
| // Check for errors | |
| if ($curl_response === false) { | |
| return false; | |
| } | |
| else { | |
| $decodedResponse = json_decode($curl_response); | |
| $studentFeeSummary = $decodedResponse->data; | |
| } | |
| // Close cURL resource | |
| curl_close($curl); | |
| if(!empty($studentFeeSummary)){ | |
| foreach($studentFeeSummary as $semFee) { | |
| if($semFee->totalBalance > 0) { | |
| throw new ExamControllerException(ExamControllerException::HALL_TICKET_BLOCKED,"Your hall ticket is currently on hold due to unpaid fees. Please pay any outstanding balances "); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentDetails; | |
| } | |
| /** | |
| * get Registered Student Subjects Details | |
| * @param $searchRequest | |
| * @return $studentRegistrationDetails | |
| * @author Krishnajith | |
| */ | |
| public function getRegisteredStudentSubjectsDetailsForHallTickets($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| if($searchRequest->orderBy == 'ROLL_NO'){ | |
| $orderBy = " ORDER BY spa.properties->>'$.rollNumber' ASC , aa.properties_value ->>'$.assessmentDate' ASC ,CAST(ap.properties ->> '$.order' AS UNSIGNED) ASC"; | |
| } | |
| else{ | |
| $orderBy = " ORDER BY spa.properties->>'$.registerNumber' ASC , aa.properties_value ->>'$.assessmentDate' ASC ,CAST(ap.properties ->> '$.order' AS UNSIGNED) ASC"; | |
| } | |
| $whereQuery = ""; | |
| $groupByQuery = ""; | |
| if(!empty($searchRequest->groupId)) { | |
| $groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','",$searchRequest->groupId) . "'" : "'".$searchRequest->groupId."'"; | |
| $whereQuery .= " AND g.id IN ( $groupIdString )"; | |
| } | |
| if(!empty($searchRequest->departmentId)) { | |
| $departmentIdString = is_array($searchRequest->departmentId) ? "'" . implode("','",$searchRequest->departmentId) . "'" : "'".$searchRequest->departmentId."'"; | |
| $whereQuery .= " AND dept.deptID IN ( $departmentIdString )"; | |
| } | |
| if(!empty($searchRequest->academicTermId)) { | |
| $academicTermIdString = is_array($searchRequest->academicTermId) ? "'" . implode("','",$searchRequest->academicTermId) . "'" : "'".$searchRequest->academicTermId."'"; | |
| $whereQuery .= " AND act.id IN ( $academicTermIdString )"; | |
| } | |
| if(!empty($searchRequest->examRegistrationId)) { | |
| $examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','",$searchRequest->examRegistrationId) . "'" : "'".$searchRequest->examRegistrationId."'"; | |
| $whereQuery .= " AND eer.id IN ( $examRegistrationIdString )"; | |
| } | |
| if(!empty($searchRequest->examRegistrationType)) { | |
| $whereQuery .= " AND eer.type = '$searchRequest->examRegistrationType'"; | |
| } | |
| if(!empty($searchRequest->registerNo)) { | |
| $registerNoString = is_array($searchRequest->registerNo) ? "'" . implode("','",$searchRequest->registerNo) . "'" : "'".$searchRequest->registerNo."'"; | |
| $whereQuery .= " AND spa.properties->>'$.registerNumber' IN ( $registerNoString )"; | |
| } | |
| if(!empty($searchRequest->rollNo)) { | |
| $rollNoString = is_array($searchRequest->rollNo) ? "'" . implode("','",$searchRequest->rollNo) . "'" : "'".$searchRequest->rollNo."'"; | |
| $whereQuery .= " AND spa.properties->>'$.rollNumber' IN ( $rollNoString )"; | |
| } | |
| if(!empty($searchRequest->studentId)) { | |
| $studentIdString = is_array($searchRequest->studentId) ? "'" . implode("','",$searchRequest->studentId) . "'" : "'".$searchRequest->studentId."'"; | |
| $whereQuery .= " AND sa.studentID IN ( $studentIdString )"; | |
| } | |
| if(!empty($searchRequest->considerPublishedTimeTable)) { | |
| $whereQuery .= " AND eer.properties ->> '$.publishExamTimeTableStudent' = 1"; | |
| } | |
| if(!empty($searchRequest->excludedCourseTypeIds)) { | |
| $whereQuery .= " AND aps.properties ->> '$.subjectTypeId' NOT IN ('" . implode("','", $searchRequest->excludedCourseTypeIds) . "')"; | |
| } | |
| $query = "SELECT DISTINCT | |
| sa.studentID AS id, | |
| sa.studentID AS studentId, | |
| sa.myImage AS studentImage, | |
| sa.studentBirthday AS DOB, | |
| sa.studentPhone, | |
| sa.studentAddress, | |
| sa.studentName, | |
| spa.properties->>'$.rollNumber' AS rollNo, | |
| spa.properties->>'$.registerNumber' AS regNo, | |
| sa.admissionNo, | |
| sa.myImage, | |
| sa.studentMother AS motherName, | |
| sa.studentFather AS fatherName, | |
| sa.studentGender, | |
| sa.abcID as abcId, | |
| g.id AS groupId, | |
| g.name AS groupName, | |
| g.properties ->> '$.startYear' AS academicYear, | |
| eer.type AS examRegistrationType, | |
| eer.id AS examRegistrationid, | |
| eer.name AS examRegistrationName, | |
| eer.properties ->> '$.examYear' AS examYear, | |
| eer.properties ->> '$.examMonth' AS examMonth, | |
| eer.properties ->> '$.enableHallTicketExamAdmin' AS enableHallTicketExamAdmin, | |
| eer.properties ->> '$.enableHallTicketExamStudent' AS enableHallTicketExamStudent, | |
| eer.properties AS examRegistrationProperties, | |
| eerb.properties AS examRegistrationBatchProperties, | |
| act.id as academicTermId, | |
| act.name as academicTermName, | |
| act.properties ->> '$.orderNo' as academicTermOrder, | |
| dept.deptID, | |
| dept.school_id as schoolId, | |
| deg.name as degreeName, | |
| p.stream_id as streamId, | |
| p.name as currentProgramName, | |
| str.name as streamName, | |
| deg.id as degreeId, | |
| dept.deptName, | |
| ct.courseTypeID, | |
| ct.typeName as courseTypeName, | |
| s.code as subjectCode, | |
| aps.properties ->> '$.syllabusName' AS syllabusName, | |
| s.name as subjectName, | |
| eers.properties as subjectProperties, | |
| eers.cm_academic_paper_subjects_id as academicPaperSubjectId, | |
| aps.properties ->>'$.credit' AS subjectCredit, | |
| aps.properties ->>'$.externalMaxMark' AS externalMaxMark, | |
| aps.properties ->>'$.InternalMaxMark' AS internalMaxMark, | |
| aps.properties ->> '$.isInternal' as isInternal, | |
| aps.properties ->> '$.isExternal' as isExternal, | |
| aps.properties ->>'$.subjectTypeId' AS subjectTypeId, | |
| aps.properties ->>'$.classType' AS classType, | |
| aps.properties ->>'$.courseCode' AS courseCode, | |
| aps.slot_id as slotId, | |
| ap.properties ->> '$.order' AS subjectOrder, | |
| aa.id as assessmentId, | |
| aa.identifying_context as assessmentIdentifyingContext, | |
| aa.properties_value as assessmentProperties, | |
| aa.properties_value ->>'$.assessmentDate' AS assessmentDate, | |
| aa.properties_value ->>'$.startTime' AS assessmentStartTime, | |
| aa.properties_value ->>'$.endTime' AS assessmentEndTime, | |
| esar.properties->>'$.hallticketStatus' AS hallticketStatus, | |
| esar.properties->>'$.registrationStatus' AS registrationStatus, | |
| esar.properties->>'$.hallticketBlockedReasons' AS hallticketBlockedReasons, | |
| esar.properties->>'$.registrationBlockedReasons' AS registrationBlockedReasons, | |
| esar.properties->>'$.courseMode' AS studentCourseMode, | |
| esar.properties->>'$.studentSeprateAssessmentDate' AS studentSeprateAssessmentDate, | |
| esar.properties->>'$.studentSeprateAssessmentStartTime' AS studentSeprateAssessmentStartTime, | |
| esar.properties->>'$.studentSeprateAssessmentEndTime' AS studentSeprateAssessmentEndTime, | |
| esbrm.ec_block_student_reason_id as blockStudentReasonId, | |
| ebsr.name as blockReasonName, | |
| cpsa.staffName as blockReasoncontactPersonName, | |
| ebsr.properties ->> '$.description' AS contactPersonDecription, | |
| esbrmSub.ec_block_student_reason_id as subjectBlockStudentReasonId, | |
| ebsrSub.name as subjectBlockReasonName, | |
| cpsaSub.staffName as subjectBlockReasoncontactPersonName, | |
| ebsrSub.properties ->> '$.description' AS SubjectContactPersonDecription, | |
| ecsmd.mark_details as subjectMarkDetails, | |
| cst.name as subjectTypeName | |
| FROM | |
| `groups` g | |
| INNER JOIN ec_exam_registration_batch eerb ON | |
| eerb.groups_id = g.id | |
| INNER JOIN ec_exam_registration_subject eers ON | |
| eers.ec_exam_registration_batch_id = eerb.id | |
| INNER JOIN cm_academic_paper_subjects aps ON | |
| eers.cm_academic_paper_subjects_id = aps.id | |
| INNER JOIN cm_academic_paper ap ON | |
| ap.id = aps.cm_academic_paper_id | |
| INNER JOIN am_assessment aa ON | |
| aa.id = eers.am_assessment_id | |
| INNER JOIN v4_ams_subject s ON | |
| aps.ams_subject_id = s.id | |
| INNER JOIN ec_exam_registration eer ON | |
| eer.id = eerb.ec_exam_registration_id | |
| INNER JOIN program p ON | |
| p.id = CAST(g.properties ->> '$.programId' AS CHAR) | |
| INNER JOIN ec_student_assessment_registration esar ON | |
| esar.am_assessment_id = eers.am_assessment_id AND CAST(esar.properties ->> '$.registrationStatus' AS CHAR) = 'REGISTERED' AND CAST(esar.properties ->> '$.feeStatus' AS CHAR) = 'PAID' AND esar.ec_exam_registration_type = eer.type | |
| INNER JOIN student_program_account spa ON | |
| spa.current_program_id = p.id AND | |
| spa.student_id = esar.student_id | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = esar.student_id | |
| INNER JOIN department dept ON | |
| dept.deptID = g.properties ->> '$.departmentId' | |
| INNER JOIN academic_term act ON | |
| act.id = CAST(eerb.properties ->> '$.academicTermId'AS CHAR) | |
| INNER JOIN degree deg ON | |
| deg.id = p.degree_id | |
| LEFT JOIN stream str ON | |
| JSON_SEARCH( p.stream_id, 'one', str.id) IS NOT NULL | |
| INNER JOIN `course_type` ct ON | |
| ct.courseTypeID = p.course_type_id | |
| LEFT JOIN ec_student_block_reason_mapping esbrm ON | |
| esbrm.student_id = sa.studentID AND esbrm.exam_registration_id = eer.id AND | |
| esbrm.blocking_type = 'HALL_TICKET_BLOCKING' AND esbrm.cm_academic_paper_subjects_id IS NULL | |
| LEFT JOIN ec_block_student_reason ebsr ON | |
| ebsr.id = esbrm.ec_block_student_reason_id AND | |
| ebsr.type = 'SEMESTER_WISE' | |
| LEFT JOIN staffaccounts cpsa ON | |
| cpsa.staffID = ebsr.contact_person_id | |
| LEFT JOIN ec_student_block_reason_mapping esbrmSub ON | |
| esbrmSub.student_id = sa.studentID AND esbrmSub.exam_registration_id = eer.id AND | |
| esbrmSub.blocking_type = 'HALL_TICKET_BLOCKING' AND esbrmSub.cm_academic_paper_subjects_id = aps.id | |
| LEFT JOIN ec_block_student_reason ebsrSub ON | |
| ebsrSub.id = esbrmSub.ec_block_student_reason_id AND | |
| ebsrSub.type = 'SUBJECT_WISE' | |
| LEFT JOIN staffaccounts cpsaSub ON | |
| cpsaSub.staffID = ebsrSub.contact_person_id | |
| LEFT JOIN ec_consolidated_subject_mark_details ecsmd ON | |
| ecsmd.cm_academic_paper_subjects_id = aps.id AND ecsmd.student_id = esar.student_id | |
| LEFT JOIN cm_subject_types cst ON | |
| cst.id = aps.properties ->> '$.subjectTypeId' | |
| WHERE 1=1 AND (CAST(esar.properties ->> '$.syllabusSubType' AS CHAR) != 'MOOC' OR esar.properties ->> '$.syllabusSubType' IS NULL) "; | |
| $studentRegistrationDetails = $this->executeQueryForList($query.$whereQuery.$groupByQuery.$orderBy, $this->mapper[HallTicketsServiceMapper::GET_HALL_TICKET_DETAILS]); | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentRegistrationDetails; | |
| } | |
| /** | |
| * Set QR code contents for the student | |
| * @param $student | |
| * @return string | |
| */ | |
| private function setQrContents($student,$hallTicketRule) { | |
| switch($hallTicketRule->qrCodeTemplate){ | |
| case '1': | |
| return $this->setQrContentsTemplate1($student); | |
| case '2': | |
| return $this->setQrContentsTemplate2($student); | |
| default: | |
| return $this->setQrContentsTemplate1($student); | |
| } | |
| return $qrContents; | |
| } | |
| /** | |
| * Set QR code contents for the student | |
| * @param $student | |
| * @return string | |
| */ | |
| private function setQrContentsTemplate1($student) { | |
| $qrContents = ""; | |
| $qrContents .= "Name: " . $student->studentName . "\n"; | |
| $qrContents .= "Admission No: " . $student->admissionNo . "\n"; | |
| $qrContents .= "Register No: " . $student->registerNo . "\n"; | |
| $qrContents .= "Program: " . $student->programName . "\n"; | |
| return $qrContents; | |
| } | |
| private function setQrContentsTemplate2($student) { | |
| $collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $qrContents = ""; | |
| $qrContents .= "Registration No: " . $student->rollNo . "\n"; | |
| $qrContents .= "Name: " . $student->studentName . "\n"; | |
| $qrContents .= "Course: " . $student->programName . "\n"; | |
| $qrContents .= "Collage: " . $collegeData->collegeName . "\n"; | |
| $qrContents .= "Examination: " . $student->examRegistrationName . "\n"; | |
| $qrContents .= "Sem: " . $student->academicTermId . "\n"; | |
| $subjectNames = implode(",",array_column($student->subjects, 'name')); | |
| //removed subjectnames from qr code for better visibility | |
| // $qrContents .= "Subjects: " . $subjectNames . "\n"; | |
| return $qrContents; | |
| } | |
| /** | |
| * Get student assigned halls for exam | |
| * @param Object $request | |
| */ | |
| public function getStudentAssignedHallsAndSeatForExam($request){ | |
| $request = $this->realEscapeObject($request); | |
| try { | |
| $sql = "SELECT | |
| eeh.id, | |
| eeh.name, | |
| ehta.properties->>'$.seatNo' AS seatNo, | |
| ehagas.am_assessment_id AS assessmentId | |
| FROM | |
| ec_hall_arrangement_group_assigned_student ehagas | |
| INNER JOIN ec_hall_arrangement_group_assigned_hall ehagah ON | |
| ehagah.id = ehagas.ec_hall_arrangement_group_assigned_hall_id | |
| INNER JOIN ec_exam_hall eeh ON | |
| eeh.id = ehagah.ec_exam_hall_id | |
| INNER JOIN ec_exam_hall_template_arrangement ehta ON | |
| ehagas.ec_exam_hall_template_arrangement_id = ehta.id | |
| WHERE | |
| ehagas.student_id = '$request->studentId' AND ehagah.is_locked = '1' "; | |
| $assignedStudents = (array)$this->executeQueryForList($sql); | |
| $studentExamHalls = []; | |
| foreach($assignedStudents as $student){ | |
| $studentExamHalls[$student->assessmentId] = $student; | |
| } | |
| } catch (\Exception $e) { | |
| throw new ExamControllerException($e->getCode(), $e->getMessage()); | |
| } | |
| return $studentExamHalls; | |
| } | |
| /** | |
| * get Registered Student Subjects Details For Eligibility Report | |
| * @param $searchRequest | |
| * @return $studentRegistrationDetails | |
| * @author Krishnajith | |
| */ | |
| public function getRegisteredStudentSubjectsDetailsForEligibilityReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| if($searchRequest->orderBy == 'ROLL_NO'){ | |
| $orderBy = " ORDER BY spa.properties->>'$.rollNumber' ASC , aa.properties_value ->>'$.assessmentDate' ASC ,CAST(ap.properties ->> '$.order' AS UNSIGNED) ASC"; | |
| } | |
| else{ | |
| $orderBy = " ORDER BY spa.properties->>'$.registerNumber' ASC , aa.properties_value ->>'$.assessmentDate' ASC ,CAST(ap.properties ->> '$.order' AS UNSIGNED) ASC"; | |
| } | |
| $whereQuery = ""; | |
| $groupByQuery = ""; | |
| if(!empty($searchRequest->groupId)) { | |
| $groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','",$searchRequest->groupId) . "'" : "'".$searchRequest->groupId."'"; | |
| $whereQuery .= " AND g.id IN ( $groupIdString )"; | |
| } | |
| if(!empty($searchRequest->examRegistrationId)) { | |
| $examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','",$searchRequest->examRegistrationId) . "'" : "'".$searchRequest->examRegistrationId."'"; | |
| $whereQuery .= " AND eer.id IN ( $examRegistrationIdString )"; | |
| } | |
| if(!empty($searchRequest->programId)) { | |
| $programIdString = is_array($searchRequest->programId) ? "'" . implode("','",$searchRequest->programId) . "'" : "'".$searchRequest->programId."'"; | |
| $whereQuery .= " AND p.id IN ( $programIdString )"; | |
| } | |
| if(!empty($searchRequest->courseTypeId)) { | |
| $courseTypeIdString = is_array($searchRequest->courseTypeId) ? "'" . implode("','",$searchRequest->courseTypeId) . "'" : "'".$searchRequest->courseTypeId."'"; | |
| $whereQuery .= " AND ct.courseTypeID IN ( $courseTypeIdString )"; | |
| } | |
| $query = "SELECT DISTINCT | |
| sa.studentID AS id, | |
| sa.studentID AS studentId, | |
| sa.studentBirthday AS DOB, | |
| sa.studentName, | |
| spa.properties->>'$.rollNumber' AS rollNo, | |
| spa.properties->>'$.registerNumber' AS regNo, | |
| sa.admissionNo, | |
| g.id AS groupId, | |
| g.name AS groupName, | |
| eer.type AS examRegistrationType, | |
| eer.id AS examRegistrationid, | |
| eer.name AS examRegistrationName, | |
| eer.properties AS examRegistrationProperties, | |
| eerb.properties AS examRegistrationBatchProperties, | |
| p.name as currentProgramName, | |
| ct.courseTypeID, | |
| ct.typeName as courseTypeName, | |
| s.code as subjectCode, | |
| s.name as subjectName, | |
| eers.properties as subjectProperties, | |
| eerb.properties ->> '$.academicTermId' as academicTermId, | |
| act.name as academicTermName, | |
| eers.cm_academic_paper_subjects_id as academicPaperSubjectId, | |
| aa.id as assessmentId, | |
| aa.properties_value ->>'$.assessmentDate' AS assessmentDate, | |
| aa.properties_value ->>'$.startTime' AS assessmentStartTime, | |
| aa.properties_value ->>'$.endTime' AS assessmentEndTime, | |
| esbrm.ec_block_student_reason_id as blockStudentReasonId, | |
| ebsr.name as blockReasonName, | |
| cpsa.staffName as blockReasoncontactPersonName, | |
| ebsr.properties ->> '$.description' AS contactPersonDecription, | |
| esbrmSub.ec_block_student_reason_id as subjectBlockStudentReasonId, | |
| ebsrSub.name as subjectBlockReasonName, | |
| cpsaSub.staffName as subjectBlockReasoncontactPersonName, | |
| ebsrSub.properties ->> '$.description' AS SubjectContactPersonDecription | |
| FROM | |
| `groups` g | |
| INNER JOIN ec_exam_registration_batch eerb ON | |
| eerb.groups_id = g.id | |
| INNER JOIN ec_exam_registration_subject eers ON | |
| eers.ec_exam_registration_batch_id = eerb.id | |
| INNER JOIN cm_academic_paper_subjects aps ON | |
| eers.cm_academic_paper_subjects_id = aps.id | |
| INNER JOIN cm_academic_paper ap ON | |
| ap.id = aps.cm_academic_paper_id | |
| INNER JOIN am_assessment aa ON | |
| aa.id = eers.am_assessment_id | |
| INNER JOIN v4_ams_subject s ON | |
| aps.ams_subject_id = s.id | |
| INNER JOIN ec_exam_registration eer ON | |
| eer.id = eerb.ec_exam_registration_id | |
| INNER JOIN academic_term act ON | |
| act.id = CAST(eerb.properties ->> '$.academicTermId'AS CHAR) | |
| INNER JOIN program p ON | |
| p.id = CAST(g.properties ->> '$.programId' AS CHAR) | |
| INNER JOIN ec_student_assessment_registration esar ON | |
| esar.am_assessment_id = eers.am_assessment_id AND CAST(esar.properties ->> '$.registrationStatus' AS CHAR) = 'REGISTERED' AND CAST(esar.properties ->> '$.feeStatus' AS CHAR) = 'PAID' AND esar.ec_exam_registration_type = eer.type | |
| INNER JOIN student_program_account spa ON | |
| spa.current_program_id = p.id AND | |
| spa.student_id = esar.student_id | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = esar.student_id | |
| INNER JOIN `course_type` ct ON | |
| ct.courseTypeID = p.course_type_id | |
| LEFT JOIN ec_student_block_reason_mapping esbrm ON | |
| esbrm.student_id = sa.studentID AND esbrm.exam_registration_id = eer.id AND | |
| esbrm.blocking_type = 'HALL_TICKET_BLOCKING' AND esbrm.cm_academic_paper_subjects_id IS NULL | |
| LEFT JOIN ec_block_student_reason ebsr ON | |
| ebsr.id = esbrm.ec_block_student_reason_id AND | |
| ebsr.type = 'SEMESTER_WISE' | |
| LEFT JOIN staffaccounts cpsa ON | |
| cpsa.staffID = ebsr.contact_person_id | |
| LEFT JOIN ec_student_block_reason_mapping esbrmSub ON | |
| esbrmSub.student_id = sa.studentID AND esbrmSub.exam_registration_id = eer.id AND | |
| esbrmSub.blocking_type = 'HALL_TICKET_BLOCKING' AND esbrmSub.cm_academic_paper_subjects_id = aps.id | |
| LEFT JOIN ec_block_student_reason ebsrSub ON | |
| ebsrSub.id = esbrmSub.ec_block_student_reason_id AND | |
| ebsrSub.type = 'SUBJECT_WISE' | |
| LEFT JOIN staffaccounts cpsaSub ON | |
| cpsaSub.staffID = ebsrSub.contact_person_id | |
| WHERE 1=1 AND (CAST(esar.properties ->> '$.syllabusSubType' AS CHAR) != 'MOOC' OR esar.properties ->> '$.syllabusSubType' IS NULL) "; | |
| $studentRegistrationDetails = $this->executeQueryForList($query.$whereQuery.$groupByQuery.$orderBy, $this->mapper[HallTicketsServiceMapper::GET_HALL_TICKET_DETAILS]); | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentRegistrationDetails; | |
| } | |
| /** | |
| * get Exam Eligibility Report | |
| * @param $searchRequest | |
| * @return $studentDetails | |
| * @author Krishnajith | |
| */ | |
| public function getExamEligibilityReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $blockedSubjectsCountToBlockHallticket = CommonService::getInstance()->getSettings("EXAM_HALL_TICKET", "BLOCKED_SUBJECT_COUNT_TO_BLOCK_HALLTICKET"); | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "BLOCK_STUDENT_SETTINGS_RULE"; | |
| $ruleObj = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $blockedSubjectsCountToBlockHallticket = $ruleObj->blockedSubjectCountToBlockHallTicket ?? 0; | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "HALL_TICKET_RULE"; | |
| $hallTicketRule = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $hallTicketRule = $hallTicketRule ? $hallTicketRule : new \stdClass; | |
| $isCheckAttendanceDueInControllerSideHallTicket = $hallTicketRule->isCheckAttendanceDueInControllerSideHallTicket == '1' ? true : false; | |
| $request = new \stdClass; | |
| $request->programId = $searchRequest->programId; | |
| $request->groupId = $searchRequest->groupId; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->courseTypeId = $searchRequest->courseTypeId; | |
| $studentDetails = $this->getRegisteredStudentSubjectsDetailsForEligibilityReport($request); | |
| if(empty($studentDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Students Found"); | |
| } | |
| $showGenderWiseAttendance = false; | |
| if($isCheckAttendanceDueInControllerSideHallTicket){ | |
| $showGenderWiseAttendance = CommonService::getInstance()->getSettings(SettingsConstants::EXAM_CONTROLLER, "EXAM_REGISTRATION_GENDER_WISE_ATTENDANCE_CHECK"); | |
| } | |
| foreach($studentDetails as $student){ | |
| if($showGenderWiseAttendance){ | |
| if(empty($student->examRegistrationProperties->genderWiseMinimumAttendance)){ | |
| throw new ExamControllerException (ExamControllerException::INVALID_PARAMETERS,"Gender wise attendance rule not added. Please contact exam controller."); | |
| } | |
| if(empty($student->gender) || (strtoupper($student->gender) != 'MALE' && strtoupper($student->gender) != 'FEMALE' && strtoupper($student->studentGender) != 'OTHER') ){ | |
| throw new ExamControllerException (ExamControllerException::INVALID_PARAMETERS,"Gender details not added. Please contact exam controller."); | |
| } | |
| $student->examRegistrationProperties->genderWiseMinimumAttendance = (array) $student->examRegistrationProperties->genderWiseMinimumAttendance; | |
| } | |
| else{ | |
| $showGenderWiseAttendance = false; | |
| } | |
| $student->isHallTicketBlocked = false; | |
| $student->blockingMsg = ""; | |
| if($student->blockReasons) { | |
| $blockReasonMsg = "Hall Ticket Blocked "; | |
| foreach($student->blockReasons as $reason){ | |
| $blockReasonMsg .= "<br> * Due to ".$reason->name .". "; | |
| $blockReasonMsg .= $reason->contactPersonName ? "Please contact ".$reason->contactPersonName :""; | |
| $blockReasonMsg .= $reason->contactPersonDecription ? " ".$reason->contactPersonDecription :""; | |
| } | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = $blockReasonMsg; | |
| } | |
| foreach($student->subjects as $subKey => $subject){ | |
| $subject->isSubjectBlocked = false; | |
| $subject->blockingMsg = ""; | |
| if($subject->blockReasons) { | |
| $blockReasonMsg = "Hall Ticket Blocked "; | |
| foreach($subject->blockReasons as $reason){ | |
| $blockReasonMsg .= "<br> * Due to ".$reason->name .". "; | |
| $blockReasonMsg .= $reason->contactPersonName ? "Please contact ".$reason->contactPersonName :""; | |
| $blockReasonMsg .= $reason->contactPersonDecription ? " ".$reason->contactPersonDecription :""; | |
| } | |
| $subject->isSubjectBlocked = true; | |
| $subject->blockingMsg = $blockReasonMsg; | |
| $blockedSubjectCount ++; | |
| } | |
| $subject->assessmentDate = $subject->assessmentDate ? date("d-m-Y", strtotime($subject->assessmentDate)) : ''; | |
| $subject->assessmentStartTime = $subject->assessmentStartTime ? date("h:i A", strtotime($subject->assessmentStartTime)) : ''; | |
| $subject->assessmentEndTime = $subject->assessmentEndTime ? date("h:i A", strtotime($subject->assessmentEndTime)) : ''; | |
| if(($isCheckAttendanceDueInControllerSideHallTicket) && $student->examRegistrationProperties->criteriaDuringMinimumAttendance == 'SUBJECT_WISE'){ | |
| if($showGenderWiseAttendance){ | |
| if ( !empty($student->examRegistrationProperties->genderWiseMinimumAttendance)){ | |
| $subject->subjectProperties->minimumAttendancePercentage = $student->examRegistrationProperties->genderWiseMinimumAttendance[strtoupper($student->gender)]; | |
| } | |
| } | |
| $attendanceTermWiseReportRequest = new AttendanceTermWiseReport(); | |
| $attendanceTermWiseReportRequest->studentId = $student->id; | |
| $attendanceTermWiseReportRequest->termId = $student->academicTermId; | |
| $attendanceTermWiseReportRequest->paperSubjectId = $subject->id; | |
| $attendanceTermWiseReportRequest->attendanceClosingDate = $student->examRegistrationBatchProperties->attendanceClosingDate; | |
| $subject->attendanceDetails = reset(AttendanceService::getInstance()->getTermWiseStudentAttendanceConfirmedReport($attendanceTermWiseReportRequest)); | |
| if($subject->subjectProperties->minimumAttendancePercentage > $subject->attendanceDetails->attendancePercentage){ | |
| if($subject->isSubjectBlocked ){ | |
| $subject->blockingMsg .= "<br> * Due to attendance shortage"; | |
| } | |
| else{ | |
| $subject->isSubjectBlocked = true; | |
| $subject->blockingMsg = "Hall Ticket Blocked <br> * Due to attendance shortage"; | |
| } | |
| $blockedSubjectCount ++; | |
| } | |
| } | |
| } | |
| $student->subjects = array_values($student->subjects); | |
| if($blockedSubjectsCountToBlockHallticket && !$student->isHallTicketBlocked){ | |
| if($blockedSubjectCount >= $blockedSubjectsCountToBlockHallticket){ | |
| if($student->isHallTicketBlocked){ | |
| $student->blockingMsg .= "<br> Hall Ticket Blocked"; | |
| } | |
| else{ | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = "Hall Ticket Blocked"; | |
| } | |
| } | |
| } | |
| $student->examRegType = $student->examRegistrationType == "REGULAR" ? "Regular" : "Supplementary"; | |
| $student->qrCodeContents = $this->setQrContents($student,$hallTicketRule); | |
| if((($isCheckAttendanceDueInStudentSideHallTicket && $searchRequest->isStudentSideHallTIcketRequest) || $isCheckAttendanceDueInControllerSideHallTicket) && $student->examRegistrationProperties->criteriaDuringMinimumAttendance == 'SEMESTER_WISE'){ | |
| $minAttendanceForExamReg = json_decode(CommonService::getInstance()->getSettings(SettingsConstents::EXAM_CONTROLLER, SettingsConstents::SEMESTER_EXAM_SETTINGS))->minAttendanceForExamReg; | |
| if($minAttendanceForExamReg->enableDayWiseAttendanceChecking){ | |
| $semWiseRequest = new \stdClass; | |
| $semWiseRequest->studentId = $student->id; | |
| $semWiseRequest->termId = $student->academicTermId; | |
| $semWiseRequest->examRegistrationId = $student->examRegistrationid; | |
| $semWiseRequest->studentGender = $student->gender; | |
| $semWiseRequest->workFlowId = $student->examRegistrationProperties->workFlowId; | |
| $semWiseCriteria = ProfessionalCommonExamService::getInstance()->checkStudentSemesterWiseAttendanceCriteriaForExamRegistration($semWiseRequest); | |
| if ( $semWiseCriteria->workflowId && $semWiseCriteria->eligibleForCondonation && !$semWiseCriteria->eligibleToApplyByDayWiseAttendance && !$examRegistration->isApplied && !$examRegistration->isRegistered){ | |
| $examRegistration->redirectToWorkFlowModule = 1; | |
| } | |
| if ( !$semWiseCriteria->eligibleToApplyByDayWiseAttendance && !$semWiseCriteria->isCondonationApproved){ | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = "Hall Ticket Blocked <br> * Due to attendance shortage"; | |
| } | |
| } | |
| else{ | |
| $attendanceTermWiseReportRequest = new AttendanceTermWiseReport(); | |
| $attendanceTermWiseReportRequest->studentId = $student->id; | |
| $attendanceTermWiseReportRequest->termId = $student->academicTermId; | |
| $student->attendanceDetails = reset(AttendanceService::getInstance()->getTermWiseStudentAttendanceConfirmedReport($attendanceTermWiseReportRequest)); | |
| if($student->examRegistrationProperties->minimumAttendancePercentage > $student->attendanceDetails->attendancePercentage){ | |
| if($student->isHallTicketBlocked){ | |
| $student->blockingMsg .= "<br> * Due to attendance shortage"; | |
| } | |
| else{ | |
| $student->isHallTicketBlocked = true; | |
| $student->blockingMsg = "Hall Ticket Blocked <br> * Due to attendance shortage"; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentDetails; | |
| } | |
| } |