3 declare(strict_types=1);
40 public function __construct(
string $a_title =
"",
string $a_postvar =
"")
44 $this->
lng->loadLanguageModule(
"meta");
45 $this->
setType(
"typical_learntime");
46 $this->
setValue(array(0, 0, 0, 0, 0));
51 $this->value = $a_value;
56 $this->lom_duration = $a_value;
62 $this->
setValue(array(0, 0, 0, 0, 0));
63 if ($a_value !==
"") {
73 $this->show_seconds = $status;
96 if ($this->
http->wrapper()->post()->has($this->
getPostVar() .
'[' . $post_name .
']')) {
97 return $this->
http->wrapper()->post()->retrieve(
108 $required_fullfilled =
false;
109 foreach ([self::POST_NAME_MONTH, self::POST_NAME_DAY, self::POST_NAME_HOUR, self::POST_NAME_MINUTE, self::POST_NAME_SECOND] as $post_name) {
112 $required_fullfilled =
true;
116 if ($this->
getRequired() && !$required_fullfilled) {
117 $this->
setAlert($this->
lng->txt(
"msg_input_is_required"));
126 for (
$i = 0;
$i <= 24;
$i++) {
127 $options[
$i] = sprintf(
'%02d',
$i);
135 for (
$i = 0;
$i <= 31;
$i++) {
136 $options[
$i] = sprintf(
'%02d',
$i);
143 $ttpl =
new ilTemplate(
"tpl.prop_typical_learning_time.html",
true,
true,
"Services/MetaData");
146 $ttpl->setVariable(
"TXT_MONTH", $this->
lng->txt(
'md_months'));
148 $ttpl->setVariable(
"SEL_DAYS", $this->
__buildDaysSelect((
string) ($val[1] ??
"")));
150 $ttpl->setVariable(
"TXT_DAYS", $this->
lng->txt(
'md_days'));
151 $ttpl->setVariable(
"TXT_TIME", $this->
lng->txt(
'md_time'));
158 (
int) ($val[2] ?? 0),
159 (
int) ($val[3] ?? 0),
160 (
int) ($val[4] ?? 0),
164 $ttpl->setVariable(
"TLT_HINT", ($val[4] ??
false) ?
'(hh:mm:ss)' :
'(hh:mm)');
167 $ttpl->setCurrentBlock(
"tlt_not_valid");
168 $ttpl->setVariable(
"TXT_CURRENT_VAL", $this->
lng->txt(
'meta_current_value'));
169 $ttpl->setVariable(
"TLT", $this->lom_duration);
170 $ttpl->setVariable(
"INFO_TLT_NOT_VALID", $this->
lng->txt(
'meta_info_tlt_not_valid'));
171 $ttpl->parseCurrentBlock();
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
static _LOMDurationToArray(string $a_string)
LOM datatype duration is a string like P2M4DT7H18M2S (2 months 4 days 7 hours 18 minutes 2 seconds) T...
static http()
Fetches the global http state from ILIAS.
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)