ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 21 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 74 of file class.ilADTEnum.php.

74 : ?bool
75 {
76 if ($this->getDefinition()->isComparableTo($a_adt)) {
77 return ($this->getSelection() === $a_adt->getSelection());
78 }
79 return null;
80 }
getDefinition()
Get definition.

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

111 : ?stdClass
112 {
113 if (!$this->isNull()) {
114 $obj = new stdClass();
115 $obj->value = $this->getSelection();
116 return $obj;
117 }
118 return null;
119 }
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 101 of file class.ilADTEnum.php.

101 : ?string
102 {
103 if (!$this->isNull()) {
104 return (string) $this->getSelection();
105 }
106 return null;
107 }

References getSelection(), and isNull().

+ Here is the call graph for this function:

◆ getSelection()

ilADTEnum::getSelection ( )
Returns
mixed

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

62 {
63 return $this->value;
64 }

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

121 : void
122 {
123 if (is_object($a_std)) {
124 $this->setSelection($a_std->value);
125 }
126 }
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 82 of file class.ilADTEnum.php.

82 : ?bool
83 {
84 return null;
85 }

◆ isNull()

ilADTEnum::isNull ( )

Is currently null.

Returns
bool | null

Reimplemented from ilADT.

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

94 : bool
95 {
96 return $this->getSelection() === null;
97 }

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

87 : ?bool
88 {
89 return null;
90 }

◆ 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 28 of file class.ilADTEnum.php.

28 : bool
29 {
30 return ($a_def instanceof ilADTEnumDefinition);
31 }

◆ isValidOption()

ilADTEnum::isValidOption (   $a_value)

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

66 : bool
67 {
68 $a_value = $this->handleSelectionValue($a_value);
69 return array_key_exists($a_value, $this->getDefinition()->getOptions());
70 }
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 33 of file class.ilADTEnum.php.

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

◆ setSelection()

ilADTEnum::setSelection (   $a_value = null)

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

48 {
49 if ($a_value !== null) {
50 $a_value = $this->handleSelectionValue($a_value);
51 if (!$this->isValidOption($a_value)) {
52 $a_value = null;
53 }
54 }
55 $this->value = $a_value;
56 }
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 26 of file class.ilADTEnum.php.

Referenced by getSelection().


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