ILIAS  release_4-4 Revision
ilDataCollectionRecordField Class Reference

Class ilDataCollectionField. More...

+ Inheritance diagram for ilDataCollectionRecordField:
+ Collaboration diagram for ilDataCollectionRecordField:

Public Member Functions

 __construct (ilDataCollectionRecord $record, ilDataCollectionField $field)
 
 doUpdate ()
 
 delete ()
 
 getValue ()
 
 setValue ($value)
 
 getFormInput ()
 
 getExportValue ()
 
 getPlainText ()
 
 getHTML ()
 
 getSingleHTML ($link=null)
 this funciton is used to in the viewdefinition of a single record. More...
 
 getField ()
 
 getId ()
 
 getRecord ()
 

Protected Member Functions

 loadValue ()
 

Protected Attributes

 $id
 
 $field
 
 $record
 
 $value
 

Private Member Functions

 doRead ()
 
 doCreate ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionRecordField::__construct ( ilDataCollectionRecord  $record,
ilDataCollectionField  $field 
)

Definition at line 31 of file class.ilDataCollectionRecordField.php.

References $field, $record, and doRead().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilDataCollectionRecordField::delete ( )

Definition at line 94 of file class.ilDataCollectionRecordField.php.

References $query.

95  {
96  global $ilDB;
97 
98  $datatype = $this->field->getDatatype();
99  $query = "DELETE FROM il_dcl_stloc".$datatype->getStorageLocation()."_value WHERE record_field_id = ".$ilDB->quote($this->id, "integer");
100  $ilDB->manipulate($query);
101 
102  $query2 = "DELETE FROM il_dcl_record_field WHERE id = ".$ilDB->quote($this->id, "integer");
103  $ilDB->manipulate($query2);
104  }

◆ doCreate()

ilDataCollectionRecordField::doCreate ( )
private

Definition at line 60 of file class.ilDataCollectionRecordField.php.

References $id, and $query.

Referenced by doRead().

61  {
62  global $ilDB;
63 
64  $id = $ilDB->nextId("il_dcl_record_field");
65  $query = "INSERT INTO il_dcl_record_field (id, record_id, field_id) VALUES (".$ilDB->quote($id, "integer").", ".$ilDB->quote($this->record->getId(), "integer").", ".$ilDB->quote($this->field->getId(), "text").")";
66  $ilDB->manipulate($query);
67  $this->id = $id;
68  }
+ Here is the caller graph for this function:

◆ doRead()

ilDataCollectionRecordField::doRead ( )
private

Definition at line 41 of file class.ilDataCollectionRecordField.php.

References $query, doCreate(), and loadValue().

Referenced by __construct().

42  {
43  global $ilDB;
44 
45  $query = "SELECT * FROM il_dcl_record_field WHERE field_id = ".$ilDB->quote($this->field->getId(), "integer")." AND record_id = ".$ilDB->quote($this->record->getId(), "integer");
46  $set = $ilDB->query($query);
47  $rec = $ilDB->fetchAssoc($set);
48  $this->id = $rec['id'];
49 
50  if($this->id == NULL)
51  {
52  $this->doCreate();
53  }
54  $this->loadValue();
55  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilDataCollectionRecordField::doUpdate ( )

Definition at line 73 of file class.ilDataCollectionRecordField.php.

References $query, and $value.

74  {
75  global $ilDB;
76 
77  //$this->loadValue(); //Removed Mantis #0011799
78  $datatype = $this->field->getDatatype();
79 
80  $query = "DELETE FROM il_dcl_stloc".$datatype->getStorageLocation()."_value WHERE record_field_id = ".$ilDB->quote($this->id, "integer");
81  $ilDB->manipulate($query);
82  $next_id = $ilDB->nextId("il_dcl_stloc".$datatype->getStorageLocation()."_value");
83 
84  $ilDB->insert("il_dcl_stloc".$datatype->getStorageLocation()."_value",
85  array("value" => array($datatype->getDbType(), $this->value),
86  "record_field_id " => array("integer", $this->id),
87  "id" => array("integer", $next_id))
88  );
89  }

◆ getExportValue()

ilDataCollectionRecordField::getExportValue ( )

Definition at line 152 of file class.ilDataCollectionRecordField.php.

References getValue().

Referenced by getPlainText().

153  {
154  $datatype = $this->field->getDatatype();
155 
156  return $datatype->parseExportValue($this->getValue());
157  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getField()

◆ getFormInput()

ilDataCollectionRecordField::getFormInput ( )

Definition at line 142 of file class.ilDataCollectionRecordField.php.

References getValue().

143  {
144  $datatype = $this->field->getDatatype();
145 
146  return $datatype->parseFormInput($this->getValue(), $this);
147  }
+ Here is the call graph for this function:

◆ getHTML()

ilDataCollectionRecordField::getHTML ( )

Definition at line 169 of file class.ilDataCollectionRecordField.php.

References getValue().

Referenced by getSingleHTML().

170  {
171  $datatype = $this->field->getDatatype();
172  return $datatype->parseHTML($this->getValue(), $this);
173  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

◆ getPlainText()

ilDataCollectionRecordField::getPlainText ( )
Returns
mixed used for the sorting.

Definition at line 162 of file class.ilDataCollectionRecordField.php.

References getExportValue().

162  {
163  return $this->getExportValue();
164  }
+ Here is the call graph for this function:

◆ getRecord()

◆ getSingleHTML()

ilDataCollectionRecordField::getSingleHTML (   $link = null)

this funciton is used to in the viewdefinition of a single record.

By default it returns the getHTML methods return.

Returns
mixed

Definition at line 179 of file class.ilDataCollectionRecordField.php.

References getHTML().

179  {
180  return $this->getHTML($link);
181  }
+ Here is the call graph for this function:

◆ getValue()

◆ loadValue()

ilDataCollectionRecordField::loadValue ( )
protected

Definition at line 186 of file class.ilDataCollectionRecordField.php.

References $query.

Referenced by doRead(), getValue(), and setValue().

187  {
188  if($this->value === NULL)
189  {
190  global $ilDB;
191  $datatype = $this->field->getDatatype();
192  $query = "SELECT * FROM il_dcl_stloc".$datatype->getStorageLocation()."_value WHERE record_field_id = ".$ilDB->quote($this->id, "integer");
193  $set = $ilDB->query($query);
194  $rec = $ilDB->fetchAssoc($set);
195  $this->value = $rec['value'];
196  }
197  }
+ Here is the caller graph for this function:

◆ setValue()

ilDataCollectionRecordField::setValue (   $value)

Definition at line 119 of file class.ilDataCollectionRecordField.php.

References $value, ilDataCollectionDatatype\INPUTFORMAT_FILE, and loadValue().

120  {
121  $type = $this->field->getDatatype()->getId();
122  $this->loadValue();
123  $tmp = $this->field->getDatatype()->parseValue($value, $this);
124  $old = $this->value;
125 
126  //if parse value fails keep the old value
127 // if($tmp !== null) // $tmp can be null to store NULL values in DB
128  if ($tmp !== false)
129  {
130  $this->value = $tmp;
131  //delete old file from filesystem
132  if($old && $this->field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE)
133  {
134  $this->record->deleteFile($old);
135  }
136  }
137  }
+ Here is the call graph for this function:

Field Documentation

◆ $field

ilDataCollectionRecordField::$field
protected

Definition at line 24 of file class.ilDataCollectionRecordField.php.

Referenced by __construct(), and getField().

◆ $id

ilDataCollectionRecordField::$id
protected

◆ $record

ilDataCollectionRecordField::$record
protected

Definition at line 25 of file class.ilDataCollectionRecordField.php.

Referenced by __construct(), and getRecord().

◆ $value


The documentation for this class was generated from the following file: