Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 14 |
CRAP | |
0.00% |
0 / 1201 |
| SupplementaryExamReportService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 14 |
21756.00 | |
0.00% |
0 / 1201 |
| getSubjectWiseSupplementaryStatusReport | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 78 |
|||
| getAllStudentDetailsListForSubjectWiseSupplementaryStatus | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 72 |
|||
| getAllSupplementaryStudentStatusReport | |
0.00% |
0 / 1 |
600.00 | |
0.00% |
0 / 166 |
|||
| getYearWiseSupplementaryResultAnalysis | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 73 |
|||
| getCourseWiseSupplementaryResultAnalysis | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 70 |
|||
| getAllStudentDetailsForSupplementaryResult | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 105 |
|||
| getYearWiseFailedStudentList | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 95 |
|||
| getExamWiseFailedStudentList | |
0.00% |
0 / 1 |
110.00 | |
0.00% |
0 / 88 |
|||
| getSupplementaryResultAnalysisTemplate | |
0.00% |
0 / 1 |
462.00 | |
0.00% |
0 / 115 |
|||
| getFailedStudentListReport | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 77 |
|||
| getSupplyStudentStatusReport | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 75 |
|||
| getSupplyDateWiseReport | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 34 |
|||
| getSupplementaryCasteCategoryResultAnalysis | |
0.00% |
0 / 1 |
420.00 | |
0.00% |
0 / 138 |
|||
| getSgpaByMonthYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
| <?php | |
| namespace com\linways\ec\core\service; | |
| use com\linways\ec\core\request\SearchRuleRequest; | |
| use com\linways\ec\core\service\RuleService; | |
| use com\linways\base\util\MakeSingletonTrait; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| use com\linways\core\ams\professional\service\ReligionService; | |
| use com\linways\core\ams\professional\service\AdmissionService; | |
| use com\linways\core\ams\professional\service\CampusTypeService; | |
| use com\linways\base\util\TwigRenderer; | |
| use com\linways\core\ams\professional\util\PdfUtil; | |
| use com\linways\core\ams\professional\service\CommonService; | |
| use com\linways\ec\core\service\ExamRegistrationService; | |
| use com\linways\ec\core\request\SearchExamRegistrationRequest; | |
| use com\linways\ec\core\service\ExamRegistrationSubjectService; | |
| use com\linways\core\ams\professional\service\CourseTypeService; | |
| use com\linways\core\ams\professional\util\CommonUtil; | |
| use com\linways\core\ams\professional\constant\ExamType; | |
| use com\linways\core\ams\professional\dto\SettingsConstents; | |
| use com\linways\base\util\SecurityUtils; | |
| use com\linways\ec\core\request\SearchExamRegistrationBatchRequest; | |
| use com\linways\ec\core\dto\StudentMarkDetails; | |
| use com\linways\ec\core\dto\exam\StudentDetails; | |
| use com\linways\ec\core\dto\exam\AcademicTermMark; | |
| use com\linways\ec\core\dto\exam\RegularExam; | |
| use com\linways\ec\core\dto\exam\ExamSubject; | |
| use com\linways\ec\core\service\CommonExamService; | |
| use com\linways\ec\core\service\NominalRollService; | |
| use com\linways\ec\core\service\RegularExamReportService; | |
| use com\linways\ec\core\service\GradeSchemeService; | |
| class SupplementaryExamReportService extends BaseService | |
| { | |
| use MakeSingletonTrait; | |
| /** | |
| * get Subject Wise Supplementary Status Report | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getSubjectWiseSupplementaryStatusReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $response = new \stdClass; | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $additionalDetails->admissionYear = $searchRequest->admissionYear; | |
| // Rule for Supply Examination report rule | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "SUPPLY_EXAM_REPORT_RULE"; | |
| $supplyReportRule = reset(RuleService::getInstance()->searchRule($searchRuleRequest))->rule; | |
| $additionalDetails->showMarks = $supplyReportRule->isShowMarksInSubjectWiseSupplyStatusReport == '1' ? true : false; | |
| $request->courseTypeId = $searchRequest->courseTypeId; | |
| $request->academicTermId = $searchRequest->academicTermId; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $request->subjectTypes = $searchRequest->subjectTypeIds; | |
| $subjectDetails=[]; | |
| $subectDetailsArray = []; | |
| $studentsDetails = $this->getAllStudentDetailsListForSubjectWiseSupplementaryStatus($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Students In Exam Registration"); | |
| } | |
| else{ | |
| foreach($studentsDetails as $student){ | |
| $additionalDetails->semester = $student->academicTerm; | |
| $subjectDetails[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $subjectDetails[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| $subjectDetails[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->studentId = $student->studentId; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->studentName = $student->studentName; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->regNo = $student->regNo; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->studentEmail = $student->studentEmail; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->studentPhone = $student->studentPhone; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->groupName = $student->groupName; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->internalMark = $student->internalMark; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->externalMark = $student->externalMark; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->attendanceStatus = $student->attendanceStatus; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->externalMaxMark = $student->externalMaxMark; | |
| $subjectDetails[$student->academicPaperSubjectId]->students[$student->studentId]->internalMaxMark = $student->internalMaxMark; | |
| } | |
| $subectDetailsArray = array_values($subjectDetails); | |
| foreach($subectDetailsArray as $subectDetail){ | |
| $subectDetail->students = array_values($subectDetail->students); | |
| } | |
| } | |
| if(empty($subectDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Students In Exam Registration"); | |
| } | |
| else{ | |
| $templateName = "PrintSubjectWiseSupplementaryStatus"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'subjects'=>$subectDetailsArray ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= ""; | |
| $prtContent .= '</head><title>Supplementary Status (Subject Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $options = array( | |
| 'page-width' => "210mm", | |
| 'page-height' => "297mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "10mm", | |
| 'margin-left' => "10mm", | |
| 'margin-right' => "10mm", | |
| 'margin-bottom' => "10mm", | |
| // '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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * get All Students For Subject Wise SUPPLEMENTARY Status | |
| * @param $searchRequest | |
| * @return $studentDetails | |
| */ | |
| public function getAllStudentDetailsListForSubjectWiseSupplementaryStatus($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $whereQuery = ""; | |
| if(!empty($searchRequest->courseTypeId)) { | |
| $whereQuery .= " AND p.course_type_id = '$searchRequest->courseTypeId'"; | |
| } | |
| if(!empty($searchRequest->admissionYear)) { | |
| $whereQuery .= " AND g.properties ->> '$.startYear' = '$searchRequest->admissionYear'"; | |
| } | |
| if(!empty($searchRequest->academicTermId)) { | |
| $whereQuery .= " AND CAST(eerb.properties ->> '$.academicTermId' AS CHAR) = '$searchRequest->academicTermId'"; | |
| } | |
| if(!empty($searchRequest->examRegistrationId)) { | |
| $whereQuery .= " AND eerb.ec_exam_registration_id = '$searchRequest->examRegistrationId'"; | |
| } | |
| if(!empty($searchRequest->subjectTypes)){ | |
| $whereQuery .= " AND aps.properties ->> '$.subjectTypeId' IN (" ."'" . implode("', '", $searchRequest->subjectTypes) . "'" .")"; | |
| } | |
| $query = "SELECT DISTINCT | |
| sa.studentID as studentId, | |
| sa.studentName, | |
| sa.regNo, | |
| sa.studentEmail, | |
| sa.studentPhone, | |
| eer.name as examRegistrationName, | |
| g.name as groupName, | |
| act.name as academicTerm, | |
| eers.am_assessment_id as assessmentId, | |
| eerb.ec_exam_registration_id as examRegistrationId, | |
| eers.cm_academic_paper_subjects_id as academicPaperSubjectId, | |
| s.code as subjectCode, | |
| s.name as subjectName, | |
| eer.name as examRegistrationName, | |
| esmd.mark_details ->> '$.internalMark' as internalMark, | |
| esmd.mark_details ->> '$.externalMark' as externalMark, | |
| esmd.mark_details ->> '$.attendanceStatus' as attendanceStatus, | |
| aps.properties->>'$.externalMaxMark' as externalMaxMark, | |
| aps.properties ->> '$.internalMaxMark' as internalMaxMark | |
| FROM | |
| `groups` g | |
| INNER JOIN program p ON | |
| p.id = g.properties->>'$.programId' | |
| INNER JOIN ec_exam_registration_batch eerb ON | |
| eerb.groups_id = g.id | |
| INNER JOIN ec_exam_registration_subject eers ON | |
| eers.ec_exam_registration_batch_id = eerb.id | |
| INNER JOIN ec_exam_registration eer ON | |
| eer.id = eerb.ec_exam_registration_id | |
| INNER JOIN ec_student_assessment_registration esar ON | |
| esar.am_assessment_id = eers.am_assessment_id AND | |
| CAST(esar.properties ->> '$.registrationStatus' AS CHAR) = 'REGISTERED' AND | |
| CAST(esar.properties ->> '$.feeStatus' AS CHAR) = 'PAID' AND | |
| esar.ec_exam_registration_type = eer.type | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = esar.student_id | |
| INNER JOIN cm_academic_paper_subjects aps ON | |
| eers.cm_academic_paper_subjects_id = aps.id | |
| INNER JOIN v4_ams_subject s ON | |
| aps.ams_subject_id = s.id | |
| INNER JOIN academic_term act ON | |
| act.id = CAST(eerb.properties ->> '$.academicTermId'AS CHAR) | |
| INNER JOIN ec_consolidated_subject_mark_details esmd ON | |
| esmd.groups_id = eerb.groups_id AND esmd.cm_academic_paper_subjects_id = eers.cm_academic_paper_subjects_id AND esmd.student_id = sa.studentID AND esmd.failed_status != 'PASSED' | |
| WHERE 1=1 "; | |
| $studentDetails = $this->executeQueryForList($query.$whereQuery); | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentDetails; | |
| } | |
| /** | |
| * get Subject Wise Supplementary Status Report | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getAllSupplementaryStudentStatusReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $response = new \stdClass; | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $dispalayType = $searchRequest->dispalayType; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->academicPaperSubjectIds = $searchRequest->academicPaperSubjectIds; | |
| $request->feeStatus = $searchRequest->feeStatus; | |
| $request->orderBy = $searchRequest->orderBy; | |
| $toDate = $searchRequest->toDate; | |
| $fromDate = $searchRequest->fromDate; | |
| $subjectDetails=[]; | |
| $subectDetailsArray = []; | |
| $studentDetails=[]; | |
| $studentDetailsArray=[]; | |
| $studentsDetails = ExamRegistrationService::getInstance()->getAllExamRegistredStudentDetails($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Registred Students In This Exam Registration"); | |
| } | |
| else{ | |
| if($dispalayType =="SUBJECT_WISE"){ | |
| foreach($studentsDetails as $student){ | |
| if((!empty($toDate)) && (!empty($fromDate))){ | |
| $toDate = date('Y-m-d', strtotime($toDate)); | |
| $fromDate = date('Y-m-d', strtotime($fromDate)); | |
| if(((date('Y-m-d', strtotime($student->studentExamRegistrationDate)) > $fromDate) && ($student->studentExamRegistrationDate != null )) || ((date('Y-m-d', strtotime($student->studentExamRegistrationDate)) < $toDate) && ($student->studentExamRegistrationDate != null))){ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $subjectDetails[$student->subjectCode]->subjectCode = $student->subjectCode; | |
| $subjectDetails[$student->subjectCode]->subjectName = $student->subjectName; | |
| $subjectDetails[$student->subjectCode]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentId = $student->studentId; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentName = $student->studentName; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->regNo = $student->regNo; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentEmail = $student->studentEmail; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentPhone = $student->studentPhone; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->groupName = $student->groupName; | |
| } | |
| } | |
| else{ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $subjectDetails[$student->subjectCode]->subjectCode = $student->subjectCode; | |
| $subjectDetails[$student->subjectCode]->subjectName = $student->subjectName; | |
| $subjectDetails[$student->subjectCode]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentId = $student->studentId; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentName = $student->studentName; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->regNo = $student->regNo; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentEmail = $student->studentEmail; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->studentPhone = $student->studentPhone; | |
| $subjectDetails[$student->subjectCode]->students[$student->studentId]->groupName = $student->groupName; | |
| } | |
| } | |
| $subectDetailsArray = array_values($subjectDetails); | |
| foreach($subectDetailsArray as $subectDetail){ | |
| $subectDetail->students = array_values($subectDetail->students); | |
| } | |
| if(empty($subectDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Students Registered In This Exam Registration Between These Dates"); | |
| } | |
| else{ | |
| $templateName = "SupplementaryReportSubjectWise"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'subjects'=>$subectDetailsArray ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary Report (Subject Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| elseif($dispalayType =="STUDENT_WISE"){ | |
| foreach($studentsDetails as $student){ | |
| if((!empty($toDate)) && (!empty($toDate))){ | |
| $toDate = date('Y-m-d', strtotime($toDate)); | |
| $fromDate = date('Y-m-d', strtotime($fromDate)); | |
| if(((date('Y-m-d', strtotime($student->studentExamRegistrationDate)) > $fromDate) && ($student->studentExamRegistrationDate != null )) && ((date('Y-m-d', strtotime($student->studentExamRegistrationDate)) < $toDate) && ($student->studentExamRegistrationDate != null))){ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentId = $student->studentId; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentName = $student->studentName; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->regNo = $student->regNo; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentEmail = $student->studentEmail; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentPhone = $student->studentPhone; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->groupName = $student->groupName; | |
| } | |
| } | |
| else{ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentId = $student->studentId; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentName = $student->studentName; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->regNo = $student->regNo; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentEmail = $student->studentEmail; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->studentPhone = $student->studentPhone; | |
| $studentDetails[$student->studentId][$student->academicPaperSubjectId]->groupName = $student->groupName; | |
| } | |
| } | |
| foreach($studentDetails as $studentSubject){ | |
| foreach($studentSubject as $student){ | |
| $studentDetailsArray[] = $student; | |
| } | |
| } | |
| if(empty($studentDetailsArray)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Registred Students In This Exam Registration"); | |
| } | |
| $templateName = "SupplementaryReportStudentWise"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'students'=>$studentDetailsArray ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary Report (Student Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * get Year Wise Supplementary result analysis Report | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getYearWiseSupplementaryResultAnalysis($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $response = new \stdClass; | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $request->courseTypeId = $searchRequest->courseType; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $request->examRegistrationIds = $searchRequest->examRegistrationIds; | |
| $examRegistrations=[]; | |
| $studentsDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Registred Students In This Exam Registration"); | |
| } | |
| else{ | |
| foreach($studentsDetails as $student){ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $examRegistrations[$student->examRegistrationId]->examRegistrationId = $student->examRegistrationId; | |
| $examRegistrations[$student->examRegistrationId]->examRegistrationName = $student->examRegistrationName; | |
| $examRegistrations[$student->examRegistrationId]->academicTerm = $student->academicTerm; | |
| $examRegistrations[$student->examRegistrationId]->subjects[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $examRegistrations[$student->examRegistrationId]->subjects[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| $examRegistrations[$student->examRegistrationId]->subjects[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $examRegistrations[$student->examRegistrationId]->subjects[$student->academicPaperSubjectId]->appeared++; | |
| if($student->failedStatus == 'FAILED' ){ | |
| $examRegistrations[$student->examRegistrationId]->subjects[$student->academicPaperSubjectId]->failed++; | |
| } | |
| else{ | |
| $examRegistrations[$student->examRegistrationId]->subjects[$student->academicPaperSubjectId]->passed++; | |
| } | |
| } | |
| $examRegistrationsArray = array_values($examRegistrations); | |
| foreach($examRegistrationsArray as $examRegistration){ | |
| foreach($examRegistration->subjects as $subject){ | |
| $subject->passPercentage = round ( ( 100 * $subject->passed / $subject->appeared ), 2); | |
| } | |
| $examRegistration->subjects = array_values($examRegistration->subjects); | |
| } | |
| $templateName = "SupplementaryYearWiseResultAnalysis"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'examRegistrations'=>$examRegistrationsArray ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary Result Analysis (Year Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * get Course Wise Supplementary result analysis Report | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getCourseWiseSupplementaryResultAnalysis($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $response = new \stdClass; | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->courseTypeId = $searchRequest->courseType; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $examRegistration = new \stdClass;; | |
| $studentsDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Registred Students In This Exam Registration"); | |
| } | |
| else{ | |
| foreach($studentsDetails as $student){ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $examRegistration->examRegistrationId = $student->examRegistrationId; | |
| $examRegistration->examRegistrationName = $student->examRegistrationName; | |
| $examRegistration->academicTerm = $student->academicTerm; | |
| $examRegistration->subjects[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $examRegistration->subjects[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| $examRegistration->subjects[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $examRegistration->subjects[$student->academicPaperSubjectId]->appeared++; | |
| if($student->failedStatus == 'FAILED' ){ | |
| $examRegistration->subjects[$student->academicPaperSubjectId]->failed++; | |
| } | |
| else{ | |
| $examRegistration->subjects[$student->academicPaperSubjectId]->passed++; | |
| } | |
| } | |
| foreach($examRegistration->subjects as $subject){ | |
| $subject->passPercentage = round ( ( 100 * $subject->passed / $subject->appeared ), 2); | |
| } | |
| $examRegistration->subjects = array_values($examRegistration->subjects); | |
| $templateName = "SupplementaryCourseWiseResultAnalysis"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'examRegistration'=>$examRegistration ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary Result Analysis (Course Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * get All Students For Subject Wise SUPPLEMENTARY Status | |
| * @param $searchRequest | |
| * @return $studentDetails | |
| */ | |
| public function getAllStudentDetailsForSupplementaryResult($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try | |
| { | |
| $finalized = '"FINALIZED"'; | |
| $whereQuery = ""; | |
| $sortBy = "ORDER BY spa.properties->>'$.registerNumber' ASC"; | |
| if(!empty($searchRequest->courseTypeId)) { | |
| $whereQuery .= " AND p.course_type_id = '$searchRequest->courseTypeId'"; | |
| } | |
| if(!empty($searchRequest->admissionYear)) { | |
| $whereQuery .= " AND g.properties ->> '$.startYear' = '$searchRequest->admissionYear'"; | |
| } | |
| if(!empty($searchRequest->examRegistrationIds)) { | |
| $examRegistrationIdsString= "'" . implode("', '", $searchRequest->examRegistrationIds) . "'" ; | |
| $whereQuery .= " AND eerb.ec_exam_registration_id IN ($examRegistrationIdsString)"; | |
| } | |
| if(!empty($searchRequest->examRegistrationId)) { | |
| $examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','", $searchRequest->examRegistrationId) . "'" : "'" . $searchRequest->examRegistrationId . "'"; | |
| $whereQuery .= " AND eerb.ec_exam_registration_id IN ( $examRegistrationIdString )"; | |
| // $whereQuery .= " AND eerb.ec_exam_registration_id = '$searchRequest->examRegistrationId' "; | |
| } | |
| if(!empty($searchRequest->isGetOnlyFailedStudent)) { | |
| if($searchRequest->isGetOnlyFailedStudent){ | |
| $whereQuery .= " AND esmd.failed_status = 'FAILED'"; | |
| } | |
| } | |
| if(!empty($searchRequest->groupId)) { | |
| $groupIdString = is_array($searchRequest->groupId) ? "'" . implode("','", $searchRequest->groupId) . "'" : "'" . $searchRequest->groupId . "'"; | |
| $whereQuery .= " AND g.id IN ( $groupIdString )"; | |
| } | |
| $query = "SELECT DISTINCT | |
| sa.studentID as studentId, | |
| sa.studentName, | |
| spa.properties->>'$.registerNumber' as regNo, | |
| g.id as groupId, | |
| g.name as groupName, | |
| act.id as academicTermId, | |
| act.name as academicTerm, | |
| ct.typeName AS courseTypeName, | |
| eer.name as examName, | |
| eer.properties ->> '$.examYear' as examYear, | |
| MONTHNAME(STR_TO_DATE(eer.properties ->> '$.examMonth', '%m')) AS examMonthName, | |
| eers.am_assessment_id as assessmentId, | |
| aa.properties_value ->>'$.assessmentDate' AS assessmentDate, | |
| aa.properties_value ->>'$.startTime' AS assessmentStartTime, | |
| aa.properties_value ->>'$.endTime' AS assessmentEndTime, | |
| eers.valuation_details as valuationDetails, | |
| eerb.ec_exam_registration_id as examRegistrationId, | |
| eers.cm_academic_paper_subjects_id as academicPaperSubjectId, | |
| s.code as subjectCode, | |
| s.name as subjectName, | |
| eer.name as examRegistrationName, | |
| esar.properties ->> '$.registeredDate' as studentExamRegistrationDate, | |
| esmd.failed_status as failedStatus, | |
| esmd.mark_details ->> '$.attendanceStatus' as absentStatus, | |
| esmd.mark_details ->>'$.revaluationId' AS subjectRevaluationId, | |
| esmd.mark_details ->>'$.hasRevaluationMark' AS subjectHasRevaluationMark, | |
| esmd.mark_details ->>'$.withoutRevaluationIsFailed' AS subjectWithoutRevaluationIsFailed, | |
| esmdsubcon.failed_status AS subjectConsolidatedFailedStatus, | |
| eerb.properties AS examBatchProperties, | |
| eserd.properties->>'$.isResultWithHeld' AS isResultWithHeld | |
| 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 | |
| INNER JOIN ec_exam_registration_batch eerb ON | |
| eerb.groups_id = g.id | |
| INNER JOIN ec_exam_registration_subject eers ON | |
| eers.ec_exam_registration_batch_id = eerb.id | |
| INNER JOIN am_assessment aa ON | |
| aa.id = eers.am_assessment_id | |
| INNER JOIN ec_exam_registration eer ON | |
| eer.id = eerb.ec_exam_registration_id AND eer.type = 'SUPPLEMENTARY' | |
| INNER JOIN ec_student_assessment_registration esar ON | |
| esar.am_assessment_id = eers.am_assessment_id AND | |
| CAST(esar.properties ->> '$.registrationStatus' AS CHAR) = 'REGISTERED' AND | |
| CAST(esar.properties ->> '$.feeStatus' AS CHAR) = 'PAID' AND | |
| esar.ec_exam_registration_type = eer.type | |
| INNER JOIN ec_student_exam_registration_details eserd ON | |
| eserd.student_id = esar.student_id AND | |
| eserd.ec_exam_registration_id = eer.id | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = esar.student_id | |
| INNER JOIN student_program_account spa | |
| ON spa.student_id = sa.studentID | |
| INNER JOIN cm_academic_paper_subjects aps ON | |
| eers.cm_academic_paper_subjects_id = aps.id | |
| INNER JOIN v4_ams_subject s ON | |
| aps.ams_subject_id = s.id | |
| INNER JOIN academic_term act ON | |
| act.id = CAST(eerb.properties ->> '$.academicTermId'AS CHAR) | |
| INNER JOIN ec_subject_mark_details esmd ON | |
| esmd.ec_exam_registration_id = eerb.ec_exam_registration_id AND esmd.groups_id = eerb.groups_id AND esmd.cm_academic_paper_subjects_id = eers.cm_academic_paper_subjects_id AND esmd.student_id = sa.studentID | |
| INNER JOIN ec_consolidated_subject_mark_details esmdsubcon ON | |
| esmdsubcon.groups_id = eerb.groups_id AND esmdsubcon.cm_academic_paper_subjects_id = eers.cm_academic_paper_subjects_id AND esmdsubcon.student_id = sa.studentID | |
| WHERE 1=1 "; | |
| $studentDetails = $this->executeQueryForList($query.$whereQuery.$sortBy); | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentDetails; | |
| } | |
| /** | |
| * get Year Wise Supplementary Failed Students | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getYearWiseFailedStudentList($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $courseType = CourseTypeService::getInstance()->getCourseTypesById ($searchRequest->courseType); | |
| $additionalDetails->courseAndYear = $courseType->courseTypeMethod ."-".$searchRequest->admissionYear; | |
| $request->examRegistrationIds = $searchRequest->examRegistrationIds; | |
| $request->courseTypeId = $searchRequest->courseType; | |
| $request->isGetOnlyFailedStudent = true; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $isConsiderAbsenteesAsFailed = $searchRequest->isConsiderAbsenteesAsFailed; | |
| $batches=[]; | |
| $batchesArray = []; | |
| $studentsDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Registred Students In This Exam Registration"); | |
| } | |
| else{ | |
| if($isConsiderAbsenteesAsFailed == "true"){ | |
| foreach($studentsDetails as $student){ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $batches[$student->groupId]->groupId = $student->groupId; | |
| $batches[$student->groupId]->groupName = $student->groupName; | |
| $batches[$student->groupId]->students[$student->studentId]->studentId = $student->studentId; | |
| $batches[$student->groupId]->students[$student->studentId]->studentName = $student->studentName; | |
| $batches[$student->groupId]->students[$student->studentId]->regNo = $student->regNo; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->academicTermId = $student->academicTermId; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->academicTerm = $student->academicTerm; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->subjects[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->subjects[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->subjects[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| } | |
| } | |
| else{ | |
| foreach($studentsDetails as $student){ | |
| if($student->absentStatus != 'ABSENT' || $student->absentStatus == null){ | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $batches[$student->groupId]->groupId = $student->groupId; | |
| $batches[$student->groupId]->groupName = $student->groupName; | |
| $batches[$student->groupId]->students[$student->studentId]->studentId = $student->studentId; | |
| $batches[$student->groupId]->students[$student->studentId]->studentName = $student->studentName; | |
| $batches[$student->groupId]->students[$student->studentId]->regNo = $student->regNo; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->academicTermId = $student->academicTermId; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->academicTerm = $student->academicTerm; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->subjects[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->subjects[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $batches[$student->groupId]->students[$student->studentId]->semsters[$student->academicTermId]->subjects[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| } | |
| } | |
| } | |
| $batchesArray = array_values($batches); | |
| foreach($batchesArray as $batch){ | |
| $batch->students = array_values($batch->students); | |
| foreach($batch->students as $student){ | |
| $student->semsters = array_values($student->semsters); | |
| foreach($student->semsters as $semster){ | |
| $semster->subjects = array_values($semster->subjects); | |
| } | |
| } | |
| } | |
| $templateName = "FailedStudentList-YearWise"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'batches'=>$batchesArray ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Failed Student List (Year Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get Year Wise Supplementary Failed Students | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getExamWiseFailedStudentList($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $courseType = CourseTypeService::getInstance()->getCourseTypesById ($searchRequest->courseType); | |
| $additionalDetails->courseAndYear = $courseType->courseTypeMethod ."-".$searchRequest->admissionYear; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->courseTypeId = $searchRequest->courseType; | |
| $request->isGetOnlyFailedStudent = true; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $isConsiderAbsenteesAsFailed = $searchRequest->isConsiderAbsenteesAsFailed; | |
| $batches=[]; | |
| $batchesArray = []; | |
| $studentsDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"No Registred Students In This Exam Registration"); | |
| } | |
| else{ | |
| $additionalDetails->examRegistrationName = $studentsDetails[0]->examRegistrationName; | |
| $additionalDetails->academicTerm = $studentsDetails[0]->academicTerm; | |
| if($isConsiderAbsenteesAsFailed == "true"){ | |
| foreach($studentsDetails as $student){ | |
| $batches[$student->groupId]->groupId = $student->groupId; | |
| $batches[$student->groupId]->groupName = $student->groupName; | |
| $batches[$student->groupId]->students[$student->studentId]->studentId = $student->studentId; | |
| $batches[$student->groupId]->students[$student->studentId]->studentName = $student->studentName; | |
| $batches[$student->groupId]->students[$student->studentId]->regNo = $student->regNo; | |
| $batches[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $batches[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $batches[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| } | |
| } | |
| else{ | |
| foreach($studentsDetails as $student){ | |
| if($student->absentStatus != 'ABSENT' || $student->absentStatus == null){ | |
| $batches[$student->groupId]->groupId = $student->groupId; | |
| $batches[$student->groupId]->groupName = $student->groupName; | |
| $batches[$student->groupId]->students[$student->studentId]->studentId = $student->studentId; | |
| $batches[$student->groupId]->students[$student->studentId]->studentName = $student->studentName; | |
| $batches[$student->groupId]->students[$student->studentId]->regNo = $student->regNo; | |
| $batches[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $batches[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->subjectCode = $student->subjectCode; | |
| $batches[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->subjectName = $student->subjectName; | |
| } | |
| } | |
| } | |
| $batchesArray = array_values($batches); | |
| foreach($batchesArray as $batch){ | |
| $batch->students = array_values($batch->students); | |
| foreach($batch->students as $student){ | |
| $student->subjects = array_values($student->subjects); | |
| } | |
| } | |
| $templateName = "FailedStudentList-ExamWise"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'batches'=>$batchesArray ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Failed Student List (Exam Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| /** | |
| * get Supplementary result analysis Report | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getSupplementaryResultAnalysisTemplate($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $response = new \stdClass; | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $request->examRegistrationId = $searchRequest->examRegistrationIds; | |
| $request->courseTypeId = $searchRequest->courseType; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $request->groupId = $searchRequest->groupId; | |
| $examRegistration = new \stdClass;; | |
| if( $searchRequest->isStaffSideView == 'true'){ | |
| $requestForExamRegistration = new SearchExamRegistrationRequest; | |
| $requestForExamRegistration->parentExamRegistrationId = $request->examRegistrationId; | |
| $revaluationRegistrations = ExamRegistrationService::getInstance()->getAllExamRevaluation($requestForExamRegistration); | |
| } | |
| $studentsDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"Result analysis not available"); | |
| } | |
| else{ | |
| foreach($studentsDetails as $key=> $student){ | |
| if( $searchRequest->isStaffSideView == 'true'){ | |
| $examBatchProperties = json_decode($student->examBatchProperties); | |
| if($student->isResultWithHeld == '1' || (!($examBatchProperties->isResultPublished ) || (($examBatchProperties->isResultPublished) && (strtotime($examBatchProperties->publishingStartDate) > strtotime(date("Y-m-d H:i")))))) { | |
| unset($studentMarkDetails[$key]); | |
| $student = null; | |
| } | |
| } | |
| if($student){ | |
| if( $searchRequest->isStaffSideView == 'true'){ | |
| if ( $student->subjectHasRevaluationMark ){ | |
| $currentRegistration = reset(array_filter($revaluationRegistrations,function($value)use($student){ | |
| return $value->id == $student->subjectRevaluationId; | |
| })); | |
| $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"))){ | |
| $student->failedStatus = $student->subjectWithoutRevaluationIsFailed == 1 ? "FAILED" : "PASSED"; | |
| $student->isFailed = $student->failedStatus; | |
| } | |
| } | |
| } | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $additionalDetails->examYear = $student->examYear; | |
| $additionalDetails->examMonthName = $student->examMonthName; | |
| $additionalDetails->courseTypeName = $student->courseTypeName; | |
| $examRegistration->examRegistrationId = $student->examRegistrationId; | |
| $examRegistration->courseTypeName = $student->courseTypeName; | |
| $examRegistration->academicTerm = $student->academicTerm; | |
| $examRegistration->subjects[$student->subjectCode]->academicTerm = $student->academicTerm; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($student->academicTerm); | |
| $examRegistration->subjects[$student->subjectCode]->semNumber = $semesterNames->semNumber; | |
| $examRegistration->subjects[$student->subjectCode]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $examRegistration->subjects[$student->subjectCode]->subjectName = $student->subjectName; | |
| $examRegistration->subjects[$student->subjectCode]->subjectCode = $student->subjectCode; | |
| $examRegistration->subjects[$student->subjectCode]->appeared++; | |
| if( $student->absentStatus == "ABSENT"){ | |
| $examRegistration->subjects[$student->subjectCode]->absent++; | |
| $examRegistration->subjects[$student->subjectCode]->appeared--; | |
| } | |
| else if($student->failedStatus == 'FAILED' ){ | |
| $examRegistration->subjects[$student->subjectCode]->failed++; | |
| } | |
| else{ | |
| $examRegistration->subjects[$student->subjectCode]->passed++; | |
| } | |
| } | |
| } | |
| if(empty($examRegistration->subjects)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"Result analysis not available"); | |
| } | |
| foreach($examRegistration->subjects as $subject){ | |
| if ( empty($subject->appeared )){ | |
| $subject->passPercentage = 0; | |
| } | |
| else{ | |
| $subject->passPercentage = round ( ( 100 * $subject->passed / $subject->appeared ), 2); | |
| } | |
| } | |
| $examRegistration->subjects = array_values($examRegistration->subjects); | |
| $templateName = "SupplementaryResultAnalysisTemplate"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'examRegistration'=>$examRegistration ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $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;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary Result Analysis (Course Wise)</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * Get Failed Student List | |
| * @param $searchRequest | |
| * @return $programResult | |
| */ | |
| public function getFailedStudentListReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| $failedStudents = []; | |
| $considerSupplementaryResult = false; | |
| $request = new \stdClass; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->academicTermId = $searchRequest->academicTermId; | |
| $request->groupId = $searchRequest->groupId; | |
| $request->courseTypeId = $searchRequest->courseTypeId; | |
| $request->religionId = $searchRequest->religionId; | |
| $request->reservationId = $searchRequest->reservationId; | |
| $request->campusTypeId = $searchRequest->campusTypeId; | |
| $request->gender = $searchRequest->gender; | |
| // Rule for Regular Failed Student List | |
| $searchRuleRequest = new SearchRuleRequest; | |
| $searchRuleRequest->name = "FAILED_STUDENT_LIST_RULE"; | |
| $failedStudentListRule = RuleService::getInstance()->searchRule($searchRuleRequest); | |
| $failedStudentListRule = $failedStudentListRule ? reset($failedStudentListRule) : null; | |
| if(!empty($failedStudentListRule)){ | |
| $considerSupplementaryResult = $failedStudentListRule->rule->considerConsolidatedResultInSupplyFailedStudentList; | |
| } | |
| $additionalData = new \stdClass; | |
| $studentMarkDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentMarkDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_REPORTS_DETAILS_FOUND,"No student(s) registered."); | |
| } | |
| foreach($studentMarkDetails as $student){ | |
| $additionalData->examName = $student->examName; | |
| $additionalData->semesterName = $student->academicTerm; | |
| $failedStudentsGroups[$student->groupId]->id = $student->groupId; | |
| $failedStudentsGroups[$student->groupId]->name = $student->groupName; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->id = $student->studentId; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->registerNo = $student->regNo; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->name = $student->studentName; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->subjects = []; | |
| $failedStudentsGroups[$student->groupId]->semesterName = $student->academicTerm; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->currentFailedStatus = $considerSupplementaryResult ? $student->subjectConsolidatedFailedStatus : $student->failedStatus; | |
| if($searchRequest->absenteesAsFailedStatus =='true'){ | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->currentFailedStatus = $student->absentStatus == 'ABSENT' ? 'FAILED' : $failedStudentsGroups[$student->groupId]->students[$student->studentId]->currentFailedStatus; | |
| } | |
| else{ | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->currentFailedStatus = $student->absentStatus == 'ABSENT' ? 'PASSED' : $failedStudentsGroups[$student->groupId]->students[$student->studentId]->currentFailedStatus; | |
| } | |
| if( $failedStudentsGroups[$student->groupId]->students[$student->studentId]->currentFailedStatus == 'FAILED'){ | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->id = $student->academicPaperSubjectId; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->code = $student->subjectCode; | |
| $failedStudentsGroups[$student->groupId]->students[$student->studentId]->subjects[$student->academicPaperSubjectId]->name = $student->subjectName; | |
| } | |
| } | |
| if(empty($failedStudentsGroups)){ | |
| throw new ExamControllerException(ExamControllerException::NO_REPORTS_DETAILS_FOUND,"No Failed students in exam registration."); | |
| } | |
| $collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $templateName = "Template_1_failed_student_list_report"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'groups'=>$failedStudentsGroups,'data'=>$collegeData,'additionalData'=>$additionalData ]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| </style>"; | |
| $prtContent .= '</head><title>Failed Student List</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 297; | |
| $totalHeight = 210; | |
| $options = array( | |
| 'page-width' => $totalHeight."mm", | |
| 'page-height' => $totalWidth."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); | |
| return $programResult; | |
| } | |
| /** | |
| * get Supply Student Status Report | |
| * @param $searchRequest | |
| * @return $response | |
| */ | |
| public function getSupplyStudentStatusReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $response = new \stdClass; | |
| $request = new \stdClass; | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collageName = $GLOBALS['COLLEGE_NAME']; | |
| $request->examRegistrationId = $searchRequest->examRegistrationIds; | |
| $request->courseTypeId = $searchRequest->courseType; | |
| $request->admissionYear = $searchRequest->admissionYear; | |
| $request->groupId = $searchRequest->groupId; | |
| $examRegistration = new \stdClass;; | |
| $studentsDetails = $this->getAllStudentDetailsForSupplementaryResult($request); | |
| if(empty($studentsDetails)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"Result analysis not available"); | |
| } | |
| else{ | |
| foreach($studentsDetails as $key=> $student){ | |
| $student->valuationDetails = json_decode($student->valuationDetails); | |
| $additionalDetails->examRegistrationName = $student->examRegistrationName; | |
| $additionalDetails->examYear = $student->examYear; | |
| $additionalDetails->examMonthName = $student->examMonthName; | |
| $examRegistration->subjects[$student->subjectCode]->academicTerm = $student->academicTerm; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($student->academicTerm); | |
| $examRegistration->subjects[$student->subjectCode]->semNumber = $semesterNames->semNumber; | |
| $examRegistration->subjects[$student->subjectCode]->academicPaperSubjectId = $student->academicPaperSubjectId; | |
| $examRegistration->subjects[$student->subjectCode]->subjectName = $student->subjectName; | |
| $examRegistration->subjects[$student->subjectCode]->subjectCode = $student->subjectCode; | |
| $examRegistration->subjects[$student->subjectCode]->batchName = $student->groupName; | |
| $examRegistration->subjects[$student->subjectCode]->examDate = date("d-m-Y", strtotime($student->assessmentDate)); | |
| if($student->absentStatus == 'PRESENT'){ | |
| $examRegistration->subjects[$student->subjectCode]->attendedStudentCount = $examRegistration->subjects[$student->subjectCode]->attendedStudentCount + 1; | |
| } | |
| if($student->absentStatus == 'PRESENT'){ | |
| $examRegistration->subjects[$student->subjectCode]->valuatedStudentCount = $examRegistration->subjects[$student->subjectCode]->valuatedStudentCount + 1; | |
| } | |
| } | |
| if(empty($examRegistration->subjects)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENTS_IN_THIS_EXAM_REGISTRATION,"Result analysis not available"); | |
| } | |
| foreach($examRegistration->subjects as $subject){ | |
| } | |
| $examRegistration->subjects = array_values($examRegistration->subjects); | |
| $templateName = "SupplementaryStudentStatusTemplate"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'examRegistration'=>$examRegistration ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| </style>"; | |
| $prtContent .= '</head><title>Supplementary Student Status Report</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 210; | |
| $totalHeight = 297; | |
| $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); | |
| return $programResult; | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * Get Supply Date wise Report | |
| * @param $searchRequest | |
| * @return $programResult | |
| */ | |
| public function getSupplyDateWiseReport($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| $request = new \stdClass; | |
| $request->examRegistrationId = $searchRequest->examRegistrationId; | |
| $request->examDate = $searchRequest->examDate; | |
| $students = NominalRollService::getInstance()->getAllExamRegisteredStudentDetailsForNominalRoll($request); | |
| if(empty($students)){ | |
| throw new ExamControllerException(ExamControllerException::NO_STUDENT_IN_THE_BATCH_SUBJECT,"No details found."); | |
| } | |
| $templateName = "supply-date-wise-report-template"; | |
| $additionalInfo->examRegistrationName = reset($students)->examRegistrationName; | |
| $additionalInfo->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/SupplementaryExamReports/$templateName.twig"), [ 'students'=>$students,'additionalInfo'=>$additionalInfo]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| </style>"; | |
| $prtContent .= '</head><title>Supply Exam Date Wise Report</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $options = array( | |
| 'page-width' => "210mm", | |
| 'page-height' => "297mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "1mm", | |
| 'margin-left' => "1mm", | |
| 'margin-right' => "1mm", | |
| 'margin-bottom' => "1mm", | |
| // '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); | |
| return $programResult; | |
| } | |
| public function getSupplementaryCasteCategoryResultAnalysis($searchRequest) { | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| try{ | |
| $additionalDetails = new \stdClass; | |
| $additionalDetails->collegeData = CommonExamService::getInstance()->getCollegeDetails(); | |
| $requestForExamRegistration = new \stdClass; | |
| $casteCategoryStudents = []; | |
| $gradeList = []; | |
| $additionalDetails->currentDate = date("d M Y"); | |
| $requestForExamRegistration->examRegistrationId = $searchRequest->examRegistrationId; | |
| $requestForExamRegistration->groupId = $searchRequest->groupId; | |
| $examRegistration = reset(ExamRegistrationService::getInstance()->searchDetailedExamRegistrationDetails($requestForExamRegistration)); | |
| if(!empty($examRegistration)){ | |
| $additionalDetails->examRegistrationName = $examRegistration->name; | |
| $additionalDetails->examRegistrationType = $examRegistration->type; | |
| $additionalDetails->degreeDescription = reset($examRegistration->groups)->degreeDescription; | |
| $additionalDetails->endYear = reset($examRegistration->groups)->properties->endYear; | |
| $additionalDetails->startYear = reset($examRegistration->groups)->properties->startYear; | |
| $additionalDetails->academicTermName = reset($examRegistration->groups)->academicTermName; | |
| $semesterNames = CommonExamService::getInstance()->getDifferentSemesterName($additionalDetails->academicTermName); | |
| $additionalDetails->academicTermRoman = $semesterNames->romanLetter; | |
| } | |
| $gradeSchemeRequest = new \stdClass; | |
| $gradeSchemeRequest->examRegistrationId = $searchRequest->examRegistrationId; | |
| $gradeSchemeRequest->groupId = array_column($examRegistration->groups,'groupId'); | |
| $gradeSchemeRequest->requestType = "SEMESTER"; | |
| $grades = GradeSchemeService::getInstance()->getAllSemesterSubjectCurriculumGrades($gradeSchemeRequest); | |
| foreach($grades as $grade){ | |
| if($grade->failStatus != '1'){ | |
| $gradeList[$grade->gradeName] = $grade; | |
| } | |
| } | |
| $gradeList["PASS"]->gradeName = "PASS"; | |
| $gradeList["ATKT"]->gradeName = "ATKT"; | |
| $gradeList["FAIL"]->gradeName = "FAIL"; | |
| $additionalDetails->gradeList = $gradeList; | |
| $casteCategoryResultAnalysisRequest = new \stdClass; | |
| $casteCategoryResultAnalysisRequest->examRegistrationId = $searchRequest->examRegistrationId; | |
| $casteCategoryResultAnalysisRequest->groupId = $searchRequest->groupId; | |
| // $casteCategoryResultAnalysisRequest->academicTermId = reset($examRegistration->groups)->academicTermId; | |
| $studentMarkDetails = RegularExamReportService::getInstance()->getAllRegistredStudentOverAllDetails($casteCategoryResultAnalysisRequest); | |
| foreach($studentMarkDetails as $student){ | |
| $currentAcademicTerm = reset(array_filter(reset($student->academicTerms)->markHistory,function($value)use($searchRequest){ | |
| return $value->examRegistrationId == $searchRequest->examRegistrationId; | |
| })); | |
| if( empty($currentAcademicTerm) ){ | |
| continue; | |
| } | |
| $reservationId = $student->studentDetails->reservationId; | |
| $casteId = $student->studentDetails->casteId; | |
| $studentGender = $student->studentDetails->gender; | |
| $studentGrade = $currentAcademicTerm->grade; | |
| $semesterMarksRequest = new \stdClass; | |
| $semesterMarksRequest->studentId = $student->id; | |
| $semesterMarksRequest->academicTermId = reset($examRegistration->groups)->academicTermId; | |
| $semesterMarks = MarksCardService::getInstance()->getStudentSemesterMarkDetails($semesterMarksRequest); | |
| $arrearCount = 0; | |
| foreach($semesterMarks as $semKey => $semester){ | |
| foreach($semester->subjects as $subject){ | |
| $currentSubject = $this->getSgpaByMonthYear($subject->subjectMarkHistory, $examRegistration, 1); | |
| if (count($subject->subjectMarkHistory) > 1){ | |
| $regularStudentHistory = reset(array_filter($subject->subjectMarkHistory,function($value){ | |
| return $value->examMarkType == "REGULAR"; | |
| })); | |
| if( $regularStudentHistory && ($currentSubject->internalMark != $regularStudentHistory->internalMark) ){ | |
| if( empty($currentSubject->externalMarkObtainedInExam ) && !$regularStudentHistory->isExternalFailed ){ | |
| $currentSubject->resultStatus = $subject->markDetails->isFailed ? 'FAILED' : 'PASSED'; | |
| } | |
| } | |
| } | |
| $arrearCount = $currentSubject->resultStatus == "FAILED" ? $arrearCount+1 : $arrearCount; | |
| } | |
| } | |
| $casteCategoryStudents[$student->studentDetails->batchId]->id = $student->studentDetails->batchId; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->name = $student->studentDetails->batchName; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->id = $reservationId; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->name = $student->studentDetails->reservationName; | |
| if(empty($casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender])){ | |
| $casteCategoryStudents[$student->studentDetails->batchId]->categoryCount++; | |
| } | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->id = $studentGender; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->name = ucwords($studentGender); | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->totalStudent++; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->totalStudent++; | |
| if($currentAcademicTerm->failedStatus == "FAILED"){ | |
| // $studentSubjects = reset($student->academicTerms)->subjects; | |
| // $failedSubjects = array_filter($studentSubjects,function($value){ | |
| // return $value->isFailed == "FAILED"; | |
| // }); | |
| if($arrearCount > 2){ | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->grades["FAIL"]++; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->gradeGrandTotal["FAIL"]++; | |
| } | |
| else{ | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->grades["ATKT"]++; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->gradeGrandTotal["ATKT"]++; | |
| } | |
| } | |
| else{ | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->grades["PASS"]++; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->category[$reservationId]->genders[$studentGender]->grades[$studentGrade]++; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->gradeGrandTotal["PASS"]++; | |
| $casteCategoryStudents[$student->studentDetails->batchId]->gradeGrandTotal[$studentGrade]++; | |
| } | |
| } | |
| $casteCategoryStudents = array_values($casteCategoryStudents); | |
| array_walk($casteCategoryStudents, function($student){ | |
| $student->castes = array_values($student->castes); | |
| }); | |
| if(empty($casteCategoryStudents)){ | |
| throw new ExamControllerException(ExamControllerException::NO_REPORTS_DETAILS_FOUND,"No Entry In This Exam Registration"); | |
| } | |
| else{ | |
| $templateName = "casteCategoryWiseResultAnalysis"; | |
| $responseHtml = TwigRenderer::renderTemplateFileToHtml(realpath(DOCUMENT_ROOT."../examcontroller-api/src/com/linways/web/templates/regularExamReportTwigs/$templateName.twig"), [ 'casteCategoryStudents'=>$casteCategoryStudents ,'additionalDetails'=>$additionalDetails]); | |
| $prtContent = NULL; | |
| $prtContent .= '<html><head>'; | |
| $prtContent .= "<style> | |
| h5 {font-size: 26px;} .text-center { text-align: center;} .align-middle {vertical-align: middle;}; tr.noBorder td {border: 0; border-collapse:collapse;} | |
| table, th, td {border: 1px solid black;border-collapse: collapse;} | |
| </style>"; | |
| $prtContent .= '</head><title>Caste Category Wise Result Anaysis</title><body>'; | |
| $prtContent .= $responseHtml; | |
| $prtContent .= '</body></html>'; | |
| $totalWidth = 297; | |
| $totalHeight = 210; | |
| $options = array( | |
| 'page-width' => $totalHeight."mm", | |
| 'page-height' => $totalWidth."mm", | |
| 'dpi' => 96, | |
| 'margin-top' => "3mm", | |
| 'margin-left' => "10mm", | |
| 'margin-right' => "10mm", | |
| 'margin-bottom' => "5mm", | |
| // '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); | |
| } | |
| } | |
| catch (\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $programResult; | |
| } | |
| protected function getSgpaByMonthYear($markHistory, $request, $subjectRequest){ | |
| $currentHistory = ''; | |
| if( $subjectRequest ){ | |
| $currentHistory = array_filter($markHistory,function($value)use($request){ | |
| return $value->examYear."-".date("m", mktime(0, 0, 0, (int)$value->examMonth, 10)) <= $request->examYear."-".date("m", mktime(0, 0, 0, (int)$request->examMonth, 10)); | |
| }); | |
| usort($currentHistory, function($a, $b) { | |
| return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))."-".$a->examMarkType) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))."-".$b->examMarkType); | |
| }); | |
| } | |
| else{ | |
| $currentHistory = array_filter($markHistory,function($value)use($request){ | |
| return $value->examYear."-".date("m", mktime(0, 0, 0, (int)$value->examMonth, 10)) <= $request->examYear."-".date("m", mktime(0, 0, 0, (int)$request->examMonth, 10)); | |
| }); | |
| usort($currentHistory, function($a, $b) { | |
| return ($a->examYear."-".date("m", mktime(0, 0, 0, (int)$a->examMonth, 10))."-".$a->historyType) < ($b->examYear."-".date("m", mktime(0, 0, 0, (int)$b->examMonth, 10))."-".$b->historyType); | |
| }); | |
| } | |
| return reset($currentHistory); | |
| } | |
| } |