19 declare(strict_types=1);
45 string $a_postvar =
"" 49 $this->
lng = $DIC->language();
55 $this->suffix = $a_value;
63 public function setValue(?
string $a_value): void
65 if ($a_value ==
"" || is_null($a_value)) {
69 $this->value = (float) str_replace(
',',
'.', $a_value);
73 $this->value = round($this->value);
78 $this->value = round($this->value, $this->
getDecimals());
81 $this->value = (float) number_format($this->value, $this->
getDecimals(),
".",
"");
92 $data = unserialize($a_data);
104 $this->maxlength = $a_maxlength;
136 $this->size = $a_size;
151 bool $a_display_always =
false 153 $this->minvalue = $a_minvalue;
154 $this->minvalue_visible = $a_display_always;
164 bool $a_display_always =
false 166 $this->maxvalue = $a_maxvalue;
167 $this->maxvalue_visible = $a_display_always;
177 $this->decimals = $a_decimals;
178 if ($this->decimals) {
190 $this->allow_decimals = $a_value;
207 $val = str_replace(
',',
'.', $val);
209 if ($val !=
"" && !is_numeric($val)) {
210 $this->minvalue_visible =
true;
211 $this->maxvalue_visible =
true;
219 $this->minvalue_visible =
true;
227 $this->minvalue_visible =
true;
237 $this->maxvalue_visible =
true;
245 $this->maxvalue_visible =
true;
257 if (trim($value) ==
"") {
260 return (
float) str_replace(
',',
'.', $value);
276 $tpl =
new ilTemplate(
"tpl.prop_number.html",
true,
true,
"components/ILIAS/Form");
278 if (strlen((
string) $this->
getValue())) {
279 $tpl->setCurrentBlock(
"prop_number_propval");
281 $tpl->parseCurrentBlock();
285 $tpl->setCurrentBlock(
'described_by_description');
286 $tpl->setVariable(
'DESCRIBED_BY_DESCRIPTION_FIELD_ID', $this->
getFieldId());
287 $tpl->parseCurrentBlock();
294 $constraints =
$lng->
txt(
"form_format") .
": ###." . str_repeat(
"#", $this->
getDecimals());
306 if ($constraints !==
"") {
307 $tpl->setCurrentBlock(
'described_by_constraint');
308 $tpl->setVariable(
'DESCRIBED_BY_CONSTRAINT_FIELD_ID', $this->
getFieldId());
309 $tpl->parseCurrentBlock();
312 $tpl->setCurrentBlock(
"prop_number");
314 $tpl->setVariable(
"POST_VAR", $this->
getPostVar());
316 $tpl->setVariable(
"SIZE", $this->
getSize());
319 $tpl->setVariable(
"INPUT_SUFFIX", $this->
getSuffix());
324 " disabled=\"disabled\"" 328 if ($this->client_side_validation) {
330 $tpl->setVariable(
"JS_ID", $this->
getFieldId());
333 if ($constraints !==
'') {
334 $tpl->setVariable(
"TXT_NUMBER_CONSTRAINTS", $constraints);
342 $tpl->setVariable(
"REQUIRED",
"required=\"required\"");
345 $tpl->parseCurrentBlock();
357 $this->client_side_validation = $validate;
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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)