Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 89 |
| Template4SupplementaryIndividualResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
156.00 | |
0.00% |
0 / 89 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 26 |
|||
| processData | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 33 |
|||
| renderIndividualMarkCardResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| <?php | |
| //Template Individual Generator For MA 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\SupplementaryIndividualMarkCardGenerator\SupplementaryIndividualMarkCardResultDataGenerator; | |
| class Template4SupplementaryIndividualResultGenerator extends SupplementaryIndividualMarkCardResultDataGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $templateName = "template_4_ug"; | |
| $templateName = "template_4_pg"; | |
| $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->type = $examRegistrationDetailsArray[0]->type; | |
| $examRegistrationDetails->groupId = $examRegistrationDetailsArray[0]->groups[0]->groupId; | |
| $examRegistrationDetails->groupName = $examRegistrationDetailsArray[0]->groups[0]->groupName; | |
| $examRegistrationDetails->courseTypeID = $examRegistrationDetailsArray[0]->groups[0]->courseTypeID; | |
| $examRegistrationDetails->courseTypeName = $examRegistrationDetailsArray[0]->groups[0]->courseTypeName; | |
| $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; | |
| if($examRegistrationDetails->courseTypeName == "UG"){ | |
| $templateName = "template_4_ug"; | |
| } | |
| else{ | |
| $templateName = "template_4_pg"; | |
| } | |
| $templateName = "template_4_ug"; | |
| return $templateName; | |
| } | |
| /** | |
| * Process Student data college base | |
| * | |
| * @param $request | |
| */ | |
| protected function processData($request){ | |
| $response = new \stdClass; | |
| $studentsMarkDetails = []; | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request); | |
| if(empty($studentsMarkDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->processSupplementaryStudentData($studentsMarkDetails,$request); | |
| $response->studentData = $studentsMarkDetails->studentsDetails; | |
| $response->examRegistrationData = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
| $response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
| $response->collegeAndOtherData = StudentMarkListService::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)); | |
| } | |
| } | |
| if($response->examRegistrationData->courseTypeName == "UG"){ | |
| if( $response->examRegistrationData->batchStartYear >=2017){ | |
| $response->examRegistrationData->section = "CBCS"; | |
| } | |
| else { | |
| $response->examRegistrationData->section = 'CBCSS'; | |
| } | |
| } | |
| else { | |
| $response->examRegistrationData->section = 'PGCSS'; | |
| } | |
| $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/Template4/$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 = 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; | |
| } | |
| } | |
| } |