20 declare(strict_types=1);
24 protected ?
int $id = null;
48 $this->
ctrl = $DIC->ctrl();
49 $this->
user = $DIC->user();
50 $this->db = $DIC->database();
51 $this->
lng = $DIC->language();
52 $this->
http = $DIC->http();
66 $query =
"SELECT * FROM il_dcl_record_field WHERE field_id = " . $this->db->quote(
69 ) .
" AND record_id = " 71 $set = $this->db->query($query);
72 $rec = $this->db->fetchAssoc($set);
73 $this->
id = $rec[
'id'] ?? null;
83 $id = $this->db->nextId(
"il_dcl_record_field");
84 $query =
"INSERT INTO il_dcl_record_field (id, record_id, field_id) VALUES (" . $this->db->quote(
91 ) .
", " . $this->db->quote($this->
getField()->
getId(),
"text") .
")";
92 $this->db->manipulate($query);
102 $datatype = $this->
getField()->getDatatype();
103 $storage_location = ($this->
getField()->getStorageLocationOverride() !== null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
105 if ($storage_location != 0) {
106 $query =
"DELETE FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = " 108 $this->db->manipulate($query);
110 $next_id = $this->db->nextId(
"il_dcl_stloc" . $storage_location .
"_value");
114 if ($this->
getId() == 0) {
119 'value' => [$this->getDbType($storage_location),
$value],
124 $this->db->insert(
"il_dcl_stloc" . $storage_location .
"_value", $insert_params);
128 private function getDBType(
int $storage_location): string
130 switch ($storage_location) {
145 public function delete():
void 147 $datatype = $this->
getField()->getDatatype();
148 $storage_location = ($this->
getField()->getStorageLocationOverride() !== null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
150 if ($storage_location != 0) {
151 $query =
"DELETE FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = " 152 . $this->db->quote($this->
id,
"integer");
153 $this->db->manipulate($query);
156 $query2 =
"DELETE FROM il_dcl_record_field WHERE id = " . $this->db->quote($this->
id,
"integer");
157 $this->db->manipulate($query2);
191 $deserialize = json_decode((
string)
$value,
true);
192 if (is_array($deserialize)) {
207 if (!$omit_parsing) {
210 if ($tmp !==
false) {
245 return (
string) $excel->
getCell($row, $col);
298 $confirmation->
addHiddenItem(
'field_' . $this->field->getId() .
"[$key]", (string)
$value);
318 if ($this->value === null) {
319 $datatype = $this->
getField()->getDatatype();
321 $storage_location = ($this->
getField()->getStorageLocationOverride() !== null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
322 if ($storage_location != 0) {
323 $query =
"SELECT * FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = " 324 . $this->db->quote($this->
id,
"integer");
326 $set = $this->db->query($query);
327 $rec = $this->db->fetchAssoc($set);
parseValue($value)
Function to parse incoming data from form input value $value.
ILIAS HTTP Services $http
setValueFromForm(ilPropertyFormGUI $form)
ilDclBaseRecordRepresentation $record_representation
fillExcelExport(ilExcel $worksheet, int &$row, int &$col)
setValue($value, bool $omit_parsing=false)
Set value for record field.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
addHiddenItem(string $a_post_var, string $a_value)
doRead()
Read object data from database.
getValueFromExcel(ilExcel $excel, int $row, int $col)
doCreate()
Creates an Id and a database entry.
cloneStructure(ilDclBaseRecordFieldModel $old_record_field)
deserializeData($value)
Deserialize data before applying to field.
ilDclBaseFieldRepresentation $field_representation
parseExportValue($value)
Function to parse incoming data from form input value $value.
setRecordRepresentation(ilDclBaseRecordRepresentation $record_representation)
static http()
Fetches the global http state from ILIAS.
addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation)
doUpdate()
Update object in database.
setFieldRepresentation(ilDclBaseFieldRepresentation $field_representation)
parseSortingValue($value, bool $link=true)
Returns sortable value for the specific field-types.
serializeData($value)
Serialize data before storing to db.
getCell(int $a_row, int $a_col)
Returns the value of a cell.
loadValue()
Load the value.
ILIAS Refinery Factory $refinery
ilDclBaseFieldModel $field
getRecordRepresentation()
getSortingValue(bool $link=true)
ilDclBaseRecordModel $record
getDBType(int $storage_location)