Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 170 |
| Template15SupplementaryTabulationRegisterGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
870.00 | |
0.00% |
0 / 170 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| processData | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 18 |
|||
| renderSupplementaryTabulationRegisterResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| processStudentDataForSupplyTabulationRegister | |
0.00% |
0 / 1 |
462.00 | |
0.00% |
0 / 113 |
|||
| <?php | |
| // Template Supply TR Generator For CCM COllege | |
| 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\core\ams\professional\util\CommonUtil; | |
| use com\linways\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\service\SupplementaryTabulationRegisterGenerator\SupplementaryTabulationRegisterResultDataGenerator; | |
| class Template15SupplementaryTabulationRegisterGenerator extends SupplementaryTabulationRegisterResultDataGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $templateName = "template_15_pg"; | |
| $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; | |
| 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 = $this->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/Template15/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= ""; | |
| $prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 707; | |
| $totalHeight=500; | |
| $options = array( | |
| 'page-width' => $totalWidth . "mm", | |
| 'page-height' => $totalHeight . "mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "20mm", | |
| 'margin-left' => "10mm", | |
| 'margin-right' => "10mm", | |
| 'margin-bottom' => "10mm", | |
| 'header-spacing' => "5", | |
| // '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; | |
| } | |
| } | |
| /** | |
| * process Student Data For Supply Tabulation Register | |
| * @param studentDetails | |
| * @return studentDetails | |
| * @author Krishnajith | |
| */ | |
| protected function processStudentDataForSupplyTabulationRegister($studentMarkDetails,$request){ | |
| try{ | |
| $examRegistrationData = TabulationRegisterService::getInstance()->getExamRegistrationDetailsForTabulationRegisterReports($request); | |
| $examYear = $examRegistrationData->examYear; | |
| $examMonth = $examRegistrationData->examMonth; | |
| $currentMonthYear = $examYear."-".$examMonth; | |
| $studentsDetailsObj = new \stdClass; | |
| $response = new \stdClass; | |
| $displaySubjectArray = []; | |
| $supplimentaryStudentIds = []; | |
| $improvementStudentIds = []; | |
| $studentsDetails = []; | |
| foreach($studentMarkDetails 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; | |
| $studentsDetails[$student->id]->roundOff = 2; | |
| foreach($student->academicTerms as $academicTerm){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->id = $academicTerm->id; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($academicTerm->name); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInRomanLetter = $semesterNames->romanLetter; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInFullName = $semesterNames->fullName; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semInSemNumber = $semesterNames->semNumber; | |
| foreach($academicTerm->markHistory as $semMarkHistory){ | |
| $historyExamYear = $semMarkHistory->examYear; | |
| $historyExamMonth = $semMarkHistory->examMonth; | |
| $historyMonthYear = $historyExamYear."-".$historyExamMonth; | |
| if($currentMonthYear >= $historyMonthYear){ | |
| // to handle same month and year for special or supply exam registration | |
| $historyTypeConstant = $semMarkHistory->historyType == 'REGULAR' ? 'R' : 'Z'; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$historyMonthYear.$historyTypeConstant]->failedStatus = $semMarkHistory->failedStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$historyMonthYear.$historyTypeConstant]->semesterGrade = $semMarkHistory->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$historyMonthYear.$historyTypeConstant]->semesterSgpa = round($semMarkHistory->sgpa, $studentsDetails[$student->id]->roundOff); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$historyMonthYear.$historyTypeConstant]->examType = $semMarkHistory->historyType; | |
| } | |
| } | |
| foreach( $academicTerm->subjects as $subject){ | |
| foreach($subject->markHistory as $subMarkHistory){ | |
| $subHistoryExamYear = $subMarkHistory->examYear; | |
| $subHistoryExamMonth = $subMarkHistory->examMonth; | |
| $subHistoryMonthYear = $subHistoryExamYear."-".$subHistoryExamMonth; | |
| $examTypesArray = ["REGULAR","SUPPLY","IMPROVEMENT"]; | |
| if($subMarkHistory->examMarkType != 'REGULAR'){ | |
| if($subMarkHistory->examMarkType == 'SUPPLY' ){ | |
| $supplimentaryStudentIds[] = $student->id; | |
| } | |
| elseif($subMarkHistory->examMarkType == 'IMPROVEMENT'){ | |
| $improvementStudentIds[] = $student->id; | |
| } | |
| } | |
| // to handle same month and year for special or supply exam registration | |
| $subHistoryTypeConstant = $subMarkHistory->examMarkType == 'REGULAR' ? 'R' : 'Z'; | |
| if($currentMonthYear >= $subHistoryMonthYear && in_array ( $subMarkHistory->examMarkType, $examTypesArray )){ | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->id = $subject->id; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->name = $subject->name; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->code = $subject->code; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->class = $subMarkHistory->class; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->grade = $subMarkHistory->grade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->externalMark = $subMarkHistory->externalMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->markObtained = $subMarkHistory->markObtained; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->totalMaxMark = $subject->totalMaxMark; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->markObtainedInWord = strtoupper(CommonUtil::convertNumberToWords((int)$subMarkHistory->markObtained)); | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->failedStatus = $subMarkHistory->resultStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->attendanceStatus = $subMarkHistory->attendanceStatus; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->credit = $subject->credit; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->creditGradePoint = $subject->credit * $subMarkHistory->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->gradePoint = $subMarkHistory->gradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->internalGrade = $subject->internalGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->externalGrade = $subMarkHistory->externalGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->internalGradePoint = $subject->internalGradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->externalGradePoint = $subMarkHistory->externalGradePoint; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->wgpa = $subMarkHistory->wgpa; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->isExternalFailed = $subMarkHistory->isExternalFailed; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->internalLetterGrade = $subject->internalLetterGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->externalLetterGrade = $subMarkHistory->externalLetterGrade; | |
| $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->markHistory[$subHistoryMonthYear.$subHistoryTypeConstant]->subjects[$subject->id]->examType = $subMarkHistory->examMarkType; | |
| } | |
| } | |
| $displaySubjectArray[$subject->id]= $subject; | |
| } | |
| } | |
| } | |
| $displaySubjectArray = array_values($displaySubjectArray); | |
| foreach($studentsDetails as $student){ | |
| $student->academicTerms = array_values($student->academicTerms); | |
| foreach($student->academicTerms as $academicTerm){ | |
| ksort($academicTerm->markHistory); | |
| $academicTerm->markHistory = array_values($academicTerm->markHistory); | |
| foreach($academicTerm->markHistory as $subMarkHistory){ | |
| $subMarkHistory->subjects = array_values($subMarkHistory->subjects); | |
| } | |
| } | |
| } | |
| foreach($studentsDetails as $student){ | |
| if ( in_array ( $student->id, $supplimentaryStudentIds ) ) { | |
| $studentsDetailsObj->supplementaryStudents[] = $student; | |
| } | |
| if ( in_array ( $student->id, $improvementStudentIds ) ) { | |
| $studentsDetailsObj->improvementStudents[] = $student; | |
| } | |
| } | |
| $response->studentsDetails = $studentsDetailsObj; | |
| $response->displaySubjects = $displaySubjectArray; | |
| return $response; | |
| } | |
| catch (\Exception $e){ | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| } | |