19declare(strict_types=1);
42 return isset($this->settings_by_test_fi[$test_id])
43 ? $this->settings_instances[$this->settings_by_test_fi[$test_id]]
44 : $this->
doSelect(
"WHERE test_id = {$this->db->quote($test_id, \ilDBConstants::T_INTEGER)}");
49 if (isset($this->settings_instances[$settings_id])) {
50 return $this->settings_instances[$settings_id];
53 $res = $this->db->queryF(
54 "SELECT * FROM tst_test_settings WHERE id = %s",
59 if ($this->db->numRows(
$res) === 0) {
63 $settings = $this->
factory->createScoreSettingsFromDBRow($this->db->fetchAssoc(
$res));
64 $this->settings_instances[$settings->getId()] = $settings;
71 $query =
'SELECT ' . PHP_EOL
72 .
'tst_set.id,' . PHP_EOL
73 .
'tst_set.count_system, tst_set.score_cutting, tst_set.pass_scoring,' . PHP_EOL
74 .
'tst_set.score_reporting, tst_set.reporting_date,' . PHP_EOL
75 .
'tst_set.show_grading_status, tst_set.show_grading_mark, tst_set.pass_deletion_allowed,' . PHP_EOL
76 .
'tst_set.print_bs_with_res,' . PHP_EOL
77 .
'tst_set.examid_in_test_res,' . PHP_EOL
78 .
'tst_set.results_presentation,' . PHP_EOL
79 .
'tst_set.exportsettings,' . PHP_EOL
80 .
'tst_set.highscore_enabled, tst_set.highscore_anon, tst_set.highscore_achieved_ts, tst_set.highscore_score, tst_set.highscore_percentage, tst_set.highscore_wtime, tst_set.highscore_own_table, tst_set.highscore_top_table, tst_set.highscore_top_num,' . PHP_EOL
81 .
'tst.test_id AS test_id' . PHP_EOL
82 .
'FROM tst_test_settings AS tst_set' . PHP_EOL
83 .
'INNER JOIN tst_tests AS tst ON tst.settings_id = tst_set.id' . PHP_EOL
86 $res = $this->db->query($query);
88 if ($this->db->numRows(
$res) === 0) {
92 $row = $this->db->fetchAssoc(
$res);
93 $settings = $this->
factory->createScoreSettingsFromDBRow($row);
95 $this->settings_instances[$row[
'test_id']] = $settings;
102 $values = array_merge(
117 $this->settings_instances = array_filter(
118 $this->settings_instances,
125 $result = $this->db->query(
127 .
'tst_set.score_reporting, tst_set.reporting_date,' . PHP_EOL
128 .
'tst_set.show_grading_status, tst_set.show_grading_mark, tst_set.pass_deletion_allowed,' . PHP_EOL
129 .
'tst_tests.obj_fi AS obj_fi' . PHP_EOL
130 .
'FROM tst_test_settings AS tst_set' . PHP_EOL
131 .
'INNER JOIN tst_tests ON tst_tests.settings_id = tst_set.id' . PHP_EOL
135 $settings_summary = [];
136 while (($row = $this->db->fetchAssoc($result)) !==
null) {
139 ->withReportingDate($row[
'reporting_date'] !== 0
140 ? \DateTimeImmutable::createFromFormat(
'U', (
string) $row[
'reporting_date'])
142 ->withShowGradingStatusEnabled((
bool) $row[
'show_grading_status'])
143 ->withShowGradingMarkEnabled((
bool) $row[
'show_grading_mark'])
144 ->withPassDeletionAllowed((
bool) $row[
'pass_deletion_allowed']);
146 return $settings_summary;
getSettingsResultSummaryByObjIds(array $obj_ids)
getById(int $settings_id)
array $settings_instances
doSelect(string $where_part)
store(ScoreSettings $settings)
array $settings_by_test_fi
__construct(protected \ilDBInterface $db, protected SettingsFactory $factory)
getResultDetailsSettings()
getGamificationSettings()
getResultSummarySettings()
@depracated This is only a temporary exception to identify missing migrations and will be removed in ...