Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 413 |
| Template6SupplementaryIndividualResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
6642.00 | |
0.00% |
0 / 413 |
| __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 |
132.00 | |
0.00% |
0 / 51 |
|||
| renderIndividualMarkCardResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| processSupplementaryStudentData | |
0.00% |
0 / 1 |
1482.00 | |
0.00% |
0 / 183 |
|||
| processSupplementaryRegularStudentData | |
0.00% |
0 / 1 |
756.00 | |
0.00% |
0 / 142 |
|||
| <?php | |
| //Template Individual Generator For SAINTGITS Colleges | |
| namespace com\linways\ec\core\service\SupplementaryIndividualMarkCardGenerator; | |
| 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\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\service\SupplementaryIndividualMarkCardGenerator\SupplementaryIndividualMarkCardResultDataGenerator; | |
| use com\linways\core\ams\professional\util\CommonUtil; | |
| use TCPDFBarcode; | |
| 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 Template6SupplementaryIndividualResultGenerator extends SupplementaryIndividualMarkCardResultDataGenerator | |
| { | |
| public function __construct(){} | |
| 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->markCardOption == 'SUPPLY+REGULAR'){ | |
| $examRegistrationData = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
| if(empty($examRegistrationData)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Exam Found"); | |
| } | |
| $searchRequest = new \stdClass(); | |
| $searchRequest->groupId = $request->groupId; | |
| $searchRequest->studentId = $request->studentId; | |
| $searchRequest->selectedSemesters = $examRegistrationData->academicTermId; | |
| $searchRequest->excludeMinorHonor = 1; | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($searchRequest); | |
| if(empty($studentsMarkDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $studentsMarkDetails = $this->processSupplementaryRegularStudentData($studentsMarkDetails,$request,$examRegistrationData); | |
| } | |
| 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 = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
| if(empty($examRegistrationData)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Exam Found"); | |
| } | |
| $studentsMarkDetails = $this->processSupplementaryStudentData($studentsMarkDetails,$request,$examRegistrationData); | |
| } | |
| $examRegistrationData->disableCollegeRegisterNumber = false; | |
| if($examRegistrationData->batchStartYear >= '2023'){ | |
| $examRegistrationData->disableCollegeRegisterNumber = true; | |
| } | |
| $response->studentData = $studentsMarkDetails->studentsDetails; | |
| $response->examRegistrationData = $examRegistrationData; | |
| $response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| 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/SupplementaryIndividualMarkCards/Template6/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary MarkList</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 = $responseHtml; | |
| $programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
| return $programResult; | |
| } | |
| } | |
| /** | |
| * processSupplementaryStudentData | |
| * @param studentDetails | |
| * @return studentDetails | |
| * @author Krishnajith | |
| */ | |
| public function processSupplementaryStudentData($studentMarkDetails,$examRegistrationRequest,$examRegistrationDetails){ | |
| $response = new \stdClass; | |
| $totalStudentDetails = new \stdClass; | |
| $totalStudentDetails->totalStudents = count($studentMarkDetails); | |
| $displaySubjectArray = []; | |
| $displaySubjectCategories = []; | |
| $studentsDetails = []; | |
| if( $examRegistrationRequest->isStudentSideExamResult == '1' ){ | |
| $requestForExamRegistration = new SearchExamRegistrationRequest; | |
| $requestForExamRegistration->groupId = $examRegistrationRequest->groupId; | |
| $revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
| } | |
| foreach($studentMarkDetails as $student){ | |
| $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; | |
| } | |
| $barcodeObj = new TCPDFBarcode($student->studentDetails->registerNo, 'C128'); | |
| $studentsDetails[$student->id]->slNo = ""; | |
| $studentsDetails[$student->id]->barcodeObj = $barcodeObj->getBarcodeHTML($w = 1, $h = 30, $color = 'black'); | |
| $studentsDetails[$student->id]->id = $student->id; | |
| $studentsDetails[$student->id]->isResultBlocked = $student->isResultBlocked; | |
| $studentsDetails[$student->id]->blockingMsg = $student->blockingMsg; | |
| $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]->isPG = $student->studentDetails->courseType == "PG" ? true : false; | |
| $studentsDetails[$student->id]->myImage = $student->studentDetails->myImage; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| $studentsDetails[$student->id]->roundOff = $student->studentDetails->academicYear < 2019 ? 2 : 3; | |
| if ($student->studentDetails->courseType == "PG"){ | |
| $studentsDetails[$student->id]->roundOff = 2; | |
| } | |
| foreach($student->academicTerms as $academicTerm){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->id = $academicTerm->id; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($academicTerm->name); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInRomanLetter = $semesterNames->romanLetter; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInFullName = $semesterNames->fullName; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInSemNumber = $semesterNames->semNumber; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterWiseFailedStatus = $academicTerm->isFailed; | |
| // $studentSubjectRequest = new \stdClass(); | |
| // $studentSubjectRequest->studentId = $student->id; | |
| // $studentSubjectRequest->examMonthLimit = $examRegistrationDetails->examMonth; | |
| // $studentSubjectRequest->examYearLimit = $examRegistrationDetails->examYear; | |
| // $studentSubjectRequest->academicTermId = $academicTerm->id; | |
| // $studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
| // $earnedCredit = 0; | |
| // foreach($studentSubjectHistory as $studentHistory){ | |
| // if($studentHistory->subjectFailedStatus == "PASSED"){ | |
| // $earnedCredit += $studentHistory->credit; | |
| // } | |
| // } | |
| foreach($academicTerm->markHistory as $semMarkHistory){ | |
| if($semMarkHistory->examRegistrationId == $examRegistrationRequest->examRegistrationId){ | |
| if ( $semMarkHistory->hasRevaluationMark && $examRegistrationRequest->isStudentSideExamResult == '1' ){ | |
| $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->failedStatus = $semMarkHistory->withoutRevaluationFailedStatus; | |
| $semMarkHistory->sgpa = $semMarkHistory->withoutRevaluationsgpa; | |
| } | |
| } | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examRegistrationWiseFailedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->earnedCredits = 0; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->failedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGrade = $semMarkHistory->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCredit = $academicTerm->credit; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGradePoint = $semMarkHistory->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditGradePoint = $semMarkHistory->creditGradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa = sprintf('%0.2f', $semMarkHistory->sgpa); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterpassPercentage = $academicTerm->passPercentage; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterTotalMinimumMarks = $academicTerm->totalMarks * $academicTerm->passPercentage / 100; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtained = $semMarkHistory->supplyMarkObtained; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($semMarkHistory->totalMark))." ONLY"; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamMonth= $semMarkHistory->examMonth; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamYear = $semMarkHistory->examYear; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamMonthName = ExamRegistrationService::getInstance()->getMonthName($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamMonth); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->qrcodeValue = $studentsDetails[$student->id]->registerNo .",".$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamMonthName."-".$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamYear.",S".$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInSemNumber; | |
| $studentsDetails[$student->id]->qrcodeAllString = $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->qrcodeValue; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterPercentage = round($semMarkHistory->percentage,2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterClass = $semMarkHistory->class; | |
| $studentsDetails[$student->id]->overallClass = $semMarkHistory->class; | |
| $studentsDetails[$student->id]->overallGrade= $semMarkHistory->grade; | |
| $studentsDetails[$student->id]->failedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examType = $semMarkHistory->historyType; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->latestExamYear = $semMarkHistory->examYear; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->latestExamMonth = $semMarkHistory->examMonth; | |
| // $studentsDetails[$student->id]->earnedCredits = $earnedCredit; | |
| } | |
| if($semMarkHistory->historyType == 'REGULAR'){ | |
| $studentsDetails[$student->id]->regularExamRegistrationId = $semMarkHistory->examRegistrationId; | |
| } | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->id = $academicTerm->id; | |
| } | |
| $studentsDetails[$student->id]->totalEarnedCredits = 0; | |
| foreach( $academicTerm->subjects as $subject){ | |
| if ( $subject->subjectHasRevaluationMark && $examRegistrationRequest->isStudentSideExamResult == '1' ){ | |
| $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; | |
| } | |
| } | |
| $displaySubjectArray[$subject->id]= $subject; | |
| $displaySubjectCategories[$subject->categoryId]->categoryId = $subject->categoryId; | |
| $displaySubjectCategories[$subject->categoryId]->categoryName = $subject->categoryName; | |
| $displaySubjectCategories[$subject->categoryId]->subjects[$subject->id] = $subject; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id] = $subject; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->credit = number_format(round($subject->credit,2),2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->id = $subject->id; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentage = round($subject->percentage,2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->totalMaxMark = $subject->totalMarks; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->markObtainedInWord = strtoupper(CommonUtil::convertNumberToWords((int)$subject->markObtained)); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->failedStatus = $subject->isFailed; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->creditGradePoint = $subject->credit * $subject->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalMinimumMark = $subject->internalMaxMark * $subject->internalPassPercentage / 100; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMinimumMark = $subject->externalMaxMark * $subject->externalPassPercentage / 100; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->totalMinimumMark = $subject->totalMarks * $subject->aggregatePassPercentage / 100; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjectCategories[$subject->categoryId]->categoryId = $subject->categoryId; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjectCategories[$subject->categoryId]->categoryName = $subject->categoryName; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjectCategories[$subject->categoryId]->subjects[$subject->id] = $subject; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamMonthName = ExamRegistrationService::getInstance()->getMonthName($subject->latestExamMonth); | |
| if( $subject->isFailed == "PASSED" ){ | |
| $studentsDetails[$student->id]->earnedCredits += $subject->credit; | |
| } | |
| if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
| } | |
| if($subject->attendanceStatus == 'ABSENT'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = $examRegistrationDetails->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $examRegistrationDetails->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| } | |
| else if($subject->attendanceStatus == 'MALPRACTICE'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = 'MAL'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = 'MAL'; | |
| } | |
| else if($subject->failedStatus == 'FAILED'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = 'F'; | |
| } | |
| } | |
| // $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditGradePoint = array_sum(array_column($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects,'creditGradePoint')); | |
| } | |
| if(reset($studentsDetails[$student->id]->academicTerms)->examRegistrationWiseFailedStatus == 'PASSED'){ | |
| $slNoRequest = new \stdClass; | |
| $slNoRequest->studentId = $student->id; | |
| $slNoRequest->examRegistrationId = $studentsDetails[$student->id]->regularExamRegistrationId; | |
| $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]->academicTerms[$academicTerm->id]->certicifateNo = 'No:GC/'.reset($studentsDetails[$student->id]->academicTerms)->latestExamYear.'/S'.reset($studentsDetails[$student->id]->academicTerms)->semInSemNumber.'/'.$studentsDetails[$student->id]->slNo; | |
| if(count($student->academicTerms) > 1){ | |
| $studentsDetails[$student->id]->overallClass = $student->class; | |
| $studentsDetails[$student->id]->overallGrade= $student->grade; | |
| $studentsDetails[$student->id]->failedStatus = $student->isFailed; | |
| } | |
| } | |
| uasort($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects, function($a, $b) { | |
| return ($a->priority > $b->priority); | |
| }); | |
| $displaySubjectCategories = array_values($displaySubjectCategories); | |
| foreach($displaySubjectCategories as $displaySubjectCategory){ | |
| $displaySubjectCategory->subjects = array_values($displaySubjectCategory->subjects); | |
| } | |
| uasort($displaySubjectArray, function($a, $b) { | |
| return ($a->priority > $b->priority); | |
| }); | |
| $displaySubjectArray = array_values($displaySubjectArray); | |
| foreach($studentsDetails as $student){ | |
| $student->academicTerms = array_values($student->academicTerms); | |
| foreach($student->academicTerms as $academicTerm){ | |
| $academicTerm->subjects = array_values($academicTerm->subjects); | |
| $academicTerm->subjectCategories = array_values($academicTerm->subjectCategories); | |
| foreach($academicTerm->subjectCategories as $subCategory){ | |
| $subCategory->subjects = array_values($subCategory->subjects); | |
| $subCategory->totaCategoryAwardedMark = 0; | |
| foreach($subCategory->subjects as $subject){ | |
| $subCategory->totaCategoryAwardedMark += $subject->internalMark + $subject->externalMark; | |
| } | |
| } | |
| } | |
| } | |
| $response->studentsDetails = $studentsDetails; | |
| $response->displaySubjects = $displaySubjectArray; | |
| $response->displaySubjectCategories = $displaySubjectCategories; | |
| return $response; | |
| } | |
| /** | |
| * processSupplementaryRegularStudentData | |
| * @param studentDetails | |
| * @return studentDetails | |
| * @author Krishnajith | |
| */ | |
| public function processSupplementaryRegularStudentData($studentMarkDetails,$examRegistrationRequest,$examRegistrationDetails){ | |
| $response = new \stdClass; | |
| $totalStudentDetails = new \stdClass; | |
| $totalStudentDetails->totalStudents = count($studentMarkDetails); | |
| $displaySubjectArray = []; | |
| $displaySubjectCategories = []; | |
| $studentsDetails = []; | |
| foreach($studentMarkDetails as $student){ | |
| $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; | |
| } | |
| $barcodeObj = new TCPDFBarcode($student->studentDetails->registerNo, 'C128'); | |
| $studentsDetails[$student->id]->slNo = ""; | |
| $studentsDetails[$student->id]->barcodeObj = $barcodeObj->getBarcodeHTML($w = 1, $h = 30, $color = 'black'); | |
| $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]->myImage = $student->studentDetails->myImage; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| foreach($student->academicTerms as $academicTerm){ | |
| $currentAcademicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($examRegistrationRequest){ | |
| return $value->examRegistrationId == $examRegistrationRequest->examRegistrationId; | |
| })); | |
| $regularExamDetails = reset(array_filter(reset($student->academicTerms)->markHistory,function($value){ | |
| return $value->historyType == 'REGULAR'; | |
| })); | |
| $studentSubjectRequest = new \stdClass(); | |
| $studentSubjectRequest->studentId = $student->id; | |
| $studentSubjectRequest->examMonthLimit = $examRegistrationDetails->examMonth; | |
| $studentSubjectRequest->examYearLimit = $examRegistrationDetails->examYear; | |
| $studentSubjectRequest->academicTermId = $academicTerm->id; | |
| $studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
| $earnedCredit = 0; | |
| foreach($studentSubjectHistory as $studentHistory){ | |
| if($studentHistory->subjectFailedStatus == "PASSED"){ | |
| $earnedCredit += $studentHistory->credit; | |
| } | |
| } | |
| $studentsDetails[$student->id]->regularExamRegistrationId = $regularExamDetails->examRegistrationId; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->id = $academicTerm->id; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($academicTerm->name); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInRomanLetter = $semesterNames->romanLetter; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInFullName = $semesterNames->fullName; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInSemNumber = $semesterNames->semNumber; | |
| $studentsDetails[$student->id]->failedStatus = $currentAcademicTerm->failedStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGrade = $currentAcademicTerm->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCredit = $academicTerm->credit; | |
| $studentsDetails[$student->id]->earnedCredits = $earnedCredit; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGradePoint = $academicTerm->gradePoint; | |
| $studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $currentAcademicTerm->sgpa); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa =sprintf('%0.2f', $currentAcademicTerm->sgpa); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->latestExamMonth = $currentAcademicTerm->examMonth; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->latestExamYear = $currentAcademicTerm->examYear; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamMonthName = ExamRegistrationService::getInstance()->getMonthName($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->latestExamMonth); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->qrcodeValue = $studentsDetails[$student->id]->registerNo .",".$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterExamMonthName."-".$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->latestExamYear.",S".$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInSemNumber; | |
| $studentsDetails[$student->id]->qrcodeAllString = $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->qrcodeValue; | |
| foreach( $academicTerm->subjects as $subject){ | |
| $subject->markHistory = array_filter($subject->subjectMarkHistory,function($value)use($examRegistrationDetails){ | |
| return $value->examYear."-".date("m", mktime(0, 0, 0, (int)$value->examMonth, 10)) <= $examRegistrationDetails->examYear."-".date("m", mktime(0, 0, 0, (int)$examRegistrationDetails->examMonth, 10)); | |
| }); | |
| // $isMarkExist = array_filter(array_column($subject->markHistory, 'externalMark')); | |
| // if (!empty($isMarkExist)){ | |
| // usort($subject->markHistory, function($a, $b) { | |
| // return ($a->externalMark < $b->externalMark); | |
| // }); | |
| // } | |
| // else{ | |
| // usort($subject->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($subject->markHistory,function($value){ | |
| return $value->examMarkType == "REGULAR"; | |
| }); | |
| $supplyHistory = array_filter($subject->markHistory,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->markHistory = array_merge($supplyHistory, $regularHistory); | |
| // } | |
| $subject->latestMarkHistory = reset($subject->markHistory); | |
| if($subject->latestMarkHistory->attendanceStatus == 'ABSENT'){ | |
| foreach ($subject->markHistory AS $subjectHistory){ | |
| if(($subjectHistory->attendanceStatus == 'PRESENT' && $subjectHistory->studentAttendanceStatus != 'FE') || ($subjectHistory->examMarkType == 'REGULAR' && $subjectHistory->studentAttendanceStatus != 'FE')){ | |
| $subject->latestMarkHistory = $subjectHistory; | |
| break; | |
| } | |
| } | |
| } | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id] = $subject; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->credit = number_format(round($subject->credit,2),2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->id = $subject->id; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->totalMaxMark = $subject->totalMarks; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentage = round($subject->latestMarkHistory->percentage,2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->failedStatus = $subject->latestMarkHistory->resultStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $subject->latestMarkHistory->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->class = $subject->latestMarkHistory->class; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamYear = $subject->latestMarkHistory->examYear; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestexamMonth = $subject->latestMarkHistory->examMonth; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamMonthName = ExamRegistrationService::getInstance()->getMonthName($subject->latestMarkHistory->examMonth); | |
| if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $subject->latestMarkHistory->resultStatus == "PASSED" ? 'P' : 'F' ; | |
| } | |
| if($subject->latestMarkHistory->attendanceStatus == 'ABSENT'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = $examRegistrationDetails->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $examRegistrationDetails->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
| } | |
| else if($subject->latestMarkHistory->attendanceStatus == 'MALPRACTICE'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = 'MAL'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = 'MAL'; | |
| } | |
| else if($subject->latestMarkHistory->resultStatus == 'FAILED'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = 'F'; | |
| } | |
| if($subject->latestMarkHistory->studentAttendanceStatus == 'FE'){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = 'FE'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->credit = '-'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamYear = '-'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamMonthName = ''; | |
| } | |
| } | |
| // $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditGradePoint = array_sum(array_column($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects,'creditGradePoint')); | |
| } | |
| if($studentsDetails[$student->id]->failedStatus == 'PASSED'){ | |
| $slNoRequest = new \stdClass; | |
| $slNoRequest->studentId = $student->id; | |
| $slNoRequest->examRegistrationId = $studentsDetails[$student->id]->regularExamRegistrationId; | |
| $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]->academicTerms[$academicTerm->id]->certicifateNo = 'No:GC/'.reset($studentsDetails[$student->id]->academicTerms)->latestExamYear.'/S'.reset($studentsDetails[$student->id]->academicTerms)->semInSemNumber.'/'.$studentsDetails[$student->id]->slNo; | |
| } | |
| uasort($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects, function($a, $b) { | |
| return ($a->priority > $b->priority); | |
| }); | |
| $displaySubjectCategories = array_values($displaySubjectCategories); | |
| foreach($displaySubjectCategories as $displaySubjectCategory){ | |
| $displaySubjectCategory->subjects = array_values($displaySubjectCategory->subjects); | |
| } | |
| uasort($displaySubjectArray, function($a, $b) { | |
| return ($a->priority > $b->priority); | |
| }); | |
| foreach($studentsDetails as $student){ | |
| $student->academicTerms = array_values($student->academicTerms); | |
| foreach($student->academicTerms as $academicTerm){ | |
| $academicTerm->subjects = array_values($academicTerm->subjects); | |
| } | |
| } | |
| $response->studentsDetails = $studentsDetails; | |
| return $response; | |
| } | |
| } |