19declare(strict_types=1);
23 protected ?
int $id =
null;
47 $this->
ctrl = $DIC->ctrl();
48 $this->
user = $DIC->user();
49 $this->db =
$DIC->database();
50 $this->
lng = $DIC->language();
51 $this->
http = $DIC->http();
70 $query =
"SELECT * FROM il_dcl_record_field WHERE field_id = " . $this->db->quote(
73 ) .
" AND record_id = "
75 $set = $this->db->query($query);
76 $rec = $this->db->fetchAssoc($set);
77 $this->
id = $rec[
'id'] ??
null;
87 $id = $this->db->nextId(
"il_dcl_record_field");
88 $query =
"INSERT INTO il_dcl_record_field (id, record_id, field_id) VALUES (" . $this->db->quote(
95 ) .
", " . $this->db->quote($this->
getField()->
getId(),
"text") .
")";
96 $this->db->manipulate($query);
106 $datatype = $this->
getField()->getDatatype();
107 $storage_location = ($this->
getField()->getStorageLocationOverride() !==
null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
109 if ($storage_location != 0) {
110 $query =
"DELETE FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = "
112 $this->db->manipulate($query);
114 $next_id = $this->db->nextId(
"il_dcl_stloc" . $storage_location .
"_value");
118 if (empty($this->
getId())) {
123 'value' => [$this->getDbType($storage_location),
$value],
128 $this->db->insert(
"il_dcl_stloc" . $storage_location .
"_value", $insert_params);
132 private function getDBType(
int $storage_location): string
134 switch ($storage_location) {
142 throw new InvalidArgumentException(
'Unsupported storage_location: ' . $storage_location);
149 public function delete():
void
151 $datatype = $this->
getField()->getDatatype();
152 $storage_location = ($this->
getField()->getStorageLocationOverride() !==
null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
154 if ($storage_location != 0) {
155 $query =
"DELETE FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = "
156 . $this->db->quote($this->
id,
"integer");
157 $this->db->manipulate($query);
160 $query2 =
"DELETE FROM il_dcl_record_field WHERE id = " . $this->db->quote($this->
id,
"integer");
161 $this->db->manipulate($query2);
195 $deserialize = json_decode((
string)
$value,
true);
196 if (is_array($deserialize)) {
211 if (!$omit_parsing) {
214 if ($tmp !==
false) {
249 return (
string) $excel->
getCell($row, $col);
298 $confirmation->
addHiddenItem(
'field_' . $this->field->getId(), (
string) $this->getValue());
301 $confirmation->
addHiddenItem(
'field_' . $this->field->getId() .
"[$key]", (
string)
$value);
321 if ($this->value ===
null) {
322 $datatype = $this->
getField()->getDatatype();
324 $storage_location = ($this->
getField()->getStorageLocationOverride() !==
null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
325 if ($storage_location != 0) {
326 $query =
"SELECT * FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = "
327 . $this->db->quote($this->
id,
"integer");
329 $set = $this->db->query($query);
330 $rec = $this->db->fetchAssoc($set);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHiddenItem(string $a_post_var, string $a_value)
Class ilCtrl provides processing control methods.
getSortingValue(bool $link=true)
ilDclBaseFieldModel $field
addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation)
getValueFromExcel(ilExcel $excel, int $row, int $col)
ilDclBaseRecordRepresentation $record_representation
getRecordRepresentation()
getDBType(int $storage_location)
ILIAS Refinery Factory $refinery
setValue($value, bool $omit_parsing=false)
Set value for record field.
deserializeData($value)
Deserialize data before applying to field.
setValueFromForm(ilPropertyFormGUI $form)
fillExcelExport(ilExcel $worksheet, int &$row, int &$col)
parseValue($value)
Function to parse incoming data from form input value $value.
parseExportValue($value)
Function to parse incoming data from form input value $value.
ilDclBaseRecordModel $record
ilDclBaseFieldRepresentation $field_representation
setRecordRepresentation(ilDclBaseRecordRepresentation $record_representation)
doCreate()
Creates an Id and a database entry.
doUpdate()
Update object in database.
serializeData($value)
Serialize data before storing to db.
doRead()
Read object data from database.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
parseSortingValue($value, bool $link=true)
Returns sortable value for the specific field-types.
ILIAS HTTP Services $http
cloneStructure(ilDclBaseRecordFieldModel $old_record_field)
loadValue()
Load the value.
setFieldRepresentation(ilDclBaseFieldRepresentation $field_representation)
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
getCell(int $a_row, int $a_col)
Returns the value of a cell.
static http()
Fetches the global http state from ILIAS.