Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 98 |
CRAP | |
0.00% |
0 / 1528 |
GraceMarkService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 98 |
74256.00 | |
0.00% |
0 / 1528 |
__construct | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
__clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 4 |
|||
saveGraceMarkRule | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
updateGraceMarkRule | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getGraceMarksRulesConditions | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getStudentEvents | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
deleteStudentEvent | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getMarksBeforeModeration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
studentPresentInModeration | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getMaxMark | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getintMaxMark | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
getSchemeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getPassPercentage | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
updateMainTableMark | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
updateGraceMark | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
saveOldMarkBeforeModeration | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 22 |
|||
getModerationRuleId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getExamRegId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
getModerationRuleDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getAllExamIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 17 |
|||
getStudentGraceMarks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getStudentDetailsByEvent | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
studentModerationApplied | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getStudentGraceMarkApplications | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getStudentExamDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getStudentExamDetailsPG | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getGraceMarkApplicationDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
finalizeAllStudents | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getStudentGraceMark | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getStudentGraceMarkPG | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
getGracemarkApplicationInitiate | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getStudentGraceMarksByApplnInitiateId | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 78 |
|||
addGraceMarksStudentWise | |
0.00% |
0 / 1 |
182.00 | |
0.00% |
0 / 86 |
|||
getStudentsExamMarksDetailsWithGraceMarkByExamId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 18 |
|||
updateExamExternalMarksAndGraceMarkTable | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 20 |
|||
getBatchStudentGraceMark | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 22 |
|||
getStudentGraceMarkDetails | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 39 |
|||
getBatchStudentGraceMarkDetails | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 21 |
|||
saveGraceMarkCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
updateGraceMarkCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
deleteGraceMarkCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
updateGraceMarkPosition | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
deleteGraceMarkPosition | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
getGraceMarkCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
saveGraceMarkPosition | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getGraceMarkPositions | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
saveGraceMarkLevels | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getCategoryLevels | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
updateGraceMarklevels | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getDistinctCategories | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
deleteGraceMarkLevel | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getGraceMarkCategoryAndLevel | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
saveGraceMarkApplied | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 27 |
|||
getGraceMarkAppliedStudentDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
saveGraceMarkInitiatedDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getGraceMarkInitiatedDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
updateGraceMarkInitiatedDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
deleteGraceMarkApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
saveGraceMarkAssignedBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getGraceMarkAssignedBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
updateGraceMarkInitiatedBatches | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getGraceMarkAssignedBatchesByAssignId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getGraceMarkAssignedBatchesByApplnId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getGraceMarkApplicationByBatchId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getGraceMarkAppliedStudentDetailsByApplicationId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
saveGraceMarkConfirmStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getGraceMarkAssignedBatch | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getGraceMarkInitiatedDetailsByApplnIds | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 8 |
|||
getGraceMarkAssignedByBatchAndSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
insertGraceMarkCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
updateGraceMarkEventCategory | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
saveGraceMarkPublishDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
getGraceMarkPublishDate | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 23 |
|||
saveGraceMarkLog | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 40 |
|||
getGraceMarkLog | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 20 |
|||
getGraceMarkAppliedStudentsByStartYear | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
saveMarkDistribution | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 26 |
|||
getSubjectGraceMarkDistribution | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 16 |
|||
getSemesterGraceMarkDistribution | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 13 |
|||
saveCarryForwardedMarkDistribution | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 29 |
|||
getGraceMarkAppliedStudentDetailsByApplnId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
saveRedistributionMarkDetails | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 23 |
|||
deleteAllDistributedGraceMark | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
getStudentRedistributionDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getStudentRedistributionApplicationDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
saveRedistributionApplicationDates | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
saveRedistributionStudentApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getStudentRedistributionAppliedDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getStudentTotalGraceMarks | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 18 |
|||
getGraceMarkAppliedDetailsByStudentId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
getStudentGraceMarkDetailsByStudentIdAndSemid | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
getStudentGraceMarksBySem | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 82 |
|||
getGraceMarksNotAwarededStudents | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 34 |
|||
getStudentGraceMarksApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 15 |
|||
getGraceMarkAppliedStudentDetailsExam | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 10 |
|||
getGraceMarkAppliedStudentListByApplicationId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getStudentGraceMarkApplicationMarkDetails | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 24 |
|||
studentsPresentInModerationByRequest | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 20 |
<?php | |
namespace com\linways\core\ams\professional\service; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
use com\linways\core\ams\professional\service\CourseTypeService; | |
use com\linways\core\ams\professional\constant\examcontroller\CourseTypeConstants; | |
class GraceMarkService extends BaseService { | |
private static $_instance = null; | |
// /Condition 2 - Locked down the constructor | |
private function __construct() {} | |
// Prevent any oustide instantiation of this class | |
// /Condition 3 - Prevent any object or instance of that class to be cloned | |
private function __clone() { | |
} | |
// Prevent any copy of this object | |
// /Condition 4 - Have a single globally accessible static method | |
public static function getInstance() { | |
if (! is_object ( self::$_instance )) | |
// or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
self::$_instance = new self (); | |
return self::$_instance; | |
} | |
/** | |
* Method for saving grace mark rules | |
*@author Ranjith Balachandran | |
*@input $gracemarks_rules_id | |
*/ | |
public function saveGraceMarkRule($GraceMarkRuleConsiderFlagRequest) | |
{ | |
$sql = "INSERT INTO gracemarks_consider_rules_flags (gracemarks_rules_id,considerMaxOrObtained,considerMarkDistribution,considerPassPercentage,considerSupplyPercentage,considerTotalPercentage,considerSubjectLimit) VALUES ('$GraceMarkRuleConsiderFlagRequest->graceMarksRulesId','$GraceMarkRuleConsiderFlagRequest->considerMaxOrObtained','$GraceMarkRuleConsiderFlagRequest->considerMarkDistribution','$GraceMarkRuleConsiderFlagRequest->considerPassPercentage','$GraceMarkRuleConsiderFlagRequest->considerSupplyPercentage','$GraceMarkRuleConsiderFlagRequest->considerTotalPercentage','$GraceMarkRuleConsiderFlagRequest->considerSubjectLimit')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for updating grace mark rules | |
*@author Ranjith Balachandran | |
*@input $gracemarks_rules_id | |
*/ | |
public function updateGraceMarkRule($GraceMarkRuleConsiderFlagRequest) | |
{ | |
$sql = "UPDATE gracemarks_consider_rules_flags SET considerMaxOrObtained = '$GraceMarkRuleConsiderFlagRequest->considerMaxOrObtained',considerMarkDistribution = '$GraceMarkRuleConsiderFlagRequest->considerMarkDistribution',considerPassPercentage = '$GraceMarkRuleConsiderFlagRequest->considerPassPercentage',considerSupplyPercentage = '$GraceMarkRuleConsiderFlagRequest->considerSupplyPercentage',considerTotalPercentage = '$GraceMarkRuleConsiderFlagRequest->considerTotalPercentage',considerSubjectLimit = '$GraceMarkRuleConsiderFlagRequest->considerSubjectLimit' WHERE gracemarks_rules_id = '$GraceMarkRuleConsiderFlagRequest->graceMarksRulesId'"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting grace marks rules display conditions | |
* @author Ranjith Balachandran | |
* @input $gracemarks_rules_id | |
*/ | |
public function getGraceMarksRulesConditions($gracemarks_rules_id) | |
{ | |
$graceMarkRuleConditions = []; | |
$sql = "SELECT gmcrf.considerMaxOrObtained as considerMaxOrObtained , gmcrf.considerMarkDistribution as considerMarkDistribution , gmcrf.considerPassPercentage as considerPassPercentage, gmcrf.considerSupplyPercentage as considerSupplyPercentage, gmcrf.considerTotalPercentage as considerTotalPercentage , gmcrf.considerSubjectLimit as considerSubjectLimit FROM gracemarks_consider_rules_flags gmcrf WHERE gmcrf.gracemarks_rules_id = $gracemarks_rules_id"; | |
try { | |
$graceMarkRuleConditions = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $graceMarkRuleConditions; | |
} | |
/** | |
* Method for getting student applied events | |
* @author Ranjith Balachandran | |
* @input $applicationId and $studentId | |
*/ | |
public function getStudentEvents($applnId,$studentId) | |
{ | |
$getStudentEvents = []; | |
$sql = "SELECT gec.eventName,gesc.subeventName as subEventName, gl.levelName, gp.positionName, gsa.heldat, gsa.performDate, gsa.performToDate, gsa.id as Id, gsa.studentaccount_id as studentId, gsa.semFrom, gsa.semTo, gsa.applnNo,gesc.markPercent FROM gracemarks_save_appln gsa INNER JOIN gracemarks_event_category gec ON gsa.gracemarks_event_category_id = gec.id INNER JOIN gracemarks_event_subcategory gesc ON gsa.gracemarks_event_subcategory_id = gesc.id INNER JOIN gracemarks_levels gl ON gsa.gracemarks_level_id = gl.id LEFT JOIN gracemarks_positions gp ON gsa.gracemarks_position_id = gp.id WHERE gsa.gracemarks_appln_initiate_id = $applnId AND gsa.studentaccount_id = $studentId"; | |
try { | |
$getStudentEvents = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $getStudentEvents; | |
} | |
/** | |
* Method for deleting student event | |
*@author Ranjith Balachandran | |
*@input $applnId, $studentId | |
*/ | |
public function deleteStudentEvent($Id,$studentId) | |
{ | |
$sql = "DELETE FROM gracemarks_save_appln WHERE id = $Id AND studentaccount_id AND $studentId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/********************Gracemark Moderation Integration methods **************************/ | |
/** | |
* Method for getting old mark before moderation | |
* @input $studentId $examId | |
* @author Ranjith Balachandran | |
*/ | |
public function getMarksBeforeModeration($studentId,$examId) | |
{ | |
$sql = ''; | |
$oldMarkDetails = null; | |
$studentId = $this->realEscapeString($studentId); | |
$examId = $this->realEscapeString($examId); | |
try{ | |
$sql = "SELECT smbm.oldMark as oldMark FROM student_mark_before_moderation smbm WHERE smbm.examID = $examId AND smbm.studentID = $studentId"; | |
$oldMarkDetails = $this->executeQueryForObject($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $oldMarkDetails; | |
} | |
/** | |
* Method for checking whether this student has moderation benefits for this exam | |
* @input $studentId $examId | |
* @author Ranjith Balachandran | |
*/ | |
public function studentPresentInModeration($studentId,$examId) | |
{ | |
$sql = ''; | |
$studentPresent = null; | |
$studentId = $this->realEscapeString($studentId); | |
$examId = $this->realEscapeString($examId); | |
try { | |
$sql = "SELECT smbm.studentID as studentId FROM student_mark_before_moderation smbm WHERE smbm.studentID = $studentId AND smbm.examID = $examId"; | |
$studentPresent = $this->executeQueryForObject($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentPresent; | |
} | |
/** | |
* Method for getting external maximum mark for a particular exam | |
* @input $examId | |
* @author Ranjith Balachandran | |
*/ | |
public function getMaxMark($examId) | |
{ | |
$sql = ''; | |
$examId = $this->realEscapeString($examId); | |
$maxMark = null; | |
try { | |
$sql = "SELECT e.examTotalMarks as maxMark FROM exam e WHERE e.examID = $examId"; | |
$maxMark = $this->executeQueryForObject($sql); | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $maxMark; | |
} | |
/** | |
* Method for getting internal max mark for a subject | |
* @param unknown $subjectId | |
* @param unknown $batchId | |
* @param unknown $semId | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getintMaxMark($subjectId,$batchId,$semId) | |
{ | |
$sql = ''; | |
$subjectId = $this->realEscapeString($subjectId); | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$intMaxMark = null; | |
try { | |
$sql = "SELECT ins.maxInternalMarks as intMaxMark FROM internal_marks_settings ins WHERE ins.subjectID = $subjectId AND ins.batchID = $batchId AND ins.semID = $semId"; | |
$intMaxMark = $this->executeQueryForObject($sql); | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $intMaxMark; | |
} | |
/** | |
* Method for getting schemeId for a courseTypeId in grading scheme | |
* @input $courseTypeId | |
* @author Ranjith Balachandran | |
*/ | |
public function getSchemeId($courseTypeId) | |
{ | |
$sql = ''; | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$schemeId = null; | |
try { | |
$sql = "SELECT egs.schemeID as schemeId FROM exam_gradingscheme egs WHERE egs.courseTypeID = $courseTypeId"; | |
$schemeId = $this->executeQueryForObject($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $schemeId; | |
} | |
/** | |
* Method for getting pass percentage for a particular course type | |
* @input $courseTypeId | |
* @author Ranjith Balachandran | |
*/ | |
public function getPassPercentage($schemeId) | |
{ | |
$sql = ''; | |
$schemeId = $this->realEscapeString($schemeId); | |
$passPercentage = null; | |
try { | |
$sql = "SELECT min(percentFrom) as passPercentage FROM exam_gradepoints WHERE schemeID = $schemeId AND failStatus = 0"; | |
$passPercentage = $this->executeQueryForObject($sql); | |
}catch (\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $passPercentage; | |
} | |
/** | |
* Method for updating main mark saving table (exammarks_external) with updated marks | |
* @input $examId $studentId $newMark | |
* @author Ranjith Balachandran | |
*/ | |
public function updateMainTableMark($examId,$studentId,$newMark) | |
{ | |
$sql = ''; | |
$examId = $this->realEscapeString($examId); | |
$studentId = $this->realEscapeString($studentId); | |
$newMark = $this->realEscapeString($newMark); | |
$sql = "UPDATE exammarks_external SET mark = $newMark WHERE examID = $examId AND studentID = $studentId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for updating grace mark for a student | |
* @input $examId $studentId $addMark | |
* @author Ranjith Balachandran | |
*/ | |
public function updateGraceMark($examId,$studentId,$addMark) | |
{ | |
$sql = ''; | |
$examId = $this->realEscapeString($examId); | |
$studentId = $this->realEscapeString($studentId); | |
$addMark = $this->realEscapeString($addMark); | |
$sql = "UPDATE gracemarks_student_marks SET marks = $addMark WHERE examID = $examId AND studentID = $studentId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* MEthod to save old mark before Moderation of a student | |
* @param unknown $examId | |
* @param unknown $studentId | |
* @param unknown $oldMark | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function saveOldMarkBeforeModeration($examId,$studentId,$oldMark,$moderationRuleId) | |
{ | |
$sql = ''; | |
$examId = $this->realEscapeString($examId); | |
$studentId = $this->realEscapeString($studentId); | |
$oldMark = $this->realEscapeString($oldMark); | |
$moderationRuleId = $this->realEscapeString($moderationRuleId); | |
$studentIdPresent = null; | |
$studentIdPresent = GraceMarkService::getInstance()->studentPresentInModeration($studentId, $examId); | |
if($studentIdPresent->studentId) | |
{ | |
$sql = "UPDATE student_mark_before_moderation SET oldMark = $oldMark WHERE studentID = $studentId AND examID = $examId AND moderation_rule_id = $moderationRuleId"; | |
} | |
else | |
{ | |
$sql = "INSERT INTO student_mark_before_moderation (studentID,examID,oldMark,moderation_rule_id) VALUES ($studentId,$examId,$oldMark,$moderationRuleId)"; | |
} | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting moderation rule Id for a batch | |
* @input $batchId $examRegId | |
* @author Ranjith Balachandran | |
*/ | |
public function getModerationRuleId($batchId,$examRegId) | |
{ | |
$sql = ''; | |
$batchId = $this->realEscapeString($batchId); | |
$examRegId = $this->realEscapeString($examRegId); | |
$moderationRuleId = ''; | |
try { | |
$sql = "SELECT mra.moderation_rule_id as modeRuleId FROM moderation_rule_assign mra WHERE mra.batchID = $batchId AND mra.exam_registration_id = $examRegId"; | |
$moderationRuleId = $this->executeQueryForObject($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $moderationRuleId; | |
} | |
/** | |
* Method for getting examregId for a student batch and sem | |
* @param unknown $studentId | |
* @param unknown $batchId | |
* @param unknown $semId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getExamRegId($studentId,$batchId,$semId) | |
{ | |
$sql = ''; | |
$examRegId = null; | |
$studentId = $this->realEscapeString($studentId); | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
try { | |
$sql = "SELECT erb.examregID as examRegId FROM exam_registration_batches erb INNER JOIN exam_reg_studentchallan ersc ON erb.examregID = ersc.examregID WHERE erb.batchID = $batchId AND erb.semID = $semId AND ersc.studentID = $studentId;"; | |
$examRegId = $this->executeQueryForObject($sql)->examRegId; | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $examRegId; | |
} | |
/** | |
* Method for getting rule details of moderation | |
*@author Kishan | |
*@param $ruleId | |
*/ | |
public function getModerationRuleDetails($ruleId) | |
{ | |
$response = null; | |
$query = "select * from moderation_rule where id = $ruleId"; | |
try { | |
$response = $this->executeQueryForObject($query); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $response; | |
} | |
/** | |
* Method for getting all examids subjectids for a batch student sem and examregid | |
* @param unknown $studentId | |
* @param unknown $batchId | |
* @param unknown $semId | |
* @param unknown $examRegId | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getAllExamIds($studentId,$batchId,$semId,$examRegId) | |
{ | |
$sql = ''; | |
$allExamIdsSubjectIds = []; | |
$studentId = $this->realEscapeString($studentId); | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$examRegId = $this->realEscapeString($examRegId); | |
try { | |
$sql = "SELECT e.examID as examId,e.subjectID as subjectId FROM exam e INNER JOIN exam_reg_studentsubject erss ON e.examregID=erss.examregID AND e.subjectID=erss.subjectID INNER JOIN exam_reg_studentchallan ersc ON e.examregID = ersc.examregID AND erss.studentID=ersc.studentID WHERE e.batchID= $batchId AND e.semID = $semId AND e.examregID = $examRegId AND | |
erss.studentID = $studentId AND ersc.paid=1 and erss.studentID NOT IN (SELECT ees.studentID FROM exam_excluded_students ees WHERE ees.examID=e.examID AND ees.batchID = $batchId)"; | |
$allExamIdsSubjectIds = $this->executeQueryForList($sql); | |
}catch(\ Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $allExamIdsSubjectIds; | |
} | |
/** | |
* Method for getting student gracemarks for a subjectId examId and studentId | |
* @param unknown $studentId | |
* @param unknown $examId | |
* @param unknown $subjectId | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentGraceMarks($studentId,$examId,$subjectId) | |
{ | |
$sql = ''; | |
$studentGraceMark = null; | |
$studentId = $this->realEscapeString($studentId); | |
$examId = $this->realEscapeString($examId); | |
$subjectId = $this->realEscapeString($subjectId); | |
try { | |
$sql = "SELECT gsm.marks as mark FROM gracemarks_student_marks gsm WHERE gsm.studentID = $studentId AND gsm.subjectID = $subjectId AND gsm.examID = $examId"; | |
$studentGraceMark = $this->executeQueryForObject($sql); | |
}catch ( \ Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentGraceMark; | |
} | |
/** | |
* Method for student gracemark details by eventId | |
* @param unknown $applnId | |
* @param unknown $studentId | |
* @param unknown $eventId | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentDetailsByEvent($applnId,$studentId,$eventId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$applnId = $this->realEscapeString($applnId); | |
$eventId = $this->realEscapeString($eventId); | |
$getStudentDetails = null; | |
$sql = "SELECT gsa.studentaccount_id as studentId,gsa.semFrom as semFrom,gsa.semTo as semTo,gsa.applnNo as applnNo FROM gracemarks_save_appln gsa WHERE gsa.gracemarks_appln_initiate_id = $applnId AND gsa.studentaccount_id = $studentId AND gsa.gracemarks_event_category_id = $eventId"; | |
try { | |
$getStudentDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $getStudentDetails; | |
} | |
/** | |
* Method to check whether this student has given moderation | |
* @param unknown $studentId | |
* @throws ProfessionalException | |
* @return object|NULL|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function studentModerationApplied($studentId,$moderationRuleId) | |
{ | |
$sql = ''; | |
$studentPresent = null; | |
$studentId = $this->realEscapeString($studentId); | |
$moderationRuleId = $this->realEscapeString($moderationRuleId); | |
try { | |
$sql = "SELECT smbm.studentID as studentId FROM student_mark_before_moderation smbm WHERE smbm.studentID = $studentId AND smbm.moderation_rule_id = $moderationRuleId"; | |
$studentPresent = $this->executeQueryForObject($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentPresent; | |
} | |
/** | |
* Method for getting all grace mark application for a studentId | |
* @param unknown $studentId | |
* @throws ProfessionalException | |
* @return object|array|\com\linways\base\util\$objectList[] | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentGraceMarkApplications($studentId) | |
{ | |
$sql = ''; | |
$applicationList = []; | |
$studentId = $this->realEscapeString($studentId); | |
try{ | |
$sql = "SELECT DISTINCT gai.id as applnId,gai.appln_heading as applnHeading , gai.fromYear as startYear, gai.toYear as endYear,gsa.semFrom,gsa.semTo FROM gracemarks_appln_initiate gai INNER JOIN gracemarks_save_appln gsa ON gai.id = gsa.gracemarks_appln_initiate_id WHERE gsa.studentaccount_id = $studentId"; | |
$applicationList = $this->executeQueryForList($sql); | |
}catch(\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $applicationList; | |
} | |
/** | |
* Method for getting student exam details (gracemark) UG | |
* @param unknown $applnId | |
* @param unknown $studentId | |
* @param unknown $semId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentExamDetails($applnId,$studentId,$semId) | |
{ | |
$sql = ''; | |
$studentId = $this->realEscapeString($studentId); | |
$applnId = $this->realEscapeString($applnId); | |
$studentExamDetails = []; | |
try{ | |
$sql = "SELECT gsm.examID as examId,gsm.semID as semId,e.examName AS examName,gsm.marks AS studentMark,im.internalMarks AS internalMark, ee.mark as externalMark,e.subjectID FROM exam e INNER JOIN gracemarks_student_marks gsm ON e.examID = gsm.examID INNER JOIN internal_marks im ON im.subjectID = gsm.subjectID AND im.batchID = e.batchID AND im.semID = e.semID AND im.studentID = gsm.studentID INNER JOIN exammarks_external ee ON ee.examID = e.examID AND ee.studentID = gsm.studentID WHERE gsm.gracemarks_appln_initiate_id = $applnId AND gsm.studentID = $studentId AND gsm.approve = 1 AND gsm.fianlize = 1 AND gsm.semID = $semId"; | |
$studentExamDetails = $this->executeQueryForList($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentExamDetails; | |
} | |
/** | |
* Method for getting student exam details (gracemark) PG | |
* @param unknown $applnId | |
* @param unknown $studentId | |
* @param unknown $semId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentExamDetailsPG($applnId,$studentId,$semId) | |
{ | |
$sql = ''; | |
$studentId = $this->realEscapeString($studentId); | |
$applnId = $this->realEscapeString($applnId); | |
$studentExamDetails = []; | |
try{ | |
$sql = "SELECT gsm.examID as examId,gsm.semID as semId,e.examName AS examName,gsm.marks AS studentMark,im.internalMarks AS internalMark, eemf.mark as externalMark,e.subjectID FROM exam e INNER JOIN gracemarks_student_marks gsm ON e.examID = gsm.examID INNER JOIN internal_marks im ON im.subjectID = gsm.subjectID AND im.batchID = e.batchID AND im.semID = e.semID AND im.studentID = gsm.studentID INNER JOIN externalexammarks_finalized eemf ON eemf.examID = e.examID AND eemf.studentID = gsm.studentID WHERE gsm.gracemarks_appln_initiate_id = $applnId AND gsm.studentID = $studentId AND gsm.approve = 1 AND gsm.fianlize = 1 AND gsm.semID = $semId"; | |
$studentExamDetails = $this->executeQueryForList($sql); | |
}catch(\Exception $e) | |
{ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentExamDetails; | |
} | |
/** | |
* Method for getting grace mark application details by applnId | |
* @param unknown $applnId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getGraceMarkApplicationDetails($applnId) | |
{ | |
$sql = ''; | |
$applnDetails = null; | |
$applnId = $this->realEscapeString($applnId); | |
try{ | |
$sql = "SELECT DISTINCT gai.id as applnId,gai.appln_heading as applnHeading , gai.fromYear as startYear, gai.toYear as endYear FROM gracemarks_appln_initiate gai WHERE gai.id = $applnId"; | |
$applnDetails = $this->executeQueryForObject($sql); | |
}catch(\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $applnDetails; | |
} | |
/** | |
* Method for finalizing all students (grace mark) | |
* @param unknown $applnId | |
* @param unknown $studentIds | |
* @throws ProfessionalException | |
* @author Ranjith Balachandran | |
*/ | |
public function finalizeAllStudents($applnId,$studentIds) | |
{ | |
$sql = ''; | |
$applnId = $this->realEscapeString($applnId); | |
$studentIds = $this->realEscapeString($studentIds); | |
try{ | |
$sql = "UPDATE gracemarks_student_marks SET fianlize = 1 WHERE gracemarks_appln_initiate_id = $applnId AND studentID IN ($studentIds)"; | |
$this->executeQuery($sql); | |
}catch(\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* Method for getting student grace mark for an examId and subjectId (UG) | |
* @param unknown $examId | |
* @param unknown $studentId | |
* @param unknown $subjectId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentGraceMark($examId,$studentId,$subjectId) | |
{ | |
$sql = ''; | |
$examId = $this->realEscapeObject($examId); | |
$studentId = $this->realEscapeObject($studentId); | |
$subjectId = $this->realEscapeObject($subjectId); | |
$studentGraceMark = null; | |
try{ | |
$sql = "SELECT gsm.marks AS studentGraceMark FROM gracemarks_student_marks gsm WHERE gsm.studentID = $studentId AND examID = $examId AND subjectID = $subjectId AND gsm.approve = 1 AND gsm.fianlize = 1"; | |
$studentGraceMark = $this->executeQueryForObject($sql)->studentGraceMark; | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentGraceMark; | |
} | |
/** | |
* Method for getting student grace mark for an examId and subjectId (PG) | |
* @param unknown $examId | |
* @param unknown $studentId | |
* @param unknown $subjectId | |
* @throws ProfessionalException | |
* @return unknown | |
* @author Ranjith Balachandran | |
*/ | |
public function getStudentGraceMarkPG($examId,$studentId,$subjectId) | |
{ | |
$sql = ''; | |
$examId = $this->realEscapeObject($examId); | |
$studentId = $this->realEscapeObject($studentId); | |
$subjectId = $this->realEscapeObject($subjectId); | |
$studentGraceMark = null; | |
try{ | |
$sql = "SELECT gsm.adminUpdatedMarks AS correctMark FROM gracemarks_student_marks gsm WHERE gsm.studentID = $studentId AND examID = $examId AND subjectID = $subjectId AND gsm.approve = 1 AND gsm.fianlize = 1"; | |
$studentGraceMark = $this->executeQueryForObject($sql)->correctMark; | |
}catch (\Exception $e){ | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
return $studentGraceMark; | |
} | |
/** | |
* Fetch grace mark application initiate | |
* @param $request | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getGracemarkApplicationInitiate ( $request ) { | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
$result = null; | |
try { | |
$sql = "SELECT id, appln_heading AS heading, fromYear, toYear, fromDate, toDate, isFeerequired FROM gracemarks_appln_initiate"; | |
$result = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
public function getStudentGraceMarksByApplnInitiateId($applnInitiateId) | |
{ | |
$applnInitiateId = $this->realEscapeString($applnInitiateId); | |
$sql = null; | |
$result = null; | |
try { | |
$sql = "SELECT | |
sa.studentID, | |
sa.regNo, | |
sa.studentName, | |
b.batchID, | |
b.batchName, | |
sem.semID, | |
sem.semName, | |
s.subjectID, | |
s.subjectName, | |
s.subjectDesc, | |
im.internalMarks, | |
eme.mark AS externalMarks, | |
gsm.marks AS graceMarks, | |
(im.internalMarks + eme.mark + gsm.marks) AS totalMarks | |
FROM | |
gracemarks_student_marks gsm | |
INNER JOIN | |
studentaccount sa ON (gsm.studentID = sa.studentID) | |
INNER JOIN | |
internal_marks im ON (im.studentID = gsm.studentID | |
AND im.semID = gsm.semID | |
AND im.subjectID = gsm.subjectID | |
AND im.batchID = sa.batchID) | |
INNER JOIN | |
exam e ON (e.semID = gsm.semID | |
AND e.subjectID = gsm.subjectID | |
AND e.batchID = sa.batchID | |
AND e.examregID IS NOT NULL) | |
INNER JOIN | |
exammarks_external eme ON (eme.examID = e.examID | |
AND eme.studentID = gsm.studentID) | |
INNER JOIN | |
batches b ON (b.batchID = sa.batchID) | |
INNER JOIN | |
semesters sem ON (sem.semID = gsm.semID) | |
INNER JOIN | |
subjects s ON (s.subjectID = gsm.subjectID) | |
WHERE | |
gracemarks_appln_initiate_id = '$applnInitiateId' "; | |
$result = $this->executeQueryForList($sql); | |
$students = []; | |
if ( !empty ( $result ) ) { | |
foreach ( $result as $graceMark ) { | |
$studentId = $graceMark->studentID; | |
$students[$studentId]->id = $studentId; | |
$students[$studentId]->regNo = $graceMark->regNo; | |
$students[$studentId]->studentName = $graceMark->studentName; | |
$students[$studentId]->batchId = $graceMark->batchID; | |
$students[$studentId]->batchName = $graceMark->batchName; | |
$semId = $graceMark->semID; | |
$students[$studentId]->semester[$semId]->id = $semId; | |
$students[$studentId]->semester[$semId]->semName = $graceMark->semName; | |
$subjectId = $graceMark->subjectID; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->id = $subjectId; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->subjectName = $graceMark->subjectName; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->subjectDesc = $graceMark->subjectDesc; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->internalMark = | |
round($graceMark->internalMarks, 2); | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->externalMark = | |
round($graceMark->externalMarks, 2); | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->graceMark = | |
round($graceMark->graceMarks, 2); | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->totalMark = | |
round($graceMark->totalMarks, 2); | |
} | |
$students = array_values($students); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $students; | |
} | |
/** | |
*add graceMarksSTudentWise | |
* @param $request | |
* @return Object|null | |
* @throws ProfessionalException | |
* @author Sibin | |
*/ | |
public function addGraceMarksStudentWise($semsubjects){ | |
$request = $this->realEscapeObject($semsubjects); | |
$request; | |
$subjects =[]; | |
$semId = (int)$request['sem']; | |
$examregId = (int) $request['examregId']; | |
$studentId = (int) $request['studentId']; | |
$subjects =$request['subjects']; | |
$subjects; | |
$sql = null; | |
$submit=2; | |
$result = null; | |
$graceMark=null; | |
$approve = $finalize = 0; | |
if($request['considerApprove']){ | |
$approve = $finalize = $request['approve']; | |
}else{ | |
$approve = $finalize = 1; | |
} | |
//start | |
foreach ($subjects as $subject) { | |
$subject = (Object) $subject; | |
$subjectId=(int)$subject->subjectID; | |
$graceMark =$subject->graceMark; | |
$remarks =$subject->remarks; | |
$examId = (int)$subject->examID; | |
$id=null; | |
if ( $remarks == 'null'){ | |
$remarks = null; | |
} | |
if(is_numeric($graceMark) || $graceMark == ""){ | |
$graceMark=(float)$graceMark; | |
$sql="SELECT | |
id from gracemarks_student_marks | |
where studentID='$studentId' | |
and subjectID='$subjectId' | |
and examID='$examId'"; | |
try { | |
//check if entry already exists | |
$result = $this->executeQueryForObject($sql); | |
$id=$result->id; | |
if($id){ | |
if($graceMark){ | |
$updateQuery = "UPDATE gracemarks_student_marks | |
set marks=$graceMark, adminUpdatedMarks =$graceMark, remarks='$remarks', submit = 2, fianlize = $finalize, approve = $approve | |
where id = $id;"; | |
$this->executeQueryForObject($updateQuery); | |
$result = true; | |
}else if ($graceMark == 0){ | |
$deleteQuery = "DELETE FROM gracemarks_student_marks | |
where id = $id;"; | |
$this->executeQueryForObject($deleteQuery); | |
$result = true; | |
} | |
} | |
else{ | |
if($graceMark){ | |
$values[] = "( | |
$studentId, | |
$semId, | |
$subjectId, | |
$graceMark, | |
$submit, | |
$finalize, | |
$approve, | |
$examId, | |
$graceMark, | |
'$remarks' | |
)"; | |
} | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
} | |
} | |
$sql = "INSERT INTO gracemarks_student_marks (studentID, semID, subjectID, marks, submit, fianlize,approve,examID,adminUpdatedMarks,remarks) | |
VALUES " . implode(",", $values); | |
//end | |
try { | |
if($values){ | |
$this->executeQueryForList($sql); | |
$result = true; | |
} | |
return $result; | |
} catch (\Exception $e) { | |
throw new ProfessionalException ($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
//end add graceMark Studentwise | |
public function getStudentsExamMarksDetailsWithGraceMarkByExamId($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$students = null; | |
$sql = "SELECT ee.examID as 'examId', | |
ee.studentID as 'studentId', | |
ee.mark,gsm.marks as 'graceMark', | |
ee.mark - gsm.marks as 'newMark', | |
gsm.isMarkRestored | |
from exammarks_external ee | |
INNER JOIN gracemarks_student_marks gsm ON gsm.examID = ee.examID AND gsm.studentID = ee.studentID | |
WHERE ee.examID = '$request->examId'"; | |
try { | |
$students = $this->executeQueryForList($sql);; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $students; | |
} | |
/** | |
* @author Sibin | |
*update exam external marks by student and isRestored flag | |
*/ | |
public function updateExamExternalMarksAndGraceMarkTable($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$result = ""; | |
$sql = ""; | |
$sql = "UPDATE exammarks_external set mark = '$request->newMark' | |
WHERE examID='$request->examId' AND studentID='$request->studentId'"; | |
try { | |
if ($sql) { | |
$this->executeQueryForObject($sql); | |
$updateIsRestored = "UPDATE gracemarks_student_marks | |
set isMarkRestored = 1 | |
WHERE examID='$request->examId' AND studentID='$request->studentId'"; | |
$this->executeQueryForObject($updateIsRestored); | |
$result = true; | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
/** | |
* @param $batchId | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getBatchStudentGraceMark($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
if (empty($batchId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, "Invalid batch"); | |
} | |
$sql = "SELECT | |
gasd.id, | |
gasd.studentID AS studentId, | |
gasd.semesters, | |
gasd.mark | |
FROM | |
gracemark_applied_student_details gasd | |
INNER JOIN studentaccount sa ON | |
sa.studentID = gasd.studentID | |
WHERE | |
sa.batchID = $batchId"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Get grace mark details of a student by register number | |
* @param ConsolidatedMarkReportRequest $request | |
* @throws ProfessionalException | |
* @return Array | |
* @author Sibin | |
*/ | |
public function getStudentGraceMarkDetails($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$graceMarkDetails = []; | |
$condition = null; | |
if ($request->regNo) { | |
$condition .= " AND sa.regNo = '" . $request->regNo . "' "; | |
} | |
if ($request->batchId) { | |
$condition .= " AND sa.batchID IN (" . $request->batchId . ") "; | |
} | |
if ($request->subjectIds) { | |
$condition .= " AND e.subjectID IN (" . $request->subjectIds . ") "; | |
} | |
$sql = "SELECT | |
sa.studentID, | |
sa.studentName, | |
sa.regNo, | |
gsm.marks AS graceMark, | |
e.examID, | |
e.examName | |
FROM | |
studentaccount sa | |
INNER JOIN | |
gracemarks_student_marks gsm ON gsm.studentID = sa.studentID | |
INNER JOIN | |
exam e ON e.subjectID = gsm.subjectID | |
AND e.examID = gsm.examID | |
WHERE | |
gsm.fianlize = 1 | |
AND gsm.approve = 1 | |
$condition | |
ORDER BY sa.studentID ASC"; | |
try { | |
$graceMarkDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $graceMarkDetails; | |
} | |
/** | |
* @param $batchId | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getBatchStudentGraceMarkDetails($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
if (empty($batchId)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, "Invalid batch"); | |
} | |
$sql = "SELECT | |
gasd.id, | |
gasd.studentID AS studentId, | |
gasd.semID | |
FROM | |
gracemarks_student_marks gasd | |
INNER JOIN studentaccount sa ON | |
sa.studentID = gasd.studentID | |
WHERE | |
sa.batchID in ($batchId) GROUP BY(gasd.studentID)"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark event category | |
* @param $categoryName | |
* @param $levelCount | |
* @param $percentageLimit | |
*/ | |
public function saveGraceMarkCategory($categoryName, $levelCount, $percentageLimit) | |
{ | |
$categoryName = $this->realEscapeString($categoryName); | |
$levelCount = $this->realEscapeString($levelCount); | |
$percentageLimit = $this->realEscapeString($percentageLimit); | |
$staffId = $_SESSION['adminID']; | |
$sql = "INSERT INTO ec_grace_mark_categories (categoryName,level_select_count,percentage_limit,created_by) VALUES ('$categoryName','$levelCount','$percentageLimit','$staffId')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark event category | |
* @param $category | |
*/ | |
public function updateGraceMarkCategory($category) | |
{ | |
$category = $this->realEscapeObject($category); | |
$staffId = $_SESSION['adminID']; | |
$sql = "UPDATE ec_grace_mark_categories set level_select_count = '$category->levelCount', percentage_limit = '$category->percentageLimit', updated_by ='$staffId' WHERE id = $category->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* delete grace mark event category | |
* @param $category | |
*/ | |
public function deleteGraceMarkCategory($category) | |
{ | |
$category = $this->realEscapeObject($category); | |
$sql = "DELETE FROM ec_grace_mark_categories WHERE id = $category->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark event position | |
* @param $position | |
*/ | |
public function updateGraceMarkPosition($position) | |
{ | |
$position = $this->realEscapeObject($position); | |
$staffId = $_SESSION['adminID']; | |
$sql = "UPDATE ec_grace_mark_positions set priority = '$position->priority', updated_by ='$staffId' WHERE id = $position->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* delete grace mark event position | |
* @param $position | |
*/ | |
public function deleteGraceMarkPosition($position) | |
{ | |
$position = $this->realEscapeObject($position); | |
$sql_Check = "SELECT id from ec_grace_mark_levels WHERE positions LIKE '%\"id\": \"$position->id\"%'"; | |
$result = $this->executeQueryForList($sql_Check); | |
if($result){ | |
return 1; | |
} | |
$staffId = $_SESSION['adminID']; | |
$sql = "DELETE FROM ec_grace_mark_positions WHERE id = $position->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark event category | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkCategories() | |
{ | |
$sql = "SELECT id, categoryName, level_select_count as levelCount, percentage_limit as percentageLimit, text_box_required as textBoxRequired FROM ec_grace_mark_categories ORDER BY created_date DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark event position | |
* @param $positionName | |
* @param $priority | |
*/ | |
public function saveGraceMarkPosition($positionName, $priority) | |
{ | |
$positionName = $this->realEscapeString($positionName); | |
$priority = $this->realEscapeString($priority); | |
$staffId = $_SESSION['adminID']; | |
$sql = "INSERT INTO ec_grace_mark_positions (positionName,priority,created_by) VALUES ('$positionName','$priority','$staffId')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark event position | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkPositions($priority = false) | |
{ | |
if($priority){ | |
$condition = "ORDER BY priority ASC"; | |
} | |
else{ | |
$condition = "ORDER BY created_date DESC"; | |
} | |
$sql = "SELECT id, positionName, priority FROM ec_grace_mark_positions $condition"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark event category | |
* @param $categoryName | |
* @param $levelCount | |
* @param $percentageLimit | |
*/ | |
public function saveGraceMarkLevels($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$request->position = array_values($request->position); | |
$request->position = json_encode($request->position); | |
$staffId = $_SESSION['adminID']; | |
$sql = "INSERT INTO ec_grace_mark_levels (levelName,categoryID,levelLimit,positions,created_by) VALUES ('$request->levelName','$request->categoryId','$request->levelLimit','$request->position','$staffId')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark levels | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getCategoryLevels($catId) | |
{ | |
$sql = "SELECT id, levelName, levelLimit, positions FROM ec_grace_mark_levels WHERE categoryID = $catId ORDER BY created_date DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark levels | |
* @param $levels | |
*/ | |
public function updateGraceMarklevels($levels) | |
{ | |
$levels = $this->realEscapeObject($levels); | |
$levels->positions = json_encode($levels->positions) ; | |
$staffId = $_SESSION['adminID']; | |
$sql = "UPDATE ec_grace_mark_levels set levelLimit = '$levels->levelLimit', positions = '$levels->positions', updated_by ='$staffId' WHERE id = $levels->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get distinct categories | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getDistinctCategories() | |
{ | |
$sql = "SELECT DISTINCT egl.categoryID, egc.categoryName from ec_grace_mark_levels egl inner join ec_grace_mark_categories egc ON(egl.categoryID = egc.id) ORDER BY egc.id DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* delete grace mark event level | |
* @param $level | |
*/ | |
public function deleteGraceMarkLevel($level) | |
{ | |
$level = $this->realEscapeObject($level); | |
$sql = "DELETE FROM ec_grace_mark_levels WHERE id = $level->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get gracemark categories and level | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkCategoryAndLevel() | |
{ | |
$sql = "SELECT egl.categoryID, egc.categoryName, egc.level_select_count as levelSelectCount, egc.percentage_limit as percentageLimit, egl.levelName, egl.id as levelId, egl.levelLimit, egl.positions from ec_grace_mark_levels egl inner join ec_grace_mark_categories egc ON(egl.categoryID = egc.id) ORDER BY egc.id DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark applied students | |
* @param $categories | |
* @param $confirm | |
* @param $studentId | |
*/ | |
public function saveGraceMarkApplied($categories, $confirm, $studentId, $applNo, $applnId,$isNoEvents = false) | |
{ | |
// $categories = $this->realEscapeObject($categories); | |
$confirm = $this->realEscapeString($confirm); | |
$applNo = $this->realEscapeString($applNo); | |
$studentId = $this->realEscapeString($studentId); | |
$applnId = $this->realEscapeString($applnId); | |
$categories = addslashes(json_encode($categories, JSON_INVALID_UTF8_IGNORE | JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_ERROR_INVALID_PROPERTY_NAME)); | |
$isNoEvents = $this->realEscapeString($isNoEvents); | |
$isExist = $this->getGraceMarkAppliedStudentDetails($studentId,$applnId) ; | |
$createdBy = NULL; | |
if($_SESSION['adminID']){ | |
$createdBy = $_SESSION['adminID']; | |
} | |
if($isNoEvents && $isExist){ | |
$sql = "DELETE FROM ec_grace_mark_applied_students WHERE id = $isExist->id"; | |
} | |
else if($isExist){ | |
$sql = "UPDATE ec_grace_mark_applied_students set isConfirmed = '$confirm', applied_events = '$categories', applied_date = now(), created_by = '$createdBy' WHERE studentID = $studentId AND gracemark_appln_id = $applnId"; | |
} | |
else{ | |
$sql = "INSERT INTO ec_grace_mark_applied_students (studentID,applNo,gracemark_appln_id,isConfirmed,applied_events,created_by) VALUES ('$studentId','$applNo','$applnId','$confirm','$categories', '$createdBy' )"; | |
} | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark applied tudents | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAppliedStudentDetails($studentId, $applnId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT id, applNo, applied_events,applied_date, isConfirmed FROM ec_grace_mark_applied_students WHERE studentID = $studentId AND gracemark_appln_id = $applnId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark initiated details | |
* @param $request | |
*/ | |
public function saveGraceMarkInitiatedDetails($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$staffId = $_SESSION['adminID']; | |
$sql = "INSERT INTO ec_grace_mark_appln_initiate (appln_heading,startYear,endYear,startDate,endDate,semesters,categoryIDs,fromTime,toTime,created_by) VALUES ('$request->applnHeading', '$request->startYear','$request->endYear','$request->fromDate','$request->toDate','$request->semesters','$request->categoryIds','$request->fromTime','$request->toTime', '$staffId')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark initiated details | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkInitiatedDetails() | |
{ | |
$sql = "SELECT id, appln_heading as applnHeading, startYear, endYear, startDate, endDate, semesters, categoryIDs,fromTime,toTime from ec_grace_mark_appln_initiate ORDER BY id DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark initiated details | |
* @param $request | |
*/ | |
public function updateGraceMarkInitiatedDetails($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$staffId = $_SESSION['adminID']; | |
$sql = "UPDATE ec_grace_mark_appln_initiate SET appln_heading = '$request->applnHeading' ,startYear = '$request->startYear',endYear = '$request->endYear',startDate = '$request->startDate',endDate = '$request->endDate',semesters = '$request->semesters',categoryIDs = '$request->categoryIds',fromTime='$request->fromTime',toTime='$request->toTime', updated_by = '$staffId' WHERE id = '$request->id'"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* delete grace mark application | |
* @param $level | |
*/ | |
public function deleteGraceMarkApplication($applnId) | |
{ | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "DELETE FROM ec_grace_mark_appln_initiate WHERE id = $applnId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark assigned batches | |
* @param $batchIds | |
* @param $applnId | |
*/ | |
public function saveGraceMarkAssignedBatches($batchIds, $applnId) | |
{ | |
$batchIds = $this->realEscapeString($batchIds); | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "INSERT INTO ec_grace_mark_appln_assigned_batches (gracemark_appln_id,batchIDs) VALUES ('$applnId', '$batchIds')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark initiated details | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAssignedBatches() | |
{ | |
$sql = "SELECT egmsb.id as assignedId, egmsb.gracemark_appln_id as applnId, egmsb.batchIDs, egmpi.startYear, egmpi.endYear, egmpi.appln_heading as applnHeading, egmpi.startDate, egmpi.endDate, egmpi.semesters from ec_grace_mark_appln_assigned_batches egmsb inner join ec_grace_mark_appln_initiate egmpi ON (egmsb.gracemark_appln_id = egmpi.id) ORDER BY gracemark_appln_id DESC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark initiated batch details | |
* @param $batchIds | |
*/ | |
public function updateGraceMarkInitiatedBatches($batchIds, $assignId) | |
{ | |
$batchIds = $this->realEscapeString($batchIds); | |
$assignId = $this->realEscapeString($assignId); | |
$sql = "UPDATE ec_grace_mark_appln_assigned_batches SET batchIDs = '$batchIds' WHERE id = '$assignId'"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark initiated details by id | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAssignedBatchesByAssignId($assignId) | |
{ | |
$assignId = $this->realEscapeString($assignId); | |
$sql = "SELECT egmsb.id as assignedId, egmsb.gracemark_appln_id as applnId, egmsb.batchIDs, egmpi.endYear, egmpi.appln_heading as applnHeading, egmpi.startDate, egmpi.endDate, egmpi.semesters from ec_grace_mark_appln_assigned_batches egmsb inner join ec_grace_mark_appln_initiate egmpi ON (egmsb.gracemark_appln_id = egmpi.id) WHERE egmsb.id='$assignId'"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
public function getGraceMarkAssignedBatchesByApplnId($applnId) | |
{ | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "SELECT egmsb.id as assignedId, egmsb.gracemark_appln_id as applnId, egmsb.batchIDs,egmpi.startYear, egmpi.endYear, egmpi.appln_heading as applnHeading, egmpi.startDate, egmpi.endDate, egmpi.semesters, egmsb.published_dates, egmpi.categoryIDs from ec_grace_mark_appln_assigned_batches egmsb inner join ec_grace_mark_appln_initiate egmpi ON (egmsb.gracemark_appln_id = egmpi.id) WHERE egmsb.gracemark_appln_id='$applnId'"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
public function getGraceMarkApplicationByBatchId($batchId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$sql = "SELECT egmsb.id as assignedId, egmsb.gracemark_appln_id as applnId, egmsb.batchIDs, egmpi.startYear, egmpi.endYear, egmpi.appln_heading as applnHeading, egmpi.startDate, egmpi.endDate, egmpi.semesters, egmpi.fromTime, egmpi.toTime from ec_grace_mark_appln_assigned_batches egmsb inner join ec_grace_mark_appln_initiate egmpi ON (egmsb.gracemark_appln_id = egmpi.id) WHERE FIND_IN_SET($batchId, egmsb.batchIDs)"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark applied students | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAppliedStudentDetailsByApplicationId($applnId) | |
{ | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "SELECT egmas.id, egmas.applNo, egmas.applied_events,egmas.applied_date, egmas.isConfirmed,sa.studentID, sa.regNO, sa.studentName, sa.batchID FROM ec_grace_mark_applied_students egmas INNER JOIN studentaccount sa on (sa.studentID = egmas.studentID) WHERE gracemark_appln_id = $applnId"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark confirm status | |
* @param $batchIds | |
*/ | |
public function saveGraceMarkConfirmStatus($applnId, $studentId, $confirm) | |
{ | |
$applnId = $this->realEscapeString($applnId); | |
$studentId = $this->realEscapeString($studentId); | |
$confirm = $this->realEscapeString($confirm); | |
$sql = "UPDATE ec_grace_mark_applied_students SET isConfirmed = '$confirm' WHERE studentID = '$studentId' AND gracemark_appln_id = $applnId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get assigned batches | |
* @param $batchIds | |
*/ | |
public function getGraceMarkAssignedBatch($batchId, $applnId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "SELECT id FROM ec_grace_mark_appln_assigned_batches WHERE gracemark_appln_id in ($applnId) AND FIND_IN_SET($batchId,batchIDs) "; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark initiated details | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkInitiatedDetailsByApplnIds($applnIds) | |
{ | |
$sql = "SELECT id, appln_heading as applnHeading, startYear, endYear, startDate, endDate, semesters from ec_grace_mark_appln_initiate WHERE id IN ($applnIds)"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get assigned batch details | |
* @param $batchIds | |
*/ | |
public function getGraceMarkAssignedByBatchAndSem($batchId, $semIds, $applnId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semIds = $this->realEscapeString($semIds); | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "SELECT egmab.id FROM ec_grace_mark_appln_assigned_batches egmab INNER JOIN ec_grace_mark_appln_initiate egai ON (egmab.gracemark_appln_id = egai.id) WHERE FIND_IN_SET($batchId,batchIDs) AND egai.semesters ='$semIds' AND egai.id = $applnId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save grace mark event category | |
* @param $categoryName | |
* @param $textBoxRequired | |
*/ | |
public function insertGraceMarkCategory($categoryName, $textBoxRequired) | |
{ | |
$categoryName = $this->realEscapeString($categoryName); | |
$textBoxRequired = $this->realEscapeString($textBoxRequired); | |
$staffId = $_SESSION['adminID']; | |
$sql = "INSERT INTO ec_grace_mark_categories (categoryName,text_box_required,created_by) VALUES ('$categoryName','$textBoxRequired','$staffId')"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* update grace mark event category | |
* @param $category | |
*/ | |
public function updateGraceMarkEventCategory($category) | |
{ | |
$category = $this->realEscapeObject($category); | |
$staffId = $_SESSION['adminID']; | |
$sql = "UPDATE ec_grace_mark_categories set text_box_required = '$category->textBoxRequired', updated_by ='$staffId' WHERE id = $category->id"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving grace mark applied students | |
* @param $applnId | |
* @param $dateArray | |
*/ | |
public function saveGraceMarkPublishDetails($applnId, $dateArray) | |
{ | |
$dateArray = $this->realEscapeObject($dateArray); | |
$applnId = $this->realEscapeString($applnId); | |
$dateArray = json_encode($dateArray); | |
$sql = "UPDATE ec_grace_mark_appln_assigned_batches set published_dates = '$dateArray' WHERE gracemark_appln_id = $applnId"; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark publish date | |
* @param $batchId | |
* @param $semId | |
*/ | |
public function getGraceMarkPublishDate($batchId, $semId) | |
{ | |
$batchId = $this->realEscapeString($batchId); | |
$semId = $this->realEscapeString($semId); | |
$sql = "SELECT egmab.published_dates FROM ec_grace_mark_appln_assigned_batches egmab INNER JOIN ec_grace_mark_appln_initiate egai ON (egmab.gracemark_appln_id = egai.id) WHERE FIND_IN_SET($batchId,batchIDs) AND FIND_IN_SET($semId,egai.semesters)"; | |
try { | |
$publishedDate = $this->executeQueryForObject($sql)->published_dates; | |
$publishedDate = json_decode($publishedDate); | |
$dates = ""; | |
foreach($publishedDate as $publishedBatchId => $publishBatch){ | |
if($batchId == $publishedBatchId){ | |
foreach($publishBatch->semester as $publishSemId => $sem){ | |
if($publishSemId == $semId){ | |
$dates = $sem; | |
break; | |
} | |
} | |
} | |
} | |
return $dates; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save grace mark log details | |
* @param $request | |
*/ | |
public function saveGraceMarkLog($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$staffId = $_SESSION['adminID']; | |
$batchId = $request->batchId ; | |
$examRegId = $request->examRegId ; | |
$semId = $request->semId ; | |
$studentId= $request->studentId; | |
$graceMark= $request->graceMark; | |
$subjectId = $request->subject->id; | |
$oldMark = $request->subject->externalMark; | |
$newMark = $oldMark + $graceMark; | |
$examId = $request->subject->regularExamId; | |
$deductedNewMark = ''; | |
if($request->deductedSubject){ | |
$deductedSubjectId = $request->deductedSubject->id; | |
$deductedOldMark = $request->deductedSubject->externalMark; | |
$deductedNewMark = $deductedOldMark - $graceMark; | |
$deductedExamId = $request->deductedSubject->regularExamId; | |
} | |
$batchDetails = CourseTypeService::getInstance()->getcourseTypeByBatchId($batchId); | |
$batchCourseType = $batchDetails->course_Type; | |
$marksTable = 'exammarks_external'; | |
if ($batchCourseType == CourseTypeConstants::UG) { | |
$marksTable = 'exammarks_external'; | |
} elseif ($batchCourseType == CourseTypeConstants::PG) { | |
$marksTable = 'externalexammarks_finalized'; | |
} | |
$sql = "INSERT INTO ec_student_mark_before_gracing (studentID,examRegID,subjectID,oldMark,graceMark,deducted_subjectID,deducted_oldMark,created_by) VALUES ('$studentId','$examRegId','$subjectId','$oldMark','$graceMark','$deductedSubjectId','$deductedOldMark','$staffId')"; | |
try { | |
$this->executeQuery($sql); | |
$sql1 = "UPDATE $marksTable set mark = '$newMark' WHERE examID = $examId and studentID = $studentId"; | |
$this->executeQuery($sql1); | |
if($deductedNewMark){ | |
$sql2 = "UPDATE $marksTable set mark = '$deductedNewMark' WHERE examID = $deductedExamId and studentID = $studentId"; | |
$this->executeQuery($sql2); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark log details | |
* @param $request | |
*/ | |
public function getGraceMarkLog($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$condition = ''; | |
if($request->studentId){ | |
$condition .= " AND studentID = $request->studentId"; | |
} | |
if($request->examRegID){ | |
$condition .= " AND examRegID = $request->examRegId"; | |
} | |
if($request->subjectId){ | |
$condition .= " AND subjectID = $request->subjectId"; | |
} | |
$sql = "SELECT subjectID,oldMark,graceMark,deducted_subjectID,deducted_oldMark FROM ec_student_mark_before_gracing WHERE 1 = 1 $condition"; | |
try { | |
$result = $this->executeQueryForList($sql); | |
return $result; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark applied students by course type and batchstartyear | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAppliedStudentsByStartYear($courseTypeId, $batchStartYear) | |
{ | |
$courseTypeId = $this->realEscapeString($courseTypeId); | |
$batchStartYear = $this->realEscapeString($batchStartYear); | |
$sql = "SELECT egmas.id, egmas.applNo, egmas.applied_events,egmas.applied_date, egmas.isConfirmed,sa.studentID, sa.regNO, sa.studentName, sa.batchID, egmi.semesters FROM ec_grace_mark_applied_students egmas INNER JOIN ec_grace_mark_appln_initiate egmi ON(egmas.gracemark_appln_id = egmi.id) INNER JOIN studentaccount sa ON(egmas.studentID = sa.studentID) INNER JOIN batches bt ON (sa.batchID = bt.batchID) WHERE bt.courseTypeID = $courseTypeId AND bt.batchStartYear = $batchStartYear AND egmas.isConfirmed = 1"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save grace mark distribution | |
* @param student | |
* @throws ProfessionalException | |
*/ | |
public function saveMarkDistribution($student) | |
{ | |
$student = $this->realEscapeObject($student); | |
try { | |
foreach($student->semMarks as $semId =>$sem){ | |
foreach ($sem->subject as $sub) { | |
if($sub->graceMark){ | |
if(!$sub->isNotApplicable){ | |
foreach ($sub->subjectMarkHistory as $subjectMarkHistory) { | |
if( $sub->externalMinimum <= $subjectMarkHistory->mark){ | |
$sql = "INSERT INTO gracemarks_student_marks (studentID,semID,subjectID,marks,examID,submit,fianlize,approve) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$subjectMarkHistory->examId','1','1','1') ON DUPLICATE KEY UPDATE marks = VALUES(marks)"; | |
$this->executeQuery($sql); | |
} | |
} | |
} | |
$subjectMarkHistory = json_encode($sub->subjectMarkHistory); | |
$sql1 = "INSERT INTO ec_subject_gracemark_details (studentID,semID,subjectID,graceMark,mark_details,excessMark,no_of_chances_taken) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$subjectMarkHistory','$sub->excessMark','$sub->chancesTaken')"; | |
$this->executeQuery($sql1); | |
} | |
} | |
$sql2 = "INSERT INTO ec_semester_gracemark_details (studentID,semID,semester_mark,addon_mark,total_mark,excess_mark,no_of_chances_taken,isCompleted,percentage_for_semester) VALUES ('$student->studentId','$semId','$sem->graceMarkForSemester','$sem->previousSemExcessMark','$sem->totalGraceMarkForSemester','$sem->excessGraceMark','$sem->chancesTaken', '$sem->isCompleted','$sem->percentageForSemester')"; | |
$this->executeQuery($sql2); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get subject graceMark distribution | |
* @throws ProfessionalException | |
*/ | |
public function getSubjectGraceMarkDistribution($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$condition = ""; | |
if ($request->semId){ | |
$condition .=" AND semID = $request->semId"; | |
} | |
if ($request->subjectId){ | |
$condition .=" AND subjectID = $request->subjectId"; | |
} | |
$sql = "SELECT * FROM ec_subject_gracemark_details WHERE studentID = $request->studentId $condition"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get subject graceMark distribution | |
* @throws ProfessionalException | |
*/ | |
public function getSemesterGraceMarkDistribution($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$condition = ""; | |
if ($request->semId){ | |
$condition .=" AND semID = $request->semId"; | |
} | |
$sql = "SELECT * FROM ec_semester_gracemark_details WHERE studentID = $request->studentId $condition"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save grace mark carry forward | |
* @param student | |
* @throws ProfessionalException | |
*/ | |
public function saveCarryForwardedMarkDistribution($student) | |
{ | |
$student = $this->realEscapeObject($student); | |
try { | |
foreach($student->semMarks as $semId =>$sem){ | |
if($sem->isDistributed){ | |
continue; | |
} | |
foreach ($sem->subject as $sub) { | |
if($sub->graceMark){ | |
if(!$sub->isNotApplicable){ | |
foreach ($sub->subjectMarkHistory as $subjectMarkHistory) { | |
if( $sub->externalMinimum <= $subjectMarkHistory->mark){ | |
$sql = "INSERT INTO gracemarks_student_marks (studentID,semID,subjectID,marks,examID,submit,fianlize,approve) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$subjectMarkHistory->examId','1','1','1') ON DUPLICATE KEY UPDATE marks = VALUES(marks)"; | |
$this->executeQuery($sql); | |
} | |
} | |
} | |
$subjectMarkHistory = json_encode($sub->subjectMarkHistory); | |
$sql1 = "INSERT INTO ec_subject_gracemark_details (studentID,semID,subjectID,graceMark,mark_details,excessMark,no_of_chances_taken) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$subjectMarkHistory','$sub->excessMark','$sub->chancesTaken') ON DUPLICATE KEY UPDATE graceMark = VALUES(graceMark), mark_details = VALUES(mark_details), excessMark = VALUES(excessMark), no_of_chances_taken = VALUES(no_of_chances_taken) "; | |
$this->executeQuery($sql1); | |
} | |
} | |
$sql2 = "UPDATE ec_semester_gracemark_details set no_of_chances_taken ='$sem->chancesTaken',isCompleted='$sem->isCompleted' WHERE studentID = $student->studentId AND semID = $semId"; | |
$this->executeQuery($sql2); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark applied students | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAppliedStudentDetailsByApplnId($applnId) | |
{ | |
$applnId = $this->realEscapeString($applnId); | |
$sql = "SELECT egmas.id, egmas.applNo, egmas.applied_events,egmas.applied_date, egmas.isConfirmed,sa.studentID, sa.regNO, sa.studentName, sa.batchID, bt.batchName FROM ec_grace_mark_applied_students egmas INNER JOIN studentaccount sa on (sa.studentID = egmas.studentID) INNER JOIN batches bt on (bt.batchID = sa.batchID) WHERE gracemark_appln_id = $applnId AND isConfirmed = 1 order by bt.batchID, sa.regNo ASC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* save redistribution grace mark | |
* @param student | |
* @throws ProfessionalException | |
*/ | |
public function saveRedistributionMarkDetails($student) | |
{ | |
$student = $this->realEscapeObject($student); | |
$staffId = $_SESSION['adminID']; | |
try { | |
foreach($student->semMarks as $semId =>$sem){ | |
foreach ($sem->subject as $sub) { | |
if($sub->graceMark != $sub->oldGraceMark){ | |
foreach ($sub->subjectMarkHistory as $subjectMarkHistory) { | |
$sql = "INSERT INTO gracemarks_student_marks (studentID,semID,subjectID,marks,examID,submit,fianlize,approve) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$subjectMarkHistory->examId','1','1','1') ON DUPLICATE KEY UPDATE marks = VALUES(marks)"; | |
$this->executeQuery($sql); | |
} | |
$subjectMarkHistory = json_encode($sub->subjectMarkHistory); | |
$sql1 = "INSERT INTO ec_subject_gracemark_details (studentID,semID,subjectID,graceMark,mark_details,excessMark,no_of_chances_taken) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$subjectMarkHistory','$sub->excessMark','$sub->chancesTaken') ON DUPLICATE KEY UPDATE graceMark = VALUES(graceMark), mark_details = VALUES(mark_details), excessMark = VALUES(excessMark), no_of_chances_taken = VALUES(no_of_chances_taken) "; | |
$this->executeQuery($sql1); | |
$sql2 = "INSERT INTO ec_gracemark_redistribution (studentID,semID,subjectID,graceMark,oldGraceMark,created_by) VALUES ('$student->studentId','$semId','$sub->subjectId','$sub->graceMark','$sub->oldGraceMark','$staffId') ON DUPLICATE KEY UPDATE graceMark = VALUES(graceMark), oldGraceMark = VALUES(oldGraceMark)"; | |
$this->executeQuery($sql2); | |
} | |
} | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* delete all distributed grace mark | |
* @param $studentId | |
*/ | |
public function deleteAllDistributedGraceMark($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "DELETE FROM ec_semester_gracemark_details WHERE studentID = $studentId"; | |
$sql1 = "DELETE FROM ec_subject_gracemark_details WHERE studentID = $studentId"; | |
$sql2 = "DELETE FROM ec_gracemark_redistribution WHERE studentID = $studentId"; | |
$sql3 = "DELETE FROM gracemarks_student_marks WHERE studentID = $studentId"; | |
try { | |
$this->executeQuery($sql); | |
$this->executeQuery($sql1); | |
$this->executeQuery($sql2); | |
$this->executeQuery($sql3); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get graceMark redistribution by studentId | |
* @throws ProfessionalException | |
*/ | |
public function getStudentRedistributionDetails($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT subjectID FROM ec_gracemark_redistribution WHERE studentID = $studentId"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get graceMark redistribution applied details by studentId | |
* @throws ProfessionalException | |
*/ | |
public function getStudentRedistributionApplicationDetails($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT startDate, endDate, applied_date, isApplied FROM ec_redistribution_applied_student_details WHERE studentID = $studentId"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving redistribution publish date | |
* @param $batchId | |
* @param $startDate | |
* @param $endDate | |
*/ | |
public function saveRedistributionApplicationDates($studentId, $startDate, $endDate) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$startDate = $this->realEscapeString($startDate); | |
$endDate = $this->realEscapeString($endDate); | |
$result = $this->getStudentRedistributionApplicationDetails($studentId); | |
if($result){ | |
$sql = "UPDATE ec_redistribution_applied_student_details set startDate = '$startDate', endDate = '$endDate' WHERE studentID = $studentId "; | |
} | |
else{ | |
$sql = "INSERT INTO ec_redistribution_applied_student_details(studentID, startDate, endDate) VALUES ($studentId, '$startDate', '$endDate')"; | |
} | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* saving student applied status | |
* @param $batchId | |
* @param $startDate | |
* @param $endDate | |
*/ | |
public function saveRedistributionStudentApplication($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$date = date("Y-m-d"); | |
$sql = "UPDATE ec_redistribution_applied_student_details set isApplied = '1', applied_date = '$date' WHERE studentID = $studentId "; | |
try { | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get graceMark redistribution applied details by studentId | |
* @throws ProfessionalException | |
*/ | |
public function getStudentRedistributionAppliedDetails($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT startDate, endDate, applied_date, isApplied FROM ec_redistribution_applied_student_details WHERE studentID = $studentId AND isApplied = 1"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* @param $studentId | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getStudentTotalGraceMarks($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT | |
SUM(gasd.marks) as totalMark | |
FROM | |
gracemarks_student_marks gasd | |
INNER JOIN exam e ON | |
e.examID = gasd.examID | |
INNER JOIN studentaccount sa ON | |
sa.studentID = gasd.studentID | |
WHERE | |
sa.studentID = $studentId AND gasd.approve = 1 AND gasd.fianlize = 1 AND e.examregID IS NOT NULL"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get grace mark applied students | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAppliedDetailsByStudentId($studentId) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$sql = "SELECT egmas.id, egmas.applNo, egmas.applied_events,egmas.applied_date, egmas.isConfirmed,sa.studentID, sa.regNO, sa.studentName, sa.batchID, egmi.semesters FROM ec_grace_mark_applied_students egmas INNER JOIN ec_grace_mark_appln_initiate egmi ON(egmas.gracemark_appln_id = egmi.id) INNER JOIN studentaccount sa ON(egmas.studentID = sa.studentID) INNER JOIN batches bt ON (sa.batchID = bt.batchID) WHERE egmas.studentID = $studentId AND egmas.isConfirmed = 1"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
/** | |
* get student grace mark details | |
* @param $studentId | |
* @param $semId | |
*/ | |
public function getStudentGraceMarkDetailsByStudentIdAndSemid($studentId, $semId = null) | |
{ | |
$studentId = (int)$this->realEscapeString($studentId); | |
$semId = (int)$this->realEscapeString($semId); | |
$condition = ""; | |
if($semId){ | |
$condition .=" AND semID = $semId "; | |
} | |
$sql = "SELECT marks FROM gracemarks_student_marks WHERE studentID = $studentId $condition AND approve = 1 AND fianlize = 1 "; | |
try { | |
$graceMarkDetails = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $graceMarkDetails; | |
} | |
public function getStudentGraceMarksBySem($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
$result = null; | |
$condition =""; | |
if($request->semId){ | |
$condition .= " AND gsm.semID IN ($request->semId) "; | |
} | |
if ($request->semId) { | |
$condition .= " AND b.batchID IN ($request->batchId) "; | |
} | |
try { | |
$sql = "SELECT | |
sa.studentID, | |
sa.regNo, | |
sa.studentName, | |
b.batchID, | |
b.batchName, | |
sem.semID, | |
sem.semName, | |
s.subjectID, | |
s.subjectName, | |
s.subjectDesc, | |
gsm.marks AS graceMarks, | |
b.batchStartYear, | |
b.batchEndYear, | |
DATE_FORMAT(egmas.applied_date ,'%d/%m/%Y') as appliedDate, | |
DATE_FORMAT(gsm.createdDate ,'%d/%m/%Y') as createdDate | |
FROM | |
gracemarks_student_marks gsm | |
INNER JOIN | |
studentaccount sa ON (gsm.studentID = sa.studentID) | |
INNER JOIN | |
exam e ON (e.semID = gsm.semID | |
AND e.subjectID = gsm.subjectID | |
AND e.batchID = sa.batchID | |
AND e.examregID IS NOT NULL) | |
INNER JOIN | |
batches b ON (b.batchID = sa.batchID) | |
INNER JOIN | |
semesters sem ON (sem.semID = gsm.semID) | |
INNER JOIN | |
subjects s ON (s.subjectID = gsm.subjectID) | |
LEFT JOIN ec_grace_mark_applied_students egmas ON egmas.studentID = sa.studentID AND egmas.gracemark_appln_id IN ($request->applnId) | |
WHERE 1=1 | |
$condition"; | |
$result = $this->executeQueryForList($sql); | |
$notAwardedStudents = $this->getGraceMarksNotAwarededStudents($request); | |
if(!empty($result) && !empty($notAwardedStudents)){ | |
$result = array_merge($result, $notAwardedStudents); | |
}else if (empty($result) && !empty($notAwardedStudents)){ | |
$result = $notAwardedStudents; | |
} | |
$students = []; | |
if (!empty($result)) { | |
foreach ($result as $graceMark) { | |
$studentId = $graceMark->studentID; | |
$students[$studentId]->id = $studentId; | |
$students[$studentId]->regNo = $graceMark->regNo; | |
$students[$studentId]->studentName = $graceMark->studentName; | |
$students[$studentId]->batchId = $graceMark->batchID; | |
$students[$studentId]->batchName = $graceMark->batchName; | |
$semId = $graceMark->semID; | |
if($semId){ | |
$students[$studentId]->semester[$semId]->id = $semId; | |
$students[$studentId]->semester[$semId]->semName = $graceMark->semName; | |
$subjectId = $graceMark->subjectID; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->id = $subjectId; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->subjectName = $graceMark->subjectName; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->subjectDesc = $graceMark->subjectDesc; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->appliedDate = $graceMark->appliedDate; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->createdDate = $graceMark->createdDate; | |
$students[$studentId]->semester[$semId]->subject[$subjectId]->graceMark = round($graceMark->graceMarks, 2); | |
} | |
} | |
$students = array_values($students); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $students; | |
} | |
public function getGraceMarksNotAwarededStudents($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
$result = null; | |
$condition = ""; | |
if ($request->semId) { | |
$condition .= " AND gsm.semID IN ($request->semId) "; | |
} | |
if ($request->semId) { | |
$condition .= " AND sa.batchID IN ($request->batchId) "; | |
} | |
try { | |
$sql = "SELECT | |
sa.studentID, | |
sa.regNo, | |
sa.studentName, | |
b.batchID, | |
b.batchName, | |
b.batchStartYear, | |
b.batchEndYear | |
FROM ec_grace_mark_applied_students ecmas | |
INNER JOIN | |
studentaccount sa ON sa.studentID = ecmas.studentID | |
INNER JOIN | |
batches b ON b.batchID = sa.batchID | |
WHERE ecmas.gracemark_appln_id IN ($request->applnId) and ecmas.studentID NOT IN (select distinct sa.studentID from gracemarks_student_marks gsm | |
INNER JOIN studentaccount sa ON sa.studentID = gsm.studentID | |
WHERE 1=1 $condition)"; | |
$result = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
public function getStudentGraceMarksApplication($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
$result = null; | |
$condition = ""; | |
try { | |
$sql = "SELECT group_concat(ecg.id) as applicationId FROM ec_grace_mark_appln_initiate ecg | |
INNER JOIN ec_grace_mark_appln_assigned_batches ecgb ON ecgb.gracemark_appln_id = ecg.id | |
WHERE FIND_IN_SET($request->semId,ecg.semesters) AND FIND_IN_SET($request->batchId,ecgb.batchIDs)"; | |
$result = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
/** | |
* get grace mark applied tudents | |
* @return mixed | |
* @throws ProfessionalException | |
*/ | |
public function getGraceMarkAppliedStudentDetailsExam($studentId, $applnIds) | |
{ | |
$studentId = $this->realEscapeString($studentId); | |
$applnIds = $this->realEscapeString($applnIds); | |
$sql = "SELECT id, applNo, applied_events,applied_date, isConfirmed FROM ec_grace_mark_applied_students WHERE studentID = $studentId AND gracemark_appln_id in ($applnIds)"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
} | |
} | |
public function getGraceMarkAppliedStudentListByApplicationId($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
$sql = "SELECT t1.studentaccount_id,t1.challanNo,t1.totalFees,t1.regDate,t2.regNo, t2.studentName, t3.paidDate,t1.semFrom,t1.semTo,t1.applnNo,t1.id,t1.gracemarks_event_category_id | |
FROM gracemarks_save_appln t1, studentaccount t2,gracemarks_fees_paid t3,batches t4 | |
WHERE t1.studentaccount_id = t2.studentID AND t2.batchID = t4.batchID and t3.studentaccount_id = t2.studentID AND t1.paid_status = 1 | |
AND t1.gracemarks_appln_initiate_id = $request->applnId GROUP BY t1.studentaccount_id ORDER BY t2.studentName ASC"; | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
public function getStudentGraceMarkApplicationMarkDetails($request){ | |
$request = $this->realEscapeObject($request); | |
$sql = null; | |
$result = null; | |
if($request->studentId){ | |
$condition .= " AND asg.studentaccount_id IN ($request->studentId)"; | |
} | |
if ($request->applnId) { | |
$condition .= " AND asg.gracemarks_appln_initiate_id IN ($request->applnId)"; | |
} | |
if($request->semFrom){ | |
$condition .=" AND asg.semFrom = $request->semFrom"; | |
} | |
if ($request->semTo) { | |
$condition .= " AND asg.semTo = $request->semTo"; | |
} | |
$sql = "SELECT asg.marks,gsm.fianlize ,gsm.approve FROM assign_student_gracemarks asg | |
LEFT JOIN gracemarks_student_marks gsm ON gsm.studentID = asg.studentaccount_id AND gsm.gracemarks_appln_initiate_id = asg.gracemarks_appln_initiate_id | |
WHERE 1=1 $condition group By asg.studentaccount_id ;"; | |
try { | |
return $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* Method for checking students in moderation | |
* @input $request | |
* @author Sibin | |
*/ | |
public function studentsPresentInModerationByRequest($request = null) | |
{ | |
$sql = ''; | |
$studentPresent = null; | |
$request = $this->realEscapeObject($request); | |
if($request->batchId){ | |
$condition .= " AND e.batchID IN($request->batchId)"; | |
} | |
if ($request->studentId) { | |
$condition .= " AND smbm.studentID IN($request->studentId)"; | |
} | |
try { | |
$sql = "SELECT studentID as studentId FROM student_mark_before_moderation smbm | |
INNER JOIN exam e ON e.examID = smbm.examID WHERE 1=1 | |
$condition"; | |
$studentPresent = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $studentPresent; | |
} | |
} | |