ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings Class Reference
+ Collaboration diagram for ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings:

Public Member Functions

 __construct (private ProcessLockModes $process_lock_mode=ProcessLockModes::ASS_PROC_LOCK_MODE_NONE, private string $image_map_line_color='FF0000', private UserIdentifiers $user_identifier=UserIdentifiers::USER_ID, private int $skill_triggering_number_of_answers=1, private bool $export_essay_questions_as_html=false, private array $disabled_question_types=[], private bool $manual_scoring_enabled=false, private bool $adjusting_questions_with_results_allowed=false, private bool $page_editor_enabled=false)
 
 toForm (UIFactory $ui_factory, Refinery $refinery, \ilLanguage $lng)
 
 getProcessLockMode ()
 
 withProcessLockMode (ProcessLockModes $process_lock_mode)
 
 getImageMapLineColor ()
 
 withImageMapLineColor (string $image_map_line_color)
 
 getUserIdentifier ()
 
 withUserIdentifier (UserIdentifiers $user_identifier)
 
 getSkillTriggeringNumberOfAnswers ()
 
 withSkillTriggeringNumberOfAnswers (int $skill_triggering_number_of_answers)
 
 getExportEssayQuestionsAsHtml ()
 
 withExportEssayQuestionsAsHtml (bool $export_essay_questions_as_html)
 
 getDisabledQuestionTypes ()
 
 withDisabledQuestionTypes (array $disabled_question_types)
 
 isManualScoringEnabled ()
 
 withManualScoringEnabled (bool $manual_scoring_enabled)
 
 isAdjustingQuestionsWithResultsAllowed ()
 
 withAdjustingQuestionsWithResultsAllowed (bool $adjusting_questions_with_results_allowed)
 
 isPageEditorEnabled ()
 
 withPageEditorEnabled (bool $page_editor_enabled)
 

Private Member Functions

 buildGlobalSettingsBuilderTrafo (Refinery $refinery, array $all_question_types)
 
 buildGeneralSettingsInputs (FieldFactory $ff, Refinery $refinery, \ilLanguage $lng)
 
 buildQuestionSettingsInputs (FieldFactory $ff, \ilLanguage $lng, array $all_question_types, array $enabled_question_types)
 

Detailed Description

Definition at line 29 of file GlobalTestSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::__construct ( private ProcessLockModes  $process_lock_mode = ProcessLockModes::ASS_PROC_LOCK_MODE_NONE,
private string  $image_map_line_color = 'FF0000',
private UserIdentifiers  $user_identifier = UserIdentifiers::USER_ID,
private int  $skill_triggering_number_of_answers = 1,
private bool  $export_essay_questions_as_html = false,
private array  $disabled_question_types = [],
private bool  $manual_scoring_enabled = false,
private bool  $adjusting_questions_with_results_allowed = false,
private bool  $page_editor_enabled = false 
)

Definition at line 31 of file GlobalTestSettings.php.

41 {
42 }

Member Function Documentation

◆ buildGeneralSettingsInputs()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::buildGeneralSettingsInputs ( FieldFactory  $ff,
Refinery  $refinery,
\ilLanguage  $lng 
)
private

Definition at line 224 of file GlobalTestSettings.php.

228 : Section {
229 return $ff->section(
230 [
231 'process_lock_mode' => $ff->optionalGroup(
232 [
233 $ff->radio($lng->txt('ass_process_lock_mode'))
234 ->withOption(
235 ProcessLockModes::ASS_PROC_LOCK_MODE_FILE->value,
236 $lng->txt('ass_process_lock_mode_file'),
237 $lng->txt('ass_process_lock_mode_file_desc')
238 )->withOption(
240 $lng->txt('ass_process_lock_mode_db'),
241 $lng->txt('ass_process_lock_mode_db_desc')
242 )
243 ],
244 $lng->txt('ass_process_lock')
245 )->withByline($lng->txt('ass_process_lock_desc'))
246 ->withValue($this->process_lock_mode === ProcessLockModes::ASS_PROC_LOCK_MODE_NONE ? null : [$this->process_lock_mode->value]),
247 'image_map_line_color' => $ff->colorSelect($lng->txt('imap_line_color'))
248 ->withValue('#' . $this->image_map_line_color),
249 'user_identifier' => $ff->select(
250 $lng->txt('user_criteria'),
251 array_reduce(
252 UserIdentifiers::cases(),
253 function (array $c, UserIdentifiers $v): array {
254 $c[$v->value] = $v->value;
255 return $c;
256 },
257 []
258 )
259 )->withRequired(true)
260 ->withByline($lng->txt('user_criteria_desc'))
261 ->withValue($this->user_identifier->value),
262 'skill_triggering_number_of_answers' => $ff->numeric($lng->txt('tst_skill_triggerings_num_req_answers'))
263 ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
264 ->withByline($lng->txt('tst_skill_triggerings_num_req_answers_desc'))
265 ->withValue($this->skill_triggering_number_of_answers),
266 'export_essay_questions_as_html' => $ff->checkbox($lng->txt('export_essay_qst_with_html'))
267 ->withByline($lng->txt('export_essay_qst_with_html_desc'))
268 ->withValue($this->export_essay_questions_as_html)
269 ],
270 $lng->txt('settings')
271 );
272 }
$c
Definition: deliver.php:25
global $lng
Definition: privfeed.php:31

◆ buildGlobalSettingsBuilderTrafo()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::buildGlobalSettingsBuilderTrafo ( Refinery  $refinery,
array  $all_question_types 
)
private

Definition at line 191 of file GlobalTestSettings.php.

194 : Transformation {
195 return $refinery->custom()->transformation(
196 static function ($vs) use ($all_question_types): self {
197 $process_lock_mode = ProcessLockModes::ASS_PROC_LOCK_MODE_NONE;
198 if ($vs['general_settings']['process_lock_mode'] !== null) {
199 $process_lock_mode = ProcessLockModes::from($vs['general_settings']['process_lock_mode'][0]);
200 }
201 return new self(
202 $process_lock_mode,
203 substr($vs['general_settings']['image_map_line_color']->asHex(), 1),
204 UserIdentifiers::from($vs['general_settings']['user_identifier']),
205 $vs['general_settings']['skill_triggering_number_of_answers'],
206 $vs['general_settings']['export_essay_questions_as_html'],
207 array_reduce(
208 $all_question_types,
209 static function (array $c, array $v) use ($vs): array {
210 if (!in_array($v['question_type_id'], $vs['question_settings']['enabled_question_types'])) {
211 $c[] = $v['question_type_id'];
212 }
213 return $c;
214 },
215 []
216 ),
217 $vs['question_settings']['manual_scoring_enabled'],
218 $vs['question_settings']['adjusting_questions_with_results_allowed']
219 );
220 }
221 );
222 }

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

+ Here is the call graph for this function:

◆ buildQuestionSettingsInputs()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::buildQuestionSettingsInputs ( FieldFactory  $ff,
\ilLanguage  $lng,
array  $all_question_types,
array  $enabled_question_types 
)
private

Definition at line 274 of file GlobalTestSettings.php.

279 : Section {
280 return $ff->section(
281 [
282 'enabled_question_types' => $ff->multiSelect(
283 $lng->txt('assf_allowed_questiontypes'),
284 array_reduce(
285 array_keys($all_question_types),
286 function (array $c, string $v) use ($all_question_types): array {
287 $c[$all_question_types[$v]['question_type_id']] = $v;
288 return $c;
289 },
290 []
291 )
292 )->withByline($lng->txt('assf_allowed_questiontypes_desc'))
293 ->withValue($enabled_question_types),
294 'manual_scoring_enabled' => $ff->checkbox($lng->txt('activate_manual_scoring'))
295 ->withByline($lng->txt('activate_manual_scoring_desc'))
296 ->withValue($this->isManualScoringEnabled()),
297 'adjusting_questions_with_results_allowed' => $ff->checkbox($lng->txt('assessment_scoring_adjust'))
298 ->withByline($lng->txt('assessment_scoring_adjust_desc'))
299 ->withValue($this->isAdjustingQuestionsWithResultsAllowed())
300 ],
301 $lng->txt('assf_questiontypes')
302 );
303 }

◆ getDisabledQuestionTypes()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::getDisabledQuestionTypes ( )
Returns
array<int>

Definition at line 140 of file GlobalTestSettings.php.

140 : array
141 {
142 return $this->disabled_question_types;
143 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ getExportEssayQuestionsAsHtml()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::getExportEssayQuestionsAsHtml ( )

Definition at line 125 of file GlobalTestSettings.php.

125 : bool
126 {
127 return $this->export_essay_questions_as_html;
128 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ getImageMapLineColor()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::getImageMapLineColor ( )

Definition at line 89 of file GlobalTestSettings.php.

89 : string
90 {
91 return $this->image_map_line_color;
92 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ getProcessLockMode()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::getProcessLockMode ( )

Definition at line 77 of file GlobalTestSettings.php.

78 {
79 return $this->process_lock_mode;
80 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ getSkillTriggeringNumberOfAnswers()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::getSkillTriggeringNumberOfAnswers ( )

Definition at line 113 of file GlobalTestSettings.php.

113 : int
114 {
115 return $this->skill_triggering_number_of_answers;
116 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ getUserIdentifier()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::getUserIdentifier ( )

Definition at line 101 of file GlobalTestSettings.php.

102 {
103 return $this->user_identifier;
104 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ isAdjustingQuestionsWithResultsAllowed()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::isAdjustingQuestionsWithResultsAllowed ( )

Definition at line 167 of file GlobalTestSettings.php.

167 : bool
168 {
169 return $this->adjusting_questions_with_results_allowed;
170 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ isManualScoringEnabled()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::isManualScoringEnabled ( )

Definition at line 155 of file GlobalTestSettings.php.

155 : bool
156 {
157 return $this->manual_scoring_enabled;
158 }

Referenced by ILIAS\Test\Settings\GlobalSettings\Repository\storeGlobalSettings().

+ Here is the caller graph for this function:

◆ isPageEditorEnabled()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::isPageEditorEnabled ( )

Definition at line 179 of file GlobalTestSettings.php.

179 : bool
180 {
181 return $this->page_editor_enabled;
182 }

◆ toForm()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::toForm ( UIFactory  $ui_factory,
Refinery  $refinery,
\ilLanguage  $lng 
)
Returns
array<ILIAS\UI\Component\Input\Input>

Definition at line 48 of file GlobalTestSettings.php.

52 : array {
53 $ff = $ui_factory->input()->field();
54 $all_question_types = \ilObjQuestionPool::_getQuestionTypes(true);
55 $enabled_question_types = array_map(
56 static fn(array $v): int => $v['question_type_id'],
57 array_filter(
58 $all_question_types,
59 fn(array $v): bool => !in_array($v['question_type_id'], $this->disabled_question_types)
60 )
61 );
62 $trafo = $this->buildGlobalSettingsBuilderTrafo($refinery, $all_question_types);
63
64 return [
65 'global_settings' => $ff->group([
66 'general_settings' => $this->buildGeneralSettingsInputs($ff, $refinery, $lng),
67 'question_settings' => $this->buildQuestionSettingsInputs(
68 $ff,
69 $lng,
70 $all_question_types,
71 $enabled_question_types
72 )
73 ])->withAdditionalTransformation($trafo)
74 ];
75 }
buildQuestionSettingsInputs(FieldFactory $ff, \ilLanguage $lng, array $all_question_types, array $enabled_question_types)
buildGlobalSettingsBuilderTrafo(Refinery $refinery, array $all_question_types)
buildGeneralSettingsInputs(FieldFactory $ff, Refinery $refinery, \ilLanguage $lng)
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)

◆ withAdjustingQuestionsWithResultsAllowed()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withAdjustingQuestionsWithResultsAllowed ( bool  $adjusting_questions_with_results_allowed)

Definition at line 172 of file GlobalTestSettings.php.

172 : self
173 {
174 $clone = clone $this;
175 $clone->adjusting_questions_with_results_allowed = $adjusting_questions_with_results_allowed;
176 return $clone;
177 }

◆ withDisabledQuestionTypes()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withDisabledQuestionTypes ( array  $disabled_question_types)
Parameters
array<int>$disabled_question_types

Definition at line 148 of file GlobalTestSettings.php.

148 : self
149 {
150 $clone = clone $this;
151 $clone->disabled_question_types = $disabled_question_types;
152 return $clone;
153 }

◆ withExportEssayQuestionsAsHtml()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withExportEssayQuestionsAsHtml ( bool  $export_essay_questions_as_html)

Definition at line 130 of file GlobalTestSettings.php.

130 : self
131 {
132 $clone = clone $this;
133 $clone->export_essay_questions_as_html = $export_essay_questions_as_html;
134 return $clone;
135 }

◆ withImageMapLineColor()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withImageMapLineColor ( string  $image_map_line_color)

Definition at line 94 of file GlobalTestSettings.php.

94 : self
95 {
96 $clone = clone $this;
97 $clone->image_map_line_color = $image_map_line_color;
98 return $clone;
99 }

◆ withManualScoringEnabled()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withManualScoringEnabled ( bool  $manual_scoring_enabled)

Definition at line 160 of file GlobalTestSettings.php.

160 : self
161 {
162 $clone = clone $this;
163 $clone->manual_scoring_enabled = $manual_scoring_enabled;
164 return $clone;
165 }

◆ withPageEditorEnabled()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withPageEditorEnabled ( bool  $page_editor_enabled)

Definition at line 184 of file GlobalTestSettings.php.

184 : self
185 {
186 $clone = clone $this;
187 $clone->page_editor_enabled = $page_editor_enabled;
188 return $clone;
189 }

◆ withProcessLockMode()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withProcessLockMode ( ProcessLockModes  $process_lock_mode)

Definition at line 82 of file GlobalTestSettings.php.

82 : self
83 {
84 $clone = clone $this;
85 $clone->process_lock_mode = $process_lock_mode;
86 return $clone;
87 }

◆ withSkillTriggeringNumberOfAnswers()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withSkillTriggeringNumberOfAnswers ( int  $skill_triggering_number_of_answers)

Definition at line 118 of file GlobalTestSettings.php.

118 : self
119 {
120 $clone = clone $this;
121 $clone->skill_triggering_number_of_answers = $skill_triggering_number_of_answers;
122 return $clone;
123 }

◆ withUserIdentifier()

ILIAS\Test\Settings\GlobalSettings\GlobalTestSettings::withUserIdentifier ( UserIdentifiers  $user_identifier)

Definition at line 106 of file GlobalTestSettings.php.

106 : self
107 {
108 $clone = clone $this;
109 $clone->user_identifier = $user_identifier;
110 return $clone;
111 }

The documentation for this class was generated from the following file: