19declare(strict_types=1);
35 protected bool $use_previous_answers_allowed =
false,
36 protected bool $suspend_test_allowed =
false,
37 protected bool $postponed_questions_move_to_end =
false,
38 protected int $usrpass_overview_mode = 0,
39 protected bool $question_marking_enabled =
false,
40 protected bool $question_list_enabled =
false
49 ?array $environment =
null
51 $inputs[
'use_previous_answers'] =
$f->checkbox(
52 $lng->txt(
'tst_use_previous_answers'),
53 $lng->txt(
'tst_use_previous_answers_description')
56 $inputs[
'allow_suspend_test'] =
$f->checkbox(
57 $lng->txt(
'tst_show_cancel'),
58 $lng->txt(
'tst_show_cancel_description')
61 $inputs[
'postponed_questions_behaviour'] = $f->radio(
62 $lng->txt(
'tst_postpone')
65 $lng->txt(
'tst_postpone_off'),
66 $lng->txt(
'tst_postpone_off_desc')
69 $lng->txt(
'tst_postpone_on'),
70 $lng->txt(
'tst_postpone_on_desc')
72 ->withAdditionalTransformation($refinery->kindlyTo()->bool());
74 $inputs[
'enable_question_list'] =
$f->checkbox(
75 $lng->txt(
'tst_enable_questionlist'),
76 $lng->txt(
'tst_enable_questionlist_description')
81 $inputs[
'enable_question_marking'] =
$f->checkbox(
82 $lng->txt(
'question_marking'),
83 $lng->txt(
'question_marking_description')
86 return $f->section(
$inputs,
$lng->txt(
'tst_sequence_properties'));
95 static function (?array $vs):
int {
100 $usrpass_overview_mode = 1;
102 if ($vs[
'show_at_beginning'] ===
true) {
103 $usrpass_overview_mode += 2;
106 if ($vs[
'show_at_end'] ===
true) {
107 $usrpass_overview_mode += 4;
110 if ($vs[
'show_description'] ===
true) {
111 $usrpass_overview_mode += 8;
114 return $usrpass_overview_mode;
118 $sub_inputs_usrpass_questionlist[
'show_at_beginning'] =
$f->checkbox(
$lng->txt(
'tst_list_of_questions_start'));
119 $sub_inputs_usrpass_questionlist[
'show_at_end'] =
$f->checkbox(
$lng->txt(
'tst_list_of_questions_end'));
120 $sub_inputs_usrpass_questionlist[
'show_description'] =
$f->checkbox(
$lng->txt(
'tst_list_of_questions_with_description'));
122 $enable_usrpass_questionlist =
$f->optionalGroup(
123 $sub_inputs_usrpass_questionlist,
124 $lng->txt(
'tst_show_summary'),
125 $lng->txt(
'tst_show_summary_description')
127 ->withAdditionalTransformation($trafo);
129 if ($this->getUsrPassOverviewEnabled() ===
false) {
130 return $enable_usrpass_questionlist;
133 return $enable_usrpass_questionlist->withValue(
135 'show_at_beginning' => $this->getShownQuestionListAtBeginning(),
136 'show_at_end' => $this->getShownQuestionListAtEnd(),
137 'show_description' => $this->getShowDescriptionInQuestionList()
145 'use_previous_answers' => [
'integer', (
int) $this->getUsePreviousAnswerAllowed()],
146 'suspend_test_allowed' => [
'integer', (
int) $this->getSuspendTestAllowed()],
147 'sequence_settings' => [
'integer', (
int) $this->getPostponedQuestionsMoveToEnd()],
148 'usr_pass_overview_mode' => [
'integer', $this->getUsrPassOverviewMode()],
149 'show_marker' => [
'integer', (
int) $this->getQuestionMarkingEnabled()],
150 'show_questionlist' => [
'integer', $this->getQuestionListEnabled()]
157 AdditionalInformationGenerator::KEY_TEST_USE_PREVIOUS_ANSWERS_ENABELD => $additional_info
159 AdditionalInformationGenerator::KEY_TEST_SUSPEND_ALLOWED => $additional_info
161 AdditionalInformationGenerator::KEY_TEST_POSTPONED_MOVE_TO_END => $additional_info
165 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_ENABLED] = $additional_info
167 if ($this->getUsrPassOverviewEnabled()) {
168 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_SHOW_START] = $additional_info
170 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_SHOW_END] = $additional_info
172 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_SHOW_DESCRIPTION] = $additional_info
176 $log_array[AdditionalInformationGenerator::KEY_TEST_QUESTION_MARKING_ENABLED] = $additional_info
178 $log_array[AdditionalInformationGenerator::KEY_TEST_QUESTION_LIST_ENABLED] = $additional_info
185 return $this->use_previous_answers_allowed;
189 $clone = clone $this;
190 $clone->use_previous_answers_allowed = $use_previous_answers_allowed;
196 return $this->suspend_test_allowed;
200 $clone = clone $this;
201 $clone->suspend_test_allowed = $suspend_test_allowed;
207 return $this->postponed_questions_move_to_end;
211 $clone = clone $this;
212 $clone->postponed_questions_move_to_end = $postponed_questions_move_to_end;
218 return $this->question_list_enabled;
222 $clone = clone $this;
223 $clone->question_list_enabled = $question_list_enabled;
229 return $this->usrpass_overview_mode;
234 $clone = clone $this;
235 $clone->usrpass_overview_mode = $usrpass_overview_mode;
241 return ($this->usrpass_overview_mode & 1) > 0;
245 return ($this->usrpass_overview_mode & 2) > 0;
249 return ($this->usrpass_overview_mode & 4) > 0;
254 return ($this->usrpass_overview_mode & 8) > 0;
259 return $this->question_marking_enabled;
264 $clone = clone $this;
265 $clone->question_marking_enabled = $question_marking_enabled;
getUsePreviousAnswerAllowed()
withQuestionListEnabled(bool $question_list_enabled)
getUsrPassOverviewEnabled()
withUsePreviousAnswerAllowed(bool $use_previous_answers_allowed)
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
getShowDescriptionInQuestionList()
getQuestionMarkingEnabled()
getInputUsrPassOverview(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
getShownQuestionListAtBeginning()
withPostponedQuestionsMoveToEnd(bool $postponed_questions_move_to_end)
withSuspendTestAllowed(bool $suspend_test_allowed)
__construct(int $test_id, protected bool $use_previous_answers_allowed=false, protected bool $suspend_test_allowed=false, protected bool $postponed_questions_move_to_end=false, protected int $usrpass_overview_mode=0, protected bool $question_marking_enabled=false, protected bool $question_list_enabled=false)
withQuestionMarkingEnabled(bool $question_marking_enabled)
getShownQuestionListAtEnd()
withUsrPassOverviewMode(int $usrpass_overview_mode)
getPostponedQuestionsMoveToEnd()
toLog(AdditionalInformationGenerator $additional_info)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))