Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 133 |
| Template15SupplementaryIndividualResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
462.00 | |
0.00% |
0 / 133 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 16 |
|||
| processData | |
0.00% |
0 / 1 |
210.00 | |
0.00% |
0 / 57 |
|||
| renderIndividualMarkCardResult | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 60 |
|||
| <?php | |
| // Template Supplementary Consilidated Generator For Carmel Collage | |
| 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\ec\core\service\CommonExamService; | |
| use com\linways\core\ams\professional\util\PdfUtil; | |
| use com\linways\ec\core\service\SupplementaryIndividualMarkCardGenerator\SupplementaryIndividualMarkCardResultDataGenerator; | |
| use com\linways\ec\core\service\RuleService; | |
| use com\linways\ec\core\request\SearchRuleRequest; | |
| class Template15SupplementaryIndividualResultGenerator extends SupplementaryIndividualMarkCardResultDataGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $templateName = "template_15_ug"; | |
| $examRegistrationDetails = new \stdClass; | |
| $examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
| if(empty($examRegistrationDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $examRegistrationDetails->courseTypeName = reset($examRegistrationDetailsArray)->groups[0]->courseTypeName; | |
| $examRegistrationDetails->batchStartYear = reset($examRegistrationDetailsArray)->groups[0]->batchStartYear; | |
| if($examRegistrationDetails->courseTypeName == "UG"){ | |
| $templateName = "template_15_ug"; | |
| } | |
| else{ | |
| $templateName = "template_15_pg"; | |
| } | |
| 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"); | |
| } | |
| if( $request->isStudentSideExamResult == '1' && !$request->groupId){ | |
| $request->groupId = reset($studentsMarkDetails)->studentDetails->batchId; | |
| } | |
| $response->examRegistrationData = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
| $studentsMarkDetails = StudentMarkListService::getInstance()->processSupplementaryStudentData($studentsMarkDetails,$request); | |
| foreach($studentsMarkDetails->studentsDetails as $student){ | |
| foreach($student->academicTerms as $academicTerm){ | |
| $academicTerm->semesterSgpa = round($academicTerm->semesterRawSgpa,2); | |
| $academicTerm->semesterSgpa = sprintf('%0.2f', $academicTerm->semesterSgpa); | |
| } | |
| } | |
| $response->studentData = $studentsMarkDetails->studentsDetails; | |
| $response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
| $response->collegeAndOtherData = CommonExamService::getInstance()->getCollegeDetails(); | |
| // to add principal name and sign by rule | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "PRINCIPAL_SIGNATURE_CONDITION"; | |
| $ruleSettings = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $response->collegeAndOtherData->hideSealAndSign = 1; | |
| $baseUrl = "http://".$_SERVER['HTTP_HOST']; | |
| $collegeCode = $GLOBALS['COLLEGE_CODE']; | |
| $response->collegeAndOtherData->principalVar = "Principal-in-Charge"; | |
| if( $response->examRegistrationData->publishingStartDate){ | |
| foreach($ruleSettings->principalNames as $principalName){ | |
| if($principalName->fromDate <= $response->examRegistrationData->publishingStartDate && $principalName->toDate >= $response->examRegistrationData->publishingStartDate){ | |
| $response->collegeAndOtherData->hideSealAndSign = $principalName->hideSealAndSign; | |
| $response->collegeAndOtherData->principalName = $principalName->principalName; | |
| $response->collegeAndOtherData->principalSign = "$baseUrl/libcommon/images/college/$collegeCode/$principalName->principalSign.png"; | |
| $response->collegeAndOtherData->principalVar = $principalName->principalVarName ?? 'Principal'; | |
| } | |
| } | |
| } | |
| 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; | |
| if( $request->isStudentSideExamResult == '1' ){ | |
| $response->displayContentOptions->collegeHeaderAndLogoFlag = '1'; | |
| $response->displayContentOptions->isShowDefaultSealAndSign = '1'; | |
| } | |
| else{ | |
| $response->displayContentOptions->collegeHeaderAndLogoFlag = '0'; | |
| $response->displayContentOptions->isShowDefaultSealAndSign = '0'; | |
| } | |
| $response->isStudentSideExamResult = $request->isStudentSideExamResult == '1' ? true : false; | |
| 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/Template15/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| // this case for pre print format in exam controller side | |
| if($data->isStudentSideExamResult){ | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| h6 {font-size: 26px;} .text-center { text-align: center;} .align-middle {vertical-align: middle;}; tr.noBorder td {border: 0; border-collapse:collapse;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Individual Mark Card</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' => "10mm", | |
| 'margin-right' => "10mm", | |
| 'margin-bottom' => "9mm", | |
| // 'binary' => "/usr/local/bin/wkhtmltopdf", // For Mac | |
| 'user-style-sheet' => realpath(DOCUMENT_ROOT . "/libcommon/bootstrap/css/bootstrap.min.css") | |
| ); | |
| } | |
| else{ | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| h6 {font-size: 26px;} | |
| .text-center { text-align: center;} | |
| .align-middle {vertical-align: middle;}; | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| .no-border-tr td, .no-border-table tbody tr td { border-right:1px solid #fff !important; border-left:1px solid #fff !important; border-top:1px solid #fff !important;border-bottom:1px solid #fff !important;}; | |
| </style>"; | |
| $prtContent .= '</head><title>Individual Mark Card</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $prtContent .= '</head><title>Individual Mark Card</title><body>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $options = array( | |
| 'page-width' => $totalWidth."mm", | |
| 'page-height' => $totalHeight."mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "4.5cm", | |
| 'margin-left' => "1cm", | |
| 'margin-right' => "1cm", | |
| 'margin-bottom' => "0.7cm", | |
| // 'binary' => "/usr/local/bin/wkhtmltopdf", // For Mac | |
| 'user-style-sheet' => realpath(DOCUMENT_ROOT . "/libcommon/bootstrap/css/bootstrap.min.css") | |
| ); | |
| } | |
| $programResult = new \stdClass; | |
| $programResult->dispalyHtmlData = $prtContent; | |
| $programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
| return $programResult; | |
| } | |
| } | |
| } | |