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

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 int $redirection_mode=ilObjTest::REDIRECT_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 ()
 
 getShowAnswerOverview ()
 
 withShowAnswerOverview (bool $show_answer_overview)
 
 getConcludingRemarksEnabled ()
 
 withConcludingRemarksEnabled (bool $concluding_remarks_enabled)
 
 getConcludingRemarksText ()
 
 getConcludingRemarksPageId ()
 
 withConcludingRemarksPageId (?int $concluding_remarks_page_id)
 
 getRedirectionMode ()
 
 withRedirectionMode (int $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 TestSettings
 __construct (int $test_id)
 
 getTestId ()
 
 withTestId (int $test_id)
 
 toForm (\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
 
 toStorage ()
 

Private Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from TestSettings
int $test_id
 

Detailed Description

Definition at line 26 of file ilObjTestSettingsFinishing.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjTestSettingsFinishing::__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 int  $redirection_mode = ilObjTest::REDIRECT_NONE,
protected ?string  $redirection_url = null,
protected int  $mail_notification_content_type = 0,
protected bool  $always_send_mail_notification = false 
)

Definition at line 28 of file ilObjTestSettingsFinishing.php.

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

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

Member Function Documentation

◆ getAlwaysSendMailNotification()

ilObjTestSettingsFinishing::getAlwaysSendMailNotification ( )

Definition at line 265 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport(), getMailNotificationInputs(), and toStorage().

265  : bool
266  {
267  return $this->always_send_mail_notification;
268  }
+ Here is the caller graph for this function:

◆ getConcludingRemarksEnabled()

ilObjTestSettingsFinishing::getConcludingRemarksEnabled ( )

Definition at line 200 of file ilObjTestSettingsFinishing.php.

Referenced by toForm(), and toStorage().

200  : bool
201  {
202  return $this->concluding_remarks_enabled;
203  }
+ Here is the caller graph for this function:

◆ getConcludingRemarksPageId()

ilObjTestSettingsFinishing::getConcludingRemarksPageId ( )

Definition at line 217 of file ilObjTestSettingsFinishing.php.

Referenced by toStorage().

217  : ?int
218  {
219  return $this->concluding_remarks_page_id;
220  }
+ Here is the caller graph for this function:

◆ getConcludingRemarksText()

ilObjTestSettingsFinishing::getConcludingRemarksText ( )

Definition at line 212 of file ilObjTestSettingsFinishing.php.

Referenced by toStorage().

212  : string
213  {
214  return $this->concluding_remarks_text ?? '';
215  }
+ Here is the caller graph for this function:

◆ getMailNotificationContentType()

ilObjTestSettingsFinishing::getMailNotificationContentType ( )

Definition at line 253 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport(), getMailNotificationInputs(), and toStorage().

253  : int
254  {
255  return $this->mail_notification_content_type;
256  }
+ Here is the caller graph for this function:

◆ getMailNotificationInputs()

ilObjTestSettingsFinishing::getMailNotificationInputs ( ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery 
)
private

Definition at line 119 of file ilObjTestSettingsFinishing.php.

References getAlwaysSendMailNotification(), getMailNotificationContentType(), ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by toForm().

123  : OptionalGroup {
124  $notification_trafo = $refinery->custom()->transformation(
125  static function (?array $v): array {
126  if ($v === null) {
127  return [
128  'notification_content_type' => 0,
129  'always_notify' => false
130  ];
131  }
132 
133  return $v;
134  }
135  );
136 
137  $sub_inputs_finish_notification = [
138  'notification_content_type' => $f->radio(
139  $lng->txt('tst_finish_notification_content_type')
140  )->withOption(
141  '1',
142  $lng->txt('tst_finish_notification_simple')
143  )->withOption(
144  '2',
145  $lng->txt('tst_finish_notification_advanced')
146  )->withRequired(true)
147  ->withValue('1')
148  ->withAdditionalTransformation($refinery->kindlyTo()->int()),
149  'always_notify' => $f->checkbox(
150  $lng->txt('mailnottype'),
151  $lng->txt('mailnottype_desc')
152  )
153  ];
154 
155  $mail_notification_inputs = $f->optionalGroup(
156  $sub_inputs_finish_notification,
157  $lng->txt('tst_finish_notification'),
158  $lng->txt('tst_finish_notification_desc')
159  )->withValue(null)
160  ->withAdditionalTransformation($notification_trafo);
161 
162  if ($this->getMailNotificationContentType() === 0) {
163  return $mail_notification_inputs;
164  }
165 
166  return $mail_notification_inputs->withValue(
167  [
168  'notification_content_type' => (string) $this->getMailNotificationContentType(),
169  'always_notify' => (bool) $this->getAlwaysSendMailNotification()
170  ]
171  );
172  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This describes optional group inputs.
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:

◆ getRedirectionInputs()

ilObjTestSettingsFinishing::getRedirectionInputs ( ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery 
)
private

Definition at line 65 of file ilObjTestSettingsFinishing.php.

References getRedirectionMode(), getRedirectionUrl(), ilObjTest\REDIRECT_ALWAYS, ilObjTest\REDIRECT_KIOSK, ilObjTest\REDIRECT_NONE, ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by toForm().

69  : OptionalGroup {
70  $redirection_trafo = $refinery->custom()->transformation(
71  static function (?array $v): array {
72  if ($v === null) {
73  return [
74  'redirect_mode' => ilObjTest::REDIRECT_NONE,
75  'redirect_url' => ''
76  ];
77  }
78 
79  return $v;
80  }
81  );
82 
83  $sub_inputs_redirect = [
84  'redirect_mode' => $f->radio(
85  $lng->txt('redirect_after_finishing_rule')
86  )->withOption(
88  $lng->txt('redirect_always')
89  )->withOption(
91  $lng->txt('redirect_in_kiosk_mode')
92  )->withRequired(true)
93  ->withAdditionalTransformation($refinery->kindlyTo()->int()),
94  'redirect_url' => $f->text(
95  $lng->txt('redirection_url')
96  )->withRequired(true)
97  ->withAdditionalTransformation($refinery->string()->hasMaxLength(4000))
98  ];
99 
100  $redirection_input = $f->optionalGroup(
101  $sub_inputs_redirect,
102  $lng->txt('redirect_after_finishing_tst'),
103  $lng->txt('redirect_after_finishing_tst_desc')
104  )->withValue(null)
105  ->withAdditionalTransformation($redirection_trafo);
106 
107  if ($this->getRedirectionMode() === ilObjTest::REDIRECT_NONE) {
108  return $redirection_input;
109  }
110 
111  return $redirection_input->withValue(
112  [
113  'redirect_mode' => $this->getRedirectionMode(),
114  'redirect_url' => $this->getRedirectionUrl()
115  ]
116  );
117  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This describes optional group inputs.
const REDIRECT_NONE
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:58
const REDIRECT_ALWAYS
const REDIRECT_KIOSK
Refinery Factory $refinery
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRedirectionMode()

ilObjTestSettingsFinishing::getRedirectionMode ( )

Definition at line 229 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport(), getRedirectionInputs(), and toStorage().

229  : int
230  {
231  return $this->redirection_mode;
232  }
+ Here is the caller graph for this function:

◆ getRedirectionUrl()

ilObjTestSettingsFinishing::getRedirectionUrl ( )

Definition at line 241 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport(), getRedirectionInputs(), and toStorage().

241  : ?string
242  {
243  return $this->redirection_url;
244  }
+ Here is the caller graph for this function:

◆ getShowAnswerOverview()

ilObjTestSettingsFinishing::getShowAnswerOverview ( )

Definition at line 188 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport(), toForm(), and toStorage().

188  : bool
189  {
190  return $this->show_answer_overview;
191  }
+ Here is the caller graph for this function:

◆ toForm()

ilObjTestSettingsFinishing::toForm ( \ilLanguage  $lng,
FieldFactory  $f,
Refinery  $refinery,
array  $environment = null 
)

Definition at line 42 of file ilObjTestSettingsFinishing.php.

References ILIAS\UI\Implementation\Component\Input\$inputs, getConcludingRemarksEnabled(), getMailNotificationInputs(), getRedirectionInputs(), getShowAnswerOverview(), ilLanguage\txt(), and ILIAS\UI\Implementation\Component\Input\withValue().

47  : FormInput {
48  $inputs['show_answer_overview'] = $f->checkbox(
49  $lng->txt('enable_examview'),
50  $lng->txt('enable_examview_desc')
51  )->withValue($this->getShowAnswerOverview());
52 
53  $inputs['show_concluding_remarks'] = $f->checkbox(
54  $lng->txt('final_statement'),
55  $lng->txt('final_statement_show_desc')
56  )->withValue((bool) $this->getConcludingRemarksEnabled());
57 
58  $inputs['redirect_after_finish'] = $this->getRedirectionInputs($lng, $f, $refinery);
59 
60  $inputs['finish_notification'] = $this->getMailNotificationInputs($lng, $f, $refinery);
61 
62  return $f->section($inputs, $lng->txt('tst_final_information'));
63  }
getMailNotificationInputs(ilLanguage $lng, FieldFactory $f, Refinery $refinery)
$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
getRedirectionInputs(ilLanguage $lng, FieldFactory $f, Refinery $refinery)
Refinery Factory $refinery
+ Here is the call graph for this function:

◆ toStorage()

ilObjTestSettingsFinishing::toStorage ( )

Definition at line 174 of file ilObjTestSettingsFinishing.php.

References getAlwaysSendMailNotification(), getConcludingRemarksEnabled(), getConcludingRemarksPageId(), getConcludingRemarksText(), getMailNotificationContentType(), getRedirectionMode(), getRedirectionUrl(), getShowAnswerOverview(), and ILIAS\Repository\int().

174  : array
175  {
176  return [
177  'enable_examview' => ['integer', (int) $this->getShowAnswerOverview()],
178  'showfinalstatement' => ['integer', (int) $this->getConcludingRemarksEnabled()],
179  'finalstatement' => ['text', $this->getConcludingRemarksText()],
180  'concluding_remarks_page_id' => ['integer', $this->getConcludingRemarksPageId()],
181  'redirection_mode' => ['integer', $this->getRedirectionMode()],
182  'redirection_url' => ['text', $this->getRedirectionUrl()],
183  'mailnotification' => ['integer', $this->getMailNotificationContentType()],
184  'mailnottype' => ['integer', (int) $this->getAlwaysSendMailNotification()]
185  ];
186  }
+ Here is the call graph for this function:

◆ withAlwaysSendMailNotification()

ilObjTestSettingsFinishing::withAlwaysSendMailNotification ( bool  $always_send_mail_notification)

Definition at line 270 of file ilObjTestSettingsFinishing.php.

270  : self
271  {
272  $clone = clone $this;
273  $clone->always_send_mail_notification = $always_send_mail_notification;
274  return $clone;
275  }

◆ withConcludingRemarksEnabled()

ilObjTestSettingsFinishing::withConcludingRemarksEnabled ( bool  $concluding_remarks_enabled)

Definition at line 205 of file ilObjTestSettingsFinishing.php.

205  : self
206  {
207  $clone = clone $this;
208  $clone->concluding_remarks_enabled = $concluding_remarks_enabled;
209  return $clone;
210  }

◆ withConcludingRemarksPageId()

ilObjTestSettingsFinishing::withConcludingRemarksPageId ( ?int  $concluding_remarks_page_id)

Definition at line 222 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTest\addConcludingRemarksToSettingsFromImport().

222  : self
223  {
224  $clone = clone $this;
225  $clone->concluding_remarks_page_id = $concluding_remarks_page_id;
226  return $clone;
227  }
+ Here is the caller graph for this function:

◆ withMailNotificationContentType()

ilObjTestSettingsFinishing::withMailNotificationContentType ( int  $mail_notification_content_type)

Definition at line 258 of file ilObjTestSettingsFinishing.php.

258  : self
259  {
260  $clone = clone $this;
261  $clone->mail_notification_content_type = $mail_notification_content_type;
262  return $clone;
263  }

◆ withRedirectionMode()

ilObjTestSettingsFinishing::withRedirectionMode ( int  $redirection_mode)

Definition at line 234 of file ilObjTestSettingsFinishing.php.

234  : self
235  {
236  $clone = clone $this;
237  $clone->redirection_mode = $redirection_mode;
238  return $clone;
239  }

◆ withRedirectionUrl()

ilObjTestSettingsFinishing::withRedirectionUrl ( ?string  $redirection_url)

Definition at line 246 of file ilObjTestSettingsFinishing.php.

246  : self
247  {
248  $clone = clone $this;
249  $clone->redirection_url = $redirection_url;
250  return $clone;
251  }

◆ withShowAnswerOverview()

ilObjTestSettingsFinishing::withShowAnswerOverview ( bool  $show_answer_overview)

Definition at line 193 of file ilObjTestSettingsFinishing.php.

Referenced by ilObjTestSettingsMainGUI\getFinishingSettingsForStorage().

193  : self
194  {
195  $clone = clone $this;
196  $clone->show_answer_overview = $show_answer_overview;
197  return $clone;
198  }
+ Here is the caller graph for this function:

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