19 declare(strict_types=1);
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();
65 $query =
"SELECT * FROM il_dcl_record_field WHERE field_id = " . $this->db->quote(
68 ) .
" AND record_id = " 70 $set = $this->db->query($query);
71 $rec = $this->db->fetchAssoc($set);
72 $this->
id = $rec[
'id'] ??
null;
82 $id = $this->db->nextId(
"il_dcl_record_field");
83 $query =
"INSERT INTO il_dcl_record_field (id, record_id, field_id) VALUES (" . $this->db->quote(
90 ) .
", " . $this->db->quote($this->
getField()->
getId(),
"text") .
")";
91 $this->db->manipulate($query);
101 $datatype = $this->
getField()->getDatatype();
102 $storage_location = ($this->
getField()->getStorageLocationOverride() !==
null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
104 if ($storage_location != 0) {
105 $query =
"DELETE FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = " 107 $this->db->manipulate($query);
109 $next_id = $this->db->nextId(
"il_dcl_stloc" . $storage_location .
"_value");
113 if (empty($this->
getId())) {
118 'value' => [$this->getDbType($storage_location),
$value],
123 $this->db->insert(
"il_dcl_stloc" . $storage_location .
"_value", $insert_params);
127 private function getDBType(
int $storage_location): string
129 switch ($storage_location) {
144 public function delete():
void 146 $datatype = $this->
getField()->getDatatype();
147 $storage_location = ($this->
getField()->getStorageLocationOverride() !==
null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
149 if ($storage_location != 0) {
150 $query =
"DELETE FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = " 151 . $this->db->quote($this->
id,
"integer");
152 $this->db->manipulate($query);
155 $query2 =
"DELETE FROM il_dcl_record_field WHERE id = " . $this->db->quote($this->
id,
"integer");
156 $this->db->manipulate($query2);
190 $deserialize = json_decode((
string)
$value,
true);
191 if (is_array($deserialize)) {
206 if (!$omit_parsing) {
209 if ($tmp !==
false) {
244 return (
string) $excel->
getCell($row, $col);
297 $confirmation->
addHiddenItem(
'field_' . $this->field->getId() .
"[$key]", (string)
$value);
317 if ($this->value ===
null) {
318 $datatype = $this->
getField()->getDatatype();
320 $storage_location = ($this->
getField()->getStorageLocationOverride() !==
null) ? $this->
getField()->getStorageLocationOverride() : $datatype->getStorageLocation();
321 if ($storage_location != 0) {
322 $query =
"SELECT * FROM il_dcl_stloc" . $storage_location .
"_value WHERE record_field_id = " 323 . $this->db->quote($this->
id,
"integer");
325 $set = $this->db->query($query);
326 $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)
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
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
parseExportValue($value)
Function to parse incoming data from form input value $value.
setRecordRepresentation(ilDclBaseRecordRepresentation $record_representation)
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
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)