19 declare(strict_types=1);
34 protected bool $start_time_enabled =
false,
36 protected bool $end_time_enabled =
false,
38 protected bool $password_enabled =
false,
39 protected ?
string $password = null,
40 protected bool $fixed_participants =
false,
49 array $environment = null
54 $inputs[
'fixed_participants_enabled'] = $f->checkbox(
55 $lng->
txt(
'participants_invitation'),
56 $lng->
txt(
'participants_invitation_description')
58 if ($environment[
'participant_data_exists']) {
59 $inputs[
'fixed_participants_enabled'] =
$inputs[
'fixed_participants_enabled']
63 return $f->section(
$inputs, $lng->
txt(
'tst_settings_header_execution'));
70 array $environment = null
72 $constraint = $refinery->custom()->constraint(
73 static fn (array $vs) =>
74 $vs[
'start_time'] === null || $vs[
'end_time'] === null || $vs[
'start_time'] < $vs[
'end_time'],
75 $lng->
txt(
'duration_end_must_not_be_earlier_than_start')
78 $trafo = $refinery->custom()->transformation(
79 static function (array $vs): array {
80 $vs[
'start_time_enabled'] = $vs[
'start_time'] !== null;
81 $vs[
'end_time_enabled'] = $vs[
'end_time'] !== null;
87 ->withAdditionalTransformation($constraint)
88 ->withAdditionalTransformation($trafo);
96 $sub_inputs_access_window[
'start_time'] = $f->dateTime(
97 $lng->
txt(
'tst_starting_time'),
98 $lng->
txt(
'tst_starting_time_desc')
99 )->withTimezone($environment[
'user_time_zone'])
100 ->withFormat($environment[
'user_date_format'])
103 $sub_inputs_access_window[
'start_time'] = $sub_inputs_access_window[
'start_time']
106 if ($environment[
'participant_data_exists']) {
107 $sub_inputs_access_window[
'start_time'] = $sub_inputs_access_window[
'start_time']->withDisabled(
true);
110 $sub_inputs_access_window[
'end_time'] = $f->dateTime(
111 $lng->
txt(
'tst_ending_time'),
112 $lng->
txt(
'tst_ending_time_desc')
113 )->withTimezone($environment[
'user_time_zone'])
114 ->withFormat($environment[
'user_date_format'])
117 $sub_inputs_access_window[
'end_time'] = $sub_inputs_access_window[
'end_time']
121 return $sub_inputs_access_window;
129 $trafo = $refinery->custom()->transformation(
130 static function (?array $vs): array {
133 'password_enabled' =>
false,
134 'password_value' => null
138 $vs[
'password_enabled'] =
true;
143 $sub_inputs_password[
'password_value'] = $f->text($lng->
txt(
'tst_password_enter'))
144 ->withRequired(
true)->withMaxLength(self::MAX_PASSWORD_LENGTH);
146 $password_input = $f->optionalGroup(
147 $sub_inputs_password,
148 $lng->
txt(
'tst_password'),
149 $lng->
txt(
'tst_password_details')
151 ->withAdditionalTransformation($trafo);
154 return $password_input;
157 return $password_input->withValue(
168 'ending_time' => [
'integer', $this->
getEndTime() !== null ? $this->
getEndTime()->getTimestamp() : 0],
177 return $this->start_time_enabled;
181 $clone = clone $this;
182 $clone->start_time_enabled = $start_time_enabled;
188 return $this->start_time;
192 $clone = clone $this;
193 $clone->start_time = $start_time;
199 return $this->end_time_enabled;
203 $clone = clone $this;
204 $clone->end_time_enabled = $end_time_enabled;
210 return $this->end_time;
214 $clone = clone $this;
215 $clone->end_time = $end_time;
221 return $this->password_enabled;
225 $clone = clone $this;
226 $clone->password_enabled = $password_enabled;
232 return $this->password;
236 $clone = clone $this;
237 $clone->password = $password;
243 return $this->fixed_participants;
247 $clone = clone $this;
248 $clone->fixed_participants = $fixed_participants;
__construct(int $test_id, protected bool $start_time_enabled=false, protected ?DateTimeImmutable $start_time=null, protected bool $end_time_enabled=false, protected ?DateTimeImmutable $end_time=null, protected bool $password_enabled=false, protected ?string $password=null, protected bool $fixed_participants=false,)
withPassword(?string $password)
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...
withPasswordEnabled(bool $password_enabled)
toForm(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
getInputPassword(\ilLanguage $lng, FieldFactory $f, Refinery $refinery)
const MAX_PASSWORD_LENGTH
getInputAccessWindow(\ilLanguage $lng, FieldFactory $f, Refinery $refinery, array $environment=null)
withEndTime(?DateTimeImmutable $end_time)
withEndTimeEnabled(bool $end_time_enabled)
getSubInputsAccessWindow(\ilLanguage $lng, FieldFactory $f, array $environment)
withStartTime(?DateTimeImmutable $start_time)
withStartTimeEnabled(bool $start_time_enabled)
withFixedParticipants(bool $fixed_participants)
Refinery Factory $refinery