ILIAS  release_4-4 Revision
class.ilDataCollectionFieldProp.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
16 {
17  protected $id; // [int]
18  protected $datatype_property_id; //[int]
19  protected $value; //[string]
20  protected $field_id; // [int]
21 
22 
29  public function __construct($a_id = 0)
30  {
31  if ($a_id != 0)
32  {
33  $this->id = $a_id;
34  $this->doRead();
35  }
36  }
37 
43  public function setId($a_id)
44  {
45  $this->id = $a_id;
46  }
47 
53  public function getId()
54  {
55  return $this->id;
56  }
57 
63  public function setDatatypePropertyId($a_id)
64  {
65  $this->datatype_property_id = $a_id;
66  }
67 
73  public function getDatatypePropertyId()
74  {
76  }
77 
83  public function setValue($a_value)
84  {
85  $this->value = $a_value;
86  }
87 
93  public function getValue()
94  {
95  return $this->value;
96  }
97 
103  public function setFieldId($a_id)
104  {
105  $this->field_id = $a_id;
106  }
107 
113  public function getFieldId()
114  {
115  return $this->field_id;
116  }
117 
118 
122  public function doRead()
123  {
124  global $ilDB;
125 
126  $query = "SELECT * FROM il_dcl_field_prop WHERE id = ".$ilDB->quote($this->getId(),"integer");
127  $set = $ilDB->query($query);
128  $rec = $ilDB->fetchAssoc($set);
129 
130  $this->setDatatypePropertyId($rec["property_id"]);
131  $this->setValue($rec["value"]);
132  $this->setFieldId($rec["field_id"]);
133 
134  }
135 
136 
140  public function doCreate()
141  {
142  global $ilDB;
143 
144  $id = $ilDB->nextId("il_dcl_field_prop");
145  $this->setId($id);
146  $query = "INSERT INTO il_dcl_field_prop (".
147  "id".
148  ", datatype_prop_id".
149  ", field_id".
150  ", value".
151  " ) VALUES (".
152  $ilDB->quote($this->getId(), "integer")
153  .",".$ilDB->quote($this->getDatatypePropertyId(), "integer")
154  .",".$ilDB->quote($this->getFieldId(), "integer")
155  .",".$ilDB->quote($this->getValue(), "text")
156  .")";
157  $ilDB->manipulate($query);
158  }
159 
160 
164  public function doUpdate()
165  {
166  global $ilDB;
167 
168  $ilDB->update("il_dcl_field_prop", array(
169  "datatype_prop_id" => array("integer", $this->getDatatypePropertyId()),
170  "field_id" => array("integer", $this->getFieldId()),
171  "value" => array("text", $this->getValue())
172  ), array(
173  "datatype_prop_id" => array("integer", $this->getDatatypePropertyId()),
174  "field_id" => array("integer", $this->getFieldId())
175  ));
176  }
177 }
178 
179 
180 ?>
Class ilDataCollectionFieldProp.
doCreate()
Create new field property.
setDatatypePropertyId($a_id)
Set property id.