ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilADTMultiEnumDefinition.php
Go to the documentation of this file.
1 <?php
2 
4 {
5  protected $options = []; // [array]
6  protected $numeric; // [bool]
7 
8 
9  // default
10 
11  public function reset()
12  {
13  parent::reset();
14 
15  $this->options = array();
16  $this->setNumeric(true);
17  }
18 
19 
20  // properties
21 
22  public function getOptions()
23  {
24  return $this->options;
25  }
26 
27  public function setOptions(array $a_values)
28  {
29  if ($this->isNumeric()) {
30  foreach (array_keys($a_values) as $key) {
31  if (!is_numeric($key)) {
32  throw new Exception("ilADTMultiEnum was expecting numeric option keys");
33  }
34  }
35  }
36 
37  $this->options = $a_values;
38  }
39 
40  public function isNumeric()
41  {
42  return $this->numeric;
43  }
44 
45  public function setNumeric($a_value)
46  {
47  $this->numeric = $a_value;
48  }
49 
50 
51  // comparison
52 
53  public function isComparableTo(ilADT $a_adt)
54  {
55  // has to be text-based
56  return ($a_adt instanceof ilADTMultiEnum);
57  }
58 
59 
60  // ADT instance
61 
62  public function getADTInstance()
63  {
64  if ($this->isNumeric()) {
65  $class = "ilADTMultiEnumNumeric";
66  } else {
67  $class = "ilADTMultiEnumText";
68  }
69  include_once "Services/ADT/classes/Types/MultiEnum/class.ilADTMultiEnum.php";
70  include_once "Services/ADT/classes/Types/MultiEnum/class." . $class . ".php";
71  return new $class($this);
72  }
73 }
ADT base class.
Definition: class.ilADT.php:11
Create styles array
The data for the language used.
ADT definition base class.
$key
Definition: croninfo.php:18