ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTEnum Class Reference
+ Inheritance diagram for ilADTEnum:
+ Collaboration diagram for ilADTEnum:

Public Member Functions

 reset ()
 
 setSelection ($a_value=null)
 
 getSelection ()
 
 isValidOption ($a_value)
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 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)
 
 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)

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

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

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

◆ exportStdClass()

ilADTEnum::exportStdClass ( )

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

References getSelection(), and isNull().

95  : ?stdClass
96  {
97  if (!$this->isNull()) {
98  $obj = new stdClass();
99  $obj->value = $this->getSelection();
100  return $obj;
101  }
102  return null;
103  }
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTEnum::getCheckSum ( )

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

References getSelection(), and isNull().

85  : ?string
86  {
87  if (!$this->isNull()) {
88  return (string) $this->getSelection();
89  }
90  return null;
91  }
+ Here is the call graph for this function:

◆ getSelection()

ilADTEnum::getSelection ( )
Returns
mixed

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

References $value.

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

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

◆ handleSelectionValue()

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

Referenced by isValidOption(), reset(), and setSelection().

+ Here is the caller graph for this function:

◆ importStdClass()

ilADTEnum::importStdClass ( ?stdClass  $a_std)

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

References setSelection().

105  : void
106  {
107  if (is_object($a_std)) {
108  $this->setSelection($a_std->value);
109  }
110  }
setSelection($a_value=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTEnum::isLarger ( ilADT  $a_adt)

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

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

◆ isNull()

ilADTEnum::isNull ( )

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

References getSelection().

Referenced by exportStdClass(), and getCheckSum().

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

◆ isSmaller()

ilADTEnum::isSmaller ( ilADT  $a_adt)

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

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

◆ isValidDefinition()

ilADTEnum::isValidDefinition ( ilADTDefinition  $a_def)
protected

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.

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

Referenced by setSelection().

50  : bool
51  {
52  $a_value = $this->handleSelectionValue($a_value);
53  return array_key_exists($a_value, $this->getDefinition()->getOptions());
54  }
handleSelectionValue($a_value)
getDefinition()
Get definition.
Definition: class.ilADT.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilADTEnum::reset ( )

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

References handleSelectionValue().

17  : void
18  {
19  parent::reset();
20  $this->value = null;
21  }
+ Here is the call graph for this function:

◆ setSelection()

ilADTEnum::setSelection (   $a_value = null)

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

References handleSelectionValue(), and isValidOption().

Referenced by importStdClass().

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  }
handleSelectionValue($a_value)
isValidOption($a_value)
+ 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: