Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 478 |
Template3TranscriptResultGenerator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
10100.00 | |
0.00% |
0 / 478 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTemplateName | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 33 |
|||
processData | |
0.00% |
0 / 1 |
6642.00 | |
0.00% |
0 / 394 |
|||
renderTranscriptMarkCardResult | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 43 |
|||
getGradeByPercentage | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 8 |
<?php | |
// Template For SB Colleges | |
namespace com\linways\ec\core\service\TranscriptMarkCardGenerator; | |
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\service\TranscriptMarkCardGenerator\TranscriptMarkCardResultDataGenerator; | |
use com\linways\ec\core\service\MarksCardService; | |
use com\linways\ec\core\service\FinalConsolidatedReportService; | |
use com\linways\ec\core\service\FinalConsolidatdMarksCardGenerator\FCMGenerator; | |
use com\linways\core\ams\professional\service\StudentService; | |
use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants; | |
use com\linways\ec\core\request\SearchExamRegistrationRequest; | |
use com\linways\ec\core\service\ExamRegistrationBatchService; | |
use com\linways\ec\core\request\SearchExamRegistrationBatchRequest; | |
use com\linways\core\ams\professional\constant\ExamType; | |
use com\linways\core\ams\professional\service\academic\AcademicTermService; | |
use com\linways\core\ams\professional\request\academic\SearchAcademicTermRequest; | |
use com\linways\ec\core\service\GradeSchemeService; | |
class Template3TranscriptResultGenerator extends TranscriptMarkCardResultDataGenerator | |
{ | |
public function __construct(){} | |
/** | |
* get Template Name | |
* @param $request | |
* @param $templateName | |
*/ | |
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 = $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; | |
$templateName = "template_3_1"; | |
if (($examRegistrationDetails->courseTypeName == CourseTypeConstants::PG || $examRegistrationDetails->courseTypeName == CourseTypeConstants::MSW )&& $examRegistrationDetails->batchStartYear >= 2019) { | |
$templateName = "template_3_2"; | |
} | |
if ($examRegistrationDetails->courseTypeName == CourseTypeConstants::PG && $examRegistrationDetails->batchStartYear <= 2014) { | |
$templateName = "template_3_3"; | |
} | |
if ($examRegistrationDetails->courseTypeName == CourseTypeConstants::MBA || $examRegistrationDetails->courseTypeName == CourseTypeConstants::LIB) { | |
$templateName = "template_3_4"; | |
} | |
if ($examRegistrationDetails->courseTypeName == CourseTypeConstants::MBA && $examRegistrationDetails->batchStartYear >= 2019) { | |
$templateName = "template_3_5"; | |
} | |
if ($examRegistrationDetails->courseTypeName == CourseTypeConstants::UG) { | |
$templateName = "template_3_6"; | |
} | |
return $templateName; | |
} | |
/** | |
* Process Student data college base | |
* @param $request | |
*/ | |
protected function processData($request){ | |
$response = new \stdClass; | |
$searchRequest = new \stdClass; | |
$response->studentData = reset(MarksCardService::getInstance()->getConsoliidatedMarksCardData($request))->students; | |
$courseType = reset($response->studentData)->courseType; | |
$batchStartYear = reset($response->studentData)->admissionYear; | |
$markListSubjectCategories = MarksCardService::getInstance()->getMarkListSubjectCategories($request->groupId); | |
$searchRequest->groupId = $request->groupId; | |
$CGPAgradeDetails = FinalConsolidatedReportService::getInstance()->getAllGradeScemesByCurriculum($searchRequest); | |
$gradeDetails = FinalConsolidatedReportService::getInstance()->getCGPAGradeScemesByCurriculum($searchRequest); | |
$markListSubjectCategories = call_user_func_array('array_merge', array_map( | |
function ($key, $value) {return array("SC$key" => $value);}, | |
array_column($markListSubjectCategories, "subjectCategoryId"), | |
$markListSubjectCategories) | |
); | |
array_walk($markListSubjectCategories,function($category,$key){ | |
$category->credit = 0; | |
$category->gradePoint = 0; | |
$category->creditPoint = 0; | |
}); | |
$additionalInfo = new \stdClass(); | |
if( empty ($response->studentData )){ | |
return null; | |
} | |
$finalMarkListSubjectCategories = MarksCardService::getInstance()->getMarkListSubjectCategories($request->groupId); | |
usort($finalMarkListSubjectCategories, function ($a, $b) { | |
return $a->priority > $b->priority; | |
}); | |
foreach ($response->studentData as $studentId => $student){ | |
$student->studentImage = StudentService::getInstance()->getStudentProfilePic($student->studentId)->docpath; | |
$student->studentBirthday = $student->dob ? date("d/m/Y", strtotime($student->dob)) : ''; | |
$batchDetails = json_decode($student->properties); | |
$getAcademicTermRequest = new SearchAcademicTermRequest(); | |
$getAcademicTermRequest->id = $batchDetails->finalTermId; | |
$academicTermMarkDetails = reset(AcademicTermService::getInstance()->searchAcademicTerm($getAcademicTermRequest)); | |
$finalSemInWords = CommonUtil::convertNumberToWords($academicTermMarkDetails->properties->orderNo); | |
// $semesterDetails = SemesterService::getInstance()->getSemestersBySemId($batchFinalSemester)[0]; | |
$accademicYearInWords = CommonUtil::convertNumberToWords($academicTermMarkDetails->properties->year); | |
$student->finalSemInWords = ucfirst($finalSemInWords); | |
$student->accademicYear = $academicTermMarkDetails->properties->year; | |
$student->accademicYearInWords = ucfirst($accademicYearInWords); | |
$student->yearOfStudy = $batchDetails->startYear. " - " .$batchDetails->endYear; | |
$student->courseCompleteWithinYear = 1; | |
$finalSem = $batchDetails->finalTermId; | |
$student->finalSem = $batchDetails->finalTermId; | |
$additionalInfo->finalSem = $batchDetails->finalTermId; | |
$student->totalMarkObtained = $student->markDetails->markObtained; | |
$student->totalMarks = $student->markDetails->totalMarks; | |
$student->credit = $student->markDetails->credit; | |
$student->creditGradePoint = $student->markDetails->creditGradePoint; | |
$student->roundOff = $student->admissionYear < 2019 ? 2 : 3; | |
$student->minimumPass = $student->admissionYear >= 2019 ? number_format(2,2, '.', '') : 1.5; | |
$student->minimumPassGrade = $student->admissionYear >= 2019 ? "P Grade" : "C Grade"; | |
$student->percentageValue = $student->admissionYear >= 2019 ? 20 : 25; | |
$student->cgpa = round($student->cgpa, $student->roundOff); | |
$student->cgpaInWords = CommonUtil::convertNumberToWords($student->cgpa); | |
if ($student->failedStatus == 'FAILED'){ | |
$student->cgpa = "-"; | |
} | |
$student->creditInWords = CommonUtil::convertNumberToWords($student->markDetails->credit); | |
$additionalInfo->finalPageNo = count($student->academicTerms) + 1; | |
$month = CommonUtil::getMonth($student->markDetails->latestExamMonth); | |
$student->lastExamYearMonth = "$month ".$student->markDetails->latestExamYear; | |
$totalMarkInWords = ''; | |
if ($student->failedStatus != 'FAILED'){ | |
$totalMarkArr = str_split($student->markDetails->markObtained); | |
foreach ($totalMarkArr as $mark){ | |
$markInWords = strtoupper(CommonUtil::convertNumberToWords($mark)); | |
$totalMarkInWords .= " ".$markInWords; | |
} | |
if ($totalMarkInWords){ | |
$totalMarkInWords .= ' ONLY'; | |
} | |
} | |
$student->totalMarkInWords = $totalMarkInWords; | |
$student->cgpaPercentage = round($student->cgpaPercentage, 2); | |
$student->finalWAS = "-"; | |
if ($student->failedStatus != 'FAILED'){ | |
$student->finalWAS = $student->markDetails->WAS; | |
} | |
$totalWAS = 0; | |
foreach ($student->academicTerms as $key => $semMark){ | |
$totalMarkMinimum = 0; | |
$examRegistrationRequest = new \stdClass; | |
$examRegistrationRequest->academicTermId = $semMark->termId; | |
$examRegistrationRequest->groupId = $semMark->groupsId; | |
$examRegistrationRequest->type = "REGULAR"; | |
$examRegistrationDetail = reset(ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($examRegistrationRequest)); | |
$semMark->examRegName = $examRegistrationDetail->name; | |
foreach ($semMark->subjects as $subject) { | |
$institutionRequest = new \stdClass(); | |
$institutionRequest->batchId = $request->batchId; | |
$institutionRequest->subjectId = $subject->id;; | |
$subject->institutionAvg = 0; | |
$subject->externalMark = $subject->markDetails->externalMark; | |
$subject->externalMaxMark = $subject->markDetails->externalMaxMark; | |
$subject->internalMark = $subject->markDetails->internalMark; | |
$subject->internalMaxMark = $subject->markDetails->internalMaxMark; | |
$subject->totalMark = $subject->markDetails->markObtained; | |
$subject->totalMaxMark = $subject->markDetails->totalMarks; | |
$subject->gradePoint = $subject->markDetails->gradePoint; | |
$subject->creditGradePoint = $subject->creditPoint; | |
$subject->wgpa = $subject->markDetails->wgpa; | |
if($subject->markDetails->isInternal && $subject->markDetails->isExternal){ | |
$subject->externalMinimum = ($subject->markDetails->externalMaxMark * $subject->markDetails->externalPassPercentage)/100 ; | |
$subject->internalMinimum = ($subject->markDetails->internalMaxMark * $subject->markDetails->internalPassPercentage)/100 ; | |
} | |
elseif ($subject->markDetails->isInternal){ | |
$subject->internalMinimum = ($subject->markDetails->internalMaxMark * $subject->markDetails->internalPassPercentage)/100 ; | |
} | |
elseif ($subject->isExternal){ | |
$subject->externalMinimum = ($subject->markDetails->externalMaxMark * $subject->markDetails->externalPassPercentage)/100 ; | |
} | |
$totalMinimum = ($subject->markDetails->totalMarks * $subject->markDetails->aggregatePassPercentage)/100 ; | |
$subject->totalMinimum = $totalMinimum; | |
$totalMarkMinimum += $totalMinimum; | |
if (!$subject->markDetails->isInternal) { | |
$subject->internalMark = "-"; | |
$subject->internalMaxMark = "-"; | |
$subject->internalMinimum = "-"; | |
} | |
if (!$subject->markDetails->isExternal) { | |
$subject->externalMark = "-"; | |
$subject->externalMaxMark = "-"; | |
$subject->externalMinimum = "-"; | |
} | |
if ($subject->attendanceStatus == "ABSENT") { | |
$subject->externalMark = "AB"; | |
} | |
$subject->markDetails->credit = round($subject->markDetails->credit); | |
$subject->credit = round($subject->markDetails->credit); | |
} | |
$semMark->totalMarks = $semMark->markDetails->markObtained; | |
$semMark->examTotalMarks = $semMark->markDetails->totalMarks; | |
$semMark->credit = $semMark->markDetails->credit; | |
$semMark->creditGradePoint = $semMark->markDetails->creditGradePoint; | |
$semMark->totalMarkMinimum = $totalMarkMinimum; | |
$student->marksNeededToPassOverall += $totalMarkMinimum; | |
$semMark->semInRoman = CommonUtil::convertNumberToRoman($semMark->termOrder); | |
$totalMarkInWords = ''; | |
if ($semMark->failedStatus != 'FAILED'){ | |
$totalMarkArr = str_split($semMark->markDetails->markObtained); | |
foreach ($totalMarkArr as $mark){ | |
$markInWords = strtoupper(CommonUtil::convertNumberToWords($mark)); | |
$totalMarkInWords .= " ".$markInWords; | |
} | |
if ($totalMarkInWords){ | |
$totalMarkInWords .= ' ONLY'; | |
} | |
} | |
$semMark->totalMarkInWords = $totalMarkInWords; | |
$sgpa = "-"; | |
$WAS = "-"; | |
if ($semMark->failedStatus != 'FAILED') { | |
$sgpa = round($semMark->sgpa, 2); | |
$WAS = round($semMark->markDetails->WAS, 2); | |
$sgpa = sprintf('%0.2f', $sgpa); | |
$WAS = sprintf('%0.2f', $WAS); | |
} | |
$totalMarkArray = array_map(function ($obj) { | |
return ($obj->markDetails->internalMark + $obj->markDetails->externalMark) * $obj->credit; | |
}, $semMark->subjects); | |
$totalWAS += array_sum($totalMarkArray); | |
$semMark->sgpa = $sgpa; | |
$semMark->WAS = $WAS; | |
$WASstring = ""; | |
if ($student->courseType != 'UG' && $student->courseType != 'MBA') { | |
$WASstring = " WAS: $WAS"; | |
} | |
$semMark->WASstring = $WASstring; | |
$month = substr(CommonUtil::getMonth($semMark->markDetails->latestExamMonth), 0, 3); | |
$semMark->lastExamYearMonth = "$month - ".$semMark->markDetails->latestExamYear; | |
if($courseType == 'UG'){ | |
$subjectCategoryWiseMarkData = []; | |
$markDataTable = []; | |
foreach ($student->academicTerms as $term) { | |
$categoryRequest = new \stdClass(); | |
$categoryRequest->groupId = $student->groupsId; | |
$categoryRequest->academicTermId = $term->termId; | |
$subjectsCategoryDetailsSemwise = MarksCardService::getInstance()->getGroupSubjectCategoryDetails($categoryRequest); | |
$searchRequest = new \stdClass(); | |
$searchRequest->groupId = $student->groupsId; | |
$searchRequest->academicTermId = $term->termId; | |
$searchRequest->requestType = "SEMESTER"; | |
$semesterGradeDetails = reset(GradeSchemeService::getInstance()->getAllSubjectGradeSchemesByRequest($searchRequest))->grades; | |
foreach ($term->subjects as $subject) { | |
$subjectCatParentId = $subjectsCategoryDetailsSemwise[$subject->paperSubjetId]->parentId; | |
if ($subjectCatParentId) { | |
$subjectCatId = $subjectCatParentId; | |
} else { | |
$subjectCatId = $subjectsCategoryDetailsSemwise[$subject->paperSubjetId]->subjectcatId; | |
} | |
if (!$subjectCatId) { | |
continue; | |
} | |
$subjectCategoryWiseMarkData[$subjectCatId]->credit[$subject->paperSubjetId] = $subject->markDetails->credit; | |
$subjectCategoryWiseMarkData[$subjectCatId]->totalMark[$subject->paperSubjetId] = $subject->markDetails->markObtained; | |
$subjectCategoryWiseMarkData[$subjectCatId]->totalMaxMark[$subject->paperSubjetId] = $subject->markDetails->totalMarks; | |
$subjectCategoryWiseMarkData[$subjectCatId]->subjectDesc = $subject->name; | |
$subjectCategoryWiseMarkData[$subjectCatId]->creditGradePoint[$subject->paperSubjetId] = $subject->creditPoint ; | |
} | |
} | |
$markDataKey = 0; | |
$creditTotal = 0; | |
$totalMarkTotal = 0; | |
$totalMaxMarkTotal = 0; | |
$creditGradePointTotal = 0; | |
foreach ($finalMarkListSubjectCategories as $markListSubjectCategory) { | |
$credit = array_sum($subjectCategoryWiseMarkData[$markListSubjectCategory->subjectCategoryId]->credit); | |
$totalMark = array_sum($subjectCategoryWiseMarkData[$markListSubjectCategory->subjectCategoryId]->totalMark); | |
$totalMaxMark = array_sum($subjectCategoryWiseMarkData[$markListSubjectCategory->subjectCategoryId]->totalMaxMark); | |
$creditGradePoint = array_sum($subjectCategoryWiseMarkData[$markListSubjectCategory->subjectCategoryId]->creditGradePoint); | |
$subjectDesc = $subjectCategoryWiseMarkData[$markListSubjectCategory->subjectCategoryId]->subjectDesc; | |
if( empty($credit) && empty($totalMark)){ | |
continue; | |
} | |
$subjectCatName = $markListSubjectCategory->code ? $markListSubjectCategory->code : $markListSubjectCategory->subjectCatName; | |
// $subjectCatName = $subjectCategoriesFetched["id$markListSubjectCategory->subjectCategoryId"]->code ? $subjectCategoriesFetched["id$markListSubjectCategory->subjectCategoryId"]->code : $markListSubjectCategory->subjectCatName; | |
$creditTotal += $credit; | |
$totalMarkTotal += $totalMark; | |
$totalMaxMarkTotal += $totalMaxMark; | |
$creditGradePointTotal += $creditGradePoint; | |
$categoryCGPA = 0; | |
if ($creditGradePoint && $credit) { | |
$categoryCGPA = round($creditGradePoint / $credit, 2); | |
} | |
$cgpaGradeDetails = $this->getGradeByPercentage($categoryCGPA, $semesterGradeDetails); | |
$cgpaGrade = $cgpaGradeDetails->letterGrade; | |
$categoryCGPA = sprintf("%.02f", $categoryCGPA); | |
$secondLangFlag = $markListSubjectCategory->secondLangFlag; | |
$openCourseFlag = $markListSubjectCategory->openCourseFlag; | |
if (($openCourseFlag == 0) && ($secondLangFlag == 0)) { | |
$displayName = $markListSubjectCategory->displayName; | |
} | |
// } elseif (($secondLangFlag) && ($openCourseFlag == 0)) { | |
// $secondLanguage = StudentService::getInstance()->getStudentSecondLanguageByStudentId($request->studentId); | |
// $subjectIdForSecondLanguage = current(array_keys($subjectCategoryWiseMarkData[$markListSubjectCategory->subjectCatId]->credit)); | |
// $secondLanguageAssignedToSubject = null; | |
// if ($subjectIdForSecondLanguage) { | |
// $secondLanguageAssignedToSubject = SubjectService::getInstance()->getSecondLanguageBySubjectId($subjectIdForSecondLanguage); | |
// } | |
// $displayName = $secondLanguage->name ? $secondLanguage->name : $secondLanguageAssignedToSubject->name; | |
// } else { | |
// $openCourse = reset(StudentService::getInstance()->getStudentOpenCourse($request->studentId, $request->batchId)); | |
// $displayName = $openCourse->subjectName ? $openCourse->subjectName : $subjectDesc; | |
// } | |
$displayName = $displayName ? ": $displayName" : ""; | |
$programResultColumnValue = "$subjectCatName$displayName"; | |
if ($student->failedStatus == "FAILED") { | |
$programResultColumnValue = !$markDataKey ? "Failed for the Programme" : ""; | |
$totalMark = "-"; | |
$totalMaxMark = "-"; | |
$creditGradePoint = "-"; | |
$credit = "-"; | |
$categoryCGPA = "-"; | |
$cgpaGrade = "-"; | |
} | |
$markDataTable[$markDataKey]->name = $programResultColumnValue; | |
$markDataTable[$markDataKey]->totalMark = $totalMark; | |
$markDataTable[$markDataKey]->totalMaxMark = $totalMaxMark; | |
$markDataTable[$markDataKey]->creditGradePoint = $creditGradePoint; | |
$markDataTable[$markDataKey]->credit = $credit; | |
$markDataTable[$markDataKey]->categoryCGPA = $categoryCGPA; | |
$markDataTable[$markDataKey]->cgpaGrade = $cgpaGrade; | |
$markDataKey++; | |
if ($student->failedStatus == "FAILED") { | |
break; | |
} | |
} | |
} | |
$additionalInfo->markDataTable = $markDataTable; | |
uasort($semMark->subject, function ($a, $b) { | |
return $a->subjectOrder > $b->subjectOrder; | |
}); | |
//start new grouping | |
$subjectCategoryWiseMarkData = []; | |
$categoryRequest = new \stdClass(); | |
$categoryRequest->groupId = $student->groupsId; | |
$categoryRequest->academicTermId = $semMark->termId; | |
$subjectsCategoryDetails = MarksCardService::getInstance()->getGroupSubjectCategoryDetails($categoryRequest); | |
foreach ($semMark->subjects as $subject) { | |
if($subject->RSI == "S" || $subject->RSI == "I"){ | |
$examMonthYear = date("M-Y",strtotime($subject->markDetails->latestExamYear."-".$subject->markDetails->latestExamMonth."-1")); | |
$semMark->monthYears[$subject->RSI][$subject->markDetails->latestExamYear.$subject->markDetails->latestExamMonth] = $examMonthYear; | |
} | |
$subject->supplyAttemptCount = $subject->noOfChancesTaken; | |
$subjectCatGroupId = $subjectsCategoryDetails[$subject->paperSubjetId]->subjectCatGroupId; | |
$subCatGroupName = $subjectsCategoryDetails[$subject->paperSubjetId]->subCatGroupName; | |
$subjectCatId = $subjectsCategoryDetails[$subject->paperSubjetId]->subjectcatId; | |
$subjectCatName = $subjectsCategoryDetails[$subject->paperSubjetId]->code ? $subjectsCategoryDetails[$subject->paperSubjetId]->code : $subjectsCategoryDetails[$subject->paperSubjetId]->subjectcatName; | |
$subjectcatPriority = $subjectsCategoryDetails[$subject->paperSubjetId]->subjectcatPriority; | |
if ($subjectCatGroupId && $courseType != 'PG') { | |
$subjectCategoryWiseMarkData["G$subjectCatGroupId"]->subjectIds[$subject->paperSubjetId] = $subject->paperSubjetId; | |
$subjectCategoryWiseMarkData["G$subjectCatGroupId"]->isSubjectCategory = true; | |
$subjectCategoryWiseMarkData["G$subjectCatGroupId"]->name = $subCatGroupName; | |
$subjectCategoryWiseMarkData["G$subjectCatGroupId"]->priority = $subjectcatPriority; | |
$subjectCategoryWiseMarkData["G$subjectCatGroupId"]->canShowCategoryHead = (int)$subjectsCategoryDetails[$subject->paperSubjetId]->canShow; | |
} else if (!$subjectCatId) { | |
$subjectCategoryWiseMarkData[0]->subjectIds[$subject->paperSubjetId] = $subject->paperSubjetId; | |
$subjectCategoryWiseMarkData[0]->isSubjectCategory = false; | |
$subjectCategoryWiseMarkData[0]->name = $subjectCatName; | |
$subjectCategoryWiseMarkData[0]->priority = 0; | |
} else { | |
$subjectCategoryWiseMarkData[$subjectCatId]->subjectIds[$subject->paperSubjetId] = $subject->paperSubjetId; | |
$subjectCategoryWiseMarkData[$subjectCatId]->isSubjectCategory = true; | |
$subjectCategoryWiseMarkData[$subjectCatId]->name = $subjectCatName; | |
$subjectCategoryWiseMarkData[$subjectCatId]->priority = $subjectcatPriority; | |
$subjectCategoryWiseMarkData[$subjectCatId]->canShowCategoryHead = (int)$subjectsCategoryDetails[$subject->paperSubjetId]->canShow; | |
} | |
} | |
if ($courseType != 'PG' && $courseType != 'MBA') { | |
usort($subjectCategoryWiseMarkData, function ($a, $b) { | |
return $a->priority > $b->priority; | |
}); | |
} | |
$semMark->subjectCategoryWiseMarkData = $subjectCategoryWiseMarkData; | |
} | |
ksort($semMark); | |
} | |
$maxRangeTo = max(array_column($gradeDetails,"rangeTo")); | |
foreach ($gradeDetails as $grade) { | |
$grade->maxRangeTo = $maxRangeTo; | |
$grade->percentageFrom = ($grade->rangeFrom / $grade->maxRangeTo) * 100; | |
$grade->percentageTo = ($grade->rangeTo / $grade->maxRangeTo) * 100; | |
} | |
$SGPAorSCPA = "SGPA"; | |
$CGPAorCCPA = "CGPA"; | |
$CGPAorCCPADesc = "CUMULATIVE GRADE POINT AVERAGE (CGPA)"; | |
if ($courseType == CourseTypeConstants::PG && $batchStartYear < 2019) { | |
$SGPAorSCPA = "SCPA"; | |
$CGPAorCCPA = "CCPA"; | |
$CGPAorCCPADesc = "CUMULATIVE CREDIT POINT AVERAGE (CCPA)"; | |
} | |
else if ($courseType == CourseTypeConstants::UG && $batchStartYear < 2017){ | |
$SGPAorSCPA = "SCPA"; | |
$CGPAorCCPA = "CCPA"; | |
$CGPAorCCPADesc = "CUMULATIVE CREDIT POINT AVERAGE (CCPA)"; | |
} | |
else if ($courseType == CourseTypeConstants::UG &&( $batchStartYear == 2018 || $batchStartYear >= 2019)){ | |
$SGPAorSCPA = "SCPA"; | |
$CGPAorCCPA = "CCPA"; | |
$CGPAorCCPADesc = "CUMULATIVE CREDIT POINT AVERAGE (CCPA)"; | |
} | |
// $additionalInfo->patternCourseName = $batchFullDetails->patterncourseName; | |
$supplyExamMonthYears = []; | |
$monthYearRequest = new \stdClass(); | |
$monthYearRequest->groupId = $request->groupId; | |
$semesterWiseDetails = FinalConsolidatedReportService::getInstance()->getSupplyExamMonthAndYearSemesterWise($monthYearRequest); | |
ksort($semesterWiseDetails); | |
$supplyChanceIndicator = []; | |
foreach ($semesterWiseDetails as $semesterWiseDetail) { | |
foreach ($semesterWiseDetail->exams as $key => $exam) { | |
$supplyChanceIndicator[$exam->semId]["$exam->examYear$exam->examMonth"] = $key; | |
$examMonthYear = date("M-Y",strtotime("$exam->examYear-$exam->examMonth-1")); | |
if($courseType->course_Type == CourseTypeConstants::MBA){ | |
$supplyExamMonthYears[$exam->semId][$key][strtotime("$exam->examYear-$exam->examMonth-1")] = "$examMonthYear"; | |
} | |
else{ | |
$supplyExamMonthYears[$exam->semId][$key][strtotime("$exam->examYear-$exam->examMonth-1")] = "$examMonthYear"; | |
} | |
} | |
} | |
foreach ($supplyExamMonthYears as $semKey => $semList) { | |
foreach ($semList as $key => $supplyExamMonthYear) { | |
ksort($supplyExamMonthYear); | |
// $supplyExamMonthYears[$semKey][$key] = implode(", ", $supplyExamMonthYear); | |
} | |
} | |
$additionalInfo->supplyExamMonthYears = $supplyExamMonthYears; | |
$additionalInfo->supplyChanceIndicator = $supplyChanceIndicator; | |
// $additionalInfo->startYear = $studentAccountData->startYear; | |
$additionalInfo->streamOrFaculty = "Faculty"; | |
if ($courseType != CourseTypeConstants::PG && $courseType != CourseTypeConstants::MBA) { | |
$additionalInfo->streamOrFaculty = "Stream"; | |
} | |
// $additionalInfo->markDataTable = $markDataTable; | |
$markCardHeading = ""; | |
if ($courseType != CourseTypeConstants::PG && $courseType != CourseTypeConstants::MPHIL && $courseType != CourseTypeConstants::MSW) { | |
$markCardHeading = "MARK CUM GRADE CARD"; | |
} | |
if($courseType == CourseTypeConstants::MBA && $batchStartYear >= 2019){ | |
$markCardHeading = ""; | |
} | |
$additionalInfo->SGPAorSCPA = $SGPAorSCPA; | |
$additionalInfo->CGPAorCCPA = $CGPAorCCPA; | |
$additionalInfo->markCardHeading = $markCardHeading; | |
$additionalInfo->CGPAorCCPADesc = $CGPAorCCPADesc; | |
$additionalInfo->currentDate = date("d.m.Y"); | |
global $EXAMCONTROLLER_ROOT; | |
$additionalInfo->creditPointHead = "CP"; | |
$additionalInfo->wasBeforeSg = false; | |
if (($courseType == CourseTypeConstants::MSW) && $batch->startYear <= 2018 && $batch->startYear >= 2015) { | |
$additionalInfo->streamOrFaculty = "Faculty"; | |
$additionalInfo->SGPAorSCPA = "SCPA"; | |
$additionalInfo->CGPAorCCPA = "CCPA"; | |
$additionalInfo->creditPointHead = "C*G"; | |
$additionalInfo->wasBeforeSg = true; | |
} | |
if ($courseType != CourseTypeConstants::MSW){ | |
$additionalInfo->showPatternAbbreviationInCertified = true; | |
} | |
$response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
$response->dateOfIssue = $request->filterSettings['markListDate']?: date("d-m-Y"); | |
$additionalInfo->internalDisplayName = "Internal"; | |
$additionalInfo->externalDisplayName = "External"; | |
$additionalInfo->internalAwardedDisplayName = "Awarded (I)"; | |
$additionalInfo->externalAwardedDisplayName = "Awarded (E)"; | |
$additionalInfo->totalAwardedDisplayName = "Awarded (E + I)"; | |
if(($courseType == CourseTypeConstants::UG && $batchStartYear >= 2019)){ | |
$additionalInfo->internalDisplayName = "ISA"; | |
$additionalInfo->externalDisplayName = "ESA"; | |
$additionalInfo->internalAwardedDisplayName = "Awarded"; | |
$additionalInfo->externalAwardedDisplayName = "Awarded"; | |
$additionalInfo->totalAwardedDisplayName = "Awarded"; | |
} | |
$response->markListSubjectCategories = $markListSubjectCategories; | |
$response->gradeDetails = $gradeDetails; | |
$response->additionalInfo = $additionalInfo; | |
return $response; | |
} | |
/** | |
* Render Program Result | |
* | |
* @param $templateName | |
* @param Object $data | |
* @return Object | |
*/ | |
protected function renderTranscriptMarkCardResult($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/Transcript/Template3/$templateName.twig"), [ 'data'=>$data ]); | |
$prtContent = NULL; | |
$responseHtml .= '<script> | |
var file1 = document.getElementById("backgroundImg").files[0]; | |
var reader1 = new FileReader(); | |
console.log(reader1); | |
reader1.onloadend = function() { | |
$(".pages").css({ | |
"backgroundImage": "url(" + reader1.result + ")" | |
}); | |
} | |
if (file1) { | |
reader1.readAsDataURL(file1); | |
} else {} | |
</script>'; | |
$prtContent .= '<html><head>'; | |
$prtContent .= "<style> | |
h6 {font-size: 26px;} .text-center { text-align: center;} .align-middle {vertical-align: middle;}; tr.noBorder td {border: 0; border-collapse:collapse;} | |
</style>"; | |
$prtContent .= '</head><title>Individual Mark Card</title><body>'; | |
$prtContent .= $responseHtml; | |
$prtContent .= '</body></html>'; | |
$options = array( | |
'page-width' => "21cm", | |
'page-height' => "29cm", | |
'dpi' => 96, | |
'margin-top' => "4cm", | |
'margin-left' => "2cm", | |
'margin-right' => "2cm", | |
'margin-bottom' => "2.5cm", | |
'footer-spacing' => -10, | |
// 'binary' => "/usr/local/bin/wkhtmltopdf", // For Mac | |
'user-style-sheet' => realpath(DOCUMENT_ROOT . "/libcommon/bootstrap/css/bootstrap.min.css") | |
); | |
$programResult = new \stdClass; | |
$programResult->dispalyHtmlData = $prtContent; | |
$programResult->printData = PdfUtil::renderPdf($prtContent, $options); | |
return $programResult; | |
} | |
} | |
protected function getGradeByPercentage($percentage, $gradeDetails) | |
{ | |
foreach ($gradeDetails as $grade) { | |
if ($grade->rangeFrom <= $percentage && $grade->rangeTo >= $percentage) { | |
return $grade; | |
} | |
} | |
return null; | |
} | |
} |