ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilADTEnumDefinition Class Reference
+ Inheritance diagram for ilADTEnumDefinition:
+ Collaboration diagram for ilADTEnumDefinition:

Public Member Functions

 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 isNumeric ()
 
 setNumeric (bool $a_value)
 
 getOptions ()
 
 setOptions (array $a_values)
 
 isComparableTo (ilADT $a_adt)
 Check if given ADT is comparable to self. More...
 
 getADTInstance ()
 
- Public Member Functions inherited from ilADTDefinition
 __construct ()
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 setAllowNull (bool $a_value)
 Toggle null allowed status. More...
 
 isNullAllowed ()
 
 isComparableTo (ilADT $a_adt)
 Check if given ADT is comparable to self. More...
 

Protected Attributes

array $options = []
 
bool $numeric
 
- Protected Attributes inherited from ilADTDefinition
bool $allow_null
 

Detailed Description

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

Member Function Documentation

◆ getADTInstance()

ilADTEnumDefinition::getADTInstance ( )

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

79 : ilADTEnum
80 {
81 if ($this->isNumeric()) {
82 $class = "ilADTEnumNumeric";
83 } else {
84 $class = "ilADTEnumText";
85 }
86 return new $class($this);
87 }

References isNumeric().

+ Here is the call graph for this function:

◆ getOptions()

ilADTEnumDefinition::getOptions ( )

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

53 : array
54 {
55 return $this->options;
56 }

References $options.

◆ getType()

ilADTEnumDefinition::getType ( )

Get type (from class/instance)

Returns
string

Reimplemented from ilADTDefinition.

Definition at line 26 of file class.ilADTEnumDefinition.php.

26 : string
27 {
28 return "Enum";
29 }

◆ isComparableTo()

ilADTEnumDefinition::isComparableTo ( ilADT  $a_adt)

Check if given ADT is comparable to self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADTDefinition.

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

73 : bool
74 {
75 // has to be enum-based
76 return ($a_adt instanceof ilADTEnum);
77 }

◆ isNumeric()

ilADTEnumDefinition::isNumeric ( )

Definition at line 43 of file class.ilADTEnumDefinition.php.

43 : bool
44 {
45 return $this->numeric;
46 }

References $numeric.

Referenced by getADTInstance(), and setOptions().

+ Here is the caller graph for this function:

◆ reset()

ilADTEnumDefinition::reset ( )

Init property defaults.

Reimplemented from ilADTDefinition.

Definition at line 33 of file class.ilADTEnumDefinition.php.

33 : void
34 {
35 parent::reset();
36
37 $this->options = array();
38 $this->setNumeric(true);
39 }

References setNumeric().

+ Here is the call graph for this function:

◆ setNumeric()

ilADTEnumDefinition::setNumeric ( bool  $a_value)

Definition at line 48 of file class.ilADTEnumDefinition.php.

48 : void
49 {
50 $this->numeric = $a_value;
51 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setOptions()

ilADTEnumDefinition::setOptions ( array  $a_values)

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

59 {
60 if ($this->isNumeric()) {
61 foreach (array_keys($a_values) as $key) {
62 if (!is_numeric($key)) {
63 throw new Exception("ilADTEnum was expecting numeric option keys");
64 }
65 }
66 }
67
68 $this->options = $a_values;
69 }

References isNumeric().

+ Here is the call graph for this function:

Field Documentation

◆ $numeric

bool ilADTEnumDefinition::$numeric
protected

Definition at line 24 of file class.ilADTEnumDefinition.php.

Referenced by isNumeric().

◆ $options

array ilADTEnumDefinition::$options = []
protected

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

Referenced by getOptions().


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