Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 68 |
| Template1SupplementaryTabulationRegisterGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
156.00 | |
0.00% |
0 / 68 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 21 |
|||
| processData | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
| renderSupplementaryTabulationRegisterResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 29 |
|||
| <?php | |
| // Template Supply TR Generator For MES VIMALA STJOSEPH Collages | |
| namespace com\linways\ec\core\service\SupplementaryTabulationRegisterGenerator; | |
| 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\ec\core\service\SupplementaryTabulationRegisterGenerator\SupplementaryTabulationRegisterResultDataGenerator; | |
| class Template1SupplementaryTabulationRegisterGenerator extends SupplementaryTabulationRegisterResultDataGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $templateName = "template_1_ug"; | |
| $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; | |
| if($examRegistrationDetails->courseTypeName == "UG"){ | |
| $templateName = "template_1_ug"; | |
| } | |
| else if($examRegistrationDetails->courseTypeName == "PG" && $examRegistrationDetails->batchStartYear >= 2019){ | |
| $templateName = "template_1_pg_2019_onwords"; | |
| } | |
| else if($examRegistrationDetails->courseTypeName == "PG"){ | |
| $templateName = "template_1_pg"; | |
| } | |
| else{ | |
| $templateName = "template_1_pg"; | |
| } | |
| return $templateName; | |
| } | |
| /** | |
| * Process Student data college base | |
| * | |
| * @param $request | |
| */ | |
| protected function processData($request){ | |
| $response = new \stdClass; | |
| $studentsMarkDetails = []; | |
| $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 = TabulationRegisterService::getInstance()->processStudentDataForSupplyTabulationRegister($studentsMarkDetails,$request); | |
| $response->studentData = $studentsMarkDetails->studentsDetails; | |
| $response->examRegistrationData = TabulationRegisterService::getInstance()->getExamRegistrationDetailsForTabulationRegisterReports($request); | |
| $response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
| $response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $response->displayContentOptions = $request->displayContentOptions; | |
| return $response; | |
| } | |
| /** | |
| * Render Program Result | |
| * | |
| * @param $templateName | |
| * @param Object $data | |
| * @return Object | |
| */ | |
| protected function renderSupplementaryTabulationRegisterResult($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/SupplyTR/Template1/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= ""; | |
| $prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $options = array( | |
| 'page-width' => $totalHeight."mm", | |
| 'page-height' => $totalWidth."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; | |
| } | |
| } | |
| } | |