Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 148 |
| Template15ConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
342.00 | |
0.00% |
0 / 148 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 24 |
|||
| processData | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 33 |
|||
| processStudentData | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 55 |
|||
| getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 24 |
|||
| processStudentSubjectDataForCourseFileTemplate | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| <?php | |
| // Template Consilidated Generator For MES VIMALA STJOSEPH Collages | |
| namespace com\linways\ec\core\service\RegularConsolidatedMarkListGenerator; | |
| 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\ec\core\service\RegularConsolidatedMarkListGenerator\RegularConsolidatedMarkListResultDataGenerator; | |
| class Template15ConsolidatedResultGenerator extends RegularConsolidatedMarkListResultDataGenerator | |
| { | |
| 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->name = reset($examRegistrationDetailsArray)->name; | |
| $examRegistrationDetails->type = reset($examRegistrationDetailsArray)->type; | |
| $examRegistrationDetails->groupId = reset($examRegistrationDetailsArray)->groups[0]->groupId; | |
| $examRegistrationDetails->groupName = reset($examRegistrationDetailsArray)->groups[0]->groupName; | |
| $examRegistrationDetails->courseTypeID = reset($examRegistrationDetailsArray)->groups[0]->courseTypeID; | |
| $examRegistrationDetails->courseTypeName = reset($examRegistrationDetailsArray)->groups[0]->courseTypeName; | |
| $examRegistrationDetails->batchStartYear = reset($examRegistrationDetailsArray)->groups[0]->batchStartYear; | |
| $examRegistrationDetails->deptID = reset($examRegistrationDetailsArray)->groups[0]->deptID; | |
| $examRegistrationDetails->deptName = reset($examRegistrationDetailsArray)->groups[0]->deptName; | |
| $examRegistrationDetails->degreeName = reset($examRegistrationDetailsArray)->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"); | |
| } | |
| $response->studentData = $this->processStudentData($studentsMarkDetails,$request); | |
| $response->examRegistrationData = $this->getExamRegistrationDetailsData($request); | |
| $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/RegularConsolidatedMarkList/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>'; | |
| $totalSubjectsCount = count($data->examRegistrationData->subjects); | |
| $totalWidth = ( $totalSubjectsCount * 5 * 15 ) + 100; | |
| $totalHeight = $totalWidth / 1.414; | |
| $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; | |
| } | |
| } | |
| protected function processStudentData($studentsMarkDetails,$request){ | |
| $studentsDetails = []; | |
| foreach($studentsMarkDetails as $student){ | |
| $studentsDetails[$student->id]->id = $student->id; | |
| $studentsDetails[$student->id]->name = $student->studentDetails->name; | |
| $studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
| $studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
| foreach($student->academicTerms[0]->markHistory as $semMarkHistory){ | |
| if($semMarkHistory->examRegistrationId == $request->examRegistrationId){ | |
| $studentsDetails[$student->id]->examRegistrationWiseFailedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->failedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->semesterGrade = $semMarkHistory->grade; | |
| $studentsDetails[$student->id]->semesterCreditGradePoint = $semMarkHistory->creditGradePoint; | |
| // $studentsDetails[$student->id]->roundOff = $student->studentDetails->academicYear < 2019 ? 2 : 3; | |
| $studentsDetails[$student->id]->roundOff = 2; | |
| $studentsDetails[$student->id]->semesterSgpa = round($semMarkHistory->sgpa, $studentsDetails[$student->id]->roundOff); | |
| $studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $studentsDetails[$student->id]->semesterSgpa); | |
| $studentsDetails[$student->id]->semesterMarkObtained = $semMarkHistory->totalMark; | |
| $studentsDetails[$student->id]->semesterPercentage = round($semMarkHistory->percentage,2); | |
| $studentsDetails[$student->id]->semesterClass = $semMarkHistory->class; | |
| $studentsDetails[$student->id]->overallClass = $semMarkHistory->class; | |
| $studentsDetails[$student->id]->overallGrade= $semMarkHistory->grade; | |
| } | |
| } | |
| foreach($student->academicTerms[0]->subjects as $subjects){ | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->id = $subjects->id; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->name = $subjects->name; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->code = $subjects->code; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->priority = intval($subjects->priority); | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->externalMaxMark = $subjects->externalMaxMark; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->internalMaxMark = $subjects->internalMaxMark; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->class = $subjects->class; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->grade = $subjects->grade; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->percentage = round($subjects->percentage,2); | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->internalMark = $subjects->internalMark; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->internalGradePoint = $subjects->internalGradePoint; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->externalMark = $subjects->externalMark; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->externalGradePoint = $subjects->externalGradePoint; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->isInternal = $subjects->isInternal; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->isExternal = $subjects->isExternal; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->percentageObtainedExternal = $subjects->percentageObtainedExternal; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->percentageObtainedInternal = $subjects->percentageObtainedInternal; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->wgpa = $subjects->wgpa; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->markObtained = $subjects->markObtained; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->gradePoint = $subjects->gradePoint; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->failedStatus = $subjects->isFailed; | |
| $studentsDetails[$student->id]->subjects[$subjects->id]->attendanceStatus = $subjects->attendanceStatus; | |
| } | |
| uasort($studentsDetails[$student->id]->subjects, function($a, $b) { | |
| return ($a->priority > $b->priority); | |
| }); | |
| } | |
| $studentsDetails = array_values($studentsDetails); | |
| foreach($studentsDetails as $student){ | |
| $student->subjects = array_values($student->subjects); | |
| } | |
| return $studentsDetails; | |
| } | |
| protected function getExamRegistrationDetailsData($request){ | |
| $examRegistrationDetails = new \stdClass; | |
| $examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
| if(empty($examRegistrationDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
| } | |
| $examRegistrationDetails->name = reset($examRegistrationDetailsArray)->name; | |
| $examRegistrationDetails->type = reset($examRegistrationDetailsArray)->type; | |
| $examRegistrationDetails->groupId = reset($examRegistrationDetailsArray)->groups[0]->groupId; | |
| $examRegistrationDetails->groupName = reset($examRegistrationDetailsArray)->groups[0]->groupName; | |
| $examRegistrationDetails->courseTypeID = reset($examRegistrationDetailsArray)->groups[0]->courseTypeID; | |
| $examRegistrationDetails->courseTypeName = reset($examRegistrationDetailsArray)->groups[0]->courseTypeName; | |
| $examRegistrationDetails->batchStartYear = reset($examRegistrationDetailsArray)->groups[0]->batchStartYear; | |
| $examRegistrationDetails->deptID = reset($examRegistrationDetailsArray)->groups[0]->deptID; | |
| $examRegistrationDetails->deptName = reset($examRegistrationDetailsArray)->groups[0]->deptName; | |
| $examRegistrationDetails->degreeName = reset($examRegistrationDetailsArray)->groups[0]->degreeName; | |
| $examRegistrationDetails->academicTermName = reset($examRegistrationDetailsArray)->groups[0]->academicTermName; | |
| foreach(reset($examRegistrationDetailsArray)->groups[0]->subjects as $subject){ | |
| $examRegistrationDetails->subjects[$subject->id]->id = $subject->id; | |
| $examRegistrationDetails->subjects[$subject->id]->code = $subject->code; | |
| $examRegistrationDetails->subjects[$subject->id]->name = $subject->name; | |
| } | |
| $examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
| return $examRegistrationDetails; | |
| } | |
| protected function processStudentSubjectDataForCourseFileTemplate($studentsList){ | |
| } | |
| } | |