Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 102 |
| FalseNumberSettingService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
182.00 | |
0.00% |
0 / 102 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| getFalseNumberSettings | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 36 |
|||
| saveFalseNumberSettings | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 39 |
|||
| updateFalseNumberSettings | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 25 |
|||
| <?php | |
| namespace com\linways\ec\core\service; | |
| use com\linways\ec\core\dto\FalseNumberSetting; | |
| use com\linways\ec\core\dto\FalseNumberSettingExamLog; | |
| use com\linways\base\util\MakeSingletonTrait; | |
| use com\linways\base\util\SecurityUtils; | |
| use com\linways\ec\core\constant\StatusConstants; | |
| use com\linways\ec\core\exception\ExamControllerException; | |
| use com\linways\ec\core\mapper\FalseNumberSettingServiceMapper; | |
| class FalseNumberSettingService extends BaseService | |
| { | |
| use MakeSingletonTrait; | |
| private function __construct() { | |
| $this->mapper = FalseNumberSettingServiceMapper::getInstance()->getMapper(); | |
| } | |
| /** | |
| * method to get false number settings | |
| * @param falseNumberSettingId | |
| * @throws ExamControllerException | |
| * @return FalseNumberSetting | |
| */ | |
| public function getFalseNumberSettings($searchRequest){ | |
| $searchRequest = $this->realEscapeObject($searchRequest); | |
| $whereQuery = ""; | |
| if(!empty($searchRequest->examRegistrationId)) { | |
| $examRegistrationIdString = is_array($searchRequest->examRegistrationId) ? "'" . implode("','",$searchRequest->examRegistrationId) . "'" : "'".$searchRequest->examRegistrationId."'"; | |
| $whereQuery .= " AND ec_exam_registration_id IN ( $examRegistrationIdString )"; | |
| } | |
| if(!empty($searchRequest->falseNumberSettingId)) { | |
| $falseNumberSettingIdString = is_array($searchRequest->falseNumberSettingId) ? "'" . implode("','",$searchRequest->falseNumberSettingId) . "'" : "'".$searchRequest->falseNumberSettingId."'"; | |
| $whereQuery .= " AND id IN ( $falseNumberSettingIdString )"; | |
| } | |
| $falseNumberSetting = null; | |
| $query="SELECT | |
| id, | |
| shuffle_all_exams, | |
| false_no_total_range_from, | |
| false_no_total_range_to, | |
| false_no_numofdigits, | |
| false_no_to_present_students_only, | |
| false_no_prefix_setting, | |
| ec_exam_registration_id, | |
| date_format, | |
| properties, | |
| createdBy, | |
| updatedBy, | |
| createdDate, | |
| updatedDate | |
| FROM false_number_settings_master | |
| WHERE 1=1 "; | |
| try{ | |
| $falseNumberSetting = $this->executeQueryForObject($query.$whereQuery,false,$this->mapper[FalseNumberSettingServiceMapper::SEARCH_FALSE_NUMBER_SETTINGS]); | |
| }catch(\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $falseNumberSetting; | |
| } | |
| /** | |
| * method to save false number settings | |
| * @author Krishnajith | |
| * @param FalseNumberSetting $falseNumberSetting | |
| * @throws ExamControllerException | |
| * @return $falseNumberSettingId | |
| */ | |
| public function saveFalseNumberSettings($falseNumberSetting){ | |
| $properties = !empty($falseNumberSetting->properties) ? "'" . json_encode($falseNumberSetting->properties) . "'" : "NULL"; | |
| $falseNumberSettingId = null; | |
| $falseNumberSetting = $this->realEscapeObject($falseNumberSetting); | |
| $query="INSERT INTO false_number_settings_master | |
| (ec_exam_registration_id, | |
| shuffle_all_exams, | |
| false_no_total_range_from, | |
| false_no_total_range_to, | |
| false_no_numofdigits, | |
| false_no_to_present_students_only, | |
| false_no_prefix_setting, | |
| date_format, | |
| properties, | |
| createdBy, | |
| updatedBy, | |
| createdDate, | |
| updatedDate) VALUES | |
| ('$falseNumberSetting->examRegistrationId', | |
| '$falseNumberSetting->shuffleAllExams', | |
| '$falseNumberSetting->falseNoTotalRangeFrom', | |
| '$falseNumberSetting->falseNoTotalRangeTo', | |
| '$falseNumberSetting->falseNoNumofdigits', | |
| '$falseNumberSetting->falseNoToPresentStudentsOnly', | |
| '$falseNumberSetting->falseNoPrefixSetting', | |
| '$falseNumberSetting->dateFormat', | |
| $properties, | |
| '$falseNumberSetting->createdBy', | |
| '$falseNumberSetting->updatedBy', | |
| utc_timestamp(), | |
| utc_timestamp() | |
| )"; | |
| try{ | |
| $falseNumberSettingId = $this->executeQueryForObject($query,TRUE); | |
| }catch(\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $falseNumberSettingId; | |
| } | |
| /** | |
| * method to update false number settings | |
| * @author Krishnajith | |
| * @param FalseNumberSetting $falseNumberSetting | |
| * @throws ExamControllerException | |
| * @return $falseNumberSettingId | |
| */ | |
| public function updateFalseNumberSettings($falseNumberSetting){ | |
| $properties = !empty($falseNumberSetting->properties) ? "'" . json_encode($falseNumberSetting->properties) . "'" : "NULL"; | |
| $falseNumberSettingId = null; | |
| $falseNumberSetting = $this->realEscapeObject($falseNumberSetting); | |
| $query="UPDATE false_number_settings_master | |
| set shuffle_all_exams = '$falseNumberSetting->shuffleAllExams', | |
| false_no_total_range_from = '$falseNumberSetting->falseNoTotalRangeFrom', | |
| false_no_total_range_to = '$falseNumberSetting->falseNoTotalRangeTo', | |
| false_no_numofdigits = '$falseNumberSetting->falseNoNumofdigits', | |
| false_no_to_present_students_only = '$falseNumberSetting->falseNoToPresentStudentsOnly', | |
| false_no_prefix_setting = '$falseNumberSetting->falseNoPrefixSetting', | |
| date_format='$falseNumberSetting->dateFormat', | |
| properties = $properties, | |
| createdBy = '$falseNumberSetting->createdBy', | |
| updatedBy = '$falseNumberSetting->updatedBy', | |
| createdDate = utc_timestamp(), | |
| updatedDate = utc_timestamp() | |
| WHERE id = '$falseNumberSetting->id'"; | |
| try{ | |
| $falseNumberSettingId = $this->executeQueryForObject($query,TRUE); | |
| }catch(\Exception $e) | |
| { | |
| throw new ExamControllerException($e->getCode(),$e->getMessage()); | |
| } | |
| return $falseNumberSettingId; | |
| } | |
| } |