3 declare(strict_types=1);
6 use \ILIAS\UI\Component\Input\Field;
7 use \ILIAS\Refinery\Factory as
Refinery;
25 if (!is_null($deadline_period) && 0 > $deadline_period) {
27 'Numbers less than 0 are not allowed' 42 if (!is_null($deadline_period) && 0 > $deadline_period) {
44 'Numbers less than 0 are not allowed' 73 $grp1 = $input->group([], $lng->
txt(
'prg_no_deadline'));
74 $grp2 = $input->group(
76 'deadline_period' => $input->numeric(
78 $lng->
txt(
'prg_deadline_period_desc')
80 ->withAdditionalTransformation($refinery->int()->isGreaterThan(-1))
83 $lng->
txt(
'prg_deadline_period')
85 $grp3 = $input->group(
87 'deadline_date' => $input->dateTime(
89 $lng->
txt(
'prg_deadline_date_desc')
95 $lng->
txt(
'prg_deadline_date')
98 $sg = $input->switchableGroup(
100 'opt_no_deadline' => $grp1,
101 'opt_deadline_period' => $grp2,
102 'opt_deadline_date' => $grp3
107 $deadline =
"opt_no_deadline";
109 $deadline =
'opt_deadline_period';
113 $deadline =
'opt_deadline_date';
116 return $input->section(
117 [
'prg_deadline' => $sg->withValue($deadline)],
118 $lng->
txt(
'prg_deadline_settings')
120 ->withAdditionalTransformation($refinery->custom()->transformation(
function ($vals) {
124 if (isset($vals[
'prg_deadline'][1][
'deadline_period'])) {
125 $period = (int) $vals[
'prg_deadline'][1][
'deadline_period'];
128 if (isset($vals[
'prg_deadline'][1][
'deadline_date'])) {
129 $date =
new DateTime($vals[
'prg_deadline'][1][
'deadline_date']);
withDeadlinePeriod(?int $deadline_period)
__construct(?int $deadline_period, ?DateTime $deadline_date)
toFormInput(Field\Factory $input, \ilLanguage $lng, Refinery $refinery, Factory $data_factory)
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...
withDeadlineDate(?DateTime $deadline_date)