Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 198 |
| Template15ConsolidatedTabulationRegisterGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
552.00 | |
0.00% |
0 / 198 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| processData | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 22 |
|||
| renderConsolidatedTabulationRegisterResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| processStudentDataForConsolidatedTabulationRegister | |
0.00% |
0 / 1 |
240.00 | |
0.00% |
0 / 137 |
|||
| <?php | |
| // Template Supply TR Generator For CCM Collages | |
| namespace com\linways\ec\core\service\ConsolidatedTabulationRegisterGenerator; | |
| use com\linways\ec\core\service\StudentMarkListService; | |
| use com\linways\ec\core\service\TabulationRegisterService; | |
| 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\core\ams\professional\util\CommonUtil; | |
| use com\linways\ec\core\service\ConsolidatedTabulationRegisterGenerator\ConsolidatedTabulationRegisterResultDataGenerator; | |
| class Template15ConsolidatedTabulationRegisterGenerator extends ConsolidatedTabulationRegisterResultDataGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $templateName = "template_15_pg"; | |
| $examRegistrationDetails = new \stdClass; | |
| $examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
| if(empty($examRegistrationDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $examRegistrationDetails->courseTypeName = $examRegistrationDetailsArray[0]->groups[0]->courseTypeName; | |
| return $templateName; | |
| } | |
| /** | |
| * Process Student data college base | |
| * | |
| * @param $request | |
| */ | |
| protected function processData($request){ | |
| $response = new \stdClass; | |
| $studentsMarkDetails = []; | |
| $request->isLastSemsterOnly = true; | |
| $request->studentId = TabulationRegisterService::getInstance()->getAllRegistredStudentIdsForSupplemenaryTabulationRegister($request); | |
| if(empty($request->studentId)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $studentsMarkDetails = TabulationRegisterService::getInstance()->getAllRegistredStudentMarkDetailsForTabulationRegister($request); | |
| if(empty($studentsMarkDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $studentsMarkDetails = $this->processStudentDataForConsolidatedTabulationRegister($studentsMarkDetails,$request); | |
| $response->studentData = $studentsMarkDetails->studentsDetails; | |
| $request->examRegistrationId = $studentsMarkDetails->examRegistrationId; | |
| $request->academicTermId = $studentsMarkDetails->academicTermId; | |
| $response->examRegistrationData = TabulationRegisterService::getInstance()->getExamRegistrationDetailsForTabulationRegisterReports($request); | |
| $response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
| $response->examRegistrationData->semesters = $studentsMarkDetails->displaySemesters; | |
| $response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $response->displayContentOptions = $request->displayContentOptions; | |
| return $response; | |
| } | |
| /** | |
| * Render Program Result | |
| * | |
| * @param $templateName | |
| * @param Object $data | |
| * @return Object | |
| */ | |
| protected function renderConsolidatedTabulationRegisterResult($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/TablationRegister/ConsolidatedTR/Template15/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= ""; | |
| $prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 420; | |
| $totalHeight=297; | |
| $options = array( | |
| 'page-width' => $totalWidth . "mm", | |
| 'page-height' => $totalHeight . "mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "20mm", | |
| 'margin-left' => "10mm", | |
| 'margin-right' => "10mm", | |
| 'margin-bottom' => "10mm", | |
| 'header-spacing' => "5", | |
| // '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; | |
| } | |
| } | |
| /** | |
| * process Student Data For Consolidated Tabulation Register | |
| * @param studentDetails | |
| * @return studentDetails | |
| * @author Krishnajith | |
| */ | |
| protected function processStudentDataForConsolidatedTabulationRegister($studentMarkDetails,$request){ | |
| try{ | |
| $response = new \stdClass; | |
| $displaySubjectArray = []; | |
| $displayOtherAcademicTermArray = []; | |
| $studentsDetails = []; | |
| foreach($studentMarkDetails as $student){ | |
| $studentsDetails[$student->id]->id = $student->id; | |
| $studentsDetails[$student->id]->name = $student->studentDetails->name; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| $studentsDetails[$student->id]->folioNumber = $student->studentDetails->folioNumber; | |
| $studentsDetails[$student->id]->failedStatus = $student->isFailed; | |
| $studentsDetails[$student->id]->cgpa = $student->cgpa; | |
| $studentsDetails[$student->id]->grade = $student->grade; | |
| $studentsDetails[$student->id]->finalTermId = $student->studentDetails->finalTermId; | |
| $studentsDetails[$student->id]->roundOff = 2; | |
| foreach($student->academicTerms as $academicTerm){ | |
| if($academicTerm->id == $studentsDetails[$student->id]->finalTermId){ | |
| $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; | |
| foreach($academicTerm->markHistory as $semMarkHistory){ | |
| if($semMarkHistory->historyType == "REGULAR"){ | |
| $examRegistrationId = $semMarkHistory->examRegistrationId; | |
| $academicTerm->rawSgpa = $semMarkHistory->sgpa; | |
| $academicTerm->isFailed = $semMarkHistory->failedStatus; | |
| if($academicTerm->isFailed == 'FAILED'){ | |
| $studentsDetails[$student->id]->failedStatus = 'FAILED'; | |
| } | |
| $academicTerm->grade = $semMarkHistory->grade; | |
| } | |
| } | |
| $academicTermId = $studentsDetails[$student->id]->finalTermId; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->failedStatus = $academicTerm->isFailed; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGrade = $academicTerm->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCredit = $academicTerm->credit; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditGradePoint = $academicTerm->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa = round($academicTerm->rawSgpa, $studentsDetails[$student->id]->roundOff); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa = sprintf('%0.2f',$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtained = $academicTerm->totalMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($semMarkHistory->totalMark))." ONLY"; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterPercentage = round($academicTerm->percentage,2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterClass = $academicTerm->class; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examType = $academicTerm->historyType; | |
| foreach( $academicTerm->subjects as $subject){ | |
| $displaySubjectArray[$subject->id]= $subject; | |
| foreach($subject->markHistory as $subMarkHistory){ | |
| if($subMarkHistory->examMarkType == "REGULAR"){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->id = $subject->id; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->name = $subject->name; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->code = $subject->code; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->class = $subMarkHistory->class; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $subMarkHistory->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentage = round($subMarkHistory->percentage,2); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = $subMarkHistory->externalMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->totalMaxMark = $subject->totalMaxMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->markObtained = $subMarkHistory->markObtained; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->failedStatus = $subMarkHistory->resultStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->attendanceStatus = $subMarkHistory->attendanceStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->credit = $subject->credit; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->creditGradePoint = $subject->credit * $subMarkHistory->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->gradePoint = $subMarkHistory->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalGrade = $subject->internalGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalGrade = $subMarkHistory->externalGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalGradePoint = $subject->internalGradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalGradePoint = $subMarkHistory->externalGradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->wgpa = $subMarkHistory->wgpa; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isExternalFailed = $subMarkHistory->isExternalFailed; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalLetterGrade = $subject->internalLetterGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalLetterGrade = $subMarkHistory->externalLetterGrade; | |
| } | |
| } | |
| } | |
| } | |
| else{ | |
| $latestExamMonthYear = ""; | |
| foreach($academicTerm->markHistory as $semMarkHistory){ | |
| $historyExamYear = $semMarkHistory->examYear; | |
| $historyExamMonth = $semMarkHistory->examMonth; | |
| $historyMonthYear = $historyExamYear."-".$historyExamMonth; | |
| if($historyMonthYear > $latestExamMonthYear){ | |
| $latestExamMonthYear = $historyMonthYear; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->latestExamYear = $semMarkHistory->examYear; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->latestExamMonth = $semMarkHistory->examMonth; | |
| } | |
| } | |
| $displayOtherAcademicTermArray[$academicTerm->id]->id= $academicTerm->id; | |
| $displayOtherAcademicTermArray[$academicTerm->id]->name= $academicTerm->name; | |
| $displayOtherAcademicTermArray[$academicTerm->id]->academicTermOrderNo= $academicTerm->academicTermOrderNo; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->id = $academicTerm->id; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($academicTerm->name); | |
| $displayOtherAcademicTermArray[$academicTerm->id]->semInRomanLetter= $semesterNames->romanLetter; | |
| $displayOtherAcademicTermArray[$academicTerm->id]->semInFullName= $semesterNames->fullName; | |
| $displayOtherAcademicTermArray[$academicTerm->id]->semInSemNumber = $semesterNames->semNumber; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semInRomanLetter = $semesterNames->romanLetter; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semInFullName = $semesterNames->fullName; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semInSemNumber = $semesterNames->semNumber; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->failedStatus = $academicTerm->isFailed; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semesterGrade = $academicTerm->grade; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semesterCredit = $academicTerm->credit; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semesterCreditGradePoint = $academicTerm->gradePoint; | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semesterSgpa = round($academicTerm->rawSgpa, $studentsDetails[$student->id]->roundOff); | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semesterSgpa = sprintf('%0.2f', $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->semesterSgpa); | |
| $studentsDetails[$student->id]->otherAcademicTerms[$academicTerm->id]->examType = $academicTerm->historyType; | |
| } | |
| } | |
| } | |
| $displaySubjectArray = array_values($displaySubjectArray); | |
| $displayOtherAcademicTermArray = array_values($displayOtherAcademicTermArray); | |
| usort($displayOtherAcademicTermArray,function($a,$b){ | |
| return (int)$a->academicTermOrderNo > (int)$b->academicTermOrderNo; | |
| }); | |
| foreach($studentsDetails as $student){ | |
| $student->academicTerms = array_values($student->academicTerms); | |
| foreach($student->academicTerms as $academicTerm){ | |
| $academicTerm->subjects = array_values($academicTerm->subjects); | |
| } | |
| } | |
| $response->studentsDetails = $studentsDetails; | |
| $response->displaySubjects = $displaySubjectArray; | |
| $response->displaySemesters = $displayOtherAcademicTermArray; | |
| $response->examRegistrationId = $examRegistrationId; | |
| $response->academicTermId = $academicTermId; | |
| return $response; | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| } | |