19 declare(strict_types=1);
30 protected \ilDBInterface
$db;
39 $where_part =
'WHERE obj_fi = ' . $this->db->quote($obj_fi,
'integer');
45 $where_part =
'WHERE test_id = ' . $this->db->quote($test_id,
'integer');
51 $query =
'SELECT ' . PHP_EOL
52 .
'test_id,' . PHP_EOL
53 .
'count_system, score_cutting, pass_scoring,' . PHP_EOL
54 .
'score_reporting, reporting_date,' . PHP_EOL
55 .
'show_grading_status, show_grading_mark, pass_deletion_allowed,' . PHP_EOL
56 .
'print_bs_with_res,' . PHP_EOL
57 .
'examid_in_test_res,' . PHP_EOL
58 .
'results_presentation,' . PHP_EOL
59 .
'exportsettings,' . PHP_EOL
60 .
'highscore_enabled, highscore_anon, highscore_achieved_ts, highscore_score, highscore_percentage, highscore_wtime, highscore_own_table, highscore_top_table, highscore_top_num' . PHP_EOL
61 .
'FROM ' . self::TABLE_NAME . PHP_EOL
64 $res = $this->db->query($query);
66 if ($this->db->numRows(
$res) == 0) {
67 throw new \Exception(
'no score settings: ' . $where_part);
70 $row = $this->db->fetchAssoc(
$res);
72 $test_id = (
int) $row[
'test_id'];
76 (
new SettingsScoring($test_id))
77 ->withCountSystem((
int) $row[
'count_system'])
78 ->withScoreCutting((
int) $row[
'score_cutting'])
79 ->withPassScoring((
int) $row[
'pass_scoring']),
83 ->withShowGradingStatusEnabled((
bool) $row[
'show_grading_status'])
84 ->withShowGradingMarkEnabled((
bool) $row[
'show_grading_mark'])
85 ->withPassDeletionAllowed((
bool) $row[
'pass_deletion_allowed']),
88 ->withResultsPresentation((
int) $row[
'results_presentation'])
89 ->withShowExamIdInTestResults((
bool) $row[
'examid_in_test_res'])
90 ->withExportSettings((
int) $row[
'exportsettings']),
92 ->withHighscoreEnabled((
bool) $row[
'highscore_enabled'])
93 ->withHighscoreAnon((
bool) $row[
'highscore_anon'])
94 ->withHighscoreAchievedTS((
bool) $row[
'highscore_achieved_ts'])
95 ->withHighscoreScore((
bool) $row[
'highscore_score'])
96 ->withHighscorePercentage((
bool) $row[
'highscore_percentage'])
97 ->withHighscoreWTime((
bool) $row[
'highscore_wtime'])
98 ->withHighscoreOwnTable((
bool) $row[
'highscore_own_table'])
99 ->withHighscoreTopTable((
bool) $row[
'highscore_top_table'])
100 ->withHighscoreTopNum((
int) $row[
'highscore_top_num'])
108 $values = array_merge(
120 [
'test_id' => [
'integer', $settings->
getTestId()]]
127 $result = $this->db->query(
129 .
'test_id, obj_fi, score_reporting, reporting_date,' . PHP_EOL
130 .
'show_grading_status, show_grading_mark, pass_deletion_allowed' . PHP_EOL
131 .
'FROM ' . self::TABLE_NAME . PHP_EOL
135 $settings_summary = [];
136 while (($row = $this->db->fetchAssoc($result)) !==
null) {
140 ->withShowGradingStatusEnabled((
bool) $row[
'show_grading_status'])
141 ->withShowGradingMarkEnabled((
bool) $row[
'show_grading_mark'])
142 ->withPassDeletionAllowed((
bool) $row[
'pass_deletion_allowed']);
144 return $settings_summary;
149 if ($reporting_date ===
null 150 || $reporting_date ===
'') {
154 return \DateTimeImmutable::createFromFormat(
155 self::STORAGE_DATE_FORMAT,
getSettingsResultSummaryByObjIds(array $obj_ids)
buildDateFromString(?string $reporting_date)
getResultDetailsSettings()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getGamificationSettings()
doSelect(string $where_part)
store(ScoreSettings $settings)
getResultSummarySettings()
const STORAGE_DATE_FORMAT
__construct(\ilDBInterface $db)