ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 33 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  $a_value = null;
26  }
27  if ($a_value !== null) {
28  $a_value = round((float) $a_value, $this->getDecimals());
29  }
30  return $a_value;
31  }
+ 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 38 of file class.ilADTFloatDefinition.php.

Referenced by reset().

39  {
40  // max precision ?!
41  $this->decimals = max(1, abs((int) $a_value));
42  }
+ 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: