ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
◀ ilDoc Overview
class.ilADTFloatDefinition.php
Go to the documentation of this file.
1
<?
php
2
3
require_once
"Services/ADT/classes/Types/Integer/class.ilADTIntegerDefinition.php"
;
4
5
class
ilADTFloatDefinition
extends
ilADTIntegerDefinition
6
{
7
protected
$decimals
;
// [float]
8
9
10
// default
11
12
public
function
reset
()
13
{
14
parent::reset();
15
16
$this->
setDecimals
(1);
17
}
18
19
20
// properties
21
22
public
function
handleNumber
($a_value)
23
{
24
if
(!is_numeric($a_value))
25
{
26
$a_value = null;
27
}
28
if
($a_value !== null)
29
{
30
$a_value = round((
float
)$a_value, $this->
getDecimals
());
31
}
32
return
$a_value;
33
}
34
35
public
function
getDecimals
()
36
{
37
return
$this->decimals
;
38
}
39
40
public
function
setDecimals
($a_value)
41
{
42
// max precision ?!
43
$this->decimals = max(1, abs((
int
)$a_value));
44
}
45
}
46
47
?>
ilADTIntegerDefinition
Definition:
class.ilADTIntegerDefinition.php:3
ilADTFloatDefinition\getDecimals
getDecimals()
Definition:
class.ilADTFloatDefinition.php:35
ilADTFloatDefinition\setDecimals
setDecimals($a_value)
Definition:
class.ilADTFloatDefinition.php:40
ilADTFloatDefinition\$decimals
$decimals
Definition:
class.ilADTFloatDefinition.php:7
ilADTFloatDefinition\reset
reset()
Definition:
class.ilADTFloatDefinition.php:12
ilADTFloatDefinition
Definition:
class.ilADTFloatDefinition.php:5
php
ilADTFloatDefinition\handleNumber
handleNumber($a_value)
Definition:
class.ilADTFloatDefinition.php:22
Services
ADT
classes
Types
Float
class.ilADTFloatDefinition.php
Generated on Fri Jan 17 2025 19:01:07 for ILIAS by
1.8.13 (using
Doxyfile
)