19 declare(strict_types=1);
42 string $a_postvar =
"" 46 $this->
lng = $DIC->language();
51 public function setDays(
int $a_days): void
53 $this->days = $a_days;
63 $this->hours = $a_hours;
73 $this->minutes = $a_minutes;
83 $this->seconds = $a_seconds;
88 $this->months = $a_months;
103 $this->showmonths = $a_show_months;
113 $this->showdays = $a_showdays;
123 $this->showhours = $a_showhours;
133 $this->showminutes = $a_showminutes;
143 $this->showseconds = $a_showseconds;
153 $values = ($a_values[$this->
getPostVar()] ?? []);
154 $value_or_zero = fn($part) => array_key_exists($part, $values ?? []) ? (
int) $values[$part] : 0;
156 $this->
setDays($value_or_zero(
"dd"));
157 $this->
setHours($value_or_zero(
"hh"));
185 $tpl =
new ilTemplate(
"tpl.prop_duration.html",
true,
true,
"components/ILIAS/Form");
188 $tpl->setCurrentBlock(
"dur_months");
189 $tpl->setVariable(
"TXT_MONTHS",
$lng->
txt(
"form_months"));
191 for ($i = 0; $i <= 36; $i++) {
208 $tpl->parseCurrentBlock();
211 $tpl->setCurrentBlock(
"dur_days");
212 $tpl->setVariable(
"TXT_DAYS",
$lng->
txt(
"form_days"));
214 for ($i = 0; $i <= 366; $i++) {
231 $tpl->parseCurrentBlock();
234 $tpl->setCurrentBlock(
"dur_hours");
235 $tpl->setVariable(
"TXT_HOURS",
$lng->
txt(
"form_hours"));
237 for ($i = 0; $i <= 23; $i++) {
254 $tpl->parseCurrentBlock();
257 $tpl->setCurrentBlock(
"dur_minutes");
258 $tpl->setVariable(
"TXT_MINUTES",
$lng->
txt(
"form_minutes"));
260 for ($i = 0; $i <= 59; $i++) {
277 $tpl->parseCurrentBlock();
280 $tpl->setCurrentBlock(
"dur_seconds");
281 $tpl->setVariable(
"TXT_SECONDS",
$lng->
txt(
"form_seconds"));
283 for ($i = 0; $i <= 59; $i++) {
300 $tpl->parseCurrentBlock();
320 return serialize(
$data);
325 $data = unserialize($a_data);
338 $value += $this->
getMonths() * 30 * 24 * 60 * 60;
341 $value += $this->
getDays() * 24 * 60 * 60;
344 $value += $this->
getHours() * 60 * 60;
358 $value_or_zero = fn($part) => array_key_exists($part, $values ?? []) ? (
int) $values[$part] : 0;
361 $value += $value_or_zero(
"MM") * 30 * 24 * 60 * 60;
364 $value += $value_or_zero(
"dd") * 24 * 60 * 60;
367 $value += $value_or_zero(
"hh") * 60 * 60;
370 $value += $value_or_zero(
"mm") * 60;
373 $value += $value_or_zero(
"ss");
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
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...
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)