Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 161 |
Template14RegularTabulationRegisterGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
552.00 | |
0.00% |
0 / 161 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
processData | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 23 |
|||
renderRegularTabulationRegisterResult | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 56 |
|||
processStudentDataForRegularTabulationRegister | |
0.00% |
0 / 1 |
182.00 | |
0.00% |
0 / 72 |
<?php | |
// Template For TR in IAGI College | |
namespace com\linways\ec\core\service\RegularTabulationRegisterGenerator; | |
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\ec\core\service\CommonExamService; | |
use com\linways\core\ams\professional\util\CommonUtil; | |
use com\linways\ec\core\service\RegularTabulationRegisterGenerator\RegularTabulationRegisterResultDataGenerator; | |
use com\linways\core\ams\professional\service\AmsCustomFieldsService; | |
use com\linways\core\ams\professional\constant\AmsCustomFieldsEntities; | |
class Template14RegularTabulationRegisterGenerator extends RegularTabulationRegisterResultDataGenerator | |
{ | |
public function __construct(){} | |
protected function getTemplateName($request){ | |
$templateName = "template_14"; | |
$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; | |
$examRegistrationDetails->batchStartYear = $examRegistrationDetailsArray[0]->groups[0]->batchStartYear; | |
return $templateName; | |
} | |
/** | |
* Process Student data college base | |
* | |
* @param $request | |
*/ | |
protected function processData($request){ | |
$response = new \stdClass; | |
$studentsMarkDetails = []; | |
$studentsMarkDetails = TabulationRegisterService::getInstance()->getAllRegistredStudentMarkDetailsForTabulationRegister($request); | |
if(empty($studentsMarkDetails)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
$studentsMarkDetails = $this->processStudentDataForRegularTabulationRegister($studentsMarkDetails,$request); | |
$response->studentData = $studentsMarkDetails->studentsDetails; | |
$response->examRegistrationData = TabulationRegisterService::getInstance()->getExamRegistrationDetailsForTabulationRegisterReports($request); | |
usort($studentsMarkDetails->displaySubjects,function($a,$b){ | |
return $a->priority > $b->priority; | |
}); | |
$response->displaySubjects = array_values($studentsMarkDetails->displaySubjects); | |
$trDate = TabulationRegisterService::getInstance()->getTrDatesAndModeration($request->examRegistrationId,$request->groupId); | |
if($trDate){ | |
$response->examRegistrationData->boardMeetingDate = date("d-m-Y", strtotime($trDate->boardMeatingDate)); | |
$response->examRegistrationData->publishDate = date("d-m-Y", strtotime($trDate->resultPublishDate)); | |
$response->examRegistrationData->moderation = $trDate->moderation; | |
} | |
$response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
$response->displayContentOptions = $request->displayContentOptions; | |
$response->isPrint = $request->isPrint ? true : false; | |
return $response; | |
} | |
/** | |
* Render Program Result | |
* | |
* @param $templateName | |
* @param Object $data | |
* @return Object | |
*/ | |
protected function renderRegularTabulationRegisterResult($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/RegularTR/Template14/$templateName.twig"), [ 'data'=>$data ]); | |
$prtContent = NULL; | |
$prtContent .= '<html><head>'; | |
$prtContent .= ""; | |
$prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
$prtContent .= $responseHtml; | |
$prtContent .= '</body></html>'; | |
$columnCount = (count($data->displaySubjects) * 6) + 5; | |
$headerHTML = "<!DOCTYPE html> | |
<html> | |
<body> | |
<table id=\"sem-wise-result-sheet\" style=\"width:100%!important; border:none\"> | |
<thead> | |
<tr> | |
<td class=\"removeTdBorder college-head no-border text-center\" style=\"text-align:center\" data-f-bold='true' data-a-h='center' colspan='$columnCount'> | |
<img style = 'width: auto; height: 90px; /* margin: 0 0 0 10%; */' src ='$data->collegeHeader'> | |
</td> | |
</tr> | |
<tr> | |
<td class=\"removeTdBorder college-head no-border text-center\" style=\"text-align:center;padding-top:10px!important;text-transform: uppercase;\" data-f-bold='true' data-a-h='center' colspan=\"$columnCount\" > | |
<b style=\"font-size: 18px;\">PROVISIONAL TABULATION SHEET ".$data->examRegistrationData->examMonthName." ".$data->examRegistrationData->examYear." - ".$data->examRegistrationData->degreeName." (SEMESTER ".$data->examRegistrationData->semInSemNumber.") </b> | |
</td> | |
</tr> | |
</thead> | |
</table> | |
</body> | |
</html>"; | |
$pageNumberPrefix = "PAGE : [page] / [toPage]"; | |
$totalWidth = (count($data->examRegistrationData->subjects) * 6 * 8) + 100; | |
$totalWidth = $totalWidth < 330 ? 330 : $totalWidth + 133; | |
$totalHeight = $totalWidth / 1.414; | |
$options = array( | |
'page-width' => $totalWidth . "mm", | |
'page-height' => $totalHeight . "mm", | |
'dpi' => 96, | |
'margin-top' => "40mm", | |
'margin-left' => "20mm", | |
'margin-right' => "10mm", | |
'margin-bottom' => "10mm", | |
'footer-right' => $pageNumberPrefix, | |
'header-html' => $headerHTML, | |
'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->hideExportExcel = true; | |
$programResult->enableSelectAllButton = true; | |
$programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
return $programResult; | |
} | |
} | |
/** | |
* processStudentDataForRegularTabulationRegister | |
* @param studentDetails | |
* @return studentDetails | |
* @author Krishnajith | |
*/ | |
public function processStudentDataForRegularTabulationRegister($studentMarkDetails,$request,$examRegistrationDetails = null){ | |
try{ | |
$response = new \stdClass; | |
$displaySubjectArray = []; | |
$studentsDetails = []; | |
$isCurrentSemester = true; | |
foreach($studentMarkDetails as $student){ | |
$student->roundOff = 2; | |
$studentsDetails[$student->id]->id = $student->id; | |
$studentsDetails[$student->id]->name = $student->studentDetails->name; | |
$studentsDetails[$student->id]->cgpa = $student->cgpa; | |
$studentsDetails[$student->id]->grade = $student->grade; | |
$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; | |
foreach($academicTerm->markHistory as $semMarkHistory){ | |
if($semMarkHistory->examRegistrationId == $request->examRegistrationId){ | |
$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]->semesterCreditGradePoint = $semMarkHistory->gradePoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examMonth = $semMarkHistory->examMonth; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->examYear = $semMarkHistory->examYear; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterCreditPoint = $semMarkHistory->creditPoint; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterSgpa = sprintf('%0.2f', $semMarkHistory->sgpa); | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterTotalMarks = $academicTerm->totalMarks; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->semesterMarkObtained = $semMarkHistory->markObtained; | |
$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]->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){ | |
$subject->totalMinimum = $subject->consolidatedMarkDetails->aggregatePassPercentage? ($subject->totalMarks * $subject->consolidatedMarkDetails->aggregatePassPercentage)/100 : 0; | |
$displaySubjectArray[$subject->id]= $subject; | |
$subject->internalMaxMark = $subject->isInternal ? $subject->internalMaxMark : '-'; | |
$subject->externalMaxMark = $subject->isExternal ? $subject->externalMaxMark : '-'; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id] = $subject; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->externalMark = (float)$subject->externalMark; | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->percentage = round($subject->percentage,2); | |
$studentsDetails[$student->id]->academicTerms[$academicTerm->id]->subjects[$subject->id]->markObtainedInWord = strtoupper(CommonUtil::convertNumberToWords((int)$subject->markObtained)); | |
$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]->excludeSubjectFromTotal = $subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1' ? 1 : 0; | |
} | |
$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; | |
} | |
} | |
$response->studentsDetails = $studentsDetails; | |
$response->displaySubjects = $displaySubjectArray; | |
return $response; | |
} | |
catch (\Exception $e){ | |
throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
} | |
} | |
} | |