ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilStudyProgrammeAutoMailSettings.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\Refinery\Factory as Refinery;
23
25{
26 public function __construct(
27 protected bool $send_re_assigned_mail,
28 protected ?int $reminder_not_restarted_by_user_days,
29 protected ?int $processing_ends_not_successful_days
30 ) {
31 if (!is_null($reminder_not_restarted_by_user_days) && 1 > $reminder_not_restarted_by_user_days) {
32 throw new InvalidArgumentException('Numbers less than 1 are not allowed');
33 }
34
35 if (!is_null($processing_ends_not_successful_days) && 1 > $processing_ends_not_successful_days) {
36 throw new InvalidArgumentException('Numbers less than 1 are not allowed');
37 }
38
39 $this->send_re_assigned_mail = $send_re_assigned_mail;
40 $this->reminder_not_restarted_by_user_days = $reminder_not_restarted_by_user_days;
41 $this->processing_ends_not_successful_days = $processing_ends_not_successful_days;
42 }
43
44 public function getSendReAssignedMail(): bool
45 {
46 return $this->send_re_assigned_mail;
47 }
48
50 {
51 return $this->reminder_not_restarted_by_user_days;
52 }
53
55 {
56 return $this->processing_ends_not_successful_days;
57 }
58
60 {
61 $clone = clone $this;
62 $clone->send_re_assigned_mail = $do_it;
63 return $clone;
64 }
65
67 ?int $days
69 if (!is_null($days) && 1 > $days) {
70 throw new InvalidArgumentException('Numbers less than 1 are not allowed');
71 }
72
73 $clone = clone $this;
74 $clone->reminder_not_restarted_by_user_days = $days;
75 return $clone;
76 }
77
79 ?int $days
81 if (!is_null($days) && 1 > $days) {
82 throw new InvalidArgumentException('Numbers less than 1 are not allowed');
83 }
84 $clone = clone $this;
85 $clone->processing_ends_not_successful_days = $days;
86 return $clone;
87 }
88
90 {
91 $reminder = null;
92 if (!is_null($this->getReminderNotRestartedByUserDays())) {
93 $reminder = [$this->getReminderNotRestartedByUserDays()];
94 }
95
96 $processing_end = null;
97 if (!is_null($this->getProcessingEndsNotSuccessfulDays())) {
98 $processing_end = [$this->getProcessingEndsNotSuccessfulDays()];
99 }
100
101 return $input->section(
102 [
103 "send_re_assigned_mail" => $input->checkbox(
104 $ilLng->txt("send_re_assigned_mail"),
105 $ilLng->txt('send_re_assigned_mail_info')
106 )
107 ->withValue($this->getSendReAssignedMail()),
108
109 "prg_user_not_restarted_time_input" => $input->optionalGroup(
110 [$input->numeric(
111 $ilLng->txt('prg_user_not_restarted_time_input'),
112 $ilLng->txt('prg_user_not_restarted_time_input_info')
113 )->withAdditionalTransformation($refinery->int()->isGreaterThanOrEqual(1))],
114 $ilLng->txt("send_info_to_re_assign_mail"),
115 $ilLng->txt("send_info_to_re_assign_mail_info")
116 )
117 ->withValue($reminder),
118
119 "processing_ends_not_success" => $input->optionalGroup(
120 [$input->numeric(
121 $ilLng->txt('prg_processing_ends_no_success'),
122 $ilLng->txt('prg_processing_ends_no_success_info')
123 )->withAdditionalTransformation($refinery->int()->isGreaterThanOrEqual(1))],
124 $ilLng->txt("send_risky_to_fail_mail"),
125 $ilLng->txt("send_risky_to_fail_mail_info")
126 )
127 ->withValue($processing_end)
128 ],
129 $ilLng->txt("prg_cron_job_configuration")
130 )
131 ->withAdditionalTransformation($refinery->custom()->transformation(function ($vals) {
133 $vals["send_re_assigned_mail"],
134 isset($vals["prg_user_not_restarted_time_input"]) ? (int) $vals["prg_user_not_restarted_time_input"][0] : null,
135 isset($vals["processing_ends_not_success"]) ? (int) $vals["processing_ends_not_success"][0] : null
136 );
137 }));
138 }
139}
Builds data types.
Definition: Factory.php:36
Definition: UI.php:24
language handling
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...
toFormInput(Field\Factory $input, ilLanguage $ilLng, Refinery $refinery)
__construct(protected bool $send_re_assigned_mail, protected ?int $reminder_not_restarted_by_user_days, protected ?int $processing_ends_not_successful_days)
This describes inputs that can be used in forms.
Definition: FormInput.php:33
This is what a factory for input fields looks like.
Definition: Factory.php:31
This describes commonalities between all inputs.
Definition: Input.php:47
withAdditionalTransformation(Transformation $trafo)
Apply a transformation to the content of the input.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Checkbox.php:21
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))