Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 461 |
| Template6IndividualResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
8556.00 | |
0.00% |
0 / 461 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 7 |
|||
| processData | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 41 |
|||
| renderIndividualMarkCardResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 32 |
|||
| processStudentData | |
0.00% |
0 / 1 |
4422.00 | |
0.00% |
0 / 316 |
|||
| getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 65 |
|||
| <?php | |
| // Template Individual Generator For SAINTGITS Colleges | |
| namespace com\linways\ec\core\service\RegularIndividualMarkCardGenerator; | |
| 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\service\RegularIndividualMarkCardGenerator\RegularIndividualMarkCardResultDataGenerator; | |
| use com\linways\core\ams\professional\service\AmsCustomFieldsService; | |
| use com\linways\core\ams\professional\constant\AmsCustomFieldsEntities; | |
| use com\linways\ec\core\service\StudentSpecializationService; | |
| use com\linways\ec\core\request\SearchExamRegistrationRequest; | |
| class Template6IndividualResultGenerator extends RegularIndividualMarkCardResultDataGenerator | |
| { | |
| public function __construct(){} | |
| /** | |
| * get Template Name | |
| * @param $request | |
| * @param $templateName | |
| */ | |
| protected function getTemplateName($request){ | |
| $templateName = "template_6"; | |
| $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 = []; | |
| if ( $request->isStudentSideExamResult == '1' && $request->isMinorOrHonour != '1'){ | |
| $studentSideRequest = json_decode(json_encode($request)); | |
| $studentSideRequest->examRegistrationId = ''; | |
| $studentSideRequest->selectedSemesters[] = $request->academicTermId; | |
| $studentSideRequest->excludeMinorHonor = 1; | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($studentSideRequest); | |
| } | |
| else{ | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request); | |
| } | |
| if(empty($studentsMarkDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| if( $request->isStudentSideExamResult == '1' && !$request->groupId){ | |
| $request->groupId = reset($studentsMarkDetails)->studentDetails->batchId; | |
| } | |
| $examRegistrationData = $this->getExamRegistrationDetailsData($request); | |
| $responseOfStudentData = $this->processStudentData($studentsMarkDetails, $request,$examRegistrationData); | |
| $response->studentData = $responseOfStudentData->studentsDetails; | |
| if ( $request->isStudentSideExamResult == '1' && $request->isMinorOrHonour != '1'){ | |
| $examRegistrationData->examMonth = $responseOfStudentData->latestExamMonth; | |
| $examRegistrationData->examMonthName = ExamRegistrationService::getInstance()->getMonthName($responseOfStudentData->latestExamMonth); | |
| $examRegistrationData->examYear = $responseOfStudentData->latestExamYear; | |
| } | |
| $response->totalStudentData = $responseOfStudentData->totalStudentDetails; | |
| $response->examRegistrationData = $examRegistrationData ; | |
| $response->collegeData = CommonExamService::getInstance()->getCollegeDetails($request); | |
| if( $request->displayContentOptions->enableDateFlag == '1'){ | |
| if(!$request->displayContentOptions->markListDate ){ | |
| $request->displayContentOptions->markListDate = date("d-m-Y"); | |
| } | |
| else{ | |
| $request->displayContentOptions->markListDate = date("d-m-Y", strtotime($request->displayContentOptions->markListDate)); | |
| } | |
| } | |
| $response->displayContentOptions = $request->displayContentOptions; | |
| $response->isStudentSideExamResult = $request->isStudentSideExamResult; | |
| return $response; | |
| } | |
| /** | |
| * Render Program Result | |
| * | |
| * @param $templateName | |
| * @param Object $data | |
| * @return Object | |
| */ | |
| protected function renderIndividualMarkCardResult($templateName, $data){ | |
| if(empty($data)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| else{ | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/RegularIndividualMarkCards/Template6/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $responseHtml .= ''; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<link href='https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,700;1,400;1,700&display=swap' rel='stylesheet'> | |
| <style> | |
| </style>"; | |
| $prtContent .= '</head><title>Individual Mark Card</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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 = $prtContent; | |
| $programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
| return $programResult; | |
| } | |
| } | |
| /** | |
| * processStudentData | |
| * @param $studentsMarkDetails | |
| * @param $studentsDetails | |
| */ | |
| protected function processStudentData($studentsMarkDetails, $request = null,$examRegistrationData = null){ | |
| $response = new \stdClass; | |
| $totalStudentDetails = new \stdClass; | |
| $totalStudentDetails->totalStudents = count($studentsMarkDetails); | |
| $studentsDetails = []; | |
| if( $request->isStudentSideExamResult == '1' && $request->isMinorOrHonour != '1'){ | |
| $requestForExamRegistration = new SearchExamRegistrationRequest; | |
| $requestForExamRegistration->groupId = $request->groupId; | |
| $revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
| } | |
| foreach($studentsMarkDetails as $student){ | |
| $studentsDetails[$student->id]->id = $student->id; | |
| $studentsDetails[$student->id]->name = $student->studentDetails->name; | |
| $studentsDetails[$student->id]->isResultBlocked = $student->isResultBlocked; | |
| $studentsDetails[$student->id]->blockingMsg = $student->blockingMsg; | |
| $requestForSpecialization = new \stdClass; | |
| $requestForSpecialization->studentId = $student->id; | |
| $requestForSpecialization->groupId = $student->studentDetails->batchId; | |
| $requestForSpecialization->academicTermId = $student->academicTerms[0]->id; | |
| $studentSpecialisation = StudentSpecializationService::getInstance()-> getStudentspecialization($requestForSpecialization); | |
| if($studentSpecialisation){ | |
| $studentsDetails[$student->id]->specialization = $studentSpecialisation->name; | |
| } | |
| $customFields = AmsCustomFieldsService::getInstance()->getAmsCustomFieldValue(AmsCustomFieldsEntities::STUDENT, $student->id, []); | |
| if( $customFields ){ | |
| $studentsDetails[$student->id]->ktuCode = CommonExamService::getInstance()->getCustomFieldObjectList($customFields)->studentData->KTU_CODE; | |
| } | |
| if( $request->isStudentSideExamResult == '1' && $request->isMinorOrHonour != '1'){ | |
| foreach($student->examRegistrations as $key => $examRegistration){ | |
| if( !($examRegistration->batchProperties->isResultPublished ) || (($examRegistration->batchProperties->isResultPublished) && (strtotime($examRegistration->batchProperties->publishingStartDate) > strtotime(date("Y-m-d H:i"))))) { | |
| if($examRegistration->examType == 'REGULAR'){ | |
| $student->regularNotPublishedExamRegIds[] = $examRegistration->id; | |
| } | |
| unset($student->examRegistrations[$key]); | |
| } | |
| else if(($examRegistration->examType) != 'REGULAR'){ | |
| if(!empty($examRegistration->blockReasons) || $examRegistration->isResultWithHeld == '1'){ | |
| unset($student->examRegistrations[$key]); | |
| } | |
| } | |
| else{ | |
| if($examRegistration->isResultWithHeld == '1'){ | |
| $student->withHeldExamRegIds[] = $examRegistration->id; | |
| unset($student->examRegistrations[$key]); | |
| } | |
| } | |
| } | |
| $student->examRegistrationIds = array_column($student->examRegistrations,'id'); | |
| $considerSupplimentary = true; | |
| uasort(reset($student->academicTerms)->markHistory, function ($a, $b) { | |
| return date("Y-m", strtotime($a->examYear . "-" . $a->examMonth)) < date("Y-m", strtotime($b->examYear . "-" . $b->examMonth)); | |
| }); | |
| $academicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($request){ | |
| return $value->failedStatus == 'PASSED'; | |
| })); | |
| if(empty($academicTerm)){ | |
| $academicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($request){ | |
| return $value->examRegistrationId == $request->examRegistrationId; | |
| })); | |
| $considerSupplimentary = false; | |
| } | |
| if( count(reset($student->academicTerms)->markHistory) > 1){ | |
| $considerSupplimentary = true; | |
| } | |
| // usort(reset($student->academicTerms)->markHistory, 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))); | |
| // }); | |
| $regularHistory = array_filter(reset($student->academicTerms)->markHistory,function($value){ | |
| return $value->historyType == "REGULAR"; | |
| }); | |
| $supplyHistory = array_filter(reset($student->academicTerms)->markHistory,function($value){ | |
| return $value->historyType == "SUPPLEMENTARY"; | |
| }); | |
| 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))); | |
| }); | |
| reset($student->academicTerms)->markHistory = array_merge($supplyHistory, $regularHistory); | |
| foreach(reset($student->academicTerms)->markHistory as $semesterMarkHistory){ | |
| if(in_array($semesterMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
| if ( $semesterMarkHistory->hasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($semesterMarkHistory){ | |
| return $value->id == $semesterMarkHistory->revaluationId; | |
| })); | |
| $revaluationBatch = reset($currentRegistration->groups); | |
| if ( $revaluationBatch->properties->isResultPublished == 1 && strtotime($revaluationBatch->properties->publishingStartDate) < strtotime(date("Y-m-d H:i"))){ | |
| $academicTerm->sgpa = $semesterMarkHistory->sgpa; | |
| $academicTerm->failedStatus = $semesterMarkHistory->failedStatus; | |
| } | |
| else{ | |
| $academicTerm->sgpa = $semesterMarkHistory->withoutRevaluationsgpa; | |
| $academicTerm->failedStatus = $semesterMarkHistory->withoutRevaluationFailedStatus; | |
| } | |
| } | |
| else{ | |
| $academicTerm->sgpa = $semesterMarkHistory->sgpa; | |
| $academicTerm->failedStatus = $semesterMarkHistory->failedStatus; | |
| } | |
| $response->latestExamMonth = $semesterMarkHistory->examMonth; | |
| $response->latestExamYear = $semesterMarkHistory->examYear; | |
| $academicTerm->examMonth = $semesterMarkHistory->examMonth; | |
| $academicTerm->examYear = $semesterMarkHistory->examYear; | |
| break; | |
| } | |
| } | |
| if($considerSupplimentary){ | |
| foreach($student->academicTerms[0]->subjects as $subject){ | |
| // $isMarkExist = array_filter(array_column($subject->subjectMarkHistory, 'externalMark')); | |
| // if (!empty($isMarkExist)){ | |
| // usort($subject->subjectMarkHistory, function($a, $b) { | |
| // return $a->externalMark < $b->externalMark; | |
| // }); | |
| // } | |
| // else{ | |
| // usort($subject->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))); | |
| // }); | |
| $regularHistory = array_filter($subject->subjectMarkHistory,function($value){ | |
| return $value->examMarkType == "REGULAR"; | |
| }); | |
| $supplyHistory = array_filter($subject->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))); | |
| }); | |
| $subject->subjectMarkHistory = array_merge($supplyHistory, $regularHistory); | |
| // } | |
| foreach($subject->subjectMarkHistory as $subjectMarkHistory){ | |
| if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
| // if ( $subjectMarkHistory->resultStatus == "PASSED" || $subjectMarkHistory->examMarkType == 'REGULAR'){ | |
| if ( $subjectMarkHistory->hasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subjectMarkHistory){ | |
| return $value->id == $subjectMarkHistory->revaluationId; | |
| })); | |
| $revaluationBatch = reset($currentRegistration->groups); | |
| if ( $revaluationBatch->properties->isResultPublished == 1 && strtotime($revaluationBatch->properties->publishingStartDate) < strtotime(date("Y-m-d H:i"))){ | |
| $subject->grade = $subjectMarkHistory->grade; | |
| $subject->isFailed = $subjectMarkHistory->resultStatus; | |
| } | |
| else{ | |
| $subject->grade = $subjectMarkHistory->withoutRevaluationGrade; | |
| $subject->isFailed = $subjectMarkHistory->withoutRevaluationIsFailed == 1 ? 'FAILED' : 'PASSED' ; | |
| } | |
| } | |
| else{ | |
| $subject->grade = $subjectMarkHistory->grade; | |
| $subject->isFailed = $subjectMarkHistory->resultStatus; | |
| } | |
| $subject->latestExamYear = $subjectMarkHistory->examYear; | |
| $subject->latestExamMonth = $subjectMarkHistory->examMonth; | |
| $subject->credit = $subject->consolidatedMarkDetails->credit; | |
| $subject->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
| $subject->studentInternalAttendanceStatus = $subjectMarkHistory->studentAttendanceStatus; | |
| break; | |
| // } | |
| } | |
| } | |
| if ( $subject->attendanceStatus == "ABSENT" ){ | |
| foreach($subject->subjectMarkHistory as $subjectMarkHistory){ | |
| if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
| if ( ($subjectMarkHistory->attendanceStatus == "PRESENT" && $subjectMarkHistory->studentAttendanceStatus != 'FE') || ($subjectMarkHistory->examMarkType == 'REGULAR' && $subjectMarkHistory->studentAttendanceStatus != 'FE') ){ | |
| if ( $subjectMarkHistory->hasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subjectMarkHistory){ | |
| return $value->id == $subjectMarkHistory->revaluationId; | |
| })); | |
| $revaluationBatch = reset($currentRegistration->groups); | |
| if ( $revaluationBatch->properties->isResultPublished == 1 && strtotime($revaluationBatch->properties->publishingStartDate) < strtotime(date("Y-m-d H:i"))){ | |
| $subject->grade = $subjectMarkHistory->grade; | |
| $subject->isFailed = $subjectMarkHistory->resultStatus; | |
| } | |
| else{ | |
| $subject->grade = $subjectMarkHistory->withoutRevaluationGrade; | |
| $subject->isFailed = $subjectMarkHistory->withoutRevaluationIsFailed == 1 ? 'FAILED' : 'PASSED' ; | |
| } | |
| } | |
| else{ | |
| $subject->grade = $subjectMarkHistory->grade; | |
| $subject->isFailed = $subjectMarkHistory->resultStatus; | |
| } | |
| $subject->latestExamYear = $subjectMarkHistory->examYear; | |
| $subject->latestExamMonth = $subjectMarkHistory->examMonth; | |
| $subject->credit = $subject->consolidatedMarkDetails->credit; | |
| $subject->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
| $subject->studentInternalAttendanceStatus = $subjectMarkHistory->studentAttendanceStatus; | |
| break; | |
| } | |
| } | |
| } | |
| } | |
| // $subject = $subject->consolidatedMarkDetails; | |
| } | |
| $subjectCopy = json_decode(json_encode($student->academicTerms[0]->subjects)); | |
| usort($subjectCopy, function($a, $b) { | |
| return ($a->latestExamYear."-".date("m", mktime(0, 0, 0, (int)$a->latestExamMonth, 10))) < ($b->latestExamYear."-".date("m", mktime(0, 0, 0, (int)$b->latestExamMonth, 10))); | |
| }); | |
| $response->latestExamMonth = reset($subjectCopy)->latestExamMonth; | |
| $response->latestExamYear = reset($subjectCopy)->latestExamYear; | |
| $academicTerm->examMonth = reset($subjectCopy)->latestExamMonth; | |
| $academicTerm->examYear = reset($subjectCopy)->latestExamYear; | |
| } | |
| } | |
| else{ | |
| $academicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($request){ | |
| return $value->examRegistrationId == $request->examRegistrationId; | |
| })); | |
| } | |
| $studentsDetails[$student->id]->slNo = ""; | |
| $studentsDetails[$student->id]->failedStatus = $academicTerm->failedStatus; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| $studentsDetails[$student->id]->semesterGrade = $academicTerm->grade; | |
| $studentsDetails[$student->id]->semesterClass = $academicTerm->class; | |
| $studentsDetails[$student->id]->semesterCredit = $student->academicTerms[0]->credit; | |
| $studentsDetails[$student->id]->creditGradePoint = $academicTerm->creditGradePoint; | |
| $studentsDetails[$student->id]->passPercentageDisplay = $student->studentDetails->academicYear < 2019 ? 40 : 40; | |
| $studentsDetails[$student->id]->passPercentageDisplayMessage = $student->studentDetails->academicYear < 2019 ? "For a pass in each course, 40% mark OR E grade is necessary." : "For a pass in each course ,35% is necessary."; | |
| $studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $academicTerm->sgpa); | |
| if ( $examRegistrationData->isMinorCourse || $examRegistrationData->isHonorCourse) { | |
| $studentsDetails[$student->id]->semesterSgpa = "-"; | |
| } | |
| $studentsDetails[$student->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
| $studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
| $studentsDetails[$student->id]->semesterPercentage = round($academicTerm->percentage,2); | |
| if($studentsDetails[$student->id]->failedStatus == "PASSED"){ | |
| $totalStudentDetails->passStudents ++; | |
| } | |
| $additionalCreditRequest = new \stdClass; | |
| $additionalCreditRequest->studentId = $student->id; | |
| $additionalCreditRequest->academicTermId = $examRegistrationData->academicTermId; | |
| $additionalCreditRequest->creditType = "CREDIT_TRANSFERED"; | |
| $additionalCredit = CommonExamService::getInstance()->getStudentAdditionalCredits($additionalCreditRequest); | |
| if($additionalCredit){ | |
| $studentsDetails[$student->id]->creditTransferred = round($additionalCredit->credit); | |
| } | |
| $studentsDetails[$student->id]->myImage = $student->studentDetails->myImage; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName(reset($student->academicTerms)->name); | |
| $studentsDetails[$student->id]->semInSemNumber = $semesterNames->semNumber; | |
| $studentsDetails[$student->id]->totalEarnedCredits = $student->academicTerms[0]->credit; | |
| $studentsDetails[$student->id]->semesterCreditGradePoint = $academicTerm->creditGradePoint; | |
| $studentsDetails[$student->id]->semesterpassPercentage = $academicTerm->passPercentage; | |
| $studentsDetails[$student->id]->semesterTotalMinimumMarks = $student->academicTerms[0]->totalMarks * $student->academicTerms[0]->passPercentage / 100; | |
| $studentsDetails[$student->id]->semesterTotalMarks = $student->academicTerms[0]->totalMarks; | |
| $studentsDetails[$student->id]->semesterMarkObtained = $academicTerm->markObtained; | |
| $studentsDetails[$student->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($academicTerm->markObtained)); | |
| $studentsDetails[$student->id]->semesterExamMonth= $academicTerm->examMonth; | |
| $studentsDetails[$student->id]->semesterExamYear = $academicTerm->examYear; | |
| $studentsDetails[$student->id]->semesterExamMonthName = ExamRegistrationService::getInstance()->getMonthName($studentsDetails[$student->id]->semesterExamMonth); | |
| $studentsDetails[$student->id]->qrcodeValue = $studentsDetails[$student->id]->registerNo .",".$studentsDetails[$student->id]->semesterExamMonthName."-".$studentsDetails[$student->id]->semesterExamYear.",S".$studentsDetails[$student->id]->semInSemNumber; | |
| // $QUICK is the secret key defined in the conf.php | |
| // encryption key disabled | |
| // $studentsDetails[$student->id]->ciphertext = hash_hmac('sha256', $studentsDetails[$student->id]->qrcodeValue,'123'); | |
| // $ciphertext_base64 = base64_encode($studentsDetails[$student->id]->ciphertext); | |
| $studentsDetails[$student->id]->qrcodeAllString = $studentsDetails[$student->id]->qrcodeValue; | |
| if($studentsDetails[$student->id]->failedStatus == "PASSED"){ | |
| $totalStudentDetails->passStudents ++; | |
| } | |
| if($studentsDetails[$student->id]->failedStatus == "PASSED"){ | |
| $slNoRequest = new \stdClass; | |
| $slNoRequest->studentId = $student->id; | |
| $slNoRequest->examRegistrationId = $request->examRegistrationId; | |
| $studentsDetails[$student->id]->slNo = CommonExamService::getInstance()->getStudentExamMarkListSerialNumber($slNoRequest)->markListSerialNo; | |
| if ($studentsDetails[$student->id]->slNo) { | |
| $studentsDetails[$student->id]->slNo = str_pad($studentsDetails[$student->id]->slNo, 6, "0", STR_PAD_LEFT); | |
| } | |
| } | |
| $studentsDetails[$student->id]->certicifateNo = 'No:GC/'.$student->latestExamYear.'/S'.$studentsDetails[$student->id]->semInSemNumber.'/'.$studentsDetails[$student->id]->slNo; | |
| $studentsDetails[$student->id]->totalEarnedCredits = 0; | |
| foreach($student->academicTerms[0]->subjects as $subject){ | |
| $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]->latestExamYear = $subject->latestExamYear; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonth = $subject->latestExamMonth; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName = ExamRegistrationService::getInstance()->getMonthName($subject->latestExamMonth); | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
| $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 = $subject->percentage; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = $subject->externalMark; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->totalMaxMark = $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 = number_format(round($subject->credit,2),2); | |
| $studentsDetails[$student->id]->subjects[$subject->id]->creditGradePoint = $subject->creditGradePoint; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->gradePoint = $subject->gradePoint; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalGrade = $subject->internalGrade; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalGrade = $subject->externalGrade; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalGradePoint = $subject->internalGradePoint; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalGradePoint = $subject->externalGradePoint; | |
| $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]->internalPassPercentage = $subject->internalPassPercentage; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalPassPercentage = $subject->externalPassPercentage; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->aggregatePassPercentage = $subject->aggregatePassPercentage; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalMinimumMark = $subject->internalMaxMark * $subject->internalPassPercentage / 100; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMinimumMark = $subject->externalMaxMark * $subject->externalPassPercentage / 100; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->totalMinimumMark = $subject->totalMarks * $subject->aggregatePassPercentage / 100; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->internalLetterGrade = $subject->internalLetterGrade; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalLetterGrade = $subject->externalLetterGrade; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->attendanceStatus = $subject->attendanceStatus; | |
| if( $subject->isFailed == "PASSED" ){ | |
| $studentsDetails[$student->id]->totalEarnedCredits += $subject->credit; | |
| } | |
| 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 = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| } | |
| else if($subject->attendanceStatus == 'MALPRACTICE'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'MAL'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'MAL'; | |
| } | |
| else if($subject->failedStatus == 'FAILED'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
| } | |
| if($subject->studentInternalAttendanceStatus == 'FE'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'FE'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->credit = '-'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->latestExamYear = '-'; | |
| $studentsDetails[$student->id]->subjects[$subject->id]->latestExamMonthName = ""; | |
| } | |
| if($subject->isMoocSubject == '1'){ | |
| $studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
| } | |
| } | |
| if($additionalCredit){ | |
| $studentsDetails[$student->id]->totalEarnedCredits += $studentsDetails[$student->id]->creditTransferred; | |
| } | |
| uasort($studentsDetails[$student->id]->subjects, function($a, $b) { | |
| return ($a->priority > $b->priority); | |
| }); | |
| } | |
| $totalStudentDetails->passPercentage = round(100 * ( $totalStudentDetails->passStudents / $totalStudentDetails->totalStudents),2); | |
| $studentsDetails = array_values($studentsDetails); | |
| foreach($studentsDetails as $student){ | |
| $student->subjects = array_values($student->subjects); | |
| $student->subjectCategories = array_values($student->subjectCategories); | |
| } | |
| $response->studentsDetails = $studentsDetails; | |
| $response->totalStudentDetails = $totalStudentDetails; | |
| 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 = $examRegistrationDetailsArray[0]->name; | |
| $examRegistrationDetails->examYear = $examRegistrationDetailsArray[0]->examYear; | |
| $examRegistrationDetails->examMonth = $examRegistrationDetailsArray[0]->examMonth; | |
| $examRegistrationDetails->examMonthName = $examRegistrationDetailsArray[0]->examMonthName; | |
| $examRegistrationDetails->type = $examRegistrationDetailsArray[0]->type; | |
| $examRegistrationDetails->groupId = $examRegistrationDetailsArray[0]->groups[0]->groupId; | |
| $examRegistrationDetails->groupName = $examRegistrationDetailsArray[0]->groups[0]->groupName; | |
| $examRegistrationDetails->departmentDesc = $examRegistrationDetailsArray[0]->groups[0]->departmentDesc; | |
| $examRegistrationDetails->degreeDescription = $examRegistrationDetailsArray[0]->groups[0]->degreeDescription; | |
| $examRegistrationDetails->courseTypeID = $examRegistrationDetailsArray[0]->groups[0]->courseTypeID; | |
| $examRegistrationDetails->courseTypeName = $examRegistrationDetailsArray[0]->groups[0]->courseTypeName; | |
| $examRegistrationDetails->academicTermName = $examRegistrationDetailsArray[0]->groups[0]->academicTermName; | |
| $examRegistrationDetails->academicTermYear = $examRegistrationDetailsArray[0]->groups[0]->academicTermYear; | |
| $examRegistrationDetails->academicTermYearRoman = strtoupper(CommonUtil::convertNumberToRoman($examRegistrationDetails->academicTermYear)); | |
| $examRegistrationDetails->academicTermId = $examRegistrationDetailsArray[0]->groups[0]->academicTermId; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($examRegistrationDetails->academicTermName); | |
| $examRegistrationDetails->semInRomanLetter = $semesterNames->romanLetter; | |
| $examRegistrationDetails->semInFullName = $semesterNames->fullName; | |
| $examRegistrationDetails->semInSemNumber = $semesterNames->semNumber; | |
| $examRegistrationDetails->batchStartYear = $examRegistrationDetailsArray[0]->groups[0]->batchStartYear; | |
| $examRegistrationDetails->deptID = $examRegistrationDetailsArray[0]->groups[0]->deptID; | |
| $examRegistrationDetails->deptName = $examRegistrationDetailsArray[0]->groups[0]->deptName; | |
| $examRegistrationDetails->degreeName = $examRegistrationDetailsArray[0]->groups[0]->degreeName; | |
| $examRegistrationDetails->programName = $examRegistrationDetailsArray[0]->groups[0]->programName; | |
| $examRegistrationDetails->isHonorCourse = reset($examRegistrationDetailsArray)->properties->isHonorCourse == "1" ? true : false; | |
| $examRegistrationDetails->isMinorCourse = reset($examRegistrationDetailsArray)->properties->isMinorCourse == "1" ? true : false; | |
| foreach($examRegistrationDetailsArray[0]->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 = 1; | |
| $examRegistrationDetails->subjects[$subject->id]->isExternal = 1; | |
| $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 = 4; | |
| $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; | |
| if($examRegistrationDetails->batchStartYear >= '2023'){ | |
| $examRegistrationDetails->disableCollegeRegisterNumber = true; | |
| } | |
| $examRegistrationDetails->totalColSpan = 5; | |
| if(!$request->hideExternalOrInternalMark){ | |
| $examRegistrationDetails->totalColSpan = 4; | |
| } | |
| foreach($examRegistrationDetails->subjects as $subject){ | |
| $examRegistrationDetails->totalColSpan = $examRegistrationDetails->totalColSpan + $subject->subColSpan; | |
| } | |
| $examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
| return $examRegistrationDetails; | |
| } | |
| } |