Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 533 |
| Template3FCMC | |
0.00% |
0 / 1 |
|
0.00% |
0 / 6 |
20592.00 | |
0.00% |
0 / 533 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
380.00 | |
0.00% |
0 / 39 |
|||
| processData | |
0.00% |
0 / 1 |
12432.00 | |
0.00% |
0 / 420 |
|||
| renderTemplate | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| getsecondLanguageName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| getopenCourseName | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 27 |
|||
| getGradeByPercentage | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 8 |
|||
| <?php | |
| // SBCOLLEGE | |
| namespace com\linways\ec\core\service\FinalConsolidatdMarksCardGenerator; | |
| use com\linways\base\util\TwigRenderer; | |
| use com\linways\ec\core\service\MarksCardService; | |
| use com\linways\ec\core\service\CommonExamService; | |
| use com\linways\core\ams\professional\util\PdfUtil; | |
| use com\linways\core\ams\professional\util\CommonUtil; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| 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\service\ExamRegistrationService; | |
| 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\ec\core\service\GradeSchemeService; | |
| class Template3FCMC extends FCMGenerator | |
| { | |
| public function __construct(){} | |
| protected function getTemplateName($request){ | |
| $query = "SELECT | |
| ct.course_Type AS courseType, | |
| g.properties->>'$.startYear' AS batchStartYear | |
| FROM | |
| `groups` g | |
| INNER JOIN program p ON | |
| p.id = CAST(g.properties->>'$.programId' AS CHAR) | |
| INNER JOIN course_type ct ON | |
| ct.courseTypeID = p.course_type_id | |
| WHERE g.id IN ('$request->groupId')"; | |
| $courseDetails = $this->executeQueryForObject($query); | |
| $courseType = $courseDetails->courseType; | |
| $batchStartYear = $courseDetails->batchStartYear; | |
| if ($courseType=="UG" && $request->filterSettings['isNewFormat'] == 1) { | |
| $templateName = "UGTemplate3FCMC_NEW"; | |
| } | |
| if (( $courseType=="PG" || $courseType=="MSW" ) && $request->filterSettings['isNewFormat'] == 1) { | |
| $templateName = "Template3FCMC_PG_NEW"; | |
| } | |
| if ($courseType=="MPHIL" && $request->filterSettings['isNewFormat'] == 1) { | |
| $templateName = "Template3FCMC_MPHIL_NEW"; | |
| } | |
| else if ($courseType=="MBA" && $request->filterSettings['isNewFormat'] == 1) { | |
| $templateName = "Template3FCMC_MBA_NEW"; | |
| } | |
| else if ($courseType=="UG") { | |
| $templateName = "UGTemplate3FCMC"; | |
| } | |
| else if (( $courseType=="MBA" || $courseType=="LIB" ) && $batchStartYear < 2019) { | |
| $templateName = "Template3FCMC_MBA"; | |
| } | |
| else if (( $courseType=="PG" || $courseType=="MSW" ) && $batchStartYear == 2014) { | |
| $templateName = "Template3FCMC_PG_2014"; | |
| } | |
| else if ( $courseType=="LIB" && $batchStartYear > 2019) { | |
| $templateName = "Template3FCMC_LIB_2019"; | |
| } | |
| 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; | |
| $institutionAvgRequest = new \stdClass(); | |
| $institutionAvgRequest->groupId = $request->groupId; | |
| $institutionAvges = MarksCardService::getInstance()->getBatchSubjectsInstitutionalAverge($institutionAvgRequest); | |
| foreach ($response->studentData as $studentId => $student){ | |
| $student->studentImage = StudentService::getInstance()->getStudentProfilePic($student->studentId)->docpath; | |
| $batchDetails = json_decode($student->properties); | |
| $student->courseCompleteWithinYear = 1; | |
| $finalSem = $batchDetails->finalTermId; | |
| $student->finalSem = $batchDetails->finalTermId; | |
| $lastAcademicTerm = reset(array_filter( $student->academicTerms ,function($value)use($finalSem){ | |
| return $value->termId == $finalSem; | |
| })); | |
| $lastAcademicTermHistory = reset(array_filter( $lastAcademicTerm->markHistory ,function($value){ | |
| return $value->historyType == "REGULAR"; | |
| })); | |
| $tempAcademicDetails = ""; | |
| if( $lastAcademicTermHistory ){ | |
| $lastSemMonth = $lastAcademicTermHistory->examMonth; | |
| $lastSemYear = $lastAcademicTermHistory->examYear; | |
| $lastSemMonthYear = date("Y-m", strtotime($lastSemYear . "-" . $lastSemMonth)); | |
| $tempMonth = $lastSemMonthYear; | |
| $student->courseCompleteWithinYear = 1; | |
| $isFinalSem = 0; | |
| $enableCheckCourseCompleted = ($batchStartYear >= 2018 && $student->courseType == "MBA") ? true : false; | |
| $enableCheckCourseCompleted = ($student->courseType == "PG") ? true : $enableCheckCourseCompleted; | |
| $enableCheckCourseCompleted = ($batchStartYear != 2019 && $student->courseType == "UG" && $student->courseType != "MBA") ? true : $enableCheckCourseCompleted; | |
| $enableCheckCourseCompleted = ($batchStartYear >= 2015 && $batchStartYear <= 2015 && $student->courseType == "MSW") ? true : $enableCheckCourseCompleted; | |
| $enableCheckCourseCompleted = ($batchStartYear >= 2015 && $student->courseType == "MPHIL") ? true : $enableCheckCourseCompleted; | |
| if ( $enableCheckCourseCompleted ) { | |
| foreach ($student->academicTerms as $key => $semesterMark){ | |
| $sem = $semesterMark->termId; | |
| $semExamMonthYear = date("Y-m", strtotime($semesterMark->markDetails->latestExamYear . "-" . $semesterMark->markDetails->latestExamMonth)); | |
| if ( $student->courseType == "UG" && $batchStartYear == 2017 && $semesterMark->markDetails->latestExamType == ExamType::SUPPLY && $semExamMonthYear <= "2020-10"){ | |
| continue; | |
| } | |
| if(($student->courseType == "MBA" ||$student->courseType == "PG") && $batchStartYear == 2020 && $semExamMonthYear <= "2022-08"){ | |
| continue; | |
| } | |
| if ($semExamMonthYear > $tempMonth) { | |
| $tempMonth = $semExamMonthYear; | |
| $lastExamSem = $sem; | |
| $lastExamRegType = $semesterMark->markDetails->latestExamType; | |
| $tempAcademicDetails = $semesterMark; | |
| if($lastExamRegType == ExamType::SUPPLY){ | |
| $student->courseCompleteWithinYear = 0; | |
| } | |
| $lastExamMonth = $semesterMark->markDetails->latestExamMonth; | |
| $lastExamYear = $semesterMark->markDetails->latestExamYear; | |
| } | |
| if ($semExamMonthYear > $lastSemMonthYear && $finalSem == $sem) { | |
| $isFinalSem = 1; | |
| $finalSemMonth = $semesterMark->markDetails->latestExamMonth; | |
| $finalSemYear = $semesterMark->markDetails->latestExamYear; | |
| } | |
| } | |
| } | |
| if (! $student->courseCompleteWithinYear && $lastExamRegType == ExamType::SUPPLY) { | |
| $supplyTermHistory = reset(array_filter( $tempAcademicDetails->markHistory ,function($value)use($lastExamMonth, $lastExamYear){ | |
| return $value->examMonth == $lastExamMonth && $value->examYear == $lastExamYear; | |
| })); | |
| if ($isFinalSem) { | |
| $finalTermHistory = reset(array_filter( $lastAcademicTerm->markHistory ,function($value)use($finalSemMonth, $finalSemYear){ | |
| return $value->examMonth == $finalSemMonth && $value->examYear == $finalSemYear; | |
| })); | |
| } | |
| if($supplyTermHistory->examRegistrationId){ | |
| $searchRequest = new SearchExamRegistrationBatchRequest(); | |
| $searchRequest->examRegistrationId = $supplyTermHistory->examRegistrationId; | |
| $searchRequest->groupId = $student->groupsId; | |
| $examRegistrationBatch = reset(ExamRegistrationBatchService::getInstance()->searchExamRegistrationBatch($searchRequest)); | |
| $student->programPassingDate = ''; | |
| if( $examRegistrationBatches->properties->isResultPublished){ | |
| $programPassingDate = $examRegistrationBatches->properties->publishingStartDate; | |
| $student->programPassingDate = date("d-m-Y", strtotime($programPassingDate)); | |
| } | |
| } | |
| if ($isFinalSem) { | |
| if($finalTermHistoryAwarded (E)->examRegistrationId){ | |
| $searchRequest = new SearchExamRegistrationRequest(); | |
| $searchRequest->id = $finalTermHistory->examRegistrationId; | |
| $examRegistration = reset(ExamRegistrationService::getInstance()->searchExamRegistration($searchRequest)); | |
| $student->examRegName = $examRegistration->name; | |
| } | |
| } else { | |
| $searchRequest = new SearchExamRegistrationRequest(); | |
| $searchRequest->id = $lastAcademicTermHistory->examRegistrationId; | |
| $examRegistration = reset(ExamRegistrationService::getInstance()->searchExamRegistration($searchRequest)); | |
| $student->examRegName = $examRegistration->name; | |
| } | |
| } else { | |
| $searchRequest = new SearchExamRegistrationRequest(); | |
| $searchRequest->id = $lastAcademicTermHistory->examRegistrationId; | |
| $examRegistration = reset(ExamRegistrationService::getInstance()->searchExamRegistration($searchRequest)); | |
| $student->examRegName = $examRegistration->name; | |
| } | |
| } | |
| $dateOfEligibility = ""; | |
| if($lastExamRegType == ExamType::SUPPLY || $lastExamRegType == ExamType::IMPROVEMENT){ | |
| $dateOfEligibility = $programPassingDate; | |
| }else{ | |
| $searchRequest = new SearchExamRegistrationBatchRequest(); | |
| $searchRequest->examRegistrationId = $lastAcademicTermHistory->examRegistrationId; | |
| $searchRequest->groupId = $student->groupsId; | |
| $examRegistrationBatch = reset(ExamRegistrationBatchService::getInstance()->searchExamRegistrationBatch($searchRequest)); | |
| if( $examRegistrationBatches->properties->isResultPublished){ | |
| $dateOfEligibility = $examRegistrationBatches->properties->publishingStartDate; | |
| } | |
| } | |
| $dateOfEligibility = $dateOfEligibility ? date("d-M-Y", strtotime($dateOfEligibility)) : ''; | |
| $student->dateOfEligibility = $student->failedStatus == 'FAILED' ? '' : $dateOfEligibility; | |
| foreach ($student->academicTerms as $key => $semMark){ | |
| $totalMarkMinimum = 0; | |
| foreach ($semMark->subjects as $subject) { | |
| $subject->institutionAvg = $institutionAvges[$subject->paperSubjetId]->institutionalAverage ?? 0; | |
| 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); | |
| } | |
| $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->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; | |
| // $semMark->semId = $semID; | |
| // $finalMarkListSubjectCategories = BatchService::getInstance()->getMarkListSubjectCategories($request->batchId); | |
| // // $markListSubjectCategories = BatchService::getInstance()->getBatchSubjectCategories($request->batchId); | |
| // $markListSubjectCategories = BatchService::getInstance()->getBatchSemSubjectCategories($request->batchId, $semID); | |
| // $subjectsCategoryDetails = SubjectService::getInstance()->getBatchSubjectCategoryDetails($request->batchId, $semID); | |
| // $subjectCategoriesFetched = SubjectService::getInstance()->getAllSubjectCategories(); | |
| // $subjectCategoriesFetchedKeyChanged = array_map( | |
| // function ($key, $value) { | |
| // return array("id$key" => $value); | |
| // }, | |
| // array_column($subjectCategoriesFetched, "subjectCatId"), | |
| // $subjectCategoriesFetched | |
| // ); | |
| // $subjectCategoriesFetched = call_user_func_array('array_merge', $subjectCategoriesFetchedKeyChanged); | |
| // usort($markListSubjectCategories, function ($a, $b) { | |
| // return $a->priority > $b->priority; | |
| // }); | |
| // usort($finalMarkListSubjectCategories, function ($a, $b) { | |
| // return $a->priority > $b->priority; | |
| // }); | |
| 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->examYear-$subject->examMonth-1")); | |
| $semMark->monthYears[$subject->RSI]["$subject->examYear$subject->examMonth"] = $examMonthYear; | |
| } | |
| $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); | |
| } | |
| $finalMarkListSubjectCategories = MarksCardService::getInstance()->getMarkListSubjectCategories($request->groupId); | |
| usort($finalMarkListSubjectCategories, function ($a, $b) { | |
| return $a->priority > $b->priority; | |
| }); | |
| $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; | |
| }); | |
| foreach ($response->studentData as $student) { | |
| $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); | |
| $student->creditInWords = CommonUtil::convertNumberToWords($student->markDetails->credit); | |
| $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; | |
| // If 0.5 < CGPA ≤ 5.5, % = 40 + (CGPA - 0.5) x 10 If CGPA > 5.5, % = 90 + (CGPA - 5.5) x 20 | |
| // if (0.5 < $student->cgpa && $student->cgpa <= 5.5) { | |
| // $student->cgpaPercentage = 40 + ($student->cgpa - 0.5) * 10; | |
| // } | |
| // else if ($student->cgpa > 5.5) { | |
| // $student->cgpaPercentage = 90 + ($student->cgpa - 5.5) * 20; | |
| // } | |
| $student->cgpaPercentage = round($student->cgpaPercentage, 2); | |
| 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; | |
| } | |
| } | |
| } | |
| $student->markDataTable = $markDataTable; | |
| $semPartAndProgramPartCombined = []; | |
| $startIndex = 0; | |
| foreach ($student->academicTerms as $term) { | |
| $term->sgpa = round($term->sgpa, $student->roundOff); | |
| $semPartAndProgramPartCombined[$startIndex]->term = $term; | |
| $startIndex++; | |
| } | |
| $startIndex = 0; | |
| foreach ($markDataTable as $markData) { | |
| $semPartAndProgramPartCombined[$startIndex]->markData = $markData; | |
| $startIndex++; | |
| } | |
| $student->semPartAndProgramPartCombined = $semPartAndProgramPartCombined; | |
| } | |
| $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; | |
| } | |
| $additionalInfo = new \stdClass(); | |
| $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; | |
| // $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->gradeArray = $gradeArray; | |
| // $additionalInfo->firstKey = array_key_first($semMarks); | |
| // $additionalInfo->endYear = $studentAccountData->endYear; | |
| // $additionalInfo->patternCourseName = $isBatchesReport ? $patternCourseName : $studentAccountData->patterncourseName; | |
| // $additionalInfo->isPrint = $isPrint ? true : false; | |
| // $additionalInfo->orderNo = $orderNo; | |
| // $additionalInfo->resultDate = !$resultDate ? "" : date("d/m/Y",strtotime($resultDate)); | |
| // $additionalInfo->courseType = $courseType; | |
| // $additionalInfo->batch = $batch; | |
| // $additionalInfo->supplyExamMonthYears = $supplyExamMonthYears; | |
| // $additionalInfo->supplyChanceIndicator = $supplyChanceIndicator; | |
| // $additionalInfo->finalPageNo = count($semMarks) + 1; | |
| // $additionalInfo->finalSem = $batchFinalSemester; | |
| $additionalInfo->currentDate = date("d.m.Y"); | |
| // $additionalInfo->failedGrade = ConsolidatedMarkReportService::getInstance()->getFailedGradeDetailsByBatch($request->batchId)->letterGrade; | |
| 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 renderTemplate($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/FinalConsolidatedMarksCard/Template3/$templateName.twig"), [ 'data'=>$data ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| </style>"; | |
| $prtContent .= '</head><title>Consolidated Marks Card</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 250; | |
| $totalHeight = 353; | |
| $options = array( | |
| 'page-width' => $totalWidth."mm", | |
| 'page-height' => $totalHeight."mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "40mm", | |
| 'margin-left' => "15mm", | |
| 'margin-right' => "15mm", | |
| 'margin-bottom' => "10mm", | |
| // 'binary' => "/usr/local/bin/wkhtmltopdf", // For Mac | |
| 'user-style-sheet' => realpath(DOCUMENT_ROOT . "/libcommon/bootstrap/css/bootstrap.min.css") | |
| ); | |
| $finalCMC = new \stdClass; | |
| $finalCMC->htmlData = $responseHtml; | |
| $finalCMC->printData = PdfUtil::renderPdf($prtContent, $options); | |
| return $finalCMC; | |
| } | |
| } | |
| private function getsecondLanguageName($studentId) | |
| { | |
| try { | |
| $query = "SELECT t1.secondLangaugeName FROM secondLangauge t1,studentaccount t2 WHERE t1.secondlangaugeID = t2.secondlangaugeID AND t2.studentID = ".$studentId.""; | |
| $displayName = $this->executeQueryForObject($query)->secondLangaugeName;; | |
| } catch (\Exception $e) { | |
| throw $e; | |
| } | |
| return $displayName; | |
| } | |
| private function getopenCourseName($studentID) | |
| { | |
| try { | |
| $sql_check33 = "SELECT t1.pseudosubjectID FROM pseudosubjects t1,pseudosubjects_students t2 WHERE t1.pseudosubjectID = t2.pseudosubjectID AND t2.studentID = ".$studentID." AND t1.isOpencourse = 1"; | |
| $pseudosubjectID = $this->executeQueryForObject($sql_check33)->pseudosubjectID; | |
| if($pseudosubjectID) | |
| { | |
| $query1 = "SELECT t1.subjectID FROM sbs_relation t1,pseudosubjects_sbs t2 WHERE t1.sbsID = t2.sbsID AND t2.pseudosubjectID = ".$pseudosubjectID.""; | |
| $subjectID = $this->executeQueryForObject($query1)->subjectID; | |
| if($subjectID) | |
| { | |
| $sql ="SELECT code as subjectName, name as subjectDesc from v4_ams_subject where id=\"".$subjectID."\""; | |
| $subjectDesc = $this->executeQueryForObject($sql)->subjectDesc; | |
| } | |
| else | |
| { | |
| $subjectDesc = '-'; | |
| } | |
| } | |
| else | |
| { | |
| $subjectDesc = '-'; | |
| } | |
| } catch (\Exception $e) { | |
| throw $e; | |
| } | |
| return $subjectDesc; | |
| } | |
| private function getGradeByPercentage($percentage, $gradeDetails) | |
| { | |
| foreach ($gradeDetails as $grade) { | |
| if ($grade->rangeFrom <= $percentage && $grade->rangeTo >= $percentage) { | |
| return $grade; | |
| } | |
| } | |
| return null; | |
| } | |
| } |