Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 99 |
| Template9SupplementaryIndividualResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
342.00 | |
0.00% |
0 / 99 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| getTemplateName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 11 |
|||
| processData | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 56 |
|||
| renderIndividualMarkCardResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| <?php | |
| //Template Individual Generator For SJC 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\core\ams\professional\util\CommonUtil; | |
| use com\linways\ec\core\service\SupplementaryIndividualMarkCardGenerator\SupplementaryIndividualMarkCardResultDataGenerator; | |
| use com\linways\ec\core\service\MarkMigrationGenerator\Template9MigrationdResultGenerator; | |
| use com\linways\core\ams\professional\service\StudentService; | |
| class Template9SupplementaryIndividualResultGenerator extends SupplementaryIndividualMarkCardResultDataGenerator | |
| { | |
| private $MarkMigrationResultDataGenerator; | |
| public function __construct(){ | |
| $this->MarkMigrationResultDataGenerator = new Template9MigrationdResultGenerator(); | |
| } | |
| protected function getTemplateName($request){ | |
| $templateName = "Template_9"; | |
| $examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
| if(empty($examRegistrationDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| if($examRegistrationDetailsArray[0]->groups[0]->batchStartYear >= '2022'){ | |
| $templateName = "Template_9_2022"; | |
| } | |
| $templateName = "Template_9_2022"; | |
| return $templateName; | |
| } | |
| /** | |
| * Process Student data college base | |
| * | |
| * @param $request | |
| */ | |
| protected function processData($request){ | |
| $response = new \stdClass; | |
| $studentsMarkDetails = []; | |
| $request->orderByCurriculum = 1; | |
| $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; | |
| } | |
| $studentsMarkDetails = $this->MarkMigrationResultDataGenerator->processSupplementaryStudentData($studentsMarkDetails,$request); | |
| $response->studentData = $studentsMarkDetails->studentsDetails; | |
| foreach($response->studentData as $student){ | |
| $slNoRequest = new \stdClass; | |
| $slNoRequest->studentId = $student->id; | |
| $slNoRequest->examRegistrationId = $request->examRegistrationId; | |
| $student->myImage = StudentService::getInstance()->getStudentProfilePic($student->id)->docpath; | |
| $student->slNo = CommonExamService::getInstance()->getStudentExamMarkListSerialNumber($slNoRequest)->markListSerialNo; | |
| foreach($student->academicTerms as $academicTerm){ | |
| $academicTerm->semesterMarkObtained = array_sum(array_column($academicTerm->subjects,'markObtained')); | |
| $academicTerm->semesterTotalMarks = array_sum(array_column($academicTerm->subjects,'totalMaxMark')); | |
| $academicTerm->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($academicTerm->semesterMarkObtained)); | |
| } | |
| } | |
| $response->examRegistrationData = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
| $response->examRegistrationData->headingOfTemplate = "STATEMENT OF MARKS"; | |
| if($request->isStudentSideExamResult == '1' ){ | |
| if($response->examRegistrationData->examBatchProperties->isResultFinalized == 1){ | |
| $examRegistrationDetails->headingOfTemplate = "STATEMENT OF MARKS"; | |
| } | |
| else{ | |
| $examRegistrationDetails->headingOfTemplate = "PROVISIONAL STATEMENT OF MARKS"; | |
| } | |
| } | |
| $response->examRegistrationData->pgCriteria = ""; | |
| if($response->examRegistrationData->courseTypeName == "PG"){ | |
| $response->examRegistrationData->pgCriteria = "Aggregate minimum for pass in each semester is 50%."; | |
| } | |
| $response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
| $response->collegeAndOtherData = CommonExamService::getInstance()->getCollegeDetails(); | |
| if( $request->displayContentOptions->enableDateFlag == '1'){ | |
| if(!$request->displayContentOptions->markListDate ){ | |
| $request->displayContentOptions->markListDate = date("F j, Y"); | |
| } | |
| else{ | |
| $request->displayContentOptions->markListDate = date("F j, Y", strtotime($request->displayContentOptions->markListDate)); | |
| } | |
| } | |
| $response->examRegistrationData->currentDate = date("F j, Y"); | |
| $response->examRegistrationData->gpaOrSgpa = "SGPA"; | |
| if($response->examRegistrationData <= 2014){ | |
| $response->examRegistrationData->gpaOrSgpa = "GPA"; | |
| } | |
| $response->displayContentOptions = $request->displayContentOptions; | |
| 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/Template9/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| </style>"; | |
| $prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 297; | |
| $totalHeight = 210; | |
| $options = array( | |
| 'page-width' => $totalWidth."mm", | |
| 'page-height' => $totalHeight."mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "9mm", | |
| 'margin-left' => "5mm", | |
| 'margin-right' => "5mm", | |
| '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; | |
| } | |
| } | |
| } |