ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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 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)
 
 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 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.

40 {
41 }

Member Function Documentation

◆ buildGeneralSettingsInputs()

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

Definition at line 210 of file GlobalTestSettings.php.

214 : Section {
215 return $ff->section(
216 [
217 'process_lock_mode' => $ff->optionalGroup(
218 [
219 $ff->radio($lng->txt('ass_process_lock_mode'))
220 ->withOption(
221 ProcessLockModes::ASS_PROC_LOCK_MODE_FILE->value,
222 $lng->txt('ass_process_lock_mode_file'),
223 $lng->txt('ass_process_lock_mode_file_desc')
224 )->withOption(
226 $lng->txt('ass_process_lock_mode_db'),
227 $lng->txt('ass_process_lock_mode_db_desc')
228 )
229 ],
230 $lng->txt('ass_process_lock')
231 )->withByline($lng->txt('ass_process_lock_desc'))
232 ->withValue($this->process_lock_mode === ProcessLockModes::ASS_PROC_LOCK_MODE_NONE ? null : [$this->process_lock_mode->value]),
233 'image_map_line_color' => $ff->colorSelect($lng->txt('imap_line_color'))
234 ->withValue('#' . $this->image_map_line_color),
235 'user_identifier' => $ff->select(
236 $lng->txt('user_criteria'),
237 array_reduce(
238 UserIdentifiers::cases(),
239 function (array $c, UserIdentifiers $v): array {
240 $c[$v->value] = $v->value;
241 return $c;
242 },
243 []
244 )
245 )->withRequired(true)
246 ->withByline($lng->txt('user_criteria_desc'))
247 ->withValue($this->user_identifier->value),
248 'skill_triggering_number_of_answers' => $ff->numeric($lng->txt('tst_skill_triggerings_num_req_answers'))
249 ->withAdditionalTransformation($refinery->int()->isGreaterThan(0))
250 ->withByline($lng->txt('tst_skill_triggerings_num_req_answers_desc'))
251 ->withValue($this->skill_triggering_number_of_answers)
252 ],
253 $lng->txt('settings')
254 );
255 }
$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 178 of file GlobalTestSettings.php.

181 : Transformation {
182 return $refinery->custom()->transformation(
183 static function ($vs) use ($all_question_types): self {
184 $process_lock_mode = ProcessLockModes::ASS_PROC_LOCK_MODE_NONE;
185 if ($vs['general_settings']['process_lock_mode'] !== null) {
186 $process_lock_mode = ProcessLockModes::from($vs['general_settings']['process_lock_mode'][0]);
187 }
188 return new self(
189 $process_lock_mode,
190 substr($vs['general_settings']['image_map_line_color']->asHex(), 1),
191 UserIdentifiers::from($vs['general_settings']['user_identifier']),
192 $vs['general_settings']['skill_triggering_number_of_answers'],
193 array_reduce(
194 $all_question_types,
195 static function (array $c, array $v) use ($vs): array {
196 if (!in_array($v['question_type_id'], $vs['question_settings']['enabled_question_types'])) {
197 $c[] = $v['question_type_id'];
198 }
199 return $c;
200 },
201 []
202 ),
203 $vs['question_settings']['manual_scoring_enabled'],
204 $vs['question_settings']['adjusting_questions_with_results_allowed']
205 );
206 }
207 );
208 }

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 257 of file GlobalTestSettings.php.

262 : Section {
263 return $ff->section(
264 [
265 'enabled_question_types' => $ff->multiSelect(
266 $lng->txt('assf_allowed_questiontypes'),
267 array_reduce(
268 array_keys($all_question_types),
269 function (array $c, string $v) use ($all_question_types): array {
270 $c[$all_question_types[$v]['question_type_id']] = $v;
271 return $c;
272 },
273 []
274 )
275 )->withByline($lng->txt('assf_allowed_questiontypes_desc'))
276 ->withValue($enabled_question_types),
277 'manual_scoring_enabled' => $ff->checkbox($lng->txt('activate_manual_scoring'))
278 ->withByline($lng->txt('activate_manual_scoring_desc'))
279 ->withValue($this->isManualScoringEnabled()),
280 'adjusting_questions_with_results_allowed' => $ff->checkbox($lng->txt('assessment_scoring_adjust'))
281 ->withByline($lng->txt('assessment_scoring_adjust_desc'))
282 ->withValue($this->isAdjustingQuestionsWithResultsAllowed())
283 ],
284 $lng->txt('assf_questiontypes')
285 );
286 }

◆ getDisabledQuestionTypes()

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

Definition at line 127 of file GlobalTestSettings.php.

127 : array
128 {
129 return $this->disabled_question_types;
130 }

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 88 of file GlobalTestSettings.php.

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

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 76 of file GlobalTestSettings.php.

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

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 112 of file GlobalTestSettings.php.

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

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 100 of file GlobalTestSettings.php.

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

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 154 of file GlobalTestSettings.php.

154 : bool
155 {
156 return $this->adjusting_questions_with_results_allowed;
157 }

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 142 of file GlobalTestSettings.php.

142 : bool
143 {
144 return $this->manual_scoring_enabled;
145 }

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 166 of file GlobalTestSettings.php.

166 : bool
167 {
168 return $this->page_editor_enabled;
169 }

◆ toForm()

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

Definition at line 47 of file GlobalTestSettings.php.

51 : array {
52 $ff = $ui_factory->input()->field();
53 $all_question_types = \ilObjQuestionPool::_getQuestionTypes(true);
54 $enabled_question_types = array_map(
55 static fn(array $v): int => $v['question_type_id'],
56 array_filter(
57 $all_question_types,
58 fn(array $v): bool => !in_array($v['question_type_id'], $this->disabled_question_types)
59 )
60 );
61 $trafo = $this->buildGlobalSettingsBuilderTrafo($refinery, $all_question_types);
62
63 return [
64 'global_settings' => $ff->group([
65 'general_settings' => $this->buildGeneralSettingsInputs($ff, $refinery, $lng),
66 'question_settings' => $this->buildQuestionSettingsInputs(
67 $ff,
68 $lng,
69 $all_question_types,
70 $enabled_question_types
71 )
72 ])->withAdditionalTransformation($trafo)
73 ];
74 }
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 159 of file GlobalTestSettings.php.

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

◆ withDisabledQuestionTypes()

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

Definition at line 135 of file GlobalTestSettings.php.

135 : self
136 {
137 $clone = clone $this;
138 $clone->disabled_question_types = $disabled_question_types;
139 return $clone;
140 }

◆ withImageMapLineColor()

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

Definition at line 93 of file GlobalTestSettings.php.

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

◆ withManualScoringEnabled()

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

Definition at line 147 of file GlobalTestSettings.php.

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

◆ withPageEditorEnabled()

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

Definition at line 171 of file GlobalTestSettings.php.

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

◆ withProcessLockMode()

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

Definition at line 81 of file GlobalTestSettings.php.

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

◆ withSkillTriggeringNumberOfAnswers()

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

Definition at line 117 of file GlobalTestSettings.php.

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

◆ withUserIdentifier()

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

Definition at line 105 of file GlobalTestSettings.php.

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

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