ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
SettingsFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Test\Settings;
22
23use ILIAS\Test\Scoring\Settings\Settings as SettingsScoring;
39
41{
42 public function createMainSettingsFromDBRow(array $row): MainSettings
43 {
44 return new MainSettings(
45 $row['id'],
47 $row['question_set_type'],
48 (bool) $row['anonymity']
49 ),
51 (bool) $row['intro_enabled'],
52 $row['introduction_page_id'],
53 (bool) $row['conditions_checkbox_enabled'],
54 ),
56 (bool) $row['starting_time_enabled'],
57 $row['starting_time'] !== 0
58 ? \DateTimeImmutable::createFromFormat('U', (string) $row['starting_time'])
59 : null,
60 (bool) $row['ending_time_enabled'],
61 $row['ending_time'] !== 0
62 ? \DateTimeImmutable::createFromFormat('U', (string) $row['ending_time'])
63 : null,
64 (bool) $row['password_enabled'],
65 $row['password'],
66 $row['ip_range_from'],
67 $row['ip_range_to'],
68 (bool) $row['fixed_participants'],
69 ),
71 $row['nr_of_tries'],
72 (bool) $row['block_after_passed'],
73 $row['pass_waiting'],
74 (bool) $row['enable_processing_time'],
75 $row['processing_time'],
76 (bool) $row['reset_processing_time'],
77 $row['kiosk'],
78 (bool) $row['examid_in_test_pass']
79 ),
81 (int) $row['title_output'],
82 (bool) $row['autosave'],
83 $row['autosave_ival'],
84 (bool) $row['shuffle_questions'],
85 (bool) $row['answer_feedback_points'],
86 (bool) $row['answer_feedback'],
87 (bool) $row['specific_feedback'],
88 (bool) $row['instant_verification'],
89 (bool) $row['force_inst_fb'],
90 (bool) $row['inst_fb_answer_fixation'],
91 (bool) $row['follow_qst_answer_fixation']
92 ),
94 (bool) $row['use_previous_answers'],
95 (bool) $row['suspend_test_allowed'],
96 (bool) $row['sequence_settings'],
97 $row['usr_pass_overview_mode'],
98 (bool) $row['show_marker'],
99 (bool) $row['show_questionlist']
100 ),
102 (bool) $row['enable_examview'],
103 (bool) $row['showfinalstatement'],
104 $row['concluding_remarks_page_id'],
105 RedirectionModes::tryFrom($row['redirection_mode']) ?? RedirectionModes::NONE,
106 $row['redirection_url']
107 ),
109 (bool) $row['skill_service'],
110 (bool) $row['hide_info_tab']
111 )
112 );
113 }
114
116 {
117 return new MainSettings(
118 0,
119 new SettingsGeneral(),
121 new SettingsAccess(),
124 0,
125 false,
126 0,
127 false,
128 false,
129 false,
130 false,
131 false,
132 false,
133 false,
134 false
135 ),
137 new SettingsFinishing(),
139 );
140 }
141
142 public function createScoreSettingsFromDBRow(array $row): ScoreSettings
143 {
144 return new ScoreSettings(
145 $row['id'],
146 (new SettingsScoring())
147 ->withCountSystem((int) $row['count_system'])
148 ->withScoreCutting((int) $row['score_cutting'])
149 ->withPassScoring((int) $row['pass_scoring']),
151 ->withScoreReporting(ScoreReportingTypes::from($row['score_reporting']))
152 ->withReportingDate(!empty($row['reporting_date'])
153 ? \DateTimeImmutable::createFromFormat('U', (string) $row['reporting_date'])
154 : null)
155 ->withShowGradingStatusEnabled((bool) $row['show_grading_status'])
156 ->withShowGradingMarkEnabled((bool) $row['show_grading_mark'])
157 ->withPassDeletionAllowed((bool) $row['pass_deletion_allowed']),
158 //->withShowPassDetails derived from results_presentation with bit RESULTPRES_BIT_PASS_DETAILS
160 ->withResultsPresentation((int) $row['results_presentation'])
161 ->withShowExamIdInTestResults((bool) $row['examid_in_test_res'])
162 ->withExportSettings((int) $row['exportsettings']),
163 );
164 }
165
167 {
168 return new PersonalSettingsTemplate(
169 $row['test_defaults_id'],
170 $row['user_fi'],
171 $row['name'],
172 $row['description'] ?? '',
173 $row['author'] ?? '',
174 \DateTimeImmutable::createFromFormat('U', (string) $row['tstamp']),
175 $row['settings_id'] ?? -1,
176 );
177 }
178}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...