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

Public Member Functions

 getType ()
 
 reset ()
 
 isNumeric ()
 
 setNumeric (bool $a_value)
 
 getOptions ()
 
 setOptions (array $a_values)
 
 isComparableTo (ilADT $a_adt)
 
 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.

References isNumeric().

79  : ilADTEnum
80  {
81  if ($this->isNumeric()) {
82  $class = "ilADTEnumNumeric";
83  } else {
84  $class = "ilADTEnumText";
85  }
86  return new $class($this);
87  }
+ Here is the call graph for this function:

◆ getOptions()

ilADTEnumDefinition::getOptions ( )

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

References $options.

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

◆ getType()

ilADTEnumDefinition::getType ( )

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

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

◆ isComparableTo()

ilADTEnumDefinition::isComparableTo ( ilADT  $a_adt)

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.

References $numeric.

Referenced by getADTInstance(), and setOptions().

43  : bool
44  {
45  return $this->numeric;
46  }
+ Here is the caller graph for this function:

◆ reset()

ilADTEnumDefinition::reset ( )

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

References setNumeric().

33  : void
34  {
35  parent::reset();
36 
37  $this->options = array();
38  $this->setNumeric(true);
39  }
+ Here is the call graph for this function:

◆ setNumeric()

ilADTEnumDefinition::setNumeric ( bool  $a_value)

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

Referenced by reset().

48  : void
49  {
50  $this->numeric = $a_value;
51  }
+ Here is the caller graph for this function:

◆ setOptions()

ilADTEnumDefinition::setOptions ( array  $a_values)

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

References isNumeric().

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  }
+ 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: