ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilObjTestSettingsParticipantFunctionality Class Reference
+ Inheritance diagram for ilObjTestSettingsParticipantFunctionality:
+ Collaboration diagram for ilObjTestSettingsParticipantFunctionality:

Public Member Functions

 __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)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 
 getUsePreviousAnswerAllowed ()
 
 withUsePreviousAnswerAllowed (bool $use_previous_answers_allowed)
 
 getSuspendTestAllowed ()
 
 withSuspendTestAllowed (bool $suspend_test_allowed)
 
 getPostponedQuestionsMoveToEnd ()
 
 withPostponedQuestionsMoveToEnd (bool $postponed_questions_move_to_end)
 
 getQuestionListEnabled ()
 
 withQuestionListEnabled (bool $question_list_enabled)
 
 getUsrPassOverviewMode ()
 
 getUsrPassOverviewEnabled ()
 
 getShownQuestionListAtBeginning ()
 
 getShownQuestionListAtEnd ()
 
 getShowDescriptionInQuestionList ()
 
 withUsrPassOverviewMode (int $usrpass_overview_mode)
 
 getQuestionMarkingEnabled ()
 
 withQuestionMarkingEnabled (bool $question_marking_enabled)
 
- Public Member Functions inherited from TestSettings
 __construct (int $test_id)
 
 getTestId ()
 
 withTestId (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 

Private Member Functions

 getInputUsrPassOverview (\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
 

Additional Inherited Members

- Protected Attributes inherited from TestSettings
int $test_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjTestSettingsParticipantFunctionality::__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 
)

Definition at line 28 of file ilObjTestSettingsParticipantFunctionality.php.

References ILIAS\MetaData\Repository\Validation\Data\__construct().

36  {
38  }
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ getInputUsrPassOverview()

ilObjTestSettingsParticipantFunctionality::getInputUsrPassOverview ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery 
)
private

Definition at line 92 of file ilObjTestSettingsParticipantFunctionality.php.

References getShowDescriptionInQuestionList(), getShownQuestionListAtBeginning(), getShownQuestionListAtEnd(), getUsrPassOverviewEnabled(), ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by toForm().

96  : OptionalGroup {
97  $trafo = $refinery->custom()->transformation(
98  static function (?array $vs): int {
99  if ($vs === null) {
100  return 0;
101  }
102 
103  $usrpass_overview_mode = 1;
104 
105  if ($vs['show_at_beginning'] === true) {
106  $usrpass_overview_mode += 2;
107  }
108 
109  if ($vs['show_at_end'] === true) {
110  $usrpass_overview_mode += 4;
111  }
112 
113  if ($vs['show_description'] === true) {
114  $usrpass_overview_mode += 8;
115  }
116 
117  return $usrpass_overview_mode;
118  }
119  );
120 
121  $sub_inputs_usrpass_questionlist['show_at_beginning'] = $f->checkbox(
122  $lng->txt('tst_list_of_questions_start')
123  );
124  $sub_inputs_usrpass_questionlist['show_at_end'] = $f->checkbox(
125  $lng->txt('tst_list_of_questions_end')
126  );
127  $sub_inputs_usrpass_questionlist['show_description'] = $f->checkbox(
128  $lng->txt('tst_list_of_questions_with_description')
129  );
130 
131  $enable_usrpass_questionlist = $f->optionalGroup(
132  $sub_inputs_usrpass_questionlist,
133  $lng->txt('tst_show_summary'),
134  $lng->txt('tst_show_summary_description')
135  )->withValue(null)
136  ->withAdditionalTransformation($trafo);
137 
138  if ($this->getUsrPassOverviewEnabled() === false) {
139  return $enable_usrpass_questionlist;
140  }
141 
142  return $enable_usrpass_questionlist->withValue(
143  [
144  'show_at_beginning' => $this->getShownQuestionListAtBeginning(),
145  'show_at_end' => $this->getShownQuestionListAtEnd(),
146  'show_description' => $this->getShowDescriptionInQuestionList()
147  ]
148  );
149  }
This describes optional group inputs.
$lng
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:58
Refinery Factory $refinery
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPostponedQuestionsMoveToEnd()

ilObjTestSettingsParticipantFunctionality::getPostponedQuestionsMoveToEnd ( )

Definition at line 185 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by toForm(), and toStorage().

185  : bool
186  {
187  return $this->postponed_questions_move_to_end;
188  }
+ Here is the caller graph for this function:

◆ getQuestionListEnabled()

ilObjTestSettingsParticipantFunctionality::getQuestionListEnabled ( )

Definition at line 196 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by toForm(), and toStorage().

196  : bool
197  {
198  return $this->question_list_enabled;
199  }
+ Here is the caller graph for this function:

◆ getQuestionMarkingEnabled()

ilObjTestSettingsParticipantFunctionality::getQuestionMarkingEnabled ( )

Definition at line 250 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by toForm(), and toStorage().

250  : bool
251  {
252  return $this->question_marking_enabled;
253  }
+ Here is the caller graph for this function:

◆ getShowDescriptionInQuestionList()

ilObjTestSettingsParticipantFunctionality::getShowDescriptionInQuestionList ( )

Definition at line 235 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by getInputUsrPassOverview().

235  : bool
236  {
237  if (($this->usrpass_overview_mode & 8) > 0) {
238  return true;
239  }
240 
241  return false;
242  }
+ Here is the caller graph for this function:

◆ getShownQuestionListAtBeginning()

ilObjTestSettingsParticipantFunctionality::getShownQuestionListAtBeginning ( )

Definition at line 219 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by getInputUsrPassOverview().

219  : bool
220  {
221  if (($this->usrpass_overview_mode & 2) > 0) {
222  return true;
223  }
224 
225  return false;
226  }
+ Here is the caller graph for this function:

◆ getShownQuestionListAtEnd()

ilObjTestSettingsParticipantFunctionality::getShownQuestionListAtEnd ( )

Definition at line 227 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by getInputUsrPassOverview().

227  : bool
228  {
229  if (($this->usrpass_overview_mode & 4) > 0) {
230  return true;
231  }
232 
233  return false;
234  }
+ Here is the caller graph for this function:

◆ getSuspendTestAllowed()

ilObjTestSettingsParticipantFunctionality::getSuspendTestAllowed ( )

Definition at line 174 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by toForm(), and toStorage().

174  : bool
175  {
176  return $this->suspend_test_allowed;
177  }
+ Here is the caller graph for this function:

◆ getUsePreviousAnswerAllowed()

ilObjTestSettingsParticipantFunctionality::getUsePreviousAnswerAllowed ( )

Definition at line 163 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by toForm(), and toStorage().

163  : bool
164  {
165  return $this->use_previous_answers_allowed;
166  }
+ Here is the caller graph for this function:

◆ getUsrPassOverviewEnabled()

ilObjTestSettingsParticipantFunctionality::getUsrPassOverviewEnabled ( )

Definition at line 211 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by getInputUsrPassOverview().

211  : bool
212  {
213  if (($this->usrpass_overview_mode & 1) > 0) {
214  return true;
215  }
216 
217  return false;
218  }
+ Here is the caller graph for this function:

◆ getUsrPassOverviewMode()

ilObjTestSettingsParticipantFunctionality::getUsrPassOverviewMode ( )

Definition at line 207 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by toStorage().

207  : int
208  {
209  return $this->usrpass_overview_mode;
210  }
+ Here is the caller graph for this function:

◆ toForm()

ilObjTestSettingsParticipantFunctionality::toForm ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery,
array  $environment = null 
)
Returns
array<ILIAS>

Definition at line 44 of file ilObjTestSettingsParticipantFunctionality.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, getInputUsrPassOverview(), getPostponedQuestionsMoveToEnd(), getQuestionListEnabled(), getQuestionMarkingEnabled(), getSuspendTestAllowed(), getUsePreviousAnswerAllowed(), ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

49  : FormInput {
50  $inputs['use_previous_answers'] = $f->checkbox(
51  $lng->txt('tst_use_previous_answers'),
52  $lng->txt('tst_use_previous_answers_description')
54 
55  $inputs['allow_suspend_test'] = $f->checkbox(
56  $lng->txt('tst_show_cancel'),
57  $lng->txt('tst_show_cancel_description')
58  )->withValue($this->getSuspendTestAllowed());
59 
60  $inputs['postponed_questions_behaviour'] = $f->radio(
61  $lng->txt('tst_postpone')
62  )->withOption(
63  '0',
64  $lng->txt('tst_postpone_off'),
65  $lng->txt('tst_postpone_off_desc'),
66  )->withOption(
67  '1',
68  $lng->txt('tst_postpone_on'),
69  $lng->txt('tst_postpone_on_desc'),
70  )->withValue($this->getPostponedQuestionsMoveToEnd() ? '1' : '0')
71  ->withAdditionalTransformation($refinery->kindlyTo()->bool());
72 
73  $inputs['enable_question_list'] = $f->checkbox(
74  $lng->txt('tst_enable_questionlist'),
75  $lng->txt('tst_enable_questionlist_description')
76  )->withValue($this->getQuestionListEnabled());
77 
78  $inputs['usr_pass_overview'] = $this->getInputUsrPassOverview(
79  $lng,
80  $f,
81  $refinery
82  );
83 
84  $inputs['enable_question_marking'] = $f->checkbox(
85  $lng->txt('question_marking'),
86  $lng->txt('question_marking_description')
88 
89  return $f->section($inputs, $lng->txt('tst_sequence_properties'));
90  }
$lng
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:58
This describes inputs that can be used in forms.
Definition: FormInput.php:31
Refinery Factory $refinery
getInputUsrPassOverview(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
+ Here is the call graph for this function:

◆ toStorage()

ilObjTestSettingsParticipantFunctionality::toStorage ( )

Definition at line 151 of file ilObjTestSettingsParticipantFunctionality.php.

References getPostponedQuestionsMoveToEnd(), getQuestionListEnabled(), getQuestionMarkingEnabled(), getSuspendTestAllowed(), getUsePreviousAnswerAllowed(), getUsrPassOverviewMode(), and ILIAS\Repository\int().

151  : array
152  {
153  return [
154  'use_previous_answers' => ['integer', (int) $this->getUsePreviousAnswerAllowed()],
155  'suspend_test_allowed' => ['integer', (int) $this->getSuspendTestAllowed()],
156  'sequence_settings' => ['integer', (int) $this->getPostponedQuestionsMoveToEnd()],
157  'usr_pass_overview_mode' => ['integer', $this->getUsrPassOverviewMode()],
158  'show_marker' => ['integer', (int) $this->getQuestionMarkingEnabled()],
159  'show_questionlist' => ['integer', $this->getQuestionListEnabled()]
160  ];
161  }
+ Here is the call graph for this function:

◆ withPostponedQuestionsMoveToEnd()

ilObjTestSettingsParticipantFunctionality::withPostponedQuestionsMoveToEnd ( bool  $postponed_questions_move_to_end)

Definition at line 189 of file ilObjTestSettingsParticipantFunctionality.php.

189  : self
190  {
191  $clone = clone $this;
192  $clone->postponed_questions_move_to_end = $postponed_questions_move_to_end;
193  return $clone;
194  }

◆ withQuestionListEnabled()

ilObjTestSettingsParticipantFunctionality::withQuestionListEnabled ( bool  $question_list_enabled)

Definition at line 200 of file ilObjTestSettingsParticipantFunctionality.php.

200  : self
201  {
202  $clone = clone $this;
203  $clone->question_list_enabled = $question_list_enabled;
204  return $clone;
205  }

◆ withQuestionMarkingEnabled()

ilObjTestSettingsParticipantFunctionality::withQuestionMarkingEnabled ( bool  $question_marking_enabled)

Definition at line 254 of file ilObjTestSettingsParticipantFunctionality.php.

254  : self
255  {
256  $clone = clone $this;
257  $clone->question_marking_enabled = $question_marking_enabled;
258  return $clone;
259  }

◆ withSuspendTestAllowed()

ilObjTestSettingsParticipantFunctionality::withSuspendTestAllowed ( bool  $suspend_test_allowed)

Definition at line 178 of file ilObjTestSettingsParticipantFunctionality.php.

178  : self
179  {
180  $clone = clone $this;
181  $clone->suspend_test_allowed = $suspend_test_allowed;
182  return $clone;
183  }

◆ withUsePreviousAnswerAllowed()

ilObjTestSettingsParticipantFunctionality::withUsePreviousAnswerAllowed ( bool  $use_previous_answers_allowed)

Definition at line 167 of file ilObjTestSettingsParticipantFunctionality.php.

Referenced by ilObjTestSettingsMainGUI\getParticipantsFunctionalitySettingsForStorage().

167  : self
168  {
169  $clone = clone $this;
170  $clone->use_previous_answers_allowed = $use_previous_answers_allowed;
171  return $clone;
172  }
+ Here is the caller graph for this function:

◆ withUsrPassOverviewMode()

ilObjTestSettingsParticipantFunctionality::withUsrPassOverviewMode ( int  $usrpass_overview_mode)

Definition at line 243 of file ilObjTestSettingsParticipantFunctionality.php.

243  : self
244  {
245  $clone = clone $this;
246  $clone->usrpass_overview_mode = $usrpass_overview_mode;
247  return $clone;
248  }

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