ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilStudyProgrammeAutoMailSettings.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Daniel Weise <daniel.weise@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
5declare(strict_types = 1);
6
7use \ILIAS\UI\Component\Input\Field;
8use \ILIAS\Refinery\Factory as Refinery;
9
11{
16
21
26
27 public function __construct(
31 ) {
32 if (
35 ) {
36 throw new InvalidArgumentException(
37 'Numbers less than 1 are not allowed'
38 );
39 }
40
41 if (
44 ) {
45 throw new InvalidArgumentException(
46 'Numbers less than 1 are not allowed'
47 );
48 }
49
50 $this->send_re_assigned_mail = $send_re_assigned_mail;
51 $this->reminder_not_restarted_by_user_days = $reminder_not_restarted_by_user_days;
52 $this->processing_ends_not_successful_days = $processing_ends_not_successful_days;
53 }
54
55 public function getSendReAssignedMail() : bool
56 {
58 }
59
60 public function getReminderNotRestartedByUserDays() : ?int
61 {
63 }
64
65 public function getProcessingEndsNotSuccessfulDays() : ?int
66 {
68 }
69
71 {
72 $clone = clone $this;
73 $clone->send_re_assigned_mail = $do_it;
74 return $clone;
75 }
76
78 ?int $days
80 if (!is_null($days) && 1 > $days) {
81 throw new InvalidArgumentException(
82 'Numbers less than 1 are not allowed'
83 );
84 }
85
86 $clone = clone $this;
87 $clone->reminder_not_restarted_by_user_days = $days;
88 return $clone;
89 }
90
92 ?int $days
94 if (!is_null($days) && 1 > $days) {
95 throw new InvalidArgumentException(
96 'Numbers less than 1 are not allowed'
97 );
98 }
99 $clone = clone $this;
100 $clone->processing_ends_not_successful_days = $days;
101 return $clone;
102 }
103
104 public function toFormInput(Field\Factory $input, \ilLanguage $ilLng, Refinery $refinery) : Field\Input
105 {
106 return $input->section(
107 [
108 "send_re_assigned_mail" => $input->checkbox(
109 $ilLng->txt("send_re_assigned_mail"),
110 $ilLng->txt('send_re_assigned_mail_info')
111 )
112 ->withValue($this->getSendReAssignedMail()),
113
114 "prg_user_not_restarted_time_input" => $input->optionalGroup(
115 [$input->numeric(
116 $ilLng->txt('prg_user_not_restarted_time_input'),
117 $ilLng->txt('prg_user_not_restarted_time_input_info')
118 )->withAdditionalTransformation($refinery->int()->isGreaterThan(0))],
119 $ilLng->txt("send_info_to_re_assign_mail"),
120 $ilLng->txt("send_info_to_re_assign_mail_info")
121 )
122 ->withValue($this->getReminderNotRestartedByUserDays() !== null ? [$this->getReminderNotRestartedByUserDays()] : null),
123
124 "processing_ends_not_success" => $input->optionalGroup(
125 [$input->numeric(
126 $ilLng->txt('prg_processing_ends_no_success'),
127 $ilLng->txt('prg_processing_ends_no_success_info')
128 )->withAdditionalTransformation($refinery->int()->isGreaterThan(0))],
129 $ilLng->txt("send_risky_to_fail_mail"),
130 $ilLng->txt("send_risky_to_fail_mail_info")
131 )
132 ->withValue($this->getProcessingEndsNotSuccessfulDays() !== null ? [$this->getProcessingEndsNotSuccessfulDays()] : null)
133 ],
134 $ilLng->txt("prg_cron_job_configuration")
135 )
136 ->withAdditionalTransformation($refinery->custom()->transformation(function ($vals) {
137 return new \ilStudyProgrammeAutoMailSettings(
138 $vals["send_re_assigned_mail"],
139 isset($vals["prg_user_not_restarted_time_input"]) ? (int) $vals["prg_user_not_restarted_time_input"][0] : null,
140 isset($vals["processing_ends_not_success"]) ? (int) $vals["processing_ends_not_success"][0] : null
141 );
142 }));
143 }
144}
An exception for terminatinating execution or to throw for unit testing.
language handling
txt($a_topic, $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...
__construct(bool $send_re_assigned_mail, ?int $reminder_not_restarted_by_user_days, ?int $processing_ends_not_successful_days)
toFormInput(Field\Factory $input, \ilLanguage $ilLng, Refinery $refinery)
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
This is what a factory for input fields looks like.
Definition: Factory.php:11
This describes commonalities between all inputs.
Definition: Input.php:32
withAdditionalTransformation(Transformation $trafo)
Apply a transformation to the content of the input.