ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
31  foreach(array_keys($a_values) as $key)
32  {
33  if(!is_numeric($key))
34  {
35  throw new Exception("ilADTMultiEnum was expecting numeric option keys");
36  }
37  }
38  }
39 
40  $this->options = $a_values;
41  }
42 
43  public function isNumeric()
44  {
45  return $this->numeric;
46  }
47 
48  public function setNumeric($a_value)
49  {
50  $this->numeric = $a_value;
51  }
52 
53 
54  // comparison
55 
56  public function isComparableTo(ilADT $a_adt)
57  {
58  // has to be text-based
59  return ($a_adt instanceof ilADTMultiEnum);
60  }
61 
62 
63  // ADT instance
64 
65  public function getADTInstance()
66  {
67  if($this->isNumeric())
68  {
69  $class = "ilADTMultiEnumNumeric";
70  }
71  else
72  {
73  $class = "ilADTMultiEnumText";
74  }
75  include_once "Services/ADT/classes/Types/MultiEnum/class.ilADTMultiEnum.php";
76  include_once "Services/ADT/classes/Types/MultiEnum/class.".$class.".php";
77  return new $class($this);
78  }
79 }
80 
81 ?>
ADT base class.
Definition: class.ilADT.php:11
Create styles array
The data for the language used.
ADT definition base class.