ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTFloat Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilADTFloat:
+ Collaboration diagram for ilADTFloat:

Public Member Functions

 reset ()
 
 setNumber ($a_value=null)
 
 getNumber ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 isValid ()
 
 getCheckSum ()
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode (string $a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 
- Protected Member Functions inherited from ilADT
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError (string $a_error_code)
 

Protected Attributes

float $value
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $validation_errors = []
 

Additional Inherited Members

- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 21 of file class.ilADTFloat.php.

Member Function Documentation

◆ equals()

ilADTFloat::equals ( ilADT  $a_adt)

Definition at line 53 of file class.ilADTFloat.php.

References ilADT\getDefinition(), and getNumber().

53  : ?bool
54  {
55  if ($this->getDefinition()->isComparableTo($a_adt)) {
56  return ($this->getNumber() == $a_adt->getNumber());
57  }
58  return null;
59  }
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTFloat::exportStdClass ( )

Definition at line 114 of file class.ilADTFloat.php.

References getNumber(), and isNull().

114  : ?stdClass
115  {
116  if (!$this->isNull()) {
117  $obj = new stdClass();
118  $obj->value = $this->getNumber();
119  return $obj;
120  }
121  return null;
122  }
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTFloat::getCheckSum ( )

Definition at line 104 of file class.ilADTFloat.php.

References getNumber(), and isNull().

104  : ?string
105  {
106  if (!$this->isNull()) {
107  return (string) $this->getNumber();
108  }
109  return null;
110  }
+ Here is the call graph for this function:

◆ getNumber()

ilADTFloat::getNumber ( )

Definition at line 46 of file class.ilADTFloat.php.

References $value.

Referenced by equals(), exportStdClass(), getCheckSum(), isLarger(), isNull(), isSmaller(), and isValid().

46  : ?float
47  {
48  return $this->value;
49  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTFloat::importStdClass ( ?stdClass  $a_std)

Definition at line 124 of file class.ilADTFloat.php.

References setNumber().

124  : void
125  {
126  if (is_object($a_std)) {
127  $this->setNumber($a_std->value);
128  }
129  }
setNumber($a_value=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTFloat::isLarger ( ilADT  $a_adt)

Definition at line 61 of file class.ilADTFloat.php.

References ilADT\getDefinition(), and getNumber().

61  : ?bool
62  {
63  if ($this->getDefinition()->isComparableTo($a_adt)) {
64  return ($this->getNumber() > $a_adt->getNumber());
65  }
66  return null;
67  }
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ isNull()

ilADTFloat::isNull ( )

Definition at line 79 of file class.ilADTFloat.php.

References getNumber().

Referenced by exportStdClass(), and getCheckSum().

79  : bool
80  {
81  return $this->getNumber() === null;
82  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTFloat::isSmaller ( ilADT  $a_adt)

Definition at line 69 of file class.ilADTFloat.php.

References ilADT\getDefinition(), and getNumber().

69  : ?bool
70  {
71  if ($this->getDefinition()->isComparableTo($a_adt)) {
72  return ($this->getNumber() < $a_adt->getNumber());
73  }
74  return null;
75  }
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ isValid()

ilADTFloat::isValid ( )

Definition at line 84 of file class.ilADTFloat.php.

References $valid, ilADT\addValidationError(), ilADT\getDefinition(), and getNumber().

84  : bool
85  {
86  $valid = parent::isValid();
87  $num = $this->getNumber();
88  if ($num !== null) {
89  $min = $this->getDefinition()->getMin();
90  if ($min !== null && $num < $min) {
91  $this->addValidationError(self::ADT_VALIDATION_ERROR_MIN);
92  $valid = false;
93  }
94 
95  $max = $this->getDefinition()->getMax();
96  if ($max !== null && $num > $max) {
97  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX);
98  $valid = false;
99  }
100  }
101  return $valid;
102  }
addValidationError(string $a_error_code)
$valid
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTFloat::isValidDefinition ( ilADTDefinition  $a_def)
protected

Definition at line 27 of file class.ilADTFloat.php.

27  : bool
28  {
29  return $a_def instanceof ilADTFloatDefinition;
30  }

◆ reset()

ilADTFloat::reset ( )

Definition at line 32 of file class.ilADTFloat.php.

32  : void
33  {
34  parent::reset();
35 
36  $this->value = null;
37  }

◆ setNumber()

ilADTFloat::setNumber (   $a_value = null)

Definition at line 41 of file class.ilADTFloat.php.

References ilADT\getDefinition().

Referenced by importStdClass().

42  {
43  $this->value = $this->getDefinition()->handleNumber($a_value);
44  }
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $value

float ilADTFloat::$value
protected

Definition at line 23 of file class.ilADTFloat.php.

Referenced by getNumber().


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