ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Settings\MainSettings\SettingsFinishing Class Reference
+ Inheritance diagram for ILIAS\Test\Settings\MainSettings\SettingsFinishing:
+ Collaboration diagram for ILIAS\Test\Settings\MainSettings\SettingsFinishing:

Public Member Functions

 __construct (int $test_id, protected bool $show_answer_overview=false, protected bool $concluding_remarks_enabled=false, protected ?string $concluding_remarks_text='', protected ?int $concluding_remarks_page_id=null, protected RedirectionModes $redirection_mode=RedirectionModes::NONE, protected ?string $redirection_url=null, protected int $mail_notification_content_type=0, protected bool $always_send_mail_notification=false)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
 
 toStorage ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 
 getShowAnswerOverview ()
 
 withShowAnswerOverview (bool $show_answer_overview)
 
 getConcludingRemarksEnabled ()
 
 withConcludingRemarksEnabled (bool $concluding_remarks_enabled)
 
 getConcludingRemarksText ()
 
 getConcludingRemarksPageId ()
 
 withConcludingRemarksPageId (?int $concluding_remarks_page_id)
 
 getRedirectionMode ()
 
 withRedirectionMode (RedirectionModes $redirection_mode)
 
 getRedirectionUrl ()
 
 withRedirectionUrl (?string $redirection_url)
 
 getMailNotificationContentType ()
 
 withMailNotificationContentType (int $mail_notification_content_type)
 
 getAlwaysSendMailNotification ()
 
 withAlwaysSendMailNotification (bool $always_send_mail_notification)
 
- Public Member Functions inherited from ILIAS\Test\Settings\TestSettings
 __construct (int $test_id)
 
 getTestId ()
 
 withTestId (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
 
 toStorage ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 

Private Member Functions

 getRedirectionInputs (\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
 
 getMailNotificationInputs (\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\Test\Settings\TestSettings
int $test_id
 

Detailed Description

Definition at line 30 of file SettingsFinishing.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::__construct ( int  $test_id,
protected bool  $show_answer_overview = false,
protected bool  $concluding_remarks_enabled = false,
protected ?string  $concluding_remarks_text = '',
protected ?int  $concluding_remarks_page_id = null,
protected RedirectionModes  $redirection_mode = RedirectionModes::NONE,
protected ?string  $redirection_url = null,
protected int  $mail_notification_content_type = 0,
protected bool  $always_send_mail_notification = false 
)

Definition at line 32 of file SettingsFinishing.php.

42 {
44 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\Test\Settings\TestSettings\$test_id, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getAlwaysSendMailNotification()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getAlwaysSendMailNotification ( )

Definition at line 356 of file SettingsFinishing.php.

356 : bool
357 {
358 return $this->always_send_mail_notification;
359 }

◆ getConcludingRemarksEnabled()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getConcludingRemarksEnabled ( )

Definition at line 291 of file SettingsFinishing.php.

291 : bool
292 {
293 return $this->concluding_remarks_enabled;
294 }

◆ getConcludingRemarksPageId()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getConcludingRemarksPageId ( )

Definition at line 308 of file SettingsFinishing.php.

308 : ?int
309 {
310 return $this->concluding_remarks_page_id;
311 }

◆ getConcludingRemarksText()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getConcludingRemarksText ( )

Definition at line 303 of file SettingsFinishing.php.

303 : string
304 {
305 return $this->concluding_remarks_text ?? '';
306 }

◆ getMailNotificationContentType()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getMailNotificationContentType ( )

Definition at line 344 of file SettingsFinishing.php.

344 : int
345 {
346 return $this->mail_notification_content_type;
347 }

◆ getMailNotificationInputs()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getMailNotificationInputs ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery 
)
private

Definition at line 162 of file SettingsFinishing.php.

166 : OptionalGroup {
167 $notification_trafo = $refinery->custom()->transformation(
168 static function (?array $v): array {
169 if ($v === null) {
170 return [
171 'notification_content_type' => 0,
172 'always_notify' => false
173 ];
174 }
175
176 return $v;
177 }
178 );
179
180 $sub_inputs_finish_notification = [
181 'notification_content_type' => $f->radio(
182 $lng->txt('tst_finish_notification_content_type')
183 )->withOption(
184 '1',
185 $lng->txt('tst_finish_notification_simple')
186 )->withOption(
187 '2',
188 $lng->txt('tst_finish_notification_advanced')
189 )->withRequired(true)
190 ->withValue('1')
191 ->withAdditionalTransformation($refinery->kindlyTo()->int()),
192 'always_notify' => $f->checkbox(
193 $lng->txt('mailnottype'),
194 $lng->txt('mailnottype_desc')
195 )
196 ];
197
198 $mail_notification_inputs = $f->optionalGroup(
199 $sub_inputs_finish_notification,
200 $lng->txt('tst_finish_notification'),
201 $lng->txt('tst_finish_notification_desc')
202 )->withValue(null)
203 ->withAdditionalTransformation($notification_trafo);
204
205 if ($this->getMailNotificationContentType() === 0) {
206 return $mail_notification_inputs;
207 }
208
209 return $mail_notification_inputs->withValue(
210 [
211 'notification_content_type' => (string) $this->getMailNotificationContentType(),
212 'always_notify' => (bool) $this->getAlwaysSendMailNotification()
213 ]
214 );
215 }
global $lng
Definition: privfeed.php:31

◆ getRedirectionInputs()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getRedirectionInputs ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery 
)
private

Definition at line 69 of file SettingsFinishing.php.

73 : OptionalGroup {
74 $redirection_trafo = $refinery->custom()->transformation(
75 static function (?array $v): array {
76 if ($v === null) {
77 return [
78 'redirect_mode' => RedirectionModes::NONE,
79 'redirect_url' => ''
80 ];
81 }
82
83 return [
84 'redirect_mode' => RedirectionModes::tryFrom($v['redirect_mode'])
85 ?? RedirectionModes::NONE,
86 'redirect_url' => $v['redirect_url']
87 ];
88 }
89 );
90
91 $sub_inputs_redirect = [
92 'redirect_mode' => $f
93 ->radio($lng->txt('redirect_after_finishing_rule'))
94 ->withOption(
95 (string) RedirectionModes::ALWAYS->value,
96 $lng->txt('redirect_always')
97 )->withOption(
99 $lng->txt('redirect_always_to_logout')
100 )->withOption(
101 (string) RedirectionModes::IF_KIOSK_ACTIVATED->value,
102 $lng->txt('redirect_in_kiosk_mode')
103 )->withRequired(true)
104 ->withAdditionalTransformation($refinery->kindlyTo()->int()),
105 'redirect_url' => $f
106 ->text($lng->txt('redirection_url'))
107 ->withAdditionalTransformation($refinery->string()->hasMaxLength(4000))
109 $refinery->custom()->constraint(
110 static function ($v) use ($refinery): bool {
111 try {
112 return $v === '' || $refinery->to()->data('uri')->transform($v);
113 } catch (Throwable) {
114 return false;
115 }
116 },
117 $lng->txt('redirect_url_invalid')
118 )
119 )
120 ];
121
122 $redirection_input = $f
123 ->optionalGroup(
124 $sub_inputs_redirect,
125 $lng->txt('redirect_after_finishing_tst'),
126 $lng->txt('redirect_after_finishing_tst_desc')
127 )
128 ->withValue(null)
129 ->withAdditionalTransformation($redirection_trafo)
130 ->withAdditionalTransformation(
131 $refinery->custom()->constraint(
132 static function (array $v): bool {
133 return in_array(
134 $v['redirect_mode'],
135 [RedirectionModes::NONE, RedirectionModes::ALWAYS_TO_LOGOUT],
136 true
137 ) || $v['redirect_url'] !== '';
138 },
139 static function (\Closure $txt, array $value): string {
140 return sprintf(
141 $txt('redirect_url_required_for_rule'),
142 $value['redirect_mode'] === RedirectionModes::ALWAYS
143 ? $txt('redirect_always')
144 : $txt('redirect_in_kiosk_mode')
145 );
146 }
147 )
148 );
149
150 if ($this->getRedirectionMode() === RedirectionModes::NONE) {
151 return $redirection_input;
152 }
153
154 return $redirection_input->withValue(
155 [
156 'redirect_mode' => $this->getRedirectionMode()->value,
157 'redirect_url' => $this->getRedirectionUrl()
158 ]
159 );
160 }
const ALWAYS
$txt
Definition: error.php:31
withAdditionalTransformation(Transformation $trafo)
@inheritDoc
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61

◆ getRedirectionMode()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getRedirectionMode ( )

Definition at line 320 of file SettingsFinishing.php.

321 {
322 return $this->redirection_mode;
323 }

◆ getRedirectionUrl()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getRedirectionUrl ( )

Definition at line 332 of file SettingsFinishing.php.

332 : ?string
333 {
334 return $this->redirection_url;
335 }

◆ getShowAnswerOverview()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::getShowAnswerOverview ( )

Definition at line 279 of file SettingsFinishing.php.

279 : bool
280 {
281 return $this->show_answer_overview;
282 }

◆ toForm()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::toForm ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery,
?array  $environment = null 
)

Reimplemented from ILIAS\Test\Settings\TestSettings.

Definition at line 46 of file SettingsFinishing.php.

51 : FormInput {
52 $inputs['show_answer_overview'] = $f->checkbox(
53 $lng->txt('enable_examview'),
54 $lng->txt('enable_examview_desc')
55 )->withValue($this->getShowAnswerOverview());
56
57 $inputs['show_concluding_remarks'] = $f->checkbox(
58 $lng->txt('final_statement'),
59 $lng->txt('final_statement_show_desc')
60 )->withValue((bool) $this->getConcludingRemarksEnabled());
61
62 $inputs['redirect_after_finish'] = $this->getRedirectionInputs($lng, $f, $refinery);
63
64 $inputs['finish_notification'] = $this->getMailNotificationInputs($lng, $f, $refinery);
65
66 return $f->section($inputs, $lng->txt('tst_final_information'));
67 }
getRedirectionInputs(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
getMailNotificationInputs(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)

◆ toLog()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::toLog ( AdditionalInformationGenerator  $additional_info)

Reimplemented from ILIAS\Test\Settings\TestSettings.

Definition at line 231 of file SettingsFinishing.php.

231 : array
232 {
233 $log_array = [
239
240 ];
241
242 switch ($this->getRedirectionMode()) {
243 case RedirectionModes::NONE:
244 $log_array[AdditionalInformationGenerator::KEY_TEST_REDIRECT_MODE] = $additional_info
245 ->getNoneTag();
246 break;
248 $log_array[AdditionalInformationGenerator::KEY_TEST_REDIRECT_MODE] = $additional_info
249 ->getTagForLangVar('redirect_always');
250 break;
251 case RedirectionModes::IF_KIOSK_ACTIVATED:
252 $log_array[AdditionalInformationGenerator::KEY_TEST_REDIRECT_MODE] = $additional_info
253 ->getTagForLangVar('redirect_in_kiosk_mode');
254 break;
255 }
256
257 switch ($this->getMailNotificationContentType()) {
258 case 0:
260 ->getNoneTag();
261 break;
262 case 1:
264 ->getTagForLangVar('tst_finish_notification_simple');
267 break;
268 case 2:
270 ->getTagForLangVar('tst_finish_notification_advanced');
273 break;
274 }
275
276 return $log_array;
277 }

References ALWAYS, ILIAS\Test\Logging\AdditionalInformationGenerator\getEnabledDisabledTagForBool(), ILIAS\Test\Logging\AdditionalInformationGenerator\getNoneTag(), and ILIAS\Test\Logging\AdditionalInformationGenerator\getTagForLangVar().

+ Here is the call graph for this function:

◆ toStorage()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::toStorage ( )

Reimplemented from ILIAS\Test\Settings\TestSettings.

Definition at line 217 of file SettingsFinishing.php.

217 : array
218 {
219 return [
220 'enable_examview' => ['integer', (int) $this->getShowAnswerOverview()],
221 'showfinalstatement' => ['integer', (int) $this->getConcludingRemarksEnabled()],
222 'finalstatement' => ['text', $this->getConcludingRemarksText()],
223 'concluding_remarks_page_id' => ['integer', $this->getConcludingRemarksPageId()],
224 'redirection_mode' => ['integer', $this->getRedirectionMode()->value],
225 'redirection_url' => ['text', $this->getRedirectionUrl()],
226 'mailnotification' => ['integer', $this->getMailNotificationContentType()],
227 'mailnottype' => ['integer', (int) $this->getAlwaysSendMailNotification()]
228 ];
229 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ withAlwaysSendMailNotification()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withAlwaysSendMailNotification ( bool  $always_send_mail_notification)

Definition at line 361 of file SettingsFinishing.php.

361 : self
362 {
363 $clone = clone $this;
364 $clone->always_send_mail_notification = $always_send_mail_notification;
365 return $clone;
366 }

◆ withConcludingRemarksEnabled()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withConcludingRemarksEnabled ( bool  $concluding_remarks_enabled)

Definition at line 296 of file SettingsFinishing.php.

296 : self
297 {
298 $clone = clone $this;
299 $clone->concluding_remarks_enabled = $concluding_remarks_enabled;
300 return $clone;
301 }

◆ withConcludingRemarksPageId()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withConcludingRemarksPageId ( ?int  $concluding_remarks_page_id)

Definition at line 313 of file SettingsFinishing.php.

313 : self
314 {
315 $clone = clone $this;
316 $clone->concluding_remarks_page_id = $concluding_remarks_page_id;
317 return $clone;
318 }

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport(), and ilObjTest\getConcludingRemarksPageId().

+ Here is the caller graph for this function:

◆ withMailNotificationContentType()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withMailNotificationContentType ( int  $mail_notification_content_type)

Definition at line 349 of file SettingsFinishing.php.

349 : self
350 {
351 $clone = clone $this;
352 $clone->mail_notification_content_type = $mail_notification_content_type;
353 return $clone;
354 }

◆ withRedirectionMode()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withRedirectionMode ( RedirectionModes  $redirection_mode)

Definition at line 325 of file SettingsFinishing.php.

325 : self
326 {
327 $clone = clone $this;
328 $clone->redirection_mode = $redirection_mode;
329 return $clone;
330 }

◆ withRedirectionUrl()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withRedirectionUrl ( ?string  $redirection_url)

Definition at line 337 of file SettingsFinishing.php.

337 : self
338 {
339 $clone = clone $this;
340 $clone->redirection_url = $redirection_url;
341 return $clone;
342 }

◆ withShowAnswerOverview()

ILIAS\Test\Settings\MainSettings\SettingsFinishing::withShowAnswerOverview ( bool  $show_answer_overview)

Definition at line 284 of file SettingsFinishing.php.

284 : self
285 {
286 $clone = clone $this;
287 $clone->show_answer_overview = $show_answer_overview;
288 return $clone;
289 }

Referenced by ILIAS\Test\Settings\MainSettings\SettingsMainGUI\getFinishingSettingsForStorage().

+ Here is the caller graph for this function:

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