ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilStudyProgrammeAutoMailSettings.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
25 {
26  protected bool $send_re_assigned_mail;
29 
30  public function __construct(
31  bool $send_re_assigned_mail,
32  ?int $reminder_not_restarted_by_user_days,
33  ?int $processing_ends_not_successful_days
34  ) {
35  if (!is_null($reminder_not_restarted_by_user_days) && 1 > $reminder_not_restarted_by_user_days) {
36  throw new InvalidArgumentException('Numbers less than 1 are not allowed');
37  }
38 
39  if (!is_null($processing_ends_not_successful_days) && 1 > $processing_ends_not_successful_days) {
40  throw new InvalidArgumentException('Numbers less than 1 are not allowed');
41  }
42 
43  $this->send_re_assigned_mail = $send_re_assigned_mail;
44  $this->reminder_not_restarted_by_user_days = $reminder_not_restarted_by_user_days;
45  $this->processing_ends_not_successful_days = $processing_ends_not_successful_days;
46  }
47 
48  public function getSendReAssignedMail(): bool
49  {
51  }
52 
54  {
56  }
57 
59  {
61  }
62 
64  {
65  $clone = clone $this;
66  $clone->send_re_assigned_mail = $do_it;
67  return $clone;
68  }
69 
71  ?int $days
73  if (!is_null($days) && 1 > $days) {
74  throw new InvalidArgumentException('Numbers less than 1 are not allowed');
75  }
76 
77  $clone = clone $this;
78  $clone->reminder_not_restarted_by_user_days = $days;
79  return $clone;
80  }
81 
83  ?int $days
85  if (!is_null($days) && 1 > $days) {
86  throw new InvalidArgumentException('Numbers less than 1 are not allowed');
87  }
88  $clone = clone $this;
89  $clone->processing_ends_not_successful_days = $days;
90  return $clone;
91  }
92 
93  public function toFormInput(Field\Factory $input, ilLanguage $ilLng, Refinery $refinery): \ILIAS\UI\Component\Input\Container\Form\FormInput
94  {
95  $reminder = null;
96  if (!is_null($this->getReminderNotRestartedByUserDays())) {
97  $reminder = [$this->getReminderNotRestartedByUserDays()];
98  }
99 
100  $processing_end = null;
101  if (!is_null($this->getProcessingEndsNotSuccessfulDays())) {
102  $processing_end = [$this->getProcessingEndsNotSuccessfulDays()];
103  }
104 
105  return $input->section(
106  [
107  "send_re_assigned_mail" => $input->checkbox(
108  $ilLng->txt("send_re_assigned_mail"),
109  $ilLng->txt('send_re_assigned_mail_info')
110  )
111  ->withValue($this->getSendReAssignedMail()),
112 
113  "prg_user_not_restarted_time_input" => $input->optionalGroup(
114  [$input->numeric(
115  $ilLng->txt('prg_user_not_restarted_time_input'),
116  $ilLng->txt('prg_user_not_restarted_time_input_info')
117  )->withAdditionalTransformation($refinery->int()->isGreaterThanOrEqual(1))],
118  $ilLng->txt("send_info_to_re_assign_mail"),
119  $ilLng->txt("send_info_to_re_assign_mail_info")
120  )
121  ->withValue($reminder),
122 
123  "processing_ends_not_success" => $input->optionalGroup(
124  [$input->numeric(
125  $ilLng->txt('prg_processing_ends_no_success'),
126  $ilLng->txt('prg_processing_ends_no_success_info')
127  )->withAdditionalTransformation($refinery->int()->isGreaterThanOrEqual(1))],
128  $ilLng->txt("send_risky_to_fail_mail"),
129  $ilLng->txt("send_risky_to_fail_mail_info")
130  )
131  ->withValue($processing_end)
132  ],
133  $ilLng->txt("prg_cron_job_configuration")
134  )
135  ->withAdditionalTransformation($refinery->custom()->transformation(function ($vals) {
137  $vals["send_re_assigned_mail"],
138  isset($vals["prg_user_not_restarted_time_input"]) ? (int) $vals["prg_user_not_restarted_time_input"][0] : null,
139  isset($vals["processing_ends_not_success"]) ? (int) $vals["processing_ends_not_success"][0] : null
140  );
141  }));
142  }
143 }
Class Factory.
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...
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(bool $send_re_assigned_mail, ?int $reminder_not_restarted_by_user_days, ?int $processing_ends_not_successful_days)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Checkbox.php:21
toFormInput(Field\Factory $input, ilLanguage $ilLng, Refinery $refinery)
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
This describes inputs that can be used in forms.
Definition: FormInput.php:31
Refinery Factory $refinery