ILIAS  release_8 Revision v8.24
ilADTEnum Class Reference
+ Inheritance diagram for ilADTEnum:
+ Collaboration diagram for ilADTEnum:

Public Member Functions

 reset ()
 Init property defaults. More...
 
 setSelection ($a_value=null)
 
 getSelection ()
 
 isValidOption ($a_value)
 
 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...
 
 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...
 
 handleSelectionValue ($a_value)
 
- 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

 $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

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

Member Function Documentation

◆ equals()

ilADTEnum::equals ( ilADT  $a_adt)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool|null

Reimplemented from ilADT.

Definition at line 58 of file class.ilADTEnum.php.

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

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

+ Here is the call graph for this function:

◆ exportStdClass()

ilADTEnum::exportStdClass ( )

Export value as stdClass.

Returns
stdClass | null

Reimplemented from ilADT.

Definition at line 95 of file class.ilADTEnum.php.

95 : ?stdClass
96 {
97 if (!$this->isNull()) {
98 $obj = new stdClass();
99 $obj->value = $this->getSelection();
100 return $obj;
101 }
102 return null;
103 }
isNull()
Is currently null.

References getSelection(), and isNull().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTEnum::getCheckSum ( )

Get unique checksum.

Returns
string | null

Reimplemented from ilADT.

Definition at line 85 of file class.ilADTEnum.php.

85 : ?string
86 {
87 if (!$this->isNull()) {
88 return (string) $this->getSelection();
89 }
90 return null;
91 }

References getSelection(), and isNull().

+ Here is the call graph for this function:

◆ getSelection()

ilADTEnum::getSelection ( )
Returns
mixed

Definition at line 45 of file class.ilADTEnum.php.

46 {
47 return $this->value;
48 }

References $value.

Referenced by equals(), exportStdClass(), getCheckSum(), and isNull().

+ Here is the caller graph for this function:

◆ handleSelectionValue()

ilADTEnum::handleSelectionValue (   $a_value)
abstractprotected
Parameters
string | int$a_value
Returns
string|int

Reimplemented in ilADTEnumNumeric, and ilADTEnumText.

Referenced by isValidOption(), and setSelection().

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTEnum::importStdClass ( ?stdClass  $a_std)

Import value from stdClass.

Parameters
stdClass  |  null$a_std

Reimplemented from ilADT.

Definition at line 105 of file class.ilADTEnum.php.

105 : void
106 {
107 if (is_object($a_std)) {
108 $this->setSelection($a_std->value);
109 }
110 }
setSelection($a_value=null)

References setSelection().

+ Here is the call graph for this function:

◆ isLarger()

ilADTEnum::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 66 of file class.ilADTEnum.php.

66 : ?bool
67 {
68 return null;
69 }

◆ isNull()

ilADTEnum::isNull ( )

Is currently null.

Returns
bool | null

Reimplemented from ilADT.

Definition at line 78 of file class.ilADTEnum.php.

78 : bool
79 {
80 return $this->getSelection() === null;
81 }

References getSelection().

Referenced by exportStdClass(), and getCheckSum().

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

◆ isSmaller()

ilADTEnum::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 71 of file class.ilADTEnum.php.

71 : ?bool
72 {
73 return null;
74 }

◆ isValidDefinition()

ilADTEnum::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Parameters
ilADTDefinition$a_def
Returns
bool

Reimplemented from ilADT.

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

12 : bool
13 {
14 return ($a_def instanceof ilADTEnumDefinition);
15 }

◆ isValidOption()

ilADTEnum::isValidOption (   $a_value)

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

50 : bool
51 {
52 $a_value = $this->handleSelectionValue($a_value);
53 return array_key_exists($a_value, $this->getDefinition()->getOptions());
54 }
handleSelectionValue($a_value)

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

Referenced by setSelection().

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

◆ reset()

ilADTEnum::reset ( )

Init property defaults.

Reimplemented from ilADT.

Definition at line 17 of file class.ilADTEnum.php.

17 : void
18 {
19 parent::reset();
20 $this->value = null;
21 }

◆ setSelection()

ilADTEnum::setSelection (   $a_value = null)

Definition at line 31 of file class.ilADTEnum.php.

32 {
33 if ($a_value !== null) {
34 $a_value = $this->handleSelectionValue($a_value);
35 if (!$this->isValidOption($a_value)) {
36 $a_value = null;
37 }
38 }
39 $this->value = $a_value;
40 }
isValidOption($a_value)

References handleSelectionValue(), and isValidOption().

Referenced by importStdClass().

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

Field Documentation

◆ $value

ilADTEnum::$value
protected

Definition at line 10 of file class.ilADTEnum.php.

Referenced by getSelection().


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