ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilADTFloatDefinition Class Reference
+ Inheritance diagram for ilADTFloatDefinition:
+ Collaboration diagram for ilADTFloatDefinition:

Public Member Functions

 reset ()
 
 handleNumber ($a_value)
 
 getDecimals ()
 
 setDecimals ($a_value)
 
- Public Member Functions inherited from ilADTIntegerDefinition
 handleNumber ($a_value)
 
 getMin ()
 
 setMin ($a_value)
 
 getMax ()
 
 setMax ($a_value)
 
 getSuffix ()
 
 setSuffix ($a_value)
 
 isComparableTo (ilADT $a_adt)
 
- Public Member Functions inherited from ilADTDefinition
 __construct ()
 Constructor. More...
 
 getType ()
 Get type (from class/instance) More...
 
 setAllowNull ($a_value)
 Toggle null allowed status. More...
 
 isNullAllowed ()
 Is null currently allowed. More...
 
 isComparableTo (ilADT $a_adt)
 Check if given ADT is comparable to self. More...
 

Protected Attributes

 $decimals
 
- Protected Attributes inherited from ilADTIntegerDefinition
 $min_value
 
 $max_value
 
 $suffix
 
- Protected Attributes inherited from ilADTDefinition
 $allow_null
 

Additional Inherited Members

- Protected Member Functions inherited from ilADTDefinition
 reset ()
 Init property defaults. More...
 

Detailed Description

Definition at line 5 of file class.ilADTFloatDefinition.php.

Member Function Documentation

◆ getDecimals()

ilADTFloatDefinition::getDecimals ( )

Definition at line 35 of file class.ilADTFloatDefinition.php.

References $decimals.

Referenced by handleNumber().

+ Here is the caller graph for this function:

◆ handleNumber()

ilADTFloatDefinition::handleNumber (   $a_value)

Definition at line 22 of file class.ilADTFloatDefinition.php.

References getDecimals().

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  }
+ Here is the call graph for this function:

◆ reset()

ilADTFloatDefinition::reset ( )

Definition at line 12 of file class.ilADTFloatDefinition.php.

References setDecimals().

13  {
14  parent::reset();
15 
16  $this->setDecimals(1);
17  }
+ Here is the call graph for this function:

◆ setDecimals()

ilADTFloatDefinition::setDecimals (   $a_value)

Definition at line 40 of file class.ilADTFloatDefinition.php.

Referenced by reset().

41  {
42  // max precision ?!
43  $this->decimals = max(1, abs((int)$a_value));
44  }
+ Here is the caller graph for this function:

Field Documentation

◆ $decimals

ilADTFloatDefinition::$decimals
protected

Definition at line 7 of file class.ilADTFloatDefinition.php.

Referenced by getDecimals().


The documentation for this class was generated from the following file: