Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 72 |
Template15SupplementaryConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
110.00 | |
0.00% |
0 / 72 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 20 |
|||
processData | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 20 |
|||
renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 32 |
<?php | |
// Template Supplementary Consilidated Generator For Carmel Collage | |
namespace com\linways\ec\core\service\SupplementaryConsolidatedMarkListGenerator; | |
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\SupplementaryConsolidatedMarkListGenerator\SupplementaryConsolidatedMarkListResultDataGenerator; | |
use com\linways\ec\core\service\CommonExamService; | |
class Template15SupplementaryConsolidatedResultGenerator extends SupplementaryConsolidatedMarkListResultDataGenerator | |
{ | |
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->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 == "PG"){ | |
$templateName = "template_15_pg"; | |
} | |
else{ | |
$templateName = "template_15_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); | |
foreach($studentsMarkDetails->studentsDetails as $student){ | |
$student->roundOff = 2; | |
foreach($student->academicTerms as $academicTerm){ | |
$academicTerm->semesterSgpa = round($academicTerm->semesterRawSgpa,2); | |
$academicTerm->semesterSgpa = sprintf('%0.2f', $academicTerm->semesterSgpa); | |
} | |
} | |
$response->studentData = $studentsMarkDetails->studentsDetails; | |
$response->examRegistrationData = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
$response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
$response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
return $response; | |
} | |
/** | |
* Render Program Result | |
* | |
* @param $templateName | |
* @param Object $data | |
* @return Object | |
*/ | |
protected function renderConsolidatedMarkListResult($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/SupplementaryConsolidatedMarkList/Template15/$templateName.twig"), [ 'data'=>$data ]); | |
$prtContent = NULL; | |
$prtContent .= '<html><head>'; | |
$prtContent .= "<style> | |
h6 {font-size: 26px;} .text-center { text-align: center;} .alignMiddle {vertical-align: middle}; tr.noBorder td {border: 0; border-collapse:collapse;} | |
table, th, td {border: 1px solid black;border-collapse: collapse; vertical-align: middle;} th {font-weight: normal;} .bold {font-weight: bold;} | |
</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' => "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; | |
} | |
} | |
} | |