Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 156 |
| Template14FCMC | |
0.00% |
0 / 1 |
|
0.00% |
0 / 5 |
650.00 | |
0.00% |
0 / 156 |
| __construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getTemplateName | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 19 |
|||
| processData | |
0.00% |
0 / 1 |
210.00 | |
0.00% |
0 / 71 |
|||
| 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 |
|||
| <?php | |
| // IAGI College | |
| 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\core\ams\professional\service\AmsCustomFieldsService; | |
| use com\linways\core\ams\professional\constant\AmsCustomFieldsEntities; | |
| class Template14FCMC 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; | |
| $templateName = 'Template14FCMC'; | |
| if ( $courseType=="PG" ) { | |
| $templateName = "Template14FCMC_PG"; | |
| } | |
| 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; | |
| uasort($response->studentData, function ($a, $b) { | |
| return $a->regNo > $b->regNo; | |
| }); | |
| $courseType = reset($response->studentData)->courseType; | |
| $batchStartYear = reset($response->studentData)->admissionYear; | |
| foreach ($response->studentData as $studentId => $student){ | |
| $student->studentImage = StudentService::getInstance()->getStudentProfilePic($student->studentId)->docpath; | |
| $student->dob = $student->dob ? date("d/m/Y", strtotime($student->dob)) : ''; | |
| $batchDetails = json_decode($student->properties); | |
| $student->courseCompleteWithinYear = 1; | |
| $finalSem = $batchDetails->finalTermId; | |
| $student->finalSem = $batchDetails->finalTermId; | |
| $student->periodOfStudy = $batchDetails->startYear."-".$batchDetails->endYear; | |
| $student->totalSemester = count($student->academicTerms); | |
| $lastAcademicTerm = reset(array_filter( $student->academicTerms ,function($value)use($finalSem){ | |
| return $value->termId == $finalSem; | |
| })); | |
| ksort($student->academicTerms ); | |
| foreach ($student->academicTerms as $key => $semMark){ | |
| $totalMarkMinimum = 0; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($semMark->termName); | |
| $semMark->semInRomanLetter = $semesterNames->romanLetter; | |
| $semMark->semInFullName = $semesterNames->fullName; | |
| if ($semMark->failedStatus != 'FAILED') { | |
| $sgpa = round($semMark->sgpa, 2); | |
| $sgpa = sprintf('%0.2f', $sgpa); | |
| } | |
| $semMark->sgpa = $sgpa; | |
| uasort($semMark->subjects, function ($a, $b) { | |
| return $a->subjectOrder > $b->subjectOrder; | |
| }); | |
| $semMark->subjects = array_values($semMark->subjects); | |
| if( $semMark->termOrder % 2 == 1){ | |
| $maxSubject = max(count($semMark->subjects), count($student->academicTerms[$key + 1]->subjects)); | |
| $semMark->totalsubjectCount = $maxSubject; | |
| $student->academicTerms[$key + 1]->totalsubjectCount = $maxSubject; | |
| } | |
| else{ | |
| if ( !$semMark->totalsubjectCount ){ | |
| $semMark->totalsubjectCount = count($semMark->subjects); | |
| } | |
| } | |
| if($semMark->totalsubjectCount >= 10){ | |
| $response->requiredExtraSpacing = 1; | |
| } | |
| } | |
| } | |
| foreach ($response->studentData as $student) { | |
| $customFields = AmsCustomFieldsService::getInstance()->getAmsCustomFieldValue(AmsCustomFieldsEntities::STUDENT, $student->studentId, []); | |
| if( $customFields ){ | |
| $student->ktuCode = CommonExamService::getInstance()->getCustomFieldObjectList($customFields)->studentData->KTU_CODE; | |
| } | |
| $student->lastExamMonthYear = $student->markDetails->latestExamMonth ? date("F Y", strtotime("01-". $student->markDetails->latestExamMonth."-".$student->markDetails->latestExamYear)) : ""; | |
| $student->credit = $student->markDetails->credit; | |
| $student->roundOff = 2; | |
| $student->cgpa = round($student->cgpa, $student->roundOff); | |
| $student->cgpaInWords = CommonUtil::convertNumberToWords($student->cgpa); | |
| $student->cgpa = sprintf('%0.2f', $student->cgpa); | |
| $student->creditInWords = CommonUtil::convertNumberToWords($student->markDetails->credit); | |
| foreach ($student->academicTerms as $term) { | |
| $term->credit = $term->markDetails->credit; | |
| foreach ($term->subjects as $subject) { | |
| $subject->examMonthYear = date('M Y',strtotime($subject->markDetails->latestExamYear."-".$subject->markDetails->latestExamMonth."-01")); | |
| $subject->credit = $subject->markDetails->credit; | |
| } | |
| } | |
| } | |
| $response->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $response->dateOfIssue = $request->filterSettings['markListDate']? date("d/m/Y", strtotime($request->filterSettings['markListDate'])): date("d/m/Y"); | |
| 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/Template14/$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>'; | |
| $width = 210; | |
| $height = 297; | |
| $options = array( | |
| 'page-width' => $width."mm", | |
| 'page-height' => $height."mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "5mm", | |
| 'margin-left' => "7mm", | |
| 'margin-right' => "7mm", | |
| 'margin-bottom' => "1mm", | |
| // '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; | |
| } | |
| } |