19declare(strict_types=1);
34 protected bool $show_answer_overview =
false,
35 protected bool $concluding_remarks_enabled =
false,
36 protected ?
string $concluding_remarks_text =
'',
37 protected ?
int $concluding_remarks_page_id =
null,
39 protected ?
string $redirection_url =
null,
40 protected int $mail_notification_content_type = 0,
41 protected bool $always_send_mail_notification =
false
50 ?array $environment =
null
52 $inputs[
'show_answer_overview'] =
$f->checkbox(
53 $lng->txt(
'enable_examview'),
54 $lng->txt(
'enable_examview_desc')
57 $inputs[
'show_concluding_remarks'] =
$f->checkbox(
58 $lng->txt(
'final_statement'),
59 $lng->txt(
'final_statement_show_desc')
66 return $f->section(
$inputs,
$lng->txt(
'tst_final_information'));
75 static function (?array $v): array {
78 'redirect_mode' => RedirectionModes::NONE,
84 'redirect_mode' => RedirectionModes::tryFrom($v[
'redirect_mode'])
85 ?? RedirectionModes::NONE,
86 'redirect_url' => $v[
'redirect_url']
91 $sub_inputs_redirect = [
93 ->radio(
$lng->txt(
'redirect_after_finishing_rule'))
96 $lng->txt(
'redirect_always')
99 $lng->txt(
'redirect_always_to_logout')
101 (
string) RedirectionModes::IF_KIOSK_ACTIVATED->value,
102 $lng->txt(
'redirect_in_kiosk_mode')
103 )->withRequired(
true)
104 ->withAdditionalTransformation(
$refinery->kindlyTo()->int()),
106 ->text(
$lng->txt(
'redirection_url'))
110 static function ($v) use (
$refinery):
bool {
113 }
catch (Throwable) {
117 $lng->txt(
'redirect_url_invalid')
122 $redirection_input =
$f
124 $sub_inputs_redirect,
125 $lng->txt(
'redirect_after_finishing_tst'),
126 $lng->txt(
'redirect_after_finishing_tst_desc')
129 ->withAdditionalTransformation($redirection_trafo)
130 ->withAdditionalTransformation(
132 static function (array $v):
bool {
137 ) || $v[
'redirect_url'] !==
'';
139 static function (\Closure
$txt, array $value):
string {
141 $txt(
'redirect_url_required_for_rule'),
143 ?
$txt(
'redirect_always')
144 :
$txt(
'redirect_in_kiosk_mode')
150 if ($this->getRedirectionMode() === RedirectionModes::NONE) {
151 return $redirection_input;
154 return $redirection_input->withValue(
156 'redirect_mode' => $this->getRedirectionMode()->value,
157 'redirect_url' => $this->getRedirectionUrl()
168 static function (?array $v): array {
171 'notification_content_type' => 0,
172 'always_notify' => false
180 $sub_inputs_finish_notification = [
181 'notification_content_type' =>
$f->radio(
182 $lng->txt(
'tst_finish_notification_content_type')
185 $lng->txt(
'tst_finish_notification_simple')
188 $lng->txt(
'tst_finish_notification_advanced')
189 )->withRequired(
true)
191 ->withAdditionalTransformation(
$refinery->kindlyTo()->int()),
192 'always_notify' =>
$f->checkbox(
193 $lng->txt(
'mailnottype'),
194 $lng->txt(
'mailnottype_desc')
198 $mail_notification_inputs =
$f->optionalGroup(
199 $sub_inputs_finish_notification,
200 $lng->txt(
'tst_finish_notification'),
201 $lng->txt(
'tst_finish_notification_desc')
203 ->withAdditionalTransformation($notification_trafo);
205 if ($this->getMailNotificationContentType() === 0) {
206 return $mail_notification_inputs;
209 return $mail_notification_inputs->withValue(
211 'notification_content_type' => (
string) $this->getMailNotificationContentType(),
212 'always_notify' => (bool) $this->getAlwaysSendMailNotification()
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()]
234 AdditionalInformationGenerator::KEY_TEST_ANSWER_OVERVIEW_ENABLED => $additional_info
236 AdditionalInformationGenerator::KEY_TEST_CONCLUDING_REMARKS_ENABLED => $additional_info
238 AdditionalInformationGenerator::KEY_TEST_REDIRECT_URL => $this->getRedirectionUrl(),
242 switch ($this->getRedirectionMode()) {
243 case RedirectionModes::NONE:
244 $log_array[AdditionalInformationGenerator::KEY_TEST_REDIRECT_MODE] = $additional_info
248 $log_array[AdditionalInformationGenerator::KEY_TEST_REDIRECT_MODE] = $additional_info
251 case RedirectionModes::IF_KIOSK_ACTIVATED:
252 $log_array[AdditionalInformationGenerator::KEY_TEST_REDIRECT_MODE] = $additional_info
257 switch ($this->getMailNotificationContentType()) {
259 $log_array[AdditionalInformationGenerator::KEY_TEST_MAIL_NOTIFICATION_CONTENT_TYPE] = $additional_info
263 $log_array[AdditionalInformationGenerator::KEY_TEST_MAIL_NOTIFICATION_CONTENT_TYPE] = $additional_info
265 $log_array[AdditionalInformationGenerator::KEY_TEST_ALWAYS_SEND_NOTIFICATION] = $additional_info
269 $log_array[AdditionalInformationGenerator::KEY_TEST_MAIL_NOTIFICATION_CONTENT_TYPE] = $additional_info
271 $log_array[AdditionalInformationGenerator::KEY_TEST_ALWAYS_SEND_NOTIFICATION] = $additional_info
281 return $this->show_answer_overview;
286 $clone = clone $this;
287 $clone->show_answer_overview = $show_answer_overview;
293 return $this->concluding_remarks_enabled;
298 $clone = clone $this;
299 $clone->concluding_remarks_enabled = $concluding_remarks_enabled;
305 return $this->concluding_remarks_text ??
'';
310 return $this->concluding_remarks_page_id;
315 $clone = clone $this;
316 $clone->concluding_remarks_page_id = $concluding_remarks_page_id;
322 return $this->redirection_mode;
327 $clone = clone $this;
328 $clone->redirection_mode = $redirection_mode;
334 return $this->redirection_url;
339 $clone = clone $this;
340 $clone->redirection_url = $redirection_url;
346 return $this->mail_notification_content_type;
351 $clone = clone $this;
352 $clone->mail_notification_content_type = $mail_notification_content_type;
358 return $this->always_send_mail_notification;
363 $clone = clone $this;
364 $clone->always_send_mail_notification = $always_send_mail_notification;
withConcludingRemarksPageId(?int $concluding_remarks_page_id)
withRedirectionUrl(?string $redirection_url)
getRedirectionInputs(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
getMailNotificationInputs(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
withAlwaysSendMailNotification(bool $always_send_mail_notification)
getConcludingRemarksEnabled()
__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)
withMailNotificationContentType(int $mail_notification_content_type)
getConcludingRemarksPageId()
withRedirectionMode(RedirectionModes $redirection_mode)
toLog(AdditionalInformationGenerator $additional_info)
withShowAnswerOverview(bool $show_answer_overview)
getAlwaysSendMailNotification()
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, ?array $environment=null)
getConcludingRemarksText()
getMailNotificationContentType()
withConcludingRemarksEnabled(bool $concluding_remarks_enabled)
__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'))