Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 417 |
Template16ConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 7 |
5852.00 | |
0.00% |
0 / 417 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
processData | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 18 |
|||
renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 81 |
|||
processStudentData | |
0.00% |
0 / 1 |
3080.00 | |
0.00% |
0 / 243 |
|||
getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 59 |
|||
getSgpaByMonthYear | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 7 |
|||
processStudentSubjectDataForCourseFileTemplate | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
<?php | |
// Template Consilidated Generator For VES Colleges | |
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\core\ams\professional\util\CommonUtil; | |
use com\linways\ec\core\service\CommonExamService; | |
use com\linways\ec\core\constant\AttendanceStatusConstant; | |
use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants; | |
use com\linways\ec\core\service\RegularConsolidatedMarkListGenerator\RegularConsolidatedMarkListResultDataGenerator; | |
use com\linways\core\ams\professional\service\AmsCustomFieldsService; | |
use com\linways\core\ams\professional\constant\AmsCustomFieldsEntities; | |
use com\linways\ec\core\service\MarksCardService; | |
use com\linways\ec\core\service\ExamValuationService; | |
class Template16ConsolidatedResultGenerator extends RegularConsolidatedMarkListResultDataGenerator | |
{ | |
public function __construct(){} | |
protected function getTemplateName($request){ | |
$templateName = "template_16"; | |
$examRegistrationDetails = new \stdClass; | |
$examRegistrationDetailsArray = ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($request); | |
if(empty($examRegistrationDetailsArray)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
return $templateName; | |
} | |
/** | |
* Process Student data college base | |
* | |
* @param $request | |
*/ | |
protected function processData($request){ | |
$response = new \stdClass; | |
$studentsMarkDetails = []; | |
$studentsMarkDetails = StudentMarkListService::getInstance()->getAllRegistredStudentMarkDetailsDummyData($request); | |
$examRegistrationData = $this->getExamRegistrationDetailsData($request); | |
if(empty($studentsMarkDetails)){ | |
throw new ExamControllerException(ExamControllerException::NO_DETAILS_FOUND,"No Details Found"); | |
} | |
$examRegistrationData->examAcademicYear = ($examRegistrationData->batchStartYear + (floor(($examRegistrationData->semInSemNumber - 1) / 2))) ." - ".($examRegistrationData->batchStartYear + (floor(($examRegistrationData->semInSemNumber - 1) / 2)) + 1); | |
$responseOfStudentData = $this->processStudentData($studentsMarkDetails,$request, $examRegistrationData); | |
$response->studentData = $responseOfStudentData->studentsDetails; | |
$response->totalStudentData = $responseOfStudentData->totalStudentDetails; | |
$response->examRegistrationData = $examRegistrationData; | |
$response->hideExternalOrInternalMark = $request->hideExternalOrInternalMark; | |
$response->currentDate = date('d-M-y H:i'); | |
$response->hideSeal = $request->hideSeal; | |
$response->collegeData = CommonExamService::getInstance()->getCollegeDetails($request); | |
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 = ""; | |
if($data->hideExternalOrInternalMark){ | |
$responseHtml .= "<style> | |
.hideExternalOrInternalMark {display:none;} | |
.hideMarks {display:none;} | |
</style>"; | |
} | |
if($data->hideSeal){ | |
$responseHtml .= "<style> | |
.hideImages {display:none;} | |
</style>"; | |
} | |
$studentData = $data->studentData; | |
$data->totalPages = (int)(ceil(count($studentData) / 10)); | |
$studentChunks = array_chunk($studentData, 10, true); | |
$data->count = 0; | |
$count = 0; | |
foreach($studentChunks as $studentChunk){ | |
$data->count++; | |
$data->slNo = $count; | |
$data->studentData = $studentChunk; | |
$responseHtml .= TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/RegularConsolidatedMarkList/Template16/$templateName.twig"), [ 'data'=>$data ]); | |
$count += count($studentChunk); | |
} | |
$prtContent = NULL; | |
$prtContent .= '<html><head>'; | |
$prtContent .= "<style> | |
.border-black td, .border-black th{ | |
border:1px solid #000 !important; | |
height:9mm; | |
vertical-align:middle; | |
background-color: #fff !important; | |
word-break: normal !important; | |
} | |
td, th{ | |
padding: 5px !important; | |
} | |
.bold{ | |
font-weight: 700 !important; | |
} | |
.no-border{ | |
border:1px solid #fff !important; | |
} | |
.no-border-top{ | |
border-top:1px solid #fff !important; | |
border-left:1px solid #fff !important; | |
border-right:1px solid #fff !important; | |
border-bottom:1px solid #000 !important; | |
} | |
table{ | |
border:1px solid #000 !important; | |
} | |
</style>"; | |
$prtContent .= '</head><title>Consolidated MarkList</title><body>'; | |
$prtContent .= $responseHtml; | |
$prtContent .= '</body></html>'; | |
$totalSubjectsCount = count(reset($studentData)->subjects) < 8 ? 8 : count(reset($studentData)->subjects); | |
$totalWidth = ( $totalSubjectsCount * 3 * 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); | |
$programResult->isShowHideExternalOrInternalMark = true; | |
$programResult->isShowHideSeal = true; | |
return $programResult; | |
} | |
} | |
protected function processStudentData($studentsMarkDetails,$examRegistrationRequest,$examRegistrationData){ | |
$response = new \stdClass; | |
$totalStudentDetails = new \stdClass; | |
$totalStudentDetails->totalStudents = count($studentsMarkDetails); | |
$studentsDetails = []; | |
$prviousHead = []; | |
$previousSubject = []; | |
$currentSubject = []; | |
$currentHead = []; | |
$sgpaSearchReq = new \stdClass(); | |
// $sgpaSearchReq->groupId = $examRegistrationRequest->groupId; | |
$sgpaSearchReq->sgpaStudentId = array_unique(array_column($studentsMarkDetails, 'id')); | |
$sgpaSearchReq->studentWithSgpa = 1; | |
$sgpaStudentList = ExamValuationService::getInstance()->getStudentDetailsForSgpaDirectEntry($sgpaSearchReq); | |
uasort($studentsMarkDetails, function($a, $b) { | |
return ($a->studentDetails->rollNo > $b->studentDetails->rollNo); | |
}); | |
foreach($studentsMarkDetails as $student){ | |
$currentAcademicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($examRegistrationRequest){ | |
return $value->examRegistrationId == $examRegistrationRequest->examRegistrationId; | |
})); | |
$studentsDetails[$student->id]->id = $student->id; | |
$customFields = AmsCustomFieldsService::getInstance()->getAmsCustomFieldValue(AmsCustomFieldsEntities::STUDENT, $student->id, []); | |
if( $customFields ){ | |
$studentsDetails[$student->id]->ktuCode = CommonExamService::getInstance()->getCustomFieldObjectList($customFields)->studentData->KTU_CODE; | |
} | |
$studentsDetails[$student->id]->name = $student->studentDetails->name; | |
$studentsDetails[$student->id]->failedStatus = $currentAcademicTerm->failedStatus; | |
$studentsDetails[$student->id]->registerNo = $student->studentDetails->registerNo; | |
$studentsDetails[$student->id]->rollNo = $student->studentDetails->rollNo; | |
$studentsDetails[$student->id]->universityExamSeatNo = $student->universityExamSeatNo; | |
$studentsDetails[$student->id]->gender = $student->studentDetails->gender; | |
$studentsDetails[$student->id]->motherName = $student->studentDetails->motherName; | |
// $studentSubjectRequest = new \stdClass(); | |
// $studentSubjectRequest->studentId = $student->id; | |
// $studentSubjectRequest->examMonthLimit = $examRegistrationData->examMonth; | |
// $studentSubjectRequest->examYearLimit = $examRegistrationData->examYear; | |
// $studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
$subjectHistory = []; | |
$totalCredit = 0; | |
$earnedCredit = 0; | |
$earnedCreditPoint = 0; | |
$semesterCgpa = 0; | |
$studentPassedPaper =[]; | |
$studentFailedPaper =[]; | |
// foreach($studentSubjectHistory as $studentHistory){ | |
// if($studentHistory->excludeSubjectFromTotal != 1){ | |
// if($studentHistory->subjectFailedStatus == "PASSED"){ | |
// $studentPassedPaper[$studentHistory->academicOrderNo]->subject[$studentHistory->paperSubjectId] = $studentHistory->paperSubjectId; | |
// } | |
// else{ | |
// $studentFailedPaper[$studentHistory->academicOrderNo]->subject[$studentHistory->paperSubjectId] = $studentHistory->paperSubjectId; | |
// } | |
// } | |
// } | |
// foreach($studentFailedPaper as $failedSemKey => $failedSem){ | |
// foreach($failedSem as $failedSubjects){ | |
// foreach($failedSubjects as $failedSubject){ | |
// if($studentPassedPaper[$failedSemKey]->subject[$failedSubject]){ | |
// unset($studentFailedPaper[$failedSemKey]->subject[$failedSubject]); | |
// } | |
// } | |
// } | |
// } | |
$semesterMarksRequest = new \stdClass; | |
// $semesterMarksRequest->groupId = $student->studentDetails->batchId; | |
$semesterMarksRequest->studentId = $student->id; | |
$semesterMarks = MarksCardService::getInstance()->getStudentSemesterMarkDetails($semesterMarksRequest); | |
foreach($semesterMarks as $semKey => $semester){ | |
if($examRegistrationData->semInSemNumber < $semester->orderNo){ | |
unset($semesterMarks[$semKey]); | |
continue; | |
} | |
$currentHistory = $this->getSgpaByMonthYear($semester->markHistory, $examRegistrationData); | |
$semester->sgpa =sprintf('%0.2f', ($currentHistory->sgpa + $currentHistory->sgpaAddonMark)); | |
$semester->totalCredit = $semester->markDetails->credit; | |
$semester->markDetails->isFailed = $currentHistory->failedStatus == "FAILED" ? 1 : 0; | |
$semester->markDetails->arrearCount = 0; | |
foreach($semester->subjects as $subject){ | |
$currentSubject = $this->getSgpaByMonthYear($subject->subjectMarkHistory, $examRegistrationData); | |
if (count($subject->subjectMarkHistory) > 1){ | |
$regularStudentHistory = reset(array_filter($subject->subjectMarkHistory,function($value){ | |
return $value->examMarkType == "REGULAR"; | |
})); | |
if( $regularStudentHistory && ($currentSubject->internalMark != $regularStudentHistory->internalMark) ){ | |
if( empty($currentSubject->externalMarkObtainedInExam ) && !$regularStudentHistory->isExternalFailed ){ | |
$currentSubject->resultStatus = $subject->markDetails->isFailed ? 'FAILED' : 'PASSED'; | |
} | |
} | |
} | |
$subject->earnedCredit = $currentSubject->resultStatus == "FAILED" ? 0 : $subject->markDetails->credit; | |
$semester->markDetails->arrearCount = $currentSubject->resultStatus == "FAILED" ? $semester->markDetails->arrearCount+1 : $semester->markDetails->arrearCount; | |
} | |
$semester->totalEarnedCredit = array_sum(array_column($semester->subjects,'earnedCredit')); | |
} | |
$semArray = []; | |
foreach($semesterMarks as $semester){ | |
$semArray[$semester->orderNo] = $semester->markDetails->arrearCount; | |
} | |
$failedArray = []; | |
$studentIdForSgpa = $student->id; | |
for( $i = 1; $i <= 4; $i++){ | |
$studentEnteredSgpa = reset(array_filter($sgpaStudentList,function($value)use($i, $studentIdForSgpa){ | |
return $value->academicTermId == $i && $value->studentId == $studentIdForSgpa; | |
})); | |
if ( $studentEnteredSgpa ){ | |
$failedArray[$i] = 0; | |
} | |
elseif($semArray[$i]){ | |
$failedArray[$i] = $semArray[$i]; | |
} | |
else{ | |
$failedArray[$i] = 0; | |
} | |
} | |
$studentsDetails[$student->id]->semPassStatus = implode('/',$failedArray); | |
$studentsDetails[$student->id]->cureentSemFailCount = $failedArray[$examRegistrationData->semInSemNumber]; | |
if((int)$studentsDetails[$student->id]->cureentSemFailCount > 2 ){ | |
$studentsDetails[$student->id]->resultStatus = "Fail"; | |
} | |
elseif((int)$studentsDetails[$student->id]->cureentSemFailCount <= 2 && (int)$studentsDetails[$student->id]->cureentSemFailCount > 0 ){ | |
$studentsDetails[$student->id]->resultStatus = "ATKT"; | |
} | |
else{ | |
$studentsDetails[$student->id]->resultStatus = "Pass"; | |
} | |
// $semesterCgpa = $earnedCreditPoint ? ($earnedCreditPoint/$totalCredit) : 0; | |
foreach($student->academicTerms[0]->markHistory as $semMarkHistory){ | |
if($semMarkHistory->examRegistrationId == $examRegistrationRequest->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]->semesterCredit = $earnedCredit; | |
$studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $semMarkHistory->sgpa); | |
$studentsDetails[$student->id]->semesterCgpa = sprintf('%0.2f', $semesterCgpa); | |
$studentsDetails[$student->id]->semesterMarkObtained = $semMarkHistory->markObtained; | |
$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; | |
$studentsDetails[$student->id]->semesterGradeUpgradedMark = round($semMarkHistory->semesterGradeUpgradedMark); | |
$studentsDetails[$student->id]->hashTotalGraceMark = round($semMarkHistory->hashTotalGraceMark); | |
$studentsDetails[$student->id]->semesterGraceMark = round($semMarkHistory->semesterGraceMark); | |
$studentsDetails[$student->id]->sgpaAddonMark = $semMarkHistory->sgpaAddonMark ? sprintf('%0.2f', $semMarkHistory->sgpaAddonMark) : ""; | |
} | |
} | |
if( empty($prviousHead)){ | |
$studentsDetails[$student->id]->initialHead = 1; | |
$studentsDetails[$student->id]->headRequired = 1; | |
} | |
$currentHead = []; | |
$currentSubject = []; | |
$studentsDetails[$student->id]->gradeUpgradedMark = 0; | |
foreach($student->academicTerms[0]->subjects as $subject){ | |
$currentHead[$subject->id] = $subject->id; | |
$subject->code = $subject->subjectDesc ? $subject->subjectDesc : $subject->code; | |
if ($student->studentDetails->degree == "BSC"){ | |
$subjectClassType = $subject->classType == "THEORY" ? "_Th" : ( $subject->classType == "PRACTICAL" ? "_Pr" : ""); | |
$subject->code = $subject->code.$subjectClassType; | |
} | |
$currentSubject[$subject->id]->id = $subject->id; | |
$currentSubject[$subject->id]->name = $subject->name; | |
$currentSubject[$subject->id]->code = $subject->code; | |
$studentsDetails[$student->id]->subjects[$subject->id]->id = $subject->id; | |
$studentsDetails[$student->id]->subjects[$subject->id]->name = $subject->name; | |
$studentsDetails[$student->id]->subjects[$subject->id]->code = $subject->code; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->class = $subject->class; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->grade; | |
$studentsDetails[$student->id]->subjects[$subject->id]->percentage = round($subject->percentage,2); | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $subject->internalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = sprintf('%02d', $studentsDetails[$student->id]->subjects[$subject->id]->internalMark); | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = $subject->externalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMarkObtainedInExam = reset($subject->subjectMarkHistory)->externalMarkObtainedInExam; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalGraceMark = reset($subject->subjectMarkHistory)->internalGraceMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalHashGraceMark = reset($subject->subjectMarkHistory)->internalHashGraceMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMarkObtainedInExam = sprintf('%02d', $studentsDetails[$student->id]->subjects[$subject->id]->externalMarkObtainedInExam); | |
$studentsDetails[$student->id]->subjects[$subject->id]->graceMark = round(reset($subject->subjectMarkHistory)->graceMark); | |
$studentsDetails[$student->id]->subjects[$subject->id]->gradeUpgradedMark = round(reset($subject->subjectMarkHistory)->gradeUpgradedMark); | |
$studentsDetails[$student->id]->gradeUpgradedMark += round(reset($subject->subjectMarkHistory)->gradeUpgradedMark); | |
$studentsDetails[$student->id]->subjects[$subject->id]->hasCondonationGraceMark = reset($subject->subjectMarkHistory)->hasCondonationGraceMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalGraceMark = round(reset($subject->subjectMarkHistory)->externalGraceMark); | |
if ($studentsDetails[$student->id]->subjects[$subject->id]->hasCondonationGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalGraceMarkToDisplay = $studentsDetails[$student->id]->subjects[$subject->id]->externalGraceMark + $studentsDetails[$student->id]->subjects[$subject->id]->internalGraceMark; | |
} | |
$studentsDetails[$student->id]->subjects[$subject->id]->hashGraceMark = round(reset($subject->subjectMarkHistory)->hashGraceMark); | |
$studentsDetails[$student->id]->subjects[$subject->id]->revaluationMark = round(reset($subject->subjectMarkHistory)->revaluationMark); | |
$studentsDetails[$student->id]->subjects[$subject->id]->moderationMark = round(reset($subject->subjectMarkHistory)->moderationMark); | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalMarks = $subject->totalMarks; | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained = $subject->markObtained; | |
if($studentsDetails[$student->id]->subjects[$subject->id]->totalGraceMarkToDisplay){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalGraceMarkToDisplay += $studentsDetails[$student->id]->subjects[$subject->id]->hashGraceMark ; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->internalGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $studentsDetails[$student->id]->subjects[$subject->id]->internalMark - $studentsDetails[$student->id]->subjects[$subject->id]->internalGraceMark; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->internalHashGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = $studentsDetails[$student->id]->subjects[$subject->id]->internalMark - $studentsDetails[$student->id]->subjects[$subject->id]->internalHashGraceMark; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->graceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained -= $studentsDetails[$student->id]->subjects[$subject->id]->graceMark; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->gradeUpgradedMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained -= $studentsDetails[$student->id]->subjects[$subject->id]->gradeUpgradedMark; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->internalGraceMark && $studentsDetails[$student->id]->subjects[$subject->id]->hasCondonationGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained -= $studentsDetails[$student->id]->subjects[$subject->id]->internalGraceMark; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->externalGraceMark && $studentsDetails[$student->id]->subjects[$subject->id]->hasCondonationGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained -= $studentsDetails[$student->id]->subjects[$subject->id]->externalGraceMark; | |
} | |
if($studentsDetails[$student->id]->subjects[$subject->id]->hashGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained -= $studentsDetails[$student->id]->subjects[$subject->id]->hashGraceMark; | |
if($studentsDetails[$student->id]->subjects[$subject->id]->externalGraceMark && $studentsDetails[$student->id]->subjects[$subject->id]->hasCondonationGraceMark){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained += $studentsDetails[$student->id]->subjects[$subject->id]->totalGraceMarkToDisplay; | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalGraceMarkToDisplay = ''; | |
} | |
} | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained = sprintf('%02d', $studentsDetails[$student->id]->subjects[$subject->id]->markObtained); | |
$studentsDetails[$student->id]->subjects[$subject->id]->gradePoint = $subject->gradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->creditGradePoint = $subject->creditGradePoint; | |
$studentsDetails[$student->id]->subjects[$subject->id]->failedStatus = $subject->isFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->credit = $subject->credit; | |
$studentsDetails[$student->id]->subjects[$subject->id]->wgpa = $subject->wgpa; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isExternalFailed = $subject->isExternalFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isInternalFailed = $subject->isInternalFailed; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isInternal = $subject->isInternal; | |
$studentsDetails[$student->id]->subjects[$subject->id]->isExternal = $subject->isExternal; | |
$studentsDetails[$student->id]->subjects[$subject->id]->categoryId = $subject->categoryId; | |
$studentsDetails[$student->id]->subjects[$subject->id]->categoryName = $subject->categoryName; | |
$studentsDetails[$student->id]->subjects[$subject->id]->attendanceStatus = $subject->attendanceStatus; | |
if($subject->internalAttendanceStatus == AttendanceStatusConstant::ABSENT){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->internalMark = 'AB'; | |
} | |
// if($subject->attendanceStatus == AttendanceStatusConstant::MALPRACTICE){ | |
// $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = "MAL"; | |
// } | |
// if($subject->attendanceStatus == AttendanceStatusConstant::ABSENT){ | |
// $studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'AB'; | |
// } | |
if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subject->attendanceStatus == AttendanceStatusConstant::ABSENT){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMarkObtainedInExam = 'AB'; | |
if($subject->internalAttendanceStatus == 'ABSENT'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained = 'AB'; | |
} | |
} | |
else if($subject->attendanceStatus == AttendanceStatusConstant::MALPRACTICE){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMarkObtainedInExam = '00'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
if($subject->failedStatus == 'FAILED'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
} | |
if($studentsDetails[$student->id]->gradeUpgradedMark){ | |
$studentsDetails[$student->id]->semesterMarkObtained -= $studentsDetails[$student->id]->gradeUpgradedMark; | |
} | |
$diffArray = array_diff($currentHead, $prviousHead); | |
if($diffArray){ | |
$studentsDetails[$student->id]->headRequired = 1; | |
$previousSubject = $currentSubject; | |
} | |
$studentsDetails[$student->id]->subjectHead = $previousSubject; | |
$prviousHead = $currentHead; | |
} | |
$totalStudentDetails->passPercentage = round(100 * ( $totalStudentDetails->passStudents / $totalStudentDetails->totalStudents),2); | |
$studentsDetails = array_values($studentsDetails); | |
$slNo = 1; | |
foreach($studentsDetails as $student){ | |
$student->slNo = $slNo++; | |
$student->subjects = array_values($student->subjects); | |
} | |
// $duplicateArrays = array_fill(0, 3, $studentsDetails); | |
// // Merge the duplicate arrays into a single array | |
// $studentsDetails = array_merge(...$duplicateArrays); | |
$response->studentsDetails = $studentsDetails; | |
$response->totalStudentDetails = $totalStudentDetails; | |
return $response; | |
} | |
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->examYear = reset($examRegistrationDetailsArray)->examYear; | |
$examRegistrationDetails->examMonth = reset($examRegistrationDetailsArray)->examMonth; | |
$examRegistrationDetails->examMonthName = reset($examRegistrationDetailsArray)->examMonthName; | |
$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->academicTermName = reset($examRegistrationDetailsArray)->groups[0]->academicTermName; | |
$examRegistrationDetails->academicTermYear = reset($examRegistrationDetailsArray)->groups[0]->academicTermYear; | |
$examRegistrationDetails->academicTermYearRoman = strtoupper(CommonUtil::convertNumberToRoman($examRegistrationDetails->academicTermYear)); | |
$examRegistrationDetails->academicTermId = reset($examRegistrationDetailsArray)->groups[0]->academicTermId; | |
$semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($examRegistrationDetails->academicTermName); | |
$examRegistrationDetails->semInRomanLetter = $semesterNames->romanLetter; | |
$examRegistrationDetails->semInFullName = $semesterNames->fullName; | |
$examRegistrationDetails->semInSemNumber = $semesterNames->semNumber; | |
$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->degreeDescription = reset($examRegistrationDetailsArray)->groups[0]->degreeDescription; | |
$examRegistrationDetails->programName = reset($examRegistrationDetailsArray)->groups[0]->programName; | |
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]->isInternal = $subject->isInternal; | |
$examRegistrationDetails->subjects[$subject->id]->isExternal = $subject->isExternal; | |
$examRegistrationDetails->subjects[$subject->id]->credit = $subject->credit; | |
$examRegistrationDetails->subjects[$subject->id]->id = $subject->id; | |
$examRegistrationDetails->subjects[$subject->id]->externalMaxMark = $subject->externalMaxMark; | |
$examRegistrationDetails->subjects[$subject->id]->internalMaxMark = $subject->internalMaxMark; | |
$examRegistrationDetails->subjects[$subject->id]->totalSubjectMark = $subject->totalSubjectMark; | |
if(!$request->hideExternalOrInternalMark){ | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = 4; | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = $examRegistrationDetails->subjects[$subject->id]->isInternal ? $examRegistrationDetails->subjects[$subject->id]->subColSpan + 1 : $examRegistrationDetails->subjects[$subject->id]->subColSpan; | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = $examRegistrationDetails->subjects[$subject->id]->isExternal ? $examRegistrationDetails->subjects[$subject->id]->subColSpan + 1 : $examRegistrationDetails->subjects[$subject->id]->subColSpan; | |
} | |
else{ | |
$examRegistrationDetails->subjects[$subject->id]->subColSpan = 1; | |
} | |
} | |
$examRegistrationDetails->totalColSpan = 8; | |
$examRegistrationDetails->subjectColspan = 1; | |
if(!$request->hideExternalOrInternalMark){ | |
$examRegistrationDetails->subjectColspan = 2; | |
} | |
foreach($examRegistrationDetails->subjects as $subject){ | |
$examRegistrationDetails->totalColSpan = $examRegistrationDetails->totalColSpan + $subject->subColSpan; | |
} | |
$examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
return $examRegistrationDetails; | |
} | |
protected function getSgpaByMonthYear($markHistory, $request){ | |
$currentHistory = ''; | |
$currentHistory = array_filter($markHistory,function($value)use($request){ | |
return $value->examYear."-".date("m", mktime(0, 0, 0, (int)$value->examMonth, 10)) <= $request->examYear."-".date("m", mktime(0, 0, 0, (int)$request->examMonth, 10)); | |
}); | |
usort($currentHistory, function($a, $b) { | |
return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))); | |
}); | |
return reset($currentHistory); | |
} | |
protected function processStudentSubjectDataForCourseFileTemplate($studentsList){ | |
} | |
} |