ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilADTActiveRecordBridge.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "Services/ActiveRecord/classes/Fields/class.arField.php";
5 
14 {
15  protected $adt; // [ilADT]
16  protected $id; // [string]
17  protected $tabe; // [string]
18  protected $primary; // [array]
19 
26  public function __construct(ilADT $a_adt)
27  {
28  $this->setADT($a_adt);
29  }
30 
31 
32  //
33  // properties
34  //
35 
44  abstract protected function isValidADT(ilADT $a_adt);
45 
52  protected function setADT(ilADT $a_adt)
53  {
54  if(!$this->isValidADT($a_adt))
55  {
56  throw new Exception('ADTActiveRecordBridge Type mismatch.');
57  }
58 
59  $this->adt = $a_adt;
60  }
61 
67  public function getADT()
68  {
69  return $this->adt;
70  }
71 
77  public function setTable($a_table)
78  {
79  $this->table = (string)$a_table;
80  }
81 
87  public function getTable()
88  {
89  return $this->table;
90  }
91 
97  public function setElementId($a_value)
98  {
99  $this->id = (string)$a_value;
100  }
101 
107  public function getElementId()
108  {
109  return $this->id;
110  }
111 
117  public function setPrimary(array $a_value)
118  {
119  $this->primary = $a_value;
120  }
121 
127  public function getPrimary()
128  {
129  return $this->primary;
130  }
131 
132 
133  //
134  // active record
135  //
136 
142  abstract public function getActiveRecordFields();
143 
144 
151  abstract public function getFieldValue($a_field_name);
152 
159  abstract public function setFieldValue($a_field_name, $a_field_value);
160 }
setFieldValue($a_field_name, $a_field_value)
Set field value.
getActiveRecordFields()
Convert ADT to active record fields.
Add rich text string
The name of the decorator.
ADT base class.
Definition: class.ilADT.php:11
isValidADT(ilADT $a_adt)
Check if given ADT is valid.
setElementId($a_value)
Set element id (aka DB column[s] [prefix])
setTable($a_table)
Set table name.
Create styles array
The data for the language used.
__construct(ilADT $a_adt)
Constructor.
getFieldValue($a_field_name)
Get field value.
setPrimary(array $a_value)
Set primary fields (in MDB2 format)