ILIAS  release_8 Revision v8.24
ilADTInteger 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 ilADTInteger:
+ Collaboration diagram for ilADTInteger:

Public Member Functions

 reset ()
 Init property defaults. More...
 
 setNumber ($a_value=null)
 
 getNumber ()
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 
- 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)
 Check if definition is valid for ADT. More...
 
- 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

int $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.ilADTInteger.php.

Member Function Documentation

◆ equals()

ilADTInteger::equals ( ilADT  $a_adt)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool|null

Reimplemented from ilADT.

Definition at line 57 of file class.ilADTInteger.php.

57 : ?bool
58 {
59 if ($this->getDefinition()->isComparableTo($a_adt)) {
60 return ($this->getNumber() == $a_adt->getNumber());
61 }
62 return null;
63 }
getDefinition()
Get definition.
Definition: class.ilADT.php:92

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTInteger::exportStdClass ( )

Export value as stdClass.

Returns
stdClass | null

Reimplemented from ilADT.

Definition at line 118 of file class.ilADTInteger.php.

118 : ?stdClass
119 {
120 if (!$this->isNull()) {
121 $obj = new stdClass();
122 $obj->value = $this->getNumber();
123 return $obj;
124 }
125 return null;
126 }
isNull()
Is currently null.

References getNumber(), and isNull().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTInteger::getCheckSum ( )

Get unique checksum.

Returns
string | null

Reimplemented from ilADT.

Definition at line 108 of file class.ilADTInteger.php.

108 : ?string
109 {
110 if (!$this->isNull()) {
111 return (string) $this->getNumber();
112 }
113 return null;
114 }

References getNumber(), and isNull().

+ Here is the call graph for this function:

◆ getNumber()

ilADTInteger::getNumber ( )

Definition at line 50 of file class.ilADTInteger.php.

50 : ?int
51 {
52 return $this->value;
53 }

References $value.

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

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTInteger::importStdClass ( ?stdClass  $a_std)

Import value from stdClass.

Parameters
stdClass  |  null$a_std

Reimplemented from ilADT.

Definition at line 128 of file class.ilADTInteger.php.

128 : void
129 {
130 if (is_object($a_std)) {
131 $this->setNumber($a_std->value);
132 }
133 }
setNumber($a_value=null)

References setNumber().

+ Here is the call graph for this function:

◆ isLarger()

ilADTInteger::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 65 of file class.ilADTInteger.php.

65 : ?bool
66 {
67 if ($this->getDefinition()->isComparableTo($a_adt)) {
68 return ($this->getNumber() > $a_adt->getNumber());
69 }
70 return null;
71 }

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

+ Here is the call graph for this function:

◆ isNull()

ilADTInteger::isNull ( )

Is currently null.

Returns
bool | null

Reimplemented from ilADT.

Definition at line 83 of file class.ilADTInteger.php.

83 : bool
84 {
85 return $this->getNumber() === null;
86 }

References getNumber().

Referenced by exportStdClass(), and getCheckSum().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTInteger::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool | null

Reimplemented from ilADT.

Definition at line 73 of file class.ilADTInteger.php.

73 : ?bool
74 {
75 if ($this->getDefinition()->isComparableTo($a_adt)) {
76 return ($this->getNumber() < $a_adt->getNumber());
77 }
78 return null;
79 }

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

+ Here is the call graph for this function:

◆ isValid()

ilADTInteger::isValid ( )

Reimplemented from ilADT.

Definition at line 88 of file class.ilADTInteger.php.

88 : bool
89 {
90 $valid = parent::isValid();
91 $num = $this->getNumber();
92 if ($num !== null) {
93 $min = $this->getDefinition()->getMin();
94 if ($min !== null && $num < $min) {
95 $this->addValidationError(self::ADT_VALIDATION_ERROR_MIN);
96 $valid = false;
97 }
98
99 $max = $this->getDefinition()->getMax();
100 if ($max !== null && $num > $max) {
101 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX);
102 $valid = false;
103 }
104 }
105 return $valid;
106 }
addValidationError(string $a_error_code)
$valid

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

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTInteger::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Parameters
ilADTDefinition$a_def
Returns
bool

Reimplemented from ilADT.

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

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

◆ reset()

ilADTInteger::reset ( )

Init property defaults.

Reimplemented from ilADT.

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

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

◆ setNumber()

ilADTInteger::setNumber (   $a_value = null)

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

42 {
43 if ($a_value !== null) {
44 $this->value = $this->getDefinition()->handleNumber((int) $a_value);
45 } else {
46 $this->value = null;
47 }
48 }

References ilADT\getDefinition().

Referenced by importStdClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $value

int ilADTInteger::$value
protected

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

Referenced by getNumber().


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