19declare(strict_types=1);
32 private ProcessLockModes $process_lock_mode = ProcessLockModes::ASS_PROC_LOCK_MODE_NONE,
33 private string $image_map_line_color =
'FF0000',
35 private int $skill_triggering_number_of_answers = 1,
36 private array $disabled_question_types = [],
37 private bool $manual_scoring_enabled =
false,
38 private bool $adjusting_questions_with_results_allowed =
false,
39 private bool $page_editor_enabled =
false
48 UIFactory $ui_factory,
52 $ff = $ui_factory->input()->field();
54 $enabled_question_types = array_map(
55 static fn(array $v):
int => $v[
'question_type_id'],
58 fn(array $v):
bool => !in_array($v[
'question_type_id'], $this->disabled_question_types)
64 'global_settings' => $ff->group([
70 $enabled_question_types
72 ])->withAdditionalTransformation($trafo)
78 return $this->process_lock_mode;
84 $clone->process_lock_mode = $process_lock_mode;
90 return $this->image_map_line_color;
96 $clone->image_map_line_color = $image_map_line_color;
102 return $this->user_identifier;
107 $clone = clone $this;
108 $clone->user_identifier = $user_identifier;
114 return $this->skill_triggering_number_of_answers;
119 $clone = clone $this;
120 $clone->skill_triggering_number_of_answers = $skill_triggering_number_of_answers;
129 return $this->disabled_question_types;
137 $clone = clone $this;
138 $clone->disabled_question_types = $disabled_question_types;
144 return $this->manual_scoring_enabled;
149 $clone = clone $this;
150 $clone->manual_scoring_enabled = $manual_scoring_enabled;
156 return $this->adjusting_questions_with_results_allowed;
161 $clone = clone $this;
162 $clone->adjusting_questions_with_results_allowed = $adjusting_questions_with_results_allowed;
168 return $this->page_editor_enabled;
173 $clone = clone $this;
174 $clone->page_editor_enabled = $page_editor_enabled;
180 array $all_question_types
183 static function ($vs) use ($all_question_types): self {
185 if ($vs[
'general_settings'][
'process_lock_mode'] !==
null) {
190 substr($vs[
'general_settings'][
'image_map_line_color']->asHex(), 1),
192 $vs[
'general_settings'][
'skill_triggering_number_of_answers'],
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'];
203 $vs[
'question_settings'][
'manual_scoring_enabled'],
204 $vs[
'question_settings'][
'adjusting_questions_with_results_allowed']
217 'process_lock_mode' => $ff->optionalGroup(
219 $ff->radio(
$lng->txt(
'ass_process_lock_mode'))
222 $lng->txt(
'ass_process_lock_mode_file'),
223 $lng->txt(
'ass_process_lock_mode_file_desc')
226 $lng->txt(
'ass_process_lock_mode_db'),
227 $lng->txt(
'ass_process_lock_mode_db_desc')
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'),
240 $c[$v->value] = $v->value;
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'))
250 ->withByline(
$lng->txt(
'tst_skill_triggerings_num_req_answers_desc'))
251 ->
withValue($this->skill_triggering_number_of_answers)
253 $lng->txt(
'settings')
260 array $all_question_types,
261 array $enabled_question_types
265 'enabled_question_types' => $ff->multiSelect(
266 $lng->txt(
'assf_allowed_questiontypes'),
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;
275 )->withByline(
$lng->txt(
'assf_allowed_questiontypes_desc'))
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())
284 $lng->txt(
'assf_questiontypes')
Builds a Color from either hex- or rgb values.
getSkillTriggeringNumberOfAnswers()
buildQuestionSettingsInputs(FieldFactory $ff, \ilLanguage $lng, array $all_question_types, array $enabled_question_types)
withPageEditorEnabled(bool $page_editor_enabled)
withDisabledQuestionTypes(array $disabled_question_types)
withProcessLockMode(ProcessLockModes $process_lock_mode)
getDisabledQuestionTypes()
withManualScoringEnabled(bool $manual_scoring_enabled)
toForm(UIFactory $ui_factory, Refinery $refinery, \ilLanguage $lng)
buildGlobalSettingsBuilderTrafo(Refinery $refinery, array $all_question_types)
withAdjustingQuestionsWithResultsAllowed(bool $adjusting_questions_with_results_allowed)
withSkillTriggeringNumberOfAnswers(int $skill_triggering_number_of_answers)
withImageMapLineColor(string $image_map_line_color)
__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)
isAdjustingQuestionsWithResultsAllowed()
buildGeneralSettingsInputs(FieldFactory $ff, Refinery $refinery, \ilLanguage $lng)
withUserIdentifier(UserIdentifiers $user_identifier)
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...