19declare(strict_types=1);
34 protected bool $use_previous_answers_allowed =
false,
35 protected bool $suspend_test_allowed =
false,
36 protected bool $postponed_questions_move_to_end =
false,
37 protected int $usrpass_overview_mode = 0,
38 protected bool $question_marking_enabled =
false,
39 protected bool $question_list_enabled =
false
48 ?array $environment =
null
50 $inputs[
'use_previous_answers'] =
$f->checkbox(
51 $lng->txt(
'tst_use_previous_answers'),
52 $lng->txt(
'tst_use_previous_answers_description')
55 $inputs[
'allow_suspend_test'] =
$f->checkbox(
56 $lng->txt(
'tst_show_cancel'),
57 $lng->txt(
'tst_show_cancel_description')
60 $inputs[
'postponed_questions_behaviour'] = $f->radio(
61 $lng->txt(
'tst_postpone')
64 $lng->txt(
'tst_postpone_off'),
65 $lng->txt(
'tst_postpone_off_desc')
68 $lng->txt(
'tst_postpone_on'),
69 $lng->txt(
'tst_postpone_on_desc')
71 ->withAdditionalTransformation($refinery->kindlyTo()->bool());
73 $inputs[
'enable_question_list'] =
$f->checkbox(
74 $lng->txt(
'tst_enable_questionlist'),
75 $lng->txt(
'tst_enable_questionlist_description')
80 $inputs[
'enable_question_marking'] =
$f->checkbox(
81 $lng->txt(
'question_marking'),
82 $lng->txt(
'question_marking_description')
85 return $f->section(
$inputs,
$lng->txt(
'tst_sequence_properties'));
94 static function (?array $vs):
int {
99 $usrpass_overview_mode = 1;
101 if ($vs[
'show_at_beginning'] ===
true) {
102 $usrpass_overview_mode += 2;
105 if ($vs[
'show_at_end'] ===
true) {
106 $usrpass_overview_mode += 4;
109 if ($vs[
'show_description'] ===
true) {
110 $usrpass_overview_mode += 8;
113 return $usrpass_overview_mode;
117 $sub_inputs_usrpass_questionlist[
'show_at_beginning'] =
$f->checkbox(
$lng->txt(
'tst_list_of_questions_start'));
118 $sub_inputs_usrpass_questionlist[
'show_at_end'] =
$f->checkbox(
$lng->txt(
'tst_list_of_questions_end'));
119 $sub_inputs_usrpass_questionlist[
'show_description'] =
$f->checkbox(
$lng->txt(
'tst_list_of_questions_with_description'));
121 $enable_usrpass_questionlist =
$f->optionalGroup(
122 $sub_inputs_usrpass_questionlist,
123 $lng->txt(
'tst_show_summary'),
124 $lng->txt(
'tst_show_summary_description')
126 ->withAdditionalTransformation($trafo);
128 if ($this->getUsrPassOverviewEnabled() ===
false) {
129 return $enable_usrpass_questionlist;
132 return $enable_usrpass_questionlist->withValue(
134 'show_at_beginning' => $this->getShownQuestionListAtBeginning(),
135 'show_at_end' => $this->getShownQuestionListAtEnd(),
136 'show_description' => $this->getShowDescriptionInQuestionList()
144 'use_previous_answers' => [
'integer', (
int) $this->getUsePreviousAnswerAllowed()],
145 'suspend_test_allowed' => [
'integer', (
int) $this->getSuspendTestAllowed()],
146 'sequence_settings' => [
'integer', (
int) $this->getPostponedQuestionsMoveToEnd()],
147 'usr_pass_overview_mode' => [
'integer', $this->getUsrPassOverviewMode()],
148 'show_marker' => [
'integer', (
int) $this->getQuestionMarkingEnabled()],
149 'show_questionlist' => [
'integer', $this->getQuestionListEnabled()]
156 AdditionalInformationGenerator::KEY_TEST_USE_PREVIOUS_ANSWERS_ENABELD => $additional_info
158 AdditionalInformationGenerator::KEY_TEST_SUSPEND_ALLOWED => $additional_info
160 AdditionalInformationGenerator::KEY_TEST_POSTPONED_MOVE_TO_END => $additional_info
164 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_ENABLED] = $additional_info
166 if ($this->getUsrPassOverviewEnabled()) {
167 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_SHOW_START] = $additional_info
169 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_SHOW_END] = $additional_info
171 $log_array[AdditionalInformationGenerator::KEY_TEST_OVERVIEW_SHOW_DESCRIPTION] = $additional_info
175 $log_array[AdditionalInformationGenerator::KEY_TEST_QUESTION_MARKING_ENABLED] = $additional_info
177 $log_array[AdditionalInformationGenerator::KEY_TEST_QUESTION_LIST_ENABLED] = $additional_info
184 return $this->use_previous_answers_allowed;
188 $clone = clone $this;
189 $clone->use_previous_answers_allowed = $use_previous_answers_allowed;
195 return $this->suspend_test_allowed;
199 $clone = clone $this;
200 $clone->suspend_test_allowed = $suspend_test_allowed;
206 return $this->postponed_questions_move_to_end;
210 $clone = clone $this;
211 $clone->postponed_questions_move_to_end = $postponed_questions_move_to_end;
217 return $this->question_list_enabled;
221 $clone = clone $this;
222 $clone->question_list_enabled = $question_list_enabled;
228 return $this->usrpass_overview_mode;
233 $clone = clone $this;
234 $clone->usrpass_overview_mode = $usrpass_overview_mode;
240 return ($this->usrpass_overview_mode & 1) > 0;
244 return ($this->usrpass_overview_mode & 2) > 0;
248 return ($this->usrpass_overview_mode & 4) > 0;
253 return ($this->usrpass_overview_mode & 8) > 0;
258 return $this->question_marking_enabled;
263 $clone = clone $this;
264 $clone->question_marking_enabled = $question_marking_enabled;
271 'use_previous_answers' => $this->getUsePreviousAnswerAllowed(),
272 'suspend_test_allowed' => $this->getSuspendTestAllowed(),
273 'postponed_questions_move_to_end' => $this->getPostponedQuestionsMoveToEnd(),
274 'usr_pass_overview_mode' => $this->getUsrPassOverviewMode(),
275 'question_marking_enabled' => $this->getQuestionMarkingEnabled(),
276 'show_questionlist' => $this->getQuestionListEnabled()
283 (bool)
$data[
'use_previous_answers'],
284 (
bool)
$data[
'suspend_test_allowed'],
285 (bool)
$data[
'postponed_questions_move_to_end'],
286 (
int)
$data[
'usr_pass_overview_mode'],
287 (bool)
$data[
'question_marking_enabled'],
288 (
bool)
$data[
'show_questionlist']
getUsePreviousAnswerAllowed()
withQuestionListEnabled(bool $question_list_enabled)
getUsrPassOverviewEnabled()
withUsePreviousAnswerAllowed(bool $use_previous_answers_allowed)
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
__construct(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)
getShowDescriptionInQuestionList()
static fromExport(array $data)
Creates an instance of the object from an array.
getQuestionMarkingEnabled()
getInputUsrPassOverview(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
toExport()
Transform the object into a simple, associative array.
getShownQuestionListAtBeginning()
withPostponedQuestionsMoveToEnd(bool $postponed_questions_move_to_end)
withSuspendTestAllowed(bool $suspend_test_allowed)
withQuestionMarkingEnabled(bool $question_marking_enabled)
getShownQuestionListAtEnd()
withUsrPassOverviewMode(int $usrpass_overview_mode)
getPostponedQuestionsMoveToEnd()
toLog(AdditionalInformationGenerator $additional_info)
This interface allows an object to define its own transformation into a language-neutral,...
__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'))