Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 267 |
Template3SupplementaryConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
1560.00 | |
0.00% |
0 / 267 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 30 |
|||
processData | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 21 |
|||
renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 32 |
|||
processSupplementaryStudentData | |
0.00% |
0 / 1 |
462.00 | |
0.00% |
0 / 184 |
<?php | |
// Template Consilidated Generator For SB College | |
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; | |
use com\linways\ec\core\constant\AttendanceStatusConstant; | |
use TCPDFBarcode; | |
use com\linways\core\ams\professional\util\CommonUtil; | |
use com\linways\ec\core\service\ExamRegistrationSubjectService; | |
class Template3SupplementaryConsolidatedResultGenerator extends SupplementaryConsolidatedMarkListResultDataGenerator | |
{ | |
public function __construct(){} | |
protected function getTemplateName($request){ | |
$templateName = "template_3_ug"; | |
$examRegistrationDetails = new \stdClass; | |
$examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
if(empty($examRegistrationDetailsArray)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
$examRegistrationDetails->name = $examRegistrationDetailsArray[0]->name; | |
$examRegistrationDetails->type = $examRegistrationDetailsArray[0]->type; | |
$examRegistrationDetails->groupId = $examRegistrationDetailsArray[0]->groups[0]->groupId; | |
$examRegistrationDetails->groupName = $examRegistrationDetailsArray[0]->groups[0]->groupName; | |
$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->degreeName == "MBA" && $examRegistrationDetails->batchStartYear >= 2019){ | |
$templateName = "template_3_mba_2019"; | |
} | |
else if($examRegistrationDetails->degreeName == "LIB" || $examRegistrationDetails->degreeName == "MBA"){ | |
$templateName = "template_3_mba"; | |
} | |
else if($examRegistrationDetails->courseTypeName == "PG" && $examRegistrationDetails->batchStartYear == 2014){ | |
$templateName = "template_3_pg_2014"; | |
} | |
else{ | |
$templateName = "template_3_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 = $this->processSupplementaryStudentData($studentsMarkDetails,$request); | |
$response->studentData = $studentsMarkDetails->studentsDetails; | |
$response->examRegistrationData = StudentMarkListService::getInstance()->getExamRegistrationDetailsDataForConsolidatedAndIndividualReports($request); | |
$response->examRegistrationData->subjects = $studentsMarkDetails->displaySubjects; | |
$response->examRegistrationData->subjectCategories = $studentsMarkDetails->displaySubjectCategories; | |
$response->examRegistrationData->sgpaOrScpa = "SGPA"; | |
if($response->examRegistrationDatadegreeName == "LIB" && $response->examRegistrationData->batchStartYear >= 2015 && $response->examRegistrationData->batchStartYear <= 2018){ | |
$response->examRegistrationData->sgpaOrScpa = "SCPA"; | |
} | |
if($response->courseTypeName == "UG" && $response->examRegistrationData->batchStartYear == 2018 ){ | |
$response->examRegistrationData->sgpaOrScpa = "SCPA"; | |
} | |
$response->collegeAndOtherData = 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/Template3/$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 = 210; | |
$totalHeight = 297; | |
$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; | |
} | |
} | |
/** | |
* processSupplementaryStudentData | |
* @param studentDetails | |
* @return studentDetails | |
*/ | |
protected function processSupplementaryStudentData($studentMarkDetails,$examRegistrationDetails){ | |
$response = new \stdClass; | |
$totalStudentDetails = new \stdClass; | |
$totalStudentDetails->totalStudents = count($studentMarkDetails); | |
$displaySubjectArray = []; | |
$displaySubjectCategories = []; | |
$studentsDetails = []; | |
foreach($studentMarkDetails as $student){ | |
$barcodeObj = new TCPDFBarcode($student->studentDetails->registerNo, 'C128'); | |
$studentsDetails[$student->id]->barcodeObj = $barcodeObj->getBarcodeHTML($w = 1, $h = 30, $color = 'black'); | |
$studentsDetails[$student->id]->id = $student->id; | |
$studentsDetails[$student->id]->name = $student->studentDetails->name; | |
$studentsDetails[$student->id]->isPG = $student->studentDetails->courseType == "PG" ? true : false; | |
$studentsDetails[$student->id]->myImage = $student->studentDetails->myImage; | |
$studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
$studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
$studentsDetails[$student->id]->roundOff = $student->studentDetails->academicYear < 2019 ? 2 : 3; | |
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; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterWiseFailedStatus = $academicTerm->isFailed; | |
foreach($academicTerm->markHistory as $semMarkHistory){ | |
if($semMarkHistory->examRegistrationId == $examRegistrationDetails->examRegistrationId){ | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examRegistrationWiseFailedStatus = $semMarkHistory->failedStatus; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->failedStatus = $semMarkHistory->failedStatus; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGrade = $semMarkHistory->grade; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCredit = $academicTerm->credit; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterGradePoint = $semMarkHistory->gradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditGradePoint = $semMarkHistory->creditGradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa = round($semMarkHistory->sgpa, $studentsDetails[$student->id]->roundOff); | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterpassPercentage = $academicTerm->passPercentage; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterTotalMinimumMarks = $academicTerm->totalMarks * $academicTerm->passPercentage / 100; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtained = $semMarkHistory->supplyMarkObtained; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtainedInWord = strtoupper(CommonUtil::convertNumberToWords($semMarkHistory->totalMark))." ONLY"; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterPercentage = round($semMarkHistory->percentage,2); | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterClass = $semMarkHistory->class; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCgpa = $semMarkHistory->semesterCgpa; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->earnedCredits = $semMarkHistory->totalEarnedCredits; | |
$studentsDetails[$student->id]->overallClass = $semMarkHistory->class; | |
$studentsDetails[$student->id]->overallGrade= $semMarkHistory->grade; | |
$studentsDetails[$student->id]->failedStatus = $semMarkHistory->failedStatus; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examType = $semMarkHistory->historyType; | |
} | |
} | |
foreach( $academicTerm->subjects as $subject){ | |
$displaySubjectArray[$subject->id]= $subject; | |
$displaySubjectCategories[$subject->categoryId]->categoryId = $subject->categoryId; | |
$displaySubjectCategories[$subject->categoryId]->categoryName = $subject->categoryName; | |
$displaySubjectCategories[$subject->categoryId]->subjects[$subject->id] = $subject; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->id = $subject->id; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->name = $subject->name; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->code = $subject->code; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->priority = $subject->priority; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->class = $subject->class; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->grade = $subject->grade; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentage = round($subject->percentage,2); | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = $subject->externalMark; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->totalMaxMark = $subject->totalMarks; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->markObtained = $subject->markObtained; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->markObtainedInWord = strtoupper(CommonUtil::convertNumberToWords((int)$subject->markObtained)); | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->failedStatus = $subject->isFailed; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->attendanceStatus = $subject->attendanceStatus; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->credit = $subject->credit; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->creditGradePoint = $subject->credit * $subject->gradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->gradePoint = $subject->gradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalGrade = $subject->internalGrade; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalGrade = $subject->externalGrade; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalGradePoint = $subject->internalGradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalGradePoint = $subject->externalGradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->wgpa = $subject->wgpa; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isExternalFailed = $subject->isExternalFailed; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->categoryId = $subject->categoryId; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->categoryName = $subject->categoryName; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentageObtainedExternal = $subject->percentageObtainedExternal; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentageObtainedInternal = $subject->percentageObtainedInternal; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalPassPercentage = $subject->internalPassPercentage; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalPassPercentage = $subject->externalPassPercentage; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->aggregatePassPercentage = $subject->aggregatePassPercentage; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalMinimumMark = $subject->internalMaxMark * $subject->internalPassPercentage / 100; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMinimumMark = $subject->externalMaxMark * $subject->externalPassPercentage / 100; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->totalMinimumMark = $subject->totalMarks * $subject->aggregatePassPercentage / 100; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalLetterGrade = $subject->internalLetterGrade; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->internalAttendanceStatus = $subject->internalAttendanceStatus; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalLetterGrade = $subject->externalLetterGrade; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjectCategories[$subject->categoryId]->categoryId = $subject->categoryId; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjectCategories[$subject->categoryId]->categoryName = $subject->categoryName; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjectCategories[$subject->categoryId]->subjects[$subject->id] = $subject; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamYear = $subject->latestExamYear; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamMonth = $subject->latestExamMonth; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->latestExamMonthName = ExamRegistrationService::getInstance()->getMonthName($subject->latestExamMonth); | |
if($subject->attendanceStatus == AttendanceStatusConstant::ABSENT){ | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = 'AB'; | |
} | |
} | |
// $studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditGradePoint = array_sum(array_column($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects,'creditGradePoint')); | |
} | |
if(count($student->academicTerms) > 1){ | |
$studentsDetails[$student->id]->overallClass = $student->class; | |
$studentsDetails[$student->id]->overallGrade= $student->grade; | |
$studentsDetails[$student->id]->failedStatus = $student->isFailed; | |
} | |
} | |
uasort($studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects, function($a, $b) { | |
return ($a->priority > $b->priority); | |
}); | |
$displaySubjectCategories = array_values($displaySubjectCategories); | |
foreach($displaySubjectCategories as $displaySubjectCategory){ | |
$displaySubjectCategory->subjects = array_values($displaySubjectCategory->subjects); | |
} | |
uasort($displaySubjectArray, function($a, $b) { | |
return ($a->priority > $b->priority); | |
}); | |
$displaySubjectArray = array_values($displaySubjectArray); | |
foreach($studentsDetails as $student){ | |
$student->academicTerms = array_values($student->academicTerms); | |
foreach($student->academicTerms as $academicTerm){ | |
$academicTerm->subjects = array_values($academicTerm->subjects); | |
$academicTerm->subjectCategories = array_values($academicTerm->subjectCategories); | |
foreach($academicTerm->subjectCategories as $subCategory){ | |
$subCategory->subjects = array_values($subCategory->subjects); | |
$subCategory->totaCategoryAwardedMark = 0; | |
foreach($subCategory->subjects as $subject){ | |
$subCategory->totaCategoryAwardedMark += $subject->internalMark + $subject->externalMark; | |
} | |
} | |
} | |
} | |
$subjectGroups = ExamRegistrationSubjectService::getInstance()->getBatchAssignedSubjectGroupsByRequest($examRegistrationDetails); | |
$i = 0; | |
$headingArray = []; | |
$groupSubsIds = []; | |
$groupSubjectCount = ""; | |
foreach ($displaySubjectArray as $subjectId => $subject) { | |
$found = 0; | |
$subjectId = $subject->id; | |
$alreadyGrouped = 0; | |
$groupId = ""; | |
foreach ($subjectGroups as $key => $group) { | |
$groupId = $group->id; | |
$selectedSubject = reset(array_filter( $group->subjects,function($value)use($subjectId){ | |
return $value->id == $subjectId; | |
})); | |
if ( $selectedSubject->id ) { | |
if (in_array($groupId, $groupSubsIds)) { | |
$alreadyGrouped = 1; | |
break; | |
} | |
$groupSubjectCount++; | |
$headingArray[$i]->isGroup = 1; | |
$headingArray[$i]->id = $group->id; | |
$headingArray[$i]->code = ""; | |
$headingArray[$i]->name = $group->subjectGroupName; | |
$headingArray[$i]->groupSubjects = $group->subjects; | |
//unset($subjectGroups[$key]); | |
$found = 1; | |
$groupSubsIds[] = $groupId; | |
break; | |
} | |
} | |
if ($alreadyGrouped == 0) { | |
if ($found == 0 | |
) { | |
$headingArray[$i]->isGroup = 0; | |
$headingArray[$i]->id = $subject->id; | |
$headingArray[$i]->code = $subject->code; | |
$headingArray[$i]->name = $subject->name; | |
$headingArray[$i]->subjectId = $subjectId; | |
} | |
$headingArray[$i]->internalMaxMark = $subject->internalMaxMark; | |
$headingArray[$i]->externalMaxMark = $subject->externalMaxMark; | |
$headingArray[$i]->totalSubjectMark = $subject->totalMarks; | |
$headingArray[$i]->credit = $subject->credit; | |
$i++; | |
} | |
} | |
$response->studentsDetails = $studentsDetails; | |
$response->displaySubjects = $headingArray; | |
$response->displaySubjectCategories = $displaySubjectCategories; | |
return $response; | |
} | |
} | |