Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 586 |
| Template20ConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
15252.00 | |
0.00% |
0 / 586 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
| processData | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 72 |
|||
| renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 70 |
|||
| processStudentData | |
0.00% |
0 / 1 |
4422.00 | |
0.00% |
0 / 270 |
|||
| getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 57 |
|||
| processStudentSubjectDataForCourseFileTemplate | |
0.00% |
0 / 1 |
1406.00 | |
0.00% |
0 / 109 |
|||
| <?php | |
| // Template Consilidated Generator For Presidency Colleges | |
| namespace com\linways\ec\core\service\RegularConsolidatedMarkListGenerator; | |
| use com\linways\ec\core\service\StudentMarkListService; | |
| use com\linways\ec\core\service\ExamRegistrationService; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| use com\linways\base\util\TwigRenderer; | |
| use com\linways\core\ams\professional\util\PdfUtil; | |
| use com\linways\core\ams\professional\util\CommonUtil; | |
| use com\linways\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\constant\AttendanceStatusConstant; | |
| use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants; | |
| use com\linways\ec\core\service\RegularConsolidatedMarkListGenerator\RegularConsolidatedMarkListResultDataGenerator; | |
| use com\linways\core\ams\professional\service\AmsCustomFieldsService; | |
| use com\linways\core\ams\professional\constant\AmsCustomFieldsEntities; | |
| use com\linways\ec\core\request\SearchExamRegistrationRequest; | |
| use com\linways\ec\core\service\GradeSchemeService; | |
| class Template20ConsolidatedResultGenerator extends RegularConsolidatedMarkListResultDataGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $templateName = "template_20"; | |
| $examRegistrationDetails = new \stdClass; | |
| $examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
| if(empty($examRegistrationDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| return $templateName; | |
| } | |
| /** | |
| * Process Student data college base | |
| * | |
| * @param $request | |
| */ | |
| protected function processData($request){ | |
| $response = new \stdClass; | |
| $studentsMarkDetails = []; | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request); | |
| $examRegistrationData = $this->getExamRegistrationDetailsData($request); | |
| if(empty($studentsMarkDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $responseOfStudentData = $this->processStudentData($studentsMarkDetails,$request, $examRegistrationData); | |
| $response->studentData = $responseOfStudentData->studentsDetails; | |
| $response->totalStudentData = $responseOfStudentData->totalStudentDetails; | |
| $subjectGradePassDetails = $responseOfStudentData->subjectGradePassDetails; | |
| $examRegistrationData = $responseOfStudentData->examRegistrationData; | |
| foreach($examRegistrationData->subjects as $subject){ | |
| if($subjectGradePassDetails[$subject->id]){ | |
| $subject->subjectResultStatus[0]->name = "PASS"; | |
| $subject->subjectResultStatus[0]->count = $subjectGradePassDetails[$subject->id]->passCount; | |
| $subject->subjectResultStatus[1]->name = "FAIL"; | |
| $subject->subjectResultStatus[1]->count = $subjectGradePassDetails[$subject->id]->failCount; | |
| $subject->subjectResultStatus[2]->name = "AB"; | |
| $subject->subjectResultStatus[2]->count = $subjectGradePassDetails[$subject->id]->absentCount; | |
| $subject->subjectResultStatus[3]->name = "MP"; | |
| $subject->subjectResultStatus[3]->count = $subjectGradePassDetails[$subject->id]->malPracticeCount; | |
| $subject->subjectResultStatus[4]->name = "DB"; | |
| $subject->subjectResultStatus[4]->count = 0; | |
| $subject->subjectResultStatus[5]->name = "NP"; | |
| $subject->subjectResultStatus[5]->count = 0; | |
| $subject->subjectResultStatus[6]->name = "WH"; | |
| $subject->subjectResultStatus[6]->count = 0; | |
| $subject->subjectResultStatus[7]->name = "PASS %"; | |
| $subject->subjectResultStatus[7]->count = $subjectGradePassDetails[$subject->id]->passPercentage; | |
| $subject->subjectResultStatus[8]->name = "TOTAL"; | |
| $subject->subjectResultStatus[8]->count = $subjectGradePassDetails[$subject->id]->totalStudents; | |
| } | |
| else{ | |
| $subject->subjectResultStatus[0]->name = "PASS"; | |
| $subject->subjectResultStatus[0]->count = 0; | |
| $subject->subjectResultStatus[1]->name = "FAIL"; | |
| $subject->subjectResultStatus[1]->count = 0; | |
| $subject->subjectResultStatus[2]->name = "AB"; | |
| $subject->subjectResultStatus[2]->count = 0; | |
| $subject->subjectResultStatus[3]->name = "MP"; | |
| $subject->subjectResultStatus[3]->count = 0; | |
| $subject->subjectResultStatus[4]->name = "DB"; | |
| $subject->subjectResultStatus[4]->count = 0; | |
| $subject->subjectResultStatus[5]->name = "NP"; | |
| $subject->subjectResultStatus[5]->count = 0; | |
| $subject->subjectResultStatus[6]->name = "WH"; | |
| $subject->subjectResultStatus[6]->count = 0; | |
| $subject->subjectResultStatus[7]->name = "PASS %"; | |
| $subject->subjectResultStatus[7]->count = 0; | |
| $subject->subjectResultStatus[8]->name = "TOTAL"; | |
| $subject->subjectResultStatus[8]->count = 0; | |
| } | |
| } | |
| $response->classHeaderDetails = $responseOfStudentData->classHeaderDetails; | |
| $response->classHeaderDetails['MP']->name = "MP"; | |
| $response->classHeaderDetails['MP']->count = 0; | |
| $response->classHeaderDetails['DB']->name = "DB"; | |
| $response->classHeaderDetails['DB']->count = 0; | |
| $response->classHeaderDetails['NP']->name = "NP"; | |
| $response->classHeaderDetails['NP']->count = 0; | |
| $response->classHeaderDetails['WH']->name = "WH"; | |
| $response->classHeaderDetails['WH']->count = 0; | |
| $response->classHeaderDetails['PASS_PERCENTAGE']->name = "PASS %"; | |
| $response->classHeaderDetails['PASS_PERCENTAGE']->count = $responseOfStudentData->overAllPassPercentage; | |
| $response->classHeaderDetails = array_values($response->classHeaderDetails); | |
| $response->examRegistrationData = $examRegistrationData; | |
| $response->hideExternalOrInternalMark = $request->hideExternalOrInternalMark; | |
| $response->hideSeal = $request->hideSeal; | |
| $response->collegeData = CommonExamService::getInstance()->getCollegeDetails($request); | |
| return $response; | |
| } | |
| /** | |
| * Render Program Result | |
| * | |
| * @param $templateName | |
| * @param Object $data | |
| * @return Object | |
| */ | |
| protected function renderConsolidatedMarkListResult($templateName, $data){ | |
| if(empty($data)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| else{ | |
| $responseHtml = ""; | |
| if($data->hideExternalOrInternalMark){ | |
| $responseHtml .= "<style> | |
| .hideExternalOrInternalMark {display:none;} | |
| .hideMarks {display:none;} | |
| </style>"; | |
| } | |
| if($data->hideSeal){ | |
| $responseHtml .= "<style> | |
| .hideImages {display:none;} | |
| </style>"; | |
| } | |
| $responseHtml .= TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/RegularConsolidatedMarkList/Template20/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| .border-black td, .border-black th{ | |
| border:1px solid #000 !important; | |
| height:9mm; | |
| vertical-align:middle; | |
| background-color: #fff !important; | |
| word-break: normal !important; | |
| } | |
| td, th{ | |
| padding: 5px !important; | |
| } | |
| .bold{ | |
| font-weight: 700 !important; | |
| } | |
| .no-border{ | |
| border:1px solid #fff !important; | |
| } | |
| .no-border-top{ | |
| border-top:1px solid #fff !important; | |
| border-left:1px solid #fff !important; | |
| border-right:1px solid #fff !important; | |
| border-bottom:1px solid #000 !important; | |
| } | |
| table{ | |
| border:1px solid #000 !important; | |
| } | |
| </style>"; | |
| $prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalSubjectsCount = count($data->examRegistrationData->subjects); | |
| $totalWidth = ( $totalSubjectsCount * 5 * 15 ) + 100; | |
| $totalHeight = $totalWidth / 1.414;; | |
| $options = array( | |
| 'page-width' => $totalWidth."mm", | |
| 'page-height' => $totalHeight."mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "9mm", | |
| 'margin-left' => "1mm", | |
| 'margin-right' => "1mm", | |
| 'margin-bottom' => "9mm", | |
| // 'binary' => "/usr/local/bin/wkhtmltopdf", // For Mac | |
| 'user-style-sheet' => realpath(DOCUMENT_ROOT . "/libcommon/bootstrap/css/bootstrap.min.css") | |
| ); | |
| $programResult = new \stdClass; | |
| $programResult->dispalyHtmlData = $responseHtml; | |
| $programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
| $programResult->isShowHideExternalOrInternalMark = true; | |
| $programResult->isShowHideSeal = true; | |
| return $programResult; | |
| } | |
| } | |
| protected function processStudentData($studentsMarkDetails,$examRegistrationRequest,$examRegistrationData){ | |
| $response = new \stdClass; | |
| $totalStudentDetails = new \stdClass; | |
| $totalStudentDetails->totalStudents = count($studentsMarkDetails); | |
| $studentsDetails = []; | |
| $subjectGradePassDetails = []; | |
| $gradeSchemeRequest->examRegistrationId = $examRegistrationRequest->examRegistrationId; | |
| $gradeSchemeRequest->academicTermId = $examRegistrationData->academicTermId; | |
| $gradeSchemes = GradeSchemeService::getInstance()->getAllExamRegistrationGradeSchemes($searchRequest); | |
| $examRegistrationData->subjects = array_column($examRegistrationData->subjects, null, 'id'); | |
| $classHeaderNames = []; | |
| foreach($gradeSchemes as $gradeScheme){ | |
| $classHeaderNames[strtoupper($gradeScheme->className)]->name = $gradeScheme->className; | |
| $classHeaderNames[strtoupper($gradeScheme->className)]->count = 0; | |
| } | |
| $classHeaderNames = array_unique($classHeaderNames); | |
| if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
| $requestForExamRegistration = new SearchExamRegistrationRequest; | |
| $requestForExamRegistration->groupId = $examRegistrationRequest->groupId; | |
| $revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
| } | |
| foreach($studentsMarkDetails as $student){ | |
| $currentAcademicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($examRegistrationRequest){ | |
| return $value->examRegistrationId == $examRegistrationRequest->examRegistrationId; | |
| })); | |
| $studentsDetails[$student->id]->id = $student->id; | |
| $customFields = AmsCustomFieldsService::getInstance()->getAmsCustomFieldValue(AmsCustomFieldsEntities::STUDENT, $student->id, []); | |
| if( $customFields ){ | |
| $studentsDetails[$student->id]->ktuCode = CommonExamService::getInstance()->getCustomFieldObjectList($customFields)->studentData->KTU_CODE; | |
| } | |
| $studentsDetails[$student->id]->name = $student->studentDetails->name; | |
| $studentsDetails[$student->id]->failedStatus = $currentAcademicTerm->failedStatus; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| $studentSubjectRequest = new \stdClass(); | |
| $studentSubjectRequest->studentId = $student->id; | |
| $studentSubjectRequest->examMonthLimit = $examRegistrationData->examMonth; | |
| $studentSubjectRequest->examYearLimit = $examRegistrationData->examYear; | |
| $studentSubjectRequest->examRegistrationType = "REGULAR"; | |
| $studentSubjectRequest->academicTermId = $currentAcademicTerm->academicTermId; | |
| $studentSubjectRequest->isHonorCourse = $examRegistrationData->isHonorCourse; | |
| $studentSubjectRequest->isMinorCourse = $examRegistrationData->isMinorCourse; | |
| $studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
| $studentSubjectRequest = new \stdClass(); | |
| $studentSubjectRequest->studentId = $student->id; | |
| $studentSubjectRequest->upToAcademicTermOrderNoExceptCurrent = $examRegistrationData->academicOrderNo; | |
| $studentSubjectRequest->isHonorCourse = $examRegistrationData->isHonorCourse; | |
| $studentSubjectRequest->isMinorCourse = $examRegistrationData->isMinorCourse; | |
| $studentSubjectHistory2 = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
| $studentSubjectHistory = array_merge($studentSubjectHistory,$studentSubjectHistory2); | |
| $subjectHistory = []; | |
| $totalCredit = 0; | |
| $earnedCredit = 0; | |
| $earnedCreditPoint = 0; | |
| $earnedCreditForDisplay = 0; | |
| $semesterCgpa = 0; | |
| $additionalCreditRequest = new \stdClass; | |
| $additionalCreditRequest->studentId = $student->id; | |
| $additionalCreditRequest->creditType = "CREDIT_TRANSFERED"; | |
| $additionalCreditRequest->requestForList = 1; | |
| $additionalCredit = CommonExamService::getInstance()->getStudentAdditionalCredits($additionalCreditRequest); | |
| $semWiseAdditionalCredit = 0; | |
| if( $additionalCredit ){ | |
| $semIdRequestedForEarnedCredit = $currentAcademicTerm->academicTermId; | |
| $semWiseAdditionalCreditArray = array_filter($additionalCredit, function($item) use($semIdRequestedForEarnedCredit) { | |
| return $item->termId <= $semIdRequestedForEarnedCredit; | |
| }); | |
| $semWiseAdditionalCredit = array_sum( array_column($semWiseAdditionalCreditArray, 'credit')); | |
| } | |
| foreach($studentSubjectHistory as $studentHistory){ | |
| if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
| if ( $studentHistory->subjectHasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($studentHistory){ | |
| return $value->id == $studentHistory->subjectRevaluationId; | |
| })); | |
| $revaluationBatch = reset($currentRegistration->groups); | |
| if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
| $studentHistory->subjectFailedStatus = $studentHistory->subjectWithoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
| $studentHistory->subjectCreditGradePoint = $studentHistory->subjectWithoutRevaluationCreditGradePoint; | |
| } | |
| } | |
| } | |
| if($subjectHistory[$studentHistory->paperSubjectId]){ | |
| if($subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint < $studentHistory->subjectCreditGradePoint){ | |
| if($studentHistory->excludeSubjectFromTotal != 1){ | |
| $earnedCreditPoint += ($studentHistory->subjectCreditGradePoint - $subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint); | |
| $subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
| if($studentHistory->subjectFailedStatus == "PASSED"){ | |
| $earnedCredit += $studentHistory->credit; | |
| } | |
| } | |
| else{ | |
| if($studentHistory->subjectFailedStatus == "PASSED"){ | |
| $earnedCreditForDisplay += $studentHistory->credit; | |
| } | |
| } | |
| } | |
| } | |
| else{ | |
| if($studentHistory->excludeSubjectFromTotal != 1){ | |
| $earnedCreditPoint += $studentHistory->subjectCreditGradePoint; | |
| $totalCredit += $studentHistory->credit; | |
| $subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
| if($studentHistory->subjectFailedStatus == "PASSED"){ | |
| $earnedCredit += $studentHistory->credit; | |
| } | |
| } | |
| else{ | |
| if($studentHistory->subjectFailedStatus == "PASSED"){ | |
| $earnedCreditForDisplay += $studentHistory->credit; | |
| } | |
| } | |
| } | |
| } | |
| $semesterCgpa = $earnedCreditPoint ? ($earnedCreditPoint/$totalCredit) : 0; | |
| $earnedCreditForDisplay += $earnedCredit; | |
| $earnedCreditForDisplay += $semWiseAdditionalCredit; | |
| foreach($student->academicTerms[0]->markHistory as $semMarkHistory){ | |
| if($semMarkHistory->examRegistrationId == $examRegistrationRequest->examRegistrationId){ | |
| if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
| if ( $semMarkHistory->hasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($semMarkHistory){ | |
| return $value->id == $semMarkHistory->revaluationId; | |
| })); | |
| $revaluationBatch = reset($currentRegistration->groups); | |
| if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
| $semMarkHistory->sgpa = $semMarkHistory->withoutRevaluationsgpa; | |
| $semMarkHistory->failedStatus = $semMarkHistory->withoutRevaluationFailedStatus; | |
| } | |
| } | |
| } | |
| $studentsDetails[$student->id]->examRegistrationWiseFailedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->failedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->semesterResultStatus = $semMarkHistory->failedStatus == "PASSED" ? "P" : "F"; | |
| $studentsDetails[$student->id]->semesterGrade = $semMarkHistory->grade; | |
| $studentsDetails[$student->id]->semesterCreditGradePoint = $semMarkHistory->gradePoint; | |
| $studentsDetails[$student->id]->semesterCredit = $earnedCredit; | |
| $studentsDetails[$student->id]->semesterearnedCreditForDisplay = $earnedCreditForDisplay; | |
| $studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $semMarkHistory->sgpa); | |
| $studentsDetails[$student->id]->semesterCgpa = sprintf('%0.2f', round($semesterCgpa, 2)); | |
| $studentsDetails[$student->id]->semesterMarkObtained = $semMarkHistory->markObtained; | |
| $studentsDetails[$student->id]->semesterPercentage = round($semMarkHistory->percentage,2); | |
| $studentsDetails[$student->id]->semesterClass = $semMarkHistory->class; | |
| $studentsDetails[$student->id]->overallClass = $semMarkHistory->class; | |
| $studentsDetails[$student->id]->overallGrade= $semMarkHistory->grade; | |
| if ( $examRegistrationData->isMinorCourse || $examRegistrationData->isHonorCourse) { | |
| $studentsDetails[$student->id]->semesterSgpa = "-"; | |
| $studentsDetails[$student->id]->semesterCgpa = "-"; | |
| } | |
| } | |
| } | |
| foreach($student->academicTerms[0]->subjects as $subject){ | |
| if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
| if ( $subject->subjectHasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subject){ | |
| return $value->id == $subject->subjectRevaluationId; | |
| })); | |
| $revaluationBatch = reset($currentRegistration->groups); | |
| if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
| $subject->failedStatus = $subject->subjectWithoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
| $subject->isFailed = $subject->failedStatus; | |
| $subject->grade = $subject->subjectWithoutRevaluationGrade; | |
| } | |
| } | |
| } | |
| if($examRegistrationData->subjects[$subject->id]){ | |
| $examRegistrationData->subjects[$subject->id]->aggregatePassPercentage = $subject->aggregatePassPercentage; | |
| $examRegistrationData->subjects[$subject->id]->totalMinimumMark = $subject->totalMarks * $subject->aggregatePassPercentage / 100; | |
| } | |
| $studentsDetails[$student->id]->subjects[$subject->id]->id = $subject->id; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->name; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->code; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->gradePoint = $subject->gradePoint; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->class = $subject->class; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->grade; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->percentage = round($subject->percentage,2); | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = $subject->externalMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->totalMarks = $subject->totalMarks; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->markObtained = $subject->markObtained; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->failedStatus = $subject->isFailed; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->credit = $subject->credit; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->wgpa = $subject->wgpa; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->isExternalFailed = $subject->isExternalFailed; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->categoryId = $subject->categoryId; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->categoryName = $subject->categoryName; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->attendanceStatus = $subject->attendanceStatus; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus = $subject->isFailed == "PASSED" ? "P" : "F"; | |
| if($subject->internalAttendanceStatus == AttendanceStatusConstant::ABSENT){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalMark = 'AB' ; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus = 'AB'; | |
| } | |
| if($subject->attendanceStatus == AttendanceStatusConstant::MALPRACTICE){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = "MAL"; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus = 'MAL'; | |
| } | |
| if($subject->attendanceStatus == AttendanceStatusConstant::ABSENT){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'AB'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus = 'AB'; | |
| } | |
| if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
| } | |
| if($subject->attendanceStatus == 'ABSENT'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'AB'; | |
| $studentsDetails[$student->id]->semesterResultStatus = 'AB'; | |
| $studentsDetails[$student->id]->semesterClass = 'AB'; | |
| $studentsDetails[$student->id]->semesterGrade = 'AB'; | |
| // $studentsDetails[$student->id]->subjects[$subject->id]->grade = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| } | |
| if($subject->studentInternalAttendanceStatus == 'FE'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'FE'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = '-'; | |
| } | |
| if($subject->isMoocSubject == '1'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
| } | |
| if($subjectGradePassDetails[$subject->id]){ | |
| $subjectGradePassDetails[$subject->id]->passCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'P' ? $subjectGradePassDetails[$subject->id]->passCount + 1 : $subjectGradePassDetails[$subject->id]->passCount; | |
| $subjectGradePassDetails[$subject->id]->failCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'F' ? $subjectGradePassDetails[$subject->id]->failCount + 1 : $subjectGradePassDetails[$subject->id]->failCount; | |
| $subjectGradePassDetails[$subject->id]->absentCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'AB' ? $subjectGradePassDetails[$subject->id]->absentCount + 1 : $subjectGradePassDetails[$subject->id]->absentCount; | |
| $subjectGradePassDetails[$subject->id]->malPracticeCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'MAL' ? $subjectGradePassDetails[$subject->id]->malPracticeCount + 1 : $subjectGradePassDetails[$subject->id]->malPracticeCount; | |
| $subjectGradePassDetails[$subject->id]->totalStudents = $subjectGradePassDetails[$subject->id]->totalStudents + 1; | |
| } | |
| else{ | |
| $subjectGradePassDetails[$subject->id]->id = $subject->id; | |
| $subjectGradePassDetails[$subject->id]->passCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'P' ? 1 : 0; | |
| $subjectGradePassDetails[$subject->id]->failCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'F' ? 1 : 0; | |
| $subjectGradePassDetails[$subject->id]->absentCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'AB' ? 1 : 0; | |
| $subjectGradePassDetails[$subject->id]->malPracticeCount = $studentsDetails[$student->id]->subjects[$subject->id]->resultStatus == 'MAL' ? 1 : 0; | |
| $subjectGradePassDetails[$subject->id]->totalStudents = 1; | |
| } | |
| } | |
| $studentsDetails[$student->id]->isResultBlock = false; | |
| $studentsDetails[$student->id]->blocResultMsg = ""; | |
| if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
| $studentsDetails[$student->id]->isResultBlock = $student->isResultWithHeld == '1' ? true : false; | |
| $studentsDetails[$student->id]->blocResultMsg = $student->isResultWithHeld == '1' ? "Result Withheld" : ""; | |
| } | |
| } | |
| $passedStudentCount = 0; | |
| $failedStudentCount = 0; | |
| $absentStudentCount = 0; | |
| foreach($studentsDetails as $student){ | |
| if($classHeaderNames[strtoupper($student->semesterClass)]){ | |
| $classHeaderNames[strtoupper($student->semesterClass)]->count ++ ; | |
| } | |
| else{ | |
| $classHeaderNames[strtoupper($student->semesterClass)]->name = $student->semesterClass; | |
| $classHeaderNames[strtoupper($student->semesterClass)]->count = 1; | |
| } | |
| $passedStudentCount = $studentsDetails[$student->id]->semesterResultStatus == 'P' ? $passedStudentCount + 1 : $passedStudentCount; | |
| $failedStudentCount = $studentsDetails[$student->id]->semesterResultStatus == 'F' ? $failedStudentCount + 1 : $failedStudentCount; | |
| $absentStudentCount = $studentsDetails[$student->id]->semesterResultStatus == 'AB' ? $absentStudentCount + 1 : $absentStudentCount; | |
| } | |
| foreach($subjectGradePassDetails as $subject){ | |
| $subject->passPercentage = round(100 * ( $subject->passCount / $subject->totalStudents),2); | |
| } | |
| $totalStudentDetails->passPercentage = round(100 * ( $totalStudentDetails->passStudents / $totalStudentDetails->totalStudents),2); | |
| $studentsDetails = array_values($studentsDetails); | |
| foreach($studentsDetails as $student){ | |
| $student->subjects = array_values($student->subjects); | |
| } | |
| $examRegistrationData->subjects = array_values($examRegistrationData->subjects); | |
| $response->studentsDetails = $studentsDetails; | |
| $response->totalStudentDetails = $totalStudentDetails; | |
| $response->classHeaderDetails = $classHeaderNames; | |
| $response->subjectGradePassDetails = $subjectGradePassDetails; | |
| $response->examRegistrationData = $examRegistrationData; | |
| $response->overAllPassPercentage = round(100 * ( $passedStudentCount / count($studentsDetails)),2); | |
| return $response; | |
| } | |
| protected function getExamRegistrationDetailsData($request){ | |
| $examRegistrationDetails = new \stdClass; | |
| $examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
| if(empty($examRegistrationDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $examRegistrationDetails->name = reset($examRegistrationDetailsArray)->name; | |
| $examRegistrationDetails->examYear = reset($examRegistrationDetailsArray)->examYear; | |
| $examRegistrationDetails->examMonth = reset($examRegistrationDetailsArray)->examMonth; | |
| $examRegistrationDetails->examMonthName = reset($examRegistrationDetailsArray)->examMonthName; | |
| $examRegistrationDetails->type = reset($examRegistrationDetailsArray)->type; | |
| $examRegistrationDetails->groupId = reset($examRegistrationDetailsArray)->groups[0]->groupId; | |
| $examRegistrationDetails->groupName = reset($examRegistrationDetailsArray)->groups[0]->groupName; | |
| $examRegistrationDetails->courseTypeID = reset($examRegistrationDetailsArray)->groups[0]->courseTypeID; | |
| $examRegistrationDetails->courseTypeName = reset($examRegistrationDetailsArray)->groups[0]->courseTypeName; | |
| $examRegistrationDetails->academicTermName = reset($examRegistrationDetailsArray)->groups[0]->academicTermName; | |
| $examRegistrationDetails->academicTermYear = reset($examRegistrationDetailsArray)->groups[0]->academicTermYear; | |
| $examRegistrationDetails->academicOrderNo = reset($examRegistrationDetailsArray)->groups[0]->academicOrderNo; | |
| $examRegistrationDetails->academicTermYearRoman = strtoupper(CommonUtil::convertNumberToRoman($examRegistrationDetails->academicTermYear)); | |
| $examRegistrationDetails->academicTermId = reset($examRegistrationDetailsArray)->groups[0]->academicTermId; | |
| $examRegistrationDetails->isHonorCourse = reset($examRegistrationDetailsArray)->properties->isHonorCourse == "1" ? true : false; | |
| $examRegistrationDetails->isMinorCourse = reset($examRegistrationDetailsArray)->properties->isMinorCourse == "1" ? true : false; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($examRegistrationDetails->academicTermName); | |
| $examRegistrationDetails->semInRomanLetter = $semesterNames->romanLetter; | |
| $examRegistrationDetails->semInFullName = $semesterNames->fullName; | |
| $examRegistrationDetails->semInSemNumber = $semesterNames->semNumber; | |
| $examRegistrationDetails->batchStartYear = reset($examRegistrationDetailsArray)->groups[0]->batchStartYear; | |
| $examRegistrationDetails->deptID = reset($examRegistrationDetailsArray)->groups[0]->deptID; | |
| $examRegistrationDetails->deptName = reset($examRegistrationDetailsArray)->groups[0]->deptName; | |
| $examRegistrationDetails->degreeName = reset($examRegistrationDetailsArray)->groups[0]->degreeName; | |
| foreach(reset($examRegistrationDetailsArray)->groups[0]->subjects as $subject){ | |
| $examRegistrationDetails->subjects[$subject->id]->id = $subject->id; | |
| $examRegistrationDetails->subjects[$subject->id]->code = $subject->code; | |
| $examRegistrationDetails->subjects[$subject->id]->name = $subject->name; | |
| $examRegistrationDetails->subjects[$subject->id]->isInternal = $subject->isInternal; | |
| $examRegistrationDetails->subjects[$subject->id]->isExternal = $subject->isExternal; | |
| $examRegistrationDetails->subjects[$subject->id]->credit = $subject->credit; | |
| $examRegistrationDetails->subjects[$subject->id]->id = $subject->id; | |
| $examRegistrationDetails->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
| $examRegistrationDetails->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
| $examRegistrationDetails->subjects[$subject->id]->totalSubjectMark = $subject->totalSubjectMark; | |
| if(!$request->hideExternalOrInternalMark){ | |
| $examRegistrationDetails->subjects[$subject->id]->subColSpan = 3; | |
| $examRegistrationDetails->subjects[$subject->id]->subColSpan = $examRegistrationDetails->subjects[$subject->id]->isInternal ? $examRegistrationDetails->subjects[$subject->id]->subColSpan + 1 : $examRegistrationDetails->subjects[$subject->id]->subColSpan; | |
| $examRegistrationDetails->subjects[$subject->id]->subColSpan = $examRegistrationDetails->subjects[$subject->id]->isExternal ? $examRegistrationDetails->subjects[$subject->id]->subColSpan + 1 : $examRegistrationDetails->subjects[$subject->id]->subColSpan; | |
| } | |
| else{ | |
| $examRegistrationDetails->subjects[$subject->id]->subColSpan = 1; | |
| } | |
| } | |
| $examRegistrationDetails->disableCollegeRegisterNumber = false; | |
| $examRegistrationDetails->totalColSpan = 10; | |
| foreach($examRegistrationDetails->subjects as $subject){ | |
| $examRegistrationDetails->totalColSpan = $examRegistrationDetails->totalColSpan + $subject->subColSpan; | |
| } | |
| $examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
| return $examRegistrationDetails; | |
| } | |
| /** | |
| * Process Student data for course file | |
| * | |
| * @param $request | |
| */ | |
| // this code for processing exam mark for course file | |
| protected function processStudentSubjectDataForCourseFileTemplate($studentsList){ | |
| $response = new \stdClass; | |
| $studentBatchList = []; | |
| $requestForExamRegistration = new SearchExamRegistrationRequest; | |
| $requestForExamRegistration->groupId = array_unique(array_column($studentsList,'groupId')); | |
| $revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
| foreach($studentsList as $studentKey => $student){ | |
| $student->errorMsg = ""; | |
| $student->isRemoved = false; | |
| usort($student->subjectMarkHistory, function($a, $b) { | |
| return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))); | |
| }); | |
| foreach($student->examRegistrations as $key => $examRegistration){ | |
| if( !($examRegistration->batchProperties->isResultPublished ) || (($examRegistration->batchProperties->isResultPublished) && (strtotime($examRegistration->batchProperties->publishingStartDate) > strtotime(date("Y-m-d H:i"))))) { | |
| unset($student->examRegistrations[$key]); | |
| } | |
| else if(($examRegistration->examType) != 'REGULAR'){ | |
| if(!empty($examRegistration->blockReasons) || $examRegistration->isResultWithHeld == '1'){ | |
| unset($student->examRegistrations[$key]); | |
| } | |
| } | |
| else{ | |
| if(!empty($examRegistration->blockReasons)) { | |
| $student->errorMsg = "Result Blocked"; | |
| } | |
| else if($examRegistration->isResultWithHeld == '1'){ | |
| $student->errorMsg = "Result Withheld"; | |
| } | |
| } | |
| } | |
| $student->examRegistrationIds = array_column($student->examRegistrations,'id'); | |
| if(empty($student->examRegistrations)){ | |
| unset($studentsList[$studentKey]); | |
| $student->isRemoved = true; | |
| } | |
| if(empty($student->errorMsg)){ | |
| $regularHistory = array_filter($student->subjectMarkHistory,function($value){ | |
| return $value->examMarkType == "REGULAR"; | |
| }); | |
| $supplyHistory = array_filter($student->subjectMarkHistory,function($value){ | |
| return $value->examMarkType == "SUPPLY"; | |
| }); | |
| usort($supplyHistory, function($a, $b) { | |
| return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))); | |
| }); | |
| $student->subjectMarkHistory = array_merge($supplyHistory, $regularHistory); | |
| foreach($student->subjectMarkHistory as $subjectMarkHistory){ | |
| if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
| if ( $subjectMarkHistory->hasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subjectMarkHistory){ | |
| return $value->id == $subjectMarkHistory->subjectRevaluationId; | |
| })); | |
| $revaluationBatch = reset(array_filter($currentRegistration->groups,function($value)use($student){ | |
| return $value->id == $student->groupId; | |
| })); | |
| if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
| $subjectMarkHistory->resultStatus = $subjectMarkHistory->withoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
| $subjectMarkHistory->grade = $subjectMarkHistory->withoutRevaluationGrade; | |
| } | |
| } | |
| $student->grade = $subjectMarkHistory->grade; | |
| $student->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
| if($student->subjectMarkDetails->excludeSubjectFromTotal == '1'){ | |
| $student->grade = $subjectMarkHistory->resultStatus == "PASSED" ? 'P' : 'F' ; | |
| } | |
| if($subjectMarkHistory->attendanceStatus == 'ABSENT'){ | |
| // $student->grade = $student->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| } | |
| else if($subjectMarkHistory->resultStatus == 'FAILED'){ | |
| $student->grade = 'F'; | |
| } | |
| if($subjectMarkHistory->studentAttendanceStatus == 'FE'){ | |
| $student->grade = 'FE'; | |
| } | |
| $student->examYear = $subjectMarkHistory->examYear; | |
| $student->examMonth = $subjectMarkHistory->examMonth; | |
| $student->examMonthName = date("F", mktime(0, 0, 0, $student->examMonth, 10)); | |
| break; | |
| } | |
| } | |
| if ( $student->attendanceStatus == "ABSENT" ){ | |
| foreach($student->subjectMarkHistory as $subjectMarkHistory){ | |
| if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
| if ( ($subjectMarkHistory->attendanceStatus == "PRESENT" && $subjectMarkHistory->studentAttendanceStatus != 'FE') || ($subjectMarkHistory->examMarkType == 'REGULAR' && $subjectMarkHistory->studentAttendanceStatus != 'FE') ){ | |
| $student->grade = $subjectMarkHistory->grade; | |
| $student->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
| if($student->subjectMarkDetails->excludeSubjectFromTotal == '1'){ | |
| $student->grade = $subjectMarkHistory->resultStatus == "PASSED" ? 'P' : 'F' ; | |
| } | |
| if($subjectMarkHistory->attendanceStatus == 'ABSENT'){ | |
| $student->semesterGrade = 'AB'; | |
| $student->semesterClass = 'AB'; | |
| } | |
| else if($subjectMarkHistory->resultStatus == 'FAILED'){ | |
| $student->grade = 'F'; | |
| } | |
| if($subjectMarkHistory->studentAttendanceStatus == 'FE'){ | |
| $student->grade = 'FE'; | |
| } | |
| $student->examYear = $subjectMarkHistory->examYear; | |
| $student->examMonth = $subjectMarkHistory->examMonth; | |
| $student->examMonthName = date("F", mktime(0, 0, 0, $student->examMonth, 10)); | |
| break; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if(!$student->isRemoved){ | |
| $studentBatchList[$student->groupId]->id = $student->groupId; | |
| $studentBatchList[$student->groupId]->name = $student->groupName; | |
| $studentBatchList[$student->groupId]->students[] = $student; | |
| } | |
| } | |
| $studentBatchList = array_values($studentBatchList); | |
| return $studentBatchList; | |
| } | |
| } |