Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 487 |
Template6ConsolidatedResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
12882.00 | |
0.00% |
0 / 487 |
__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 / 16 |
|||
renderConsolidatedMarkListResult | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 70 |
|||
processStudentData | |
0.00% |
0 / 1 |
2862.00 | |
0.00% |
0 / 215 |
|||
getExamRegistrationDetailsData | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 69 |
|||
processStudentSubjectDataForCourseFileTemplate | |
0.00% |
0 / 1 |
1560.00 | |
0.00% |
0 / 109 |
<?php | |
// Template Consilidated Generator For SAINTGITS 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\request\SearchExamRegistrationRequest; | |
class Template6ConsolidatedResultGenerator extends RegularConsolidatedMarkListResultDataGenerator | |
{ | |
public function __construct(){} | |
protected function getTemplateName($request){ | |
$templateName = "template_6"; | |
$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"); | |
} | |
$responseOfStudentData = $this->processStudentData($studentsMarkDetails,$request, $examRegistrationData); | |
$response->studentData = $responseOfStudentData->studentsDetails; | |
$response->totalStudentData = $responseOfStudentData->totalStudentDetails; | |
$response->examRegistrationData = $examRegistrationData; | |
$response->hideExternalOrInternalMark = $request->hideExternalOrInternalMark; | |
$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>"; | |
} | |
$responseHtml .= TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/RegularConsolidatedMarkList/Template6/$templateName.twig"), [ 'data'=>$data ]); | |
$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($data->examRegistrationData->subjects); | |
$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); | |
$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 = []; | |
if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
$requestForExamRegistration = new SearchExamRegistrationRequest; | |
$requestForExamRegistration->groupId = $examRegistrationRequest->groupId; | |
$revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
} | |
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; | |
$studentSubjectRequest = new \stdClass(); | |
$studentSubjectRequest->studentId = $student->id; | |
$studentSubjectRequest->examMonthLimit = $examRegistrationData->examMonth; | |
$studentSubjectRequest->examYearLimit = $examRegistrationData->examYear; | |
$studentSubjectRequest->examRegistrationType = "REGULAR"; | |
$studentSubjectRequest->academicTermId = $currentAcademicTerm->academicTermId; | |
$studentSubjectRequest->isHonorCourse = $examRegistrationData->isHonorCourse; | |
$studentSubjectRequest->isMinorCourse = $examRegistrationData->isMinorCourse; | |
$studentSubjectHistory = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
$studentSubjectRequest = new \stdClass(); | |
$studentSubjectRequest->studentId = $student->id; | |
$studentSubjectRequest->upToAcademicTermOrderNoExceptCurrent = $examRegistrationData->academicOrderNo; | |
$studentSubjectRequest->isHonorCourse = $examRegistrationData->isHonorCourse; | |
$studentSubjectRequest->isMinorCourse = $examRegistrationData->isMinorCourse; | |
$studentSubjectHistory2 = StudentMarkListService::getInstance()->getAllStudentSubjectMarkDetailsByRequest($studentSubjectRequest); | |
$studentSubjectHistory = array_merge($studentSubjectHistory,$studentSubjectHistory2); | |
$subjectHistory = []; | |
$totalCredit = 0; | |
$earnedCredit = 0; | |
$earnedCreditPoint = 0; | |
$earnedCreditForDisplay = 0; | |
$semesterCgpa = 0; | |
$additionalCreditRequest = new \stdClass; | |
$additionalCreditRequest->studentId = $student->id; | |
$additionalCreditRequest->creditType = "CREDIT_TRANSFERED"; | |
$additionalCreditRequest->requestForList = 1; | |
$additionalCredit = CommonExamService::getInstance()->getStudentAdditionalCredits($additionalCreditRequest); | |
$semWiseAdditionalCredit = 0; | |
if( $additionalCredit ){ | |
$semIdRequestedForEarnedCredit = $currentAcademicTerm->academicTermId; | |
$semWiseAdditionalCreditArray = array_filter($additionalCredit, function($item) use($semIdRequestedForEarnedCredit) { | |
return $item->termId <= $semIdRequestedForEarnedCredit; | |
}); | |
$semWiseAdditionalCredit = array_sum( array_column($semWiseAdditionalCreditArray, 'credit')); | |
} | |
foreach($studentSubjectHistory as $studentHistory){ | |
if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
if ( $studentHistory->subjectHasRevaluationMark ){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($studentHistory){ | |
return $value->id == $studentHistory->subjectRevaluationId; | |
})); | |
$revaluationBatch = reset($currentRegistration->groups); | |
if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
$studentHistory->subjectFailedStatus = $studentHistory->subjectWithoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
$studentHistory->subjectCreditGradePoint = $studentHistory->subjectWithoutRevaluationCreditGradePoint; | |
} | |
} | |
} | |
if($subjectHistory[$studentHistory->paperSubjectId]){ | |
if($subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint < $studentHistory->subjectCreditGradePoint){ | |
if($studentHistory->excludeSubjectFromTotal != 1){ | |
$earnedCreditPoint += ($studentHistory->subjectCreditGradePoint - $subjectHistory[$studentHistory->paperSubjectId]->subjectCreditGradePoint); | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
if($studentHistory->subjectFailedStatus == "PASSED"){ | |
$earnedCredit += $studentHistory->credit; | |
} | |
} | |
else{ | |
if($studentHistory->subjectFailedStatus == "PASSED"){ | |
$earnedCreditForDisplay += $studentHistory->credit; | |
} | |
} | |
} | |
} | |
else{ | |
if($studentHistory->excludeSubjectFromTotal != 1){ | |
$earnedCreditPoint += $studentHistory->subjectCreditGradePoint; | |
$totalCredit += $studentHistory->credit; | |
$subjectHistory[$studentHistory->paperSubjectId] = $studentHistory; | |
if($studentHistory->subjectFailedStatus == "PASSED"){ | |
$earnedCredit += $studentHistory->credit; | |
} | |
} | |
else{ | |
if($studentHistory->subjectFailedStatus == "PASSED"){ | |
$earnedCreditForDisplay += $studentHistory->credit; | |
} | |
} | |
} | |
} | |
$semesterCgpa = $earnedCreditPoint ? ($earnedCreditPoint/$totalCredit) : 0; | |
$earnedCreditForDisplay += $earnedCredit; | |
$earnedCreditForDisplay += $semWiseAdditionalCredit; | |
foreach($student->academicTerms[0]->markHistory as $semMarkHistory){ | |
if($semMarkHistory->examRegistrationId == $examRegistrationRequest->examRegistrationId){ | |
if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
if ( $semMarkHistory->hasRevaluationMark ){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($semMarkHistory){ | |
return $value->id == $semMarkHistory->revaluationId; | |
})); | |
$revaluationBatch = reset($currentRegistration->groups); | |
if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
$semMarkHistory->sgpa = $semMarkHistory->withoutRevaluationsgpa; | |
$semMarkHistory->failedStatus = $semMarkHistory->withoutRevaluationFailedStatus; | |
} | |
} | |
} | |
$studentsDetails[$student->id]->examRegistrationWiseFailedStatus = $semMarkHistory->failedStatus; | |
$studentsDetails[$student->id]->failedStatus = $semMarkHistory->failedStatus; | |
$studentsDetails[$student->id]->semesterGrade = $semMarkHistory->grade; | |
$studentsDetails[$student->id]->semesterCreditGradePoint = $semMarkHistory->gradePoint; | |
$studentsDetails[$student->id]->semesterCredit = $earnedCredit; | |
$studentsDetails[$student->id]->semesterearnedCreditForDisplay = $earnedCreditForDisplay; | |
$studentsDetails[$student->id]->semesterSgpa = sprintf('%0.2f', $semMarkHistory->sgpa); | |
$studentsDetails[$student->id]->semesterCgpa = sprintf('%0.2f', round($semesterCgpa, 2)); | |
$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; | |
if ( $examRegistrationData->isMinorCourse || $examRegistrationData->isHonorCourse) { | |
$studentsDetails[$student->id]->semesterSgpa = "-"; | |
$studentsDetails[$student->id]->semesterCgpa = "-"; | |
} | |
} | |
} | |
foreach($student->academicTerms[0]->subjects as $subject){ | |
if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
if ( $subject->subjectHasRevaluationMark ){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subject){ | |
return $value->id == $subject->subjectRevaluationId; | |
})); | |
$revaluationBatch = reset($currentRegistration->groups); | |
if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
$subject->failedStatus = $subject->subjectWithoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
$subject->isFailed = $subject->failedStatus; | |
$subject->grade = $subject->subjectWithoutRevaluationGrade; | |
} | |
} | |
} | |
$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]->externalMark = $subject->externalMark; | |
$studentsDetails[$student->id]->subjects[$subject->id]->totalMarks = $subject->totalMarks; | |
$studentsDetails[$student->id]->subjects[$subject->id]->markObtained = $subject->markObtained; | |
$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 = ($examRegistrationData->courseTypeName == CourseTypeConstants::MBA) ? 'AB' : 'I'; | |
} | |
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 = ($examRegistrationData->courseTypeName == CourseTypeConstants::MBA) ? 'AB' : 'I'; | |
} | |
if($subject->consolidatedMarkDetails->excludeSubjectFromTotal == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subject->attendanceStatus == 'ABSENT'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $examRegistrationData->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
} | |
else if($subject->attendanceStatus == 'MALPRACTICE'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = 'MAL'; | |
// $studentsDetails[$student->id]->subjects[$subject->id]->grade = 'MAL'; | |
} | |
else if($subject->failedStatus == 'FAILED'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'F'; | |
} | |
if($subject->studentInternalAttendanceStatus == 'FE'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = 'FE'; | |
$studentsDetails[$student->id]->subjects[$subject->id]->externalMark = '-'; | |
} | |
if($subject->isMoocSubject == '1'){ | |
$studentsDetails[$student->id]->subjects[$subject->id]->grade = $subject->isFailed == "PASSED" ? 'P' : 'F' ; | |
} | |
} | |
$studentsDetails[$student->id]->isResultBlock = false; | |
$studentsDetails[$student->id]->blocResultMsg = ""; | |
if($examRegistrationRequest->isStaffSideExamResultSheet == '1'){ | |
$studentsDetails[$student->id]->isResultBlock = $student->isResultWithHeld == '1' ? true : false; | |
$studentsDetails[$student->id]->blocResultMsg = $student->isResultWithHeld == '1' ? "Result Withheld" : ""; | |
} | |
} | |
$totalStudentDetails->passPercentage = round(100 * ( $totalStudentDetails->passStudents / $totalStudentDetails->totalStudents),2); | |
$studentsDetails = array_values($studentsDetails); | |
foreach($studentsDetails as $student){ | |
$student->subjects = array_values($student->subjects); | |
} | |
$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->academicOrderNo = reset($examRegistrationDetailsArray)->groups[0]->academicOrderNo; | |
$examRegistrationDetails->academicTermYearRoman = strtoupper(CommonUtil::convertNumberToRoman($examRegistrationDetails->academicTermYear)); | |
$examRegistrationDetails->academicTermId = reset($examRegistrationDetailsArray)->groups[0]->academicTermId; | |
$examRegistrationDetails->isHonorCourse = reset($examRegistrationDetailsArray)->properties->isHonorCourse == "1" ? true : false; | |
$examRegistrationDetails->isMinorCourse = reset($examRegistrationDetailsArray)->properties->isMinorCourse == "1" ? true : false; | |
$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; | |
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->disableCollegeRegisterNumber = false; | |
if($examRegistrationDetails->batchStartYear >= '2023'){ | |
$examRegistrationDetails->disableCollegeRegisterNumber = true; | |
$examRegistrationDetails->totalColSpan = 6; | |
if(!$request->hideExternalOrInternalMark){ | |
$examRegistrationDetails->totalColSpan = 7; | |
} | |
} | |
else{ | |
$examRegistrationDetails->totalColSpan = 7; | |
if(!$request->hideExternalOrInternalMark){ | |
$examRegistrationDetails->totalColSpan = 8; | |
} | |
} | |
foreach($examRegistrationDetails->subjects as $subject){ | |
$examRegistrationDetails->totalColSpan = $examRegistrationDetails->totalColSpan + $subject->subColSpan; | |
} | |
$examRegistrationDetails->subjects = array_values($examRegistrationDetails->subjects); | |
return $examRegistrationDetails; | |
} | |
/** | |
* Process Student data for course file | |
* | |
* @param $request | |
*/ | |
// this code for processing exam mark for course file | |
protected function processStudentSubjectDataForCourseFileTemplate($studentsList){ | |
$response = new \stdClass; | |
$studentBatchList = []; | |
$requestForExamRegistration = new SearchExamRegistrationRequest; | |
$requestForExamRegistration->groupId = array_unique(array_column($studentsList,'groupId')); | |
$revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
foreach($studentsList as $studentKey => $student){ | |
$student->errorMsg = ""; | |
$student->isRemoved = false; | |
usort($student->subjectMarkHistory, 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))); | |
}); | |
foreach($student->examRegistrations as $key => $examRegistration){ | |
if( !($examRegistration->batchProperties->isResultPublished ) || (($examRegistration->batchProperties->isResultPublished) && (strtotime($examRegistration->batchProperties->publishingStartDate) > strtotime(date("Y-m-d H:i"))))) { | |
unset($student->examRegistrations[$key]); | |
} | |
else if(($examRegistration->examType) != 'REGULAR'){ | |
if(!empty($examRegistration->blockReasons) || $examRegistration->isResultWithHeld == '1'){ | |
unset($student->examRegistrations[$key]); | |
} | |
} | |
else{ | |
if(!empty($examRegistration->blockReasons)) { | |
$student->errorMsg = "Result Blocked"; | |
} | |
else if($examRegistration->isResultWithHeld == '1'){ | |
$student->errorMsg = "Result Withheld"; | |
} | |
} | |
} | |
$student->examRegistrationIds = array_column($student->examRegistrations,'id'); | |
if(empty($student->examRegistrations)){ | |
unset($studentsList[$studentKey]); | |
$student->isRemoved = true; | |
} | |
if(empty($student->errorMsg)){ | |
$regularHistory = array_filter($student->subjectMarkHistory,function($value){ | |
return $value->examMarkType == "REGULAR"; | |
}); | |
$supplyHistory = array_filter($student->subjectMarkHistory,function($value){ | |
return $value->examMarkType == "SUPPLY"; | |
}); | |
usort($supplyHistory, 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))); | |
}); | |
$student->subjectMarkHistory = array_merge($supplyHistory, $regularHistory); | |
foreach($student->subjectMarkHistory as $subjectMarkHistory){ | |
if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
if ( $subjectMarkHistory->hasRevaluationMark ){ | |
$currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($subjectMarkHistory){ | |
return $value->id == $subjectMarkHistory->revaluationId; | |
})); | |
$revaluationBatch = reset(array_filter($currentRegistration->groups,function($value)use($student){ | |
return $value->id == $student->groupId; | |
})); | |
if ( $revaluationBatch->properties->isResultPublished != 1 || strtotime($revaluationBatch->properties->publishingStartDate) > strtotime(date("Y-m-d H:i"))){ | |
$subjectMarkHistory->resultStatus = $subjectMarkHistory->withoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
$subjectMarkHistory->grade = $subjectMarkHistory->withoutRevaluationGrade; | |
} | |
} | |
$student->grade = $subjectMarkHistory->grade; | |
$student->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
if($student->subjectMarkDetails->excludeSubjectFromTotal == '1'){ | |
$student->grade = $subjectMarkHistory->resultStatus == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subjectMarkHistory->attendanceStatus == 'ABSENT'){ | |
$student->grade = $student->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
} | |
else if($subjectMarkHistory->resultStatus == 'FAILED'){ | |
$student->grade = 'F'; | |
} | |
if($subjectMarkHistory->studentAttendanceStatus == 'FE'){ | |
$student->grade = 'FE'; | |
} | |
$student->examYear = $subjectMarkHistory->examYear; | |
$student->examMonth = $subjectMarkHistory->examMonth; | |
$student->examMonthName = date("F", mktime(0, 0, 0, $student->examMonth, 10)); | |
break; | |
} | |
} | |
if ( $student->attendanceStatus == "ABSENT" ){ | |
foreach($student->subjectMarkHistory as $subjectMarkHistory){ | |
if(in_array($subjectMarkHistory->examRegistrationId,$student->examRegistrationIds)){ | |
if ( ($subjectMarkHistory->attendanceStatus == "PRESENT" && $subjectMarkHistory->studentAttendanceStatus != 'FE') || ($subjectMarkHistory->examMarkType == 'REGULAR' && $subjectMarkHistory->studentAttendanceStatus != 'FE') ){ | |
$student->grade = $subjectMarkHistory->grade; | |
$student->attendanceStatus = $subjectMarkHistory->attendanceStatus; | |
if($student->subjectMarkDetails->excludeSubjectFromTotal == '1'){ | |
$student->grade = $subjectMarkHistory->resultStatus == "PASSED" ? 'P' : 'F' ; | |
} | |
if($subjectMarkHistory->attendanceStatus == 'ABSENT'){ | |
$student->grade = $student->courseTypeName != 'MBA' ? 'I' : 'AB'; | |
} | |
else if($subjectMarkHistory->resultStatus == 'FAILED'){ | |
$student->grade = 'F'; | |
} | |
if($subjectMarkHistory->studentAttendanceStatus == 'FE'){ | |
$student->grade = 'FE'; | |
} | |
$student->examYear = $subjectMarkHistory->examYear; | |
$student->examMonth = $subjectMarkHistory->examMonth; | |
$student->examMonthName = date("F", mktime(0, 0, 0, $student->examMonth, 10)); | |
break; | |
} | |
} | |
} | |
} | |
} | |
if(!$student->isRemoved){ | |
$studentBatchList[$student->groupId]->id = $student->groupId; | |
$studentBatchList[$student->groupId]->name = $student->groupName; | |
$studentBatchList[$student->groupId]->students[] = $student; | |
} | |
} | |
$studentBatchList = array_values($studentBatchList); | |
return $studentBatchList; | |
} | |
} |