Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 204 |
Template1ConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
1260.00 | |
0.00% |
0 / 204 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 23 |
|||
processData | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 38 |
|||
processStudentData | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 60 |
|||
getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
240.00 | |
0.00% |
0 / 71 |
|||
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\core\ams\professional\service\examcontroller\CommonExamService as CoreCommonExamService; | |
use com\linways\ec\core\service\RegularConsolidatedMarkListGenerator\RegularConsolidatedMarkListResultDataGenerator; | |
class Template1ConsolidatedResultGenerator extends RegularConsolidatedMarkListResultDataGenerator | |
{ | |
public function __construct(){} | |
protected function getTemplateName($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; | |
if($examRegistrationDetails->courseTypeName == "PG"){ | |
$templateName = "template_1_pg"; | |
} | |
else{ | |
$templateName = "template_1_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/Template1/$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>'; | |
if($data->examRegistrationData->courseTypeName == "PG"){ | |
$totalSubjectsCount = count($data->examRegistrationData->subjects); | |
} | |
else{ | |
$totalSubjectsCount = count($data->examRegistrationData->subjectGroups); | |
} | |
$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; | |
$studentsDetails[$student->id]->batchOptionName = $student->studentDetails->batchOptionName; | |
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 = $student->studentDetails->courseTypeName == 'UG' ? 3 : 2; | |
$studentsDetails[$student->id]->semesterSgpa = round($semMarkHistory->rawSgpa, $studentsDetails[$student->id]->roundOff); | |
$studentsDetails[$student->id]->semesterSgpa = $student->studentDetails->courseTypeName == 'UG' ? sprintf('%0.3f', $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]->excludeSubjectFromTotal = $subjects->excludeSubjectFromTotal; | |
$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; | |
if($subjects->excludeSubjectFromTotal && $studentsDetails[$student->id]->batchOptionName == "BVOC"){ | |
$studentsDetails[$student->id]->subjects[$subjects->id]->showExcludeSubjectFromTotalWithDetails = true; | |
} | |
} | |
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[$subject->id]->excludeSubjectFromTotal = $subject->excludeSubjectFromTotal; | |
} | |
if($examRegistrationDetails->courseTypeName == "PG"){ | |
// avoid excludeSubjectFromTotal subjects | |
foreach($examRegistrationDetails->subjects as $key => $subject){ | |
if($subject->excludeSubjectFromTotal == '1'){ | |
unset($examRegistrationDetails->subjects[$key]); | |
} | |
} | |
} | |
$requestForSubjectGroup = new \stdClass; | |
$requestForSubjectGroup->examRegId = $request->examRegistrationId; | |
$requestForSubjectGroup->batchId = $request->groupId; | |
$requestForSubjectGroup->termId = reset($examRegistrationDetailsArray)->groups[0]->academicTermId; | |
$subjectGroups = CoreCommonExamService::getInstance()->getGroupedHeaderDetails($requestForSubjectGroup); | |
if(!empty($subjectGroups->paperDetails)){ | |
foreach($subjectGroups->paperDetails as $subjectGroup){ | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->id = $subjectGroup->id; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->name = $subjectGroup->paperName; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->academicPaperSubjectIds = $subjectGroup->paperSubjectIds; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->isGrouped = $subjectGroup->isgrouped == '1' ? true : false; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->subjectColSpan = 4; | |
} | |
foreach($subjectGroups->paperDetailsMinor as $subjectGroup){ | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->id = $subjectGroup->id; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->name = $subjectGroup->paperName; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->academicPaperSubjectIds = $subjectGroup->paperSubjectIds; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->isGrouped = $subjectGroup->isgrouped == '1' ? true : false; | |
$examRegistrationDetails->subjectGroups[$subjectGroup->id]->subjectColSpan = 4; | |
} | |
foreach($examRegistrationDetails->subjectGroups as $subjectGroup){ | |
$subjectGroup->academicPaperSubjectIds = array_values($subjectGroup->academicPaperSubjectIds); | |
foreach($subjectGroup->academicPaperSubjectIds as $subjectId){ | |
if($examRegistrationDetails->subjects[$subjectId]){ | |
if(!$subjectGroup->isGrouped){ | |
$subjectGroup->name = $examRegistrationDetails->subjects[$subjectId]->name; | |
$subjectGroup->code = $examRegistrationDetails->subjects[$subjectId]->code; | |
} | |
$subjectGroup->isInternal = $examRegistrationDetails->subjects[$subjectId]->isInternal; | |
$subjectGroup->isExternal = $examRegistrationDetails->subjects[$subjectId]->isExternal; | |
$subjectGroup->externalMaxMark = $examRegistrationDetails->subjects[$subjectId]->externalMaxMark; | |
$subjectGroup->internalMaxMark = $examRegistrationDetails->subjects[$subjectId]->internalMaxMark; | |
$subjectGroup->totalSubjectMark = $examRegistrationDetails->subjects[$subjectId]->totalSubjectMark; | |
break; | |
} | |
} | |
} | |
$examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
$examRegistrationDetails->subjectGroups = array_values($examRegistrationDetails->subjectGroups); | |
} | |
return $examRegistrationDetails; | |
} | |
protected function processStudentSubjectDataForCourseFileTemplate($studentsList){ | |
} | |
} | |