From c381af320998e0369cf1c9ad8689ef730e9b9c15 Mon Sep 17 00:00:00 2001 From: iszmais Date: Mon, 1 Jul 2024 19:05:13 +0200 Subject: [PATCH] Fix cs code style --- .../Content/class.ilDclContentExporter.php | 2 +- .../Content/class.ilDclRecordEditGUI.php | 26 ++--- .../Content/class.ilDclRecordListGUI.php | 10 +- .../Content/class.ilDclRecordListTableGUI.php | 2 +- .../class.ilDclCreateViewDefinitionGUI.php | 6 +- .../class.ilDclCreateViewTableGUI.php | 4 +- .../class.ilDclDetailedViewDefinitionGUI.php | 2 +- .../class.ilDclEditViewDefinitionGUI.php | 2 +- .../Fields/Base/class.ilDclBaseFieldModel.php | 12 +-- .../class.ilDclBaseFieldRepresentation.php | 2 +- .../Base/class.ilDclBaseRecordFieldModel.php | 8 +- .../Base/class.ilDclBaseRecordModel.php | 4 +- .../class.ilDclBaseRecordRepresentation.php | 2 +- .../Fields/Base/class.ilDclFieldProperty.php | 2 +- ...ass.ilDclDateSelectionRecordFieldModel.php | 2 +- .../class.ilDclDatetimeRecordFieldModel.php | 2 +- .../File/class.ilDclFileRecordFieldModel.php | 2 +- .../class.ilDclFileuploadRecordFieldModel.php | 8 +- ...ss.ilDclFileuploadRecordRepresentation.php | 4 +- .../class.ilDclFormulaRecordFieldModel.php | 2 +- .../class.ilDclIliasReferenceFieldModel.php | 2 +- .../Mob/class.ilDclMobFieldRepresentation.php | 2 +- .../Mob/class.ilDclMobRecordFieldModel.php | 2 +- .../class.ilDclMobRecordRepresentation.php | 6 +- .../class.ilDclNumberRecordFieldModel.php | 2 +- .../Rating/class.ilDclRatingFieldModel.php | 2 +- .../class.ilDclRatingRecordFieldModel.php | 4 +- .../class.ilDclRatingRecordRepresentation.php | 2 +- .../class.ilDclReferenceFieldModel.php | 4 +- ...lass.ilDclReferenceFieldRepresentation.php | 6 +- .../class.ilDclReferenceRecordFieldModel.php | 10 +- ...ass.ilDclReferenceRecordRepresentation.php | 2 +- .../class.ilDclSelectionFieldModel.php | 22 ++--- ...lass.ilDclSelectionFieldRepresentation.php | 8 +- .../Selection/class.ilDclSelectionOption.php | 2 +- .../class.ilDclSelectionRecordFieldModel.php | 4 +- .../Fields/Text/class.ilDclTextFieldModel.php | 2 +- .../class.ilDclTextFieldRepresentation.php | 4 +- .../Text/class.ilDclTextRecordFieldModel.php | 4 +- .../class.ilDclTextRecordRepresentation.php | 4 +- .../Fields/class.ilDclFieldEditGUI.php | 12 +-- .../Fields/class.ilDclFieldListGUI.php | 2 +- .../classes/Helpers/class.ilDclCache.php | 2 +- .../class.ilDclGenericMultiInputGUI.php | 2 +- .../classes/Table/class.ilDclTable.php | 30 +++--- .../classes/Table/class.ilDclTableEditGUI.php | 12 +-- .../classes/Table/class.ilDclTableListGUI.php | 2 +- .../class.ilDclTableViewEditFormGUI.php | 2 +- .../class.ilDclTableViewFieldSetting.php | 2 +- .../TableView/class.ilDclTableViewGUI.php | 2 +- .../classes/class.ilDataCollectionDataSet.php | 98 +++++++++---------- .../classes/class.ilDclExportTableGUI.php | 2 +- .../classes/class.ilObjDataCollection.php | 12 +-- .../classes/class.ilObjDataCollectionGUI.php | 16 +-- 54 files changed, 197 insertions(+), 197 deletions(-) diff --git a/Modules/DataCollection/classes/Content/class.ilDclContentExporter.php b/Modules/DataCollection/classes/Content/class.ilDclContentExporter.php index 484f378338f6..f54c3adbdf10 100644 --- a/Modules/DataCollection/classes/Content/class.ilDclContentExporter.php +++ b/Modules/DataCollection/classes/Content/class.ilDclContentExporter.php @@ -156,7 +156,7 @@ public function export(string $format = self::EXPORT_EXCEL, string $filepath = n foreach ($this->tables as $table) { ilDclCache::resetCache(); - $list = $table->getPartialRecords((string)$this->dcl->getRefId(), 'id', 'asc', null, 0, $this->filter); + $list = $table->getPartialRecords((string) $this->dcl->getRefId(), 'id', 'asc', null, 0, $this->filter); $data_available = $data_available || ($list['total'] > 0); $fields_available = $fields_available || (count($table->getExportableFields()) > 0); if ($list['total'] > 0 && count($table->getExportableFields()) > 0) { diff --git a/Modules/DataCollection/classes/Content/class.ilDclRecordEditGUI.php b/Modules/DataCollection/classes/Content/class.ilDclRecordEditGUI.php index 3db988d64ada..5b2478811932 100644 --- a/Modules/DataCollection/classes/Content/class.ilDclRecordEditGUI.php +++ b/Modules/DataCollection/classes/Content/class.ilDclRecordEditGUI.php @@ -207,9 +207,9 @@ public function confirmDelete(): void $record_data .= $field->getTitle() . ": " . $record_representation->getConfirmationHTML() . "
"; } } - $conf->addItem('record_id', (string)$record->getId(), $record_data); - $conf->addHiddenItem('table_id', (string)$this->table_id); - $conf->addHiddenItem('tableview_id', (string)$this->tableview_id); + $conf->addItem('record_id', (string) $record->getId(), $record_data); + $conf->addHiddenItem('table_id', (string) $this->table_id); + $conf->addHiddenItem('tableview_id', (string) $this->tableview_id); $conf->setConfirm($this->lng->txt('delete'), 'delete'); $conf->setCancel($this->lng->txt('cancel'), 'cancelDelete'); $this->tpl->setContent($conf->getHTML()); @@ -276,14 +276,14 @@ public function initForm(): void $this->form->setId($prefix . $this->table_id . $this->record_id); $hidden_prop = new ilHiddenInputGUI("table_id"); - $hidden_prop->setValue((string)$this->table_id); + $hidden_prop->setValue((string) $this->table_id); $this->form->addItem($hidden_prop); $hidden_prop = new ilHiddenInputGUI("tableview_id"); - $hidden_prop->setValue((string)$this->tableview_id); + $hidden_prop->setValue((string) $this->tableview_id); $this->form->addItem($hidden_prop); if ($this->record_id) { $hidden_prop = new ilHiddenInputGUI("record_id"); - $hidden_prop->setValue((string)$this->record_id); + $hidden_prop->setValue((string) $this->record_id); $this->form->addItem($hidden_prop); } @@ -315,9 +315,9 @@ public function initForm(): void if ($default_value !== null) { if ($item instanceof ilDclCheckboxInputGUI) { - $item->setChecked((bool)$default_value->getValue()); + $item->setChecked((bool) $default_value->getValue()); } else { - $item->setValue((string)$default_value->getValue()); + $item->setValue((string) $default_value->getValue()); } } else { if ($item instanceof ilDclTextInputGUI) { @@ -443,7 +443,7 @@ public function saveConfirmation(ilDclBaseRecordModel $record_obj, string $fileh $empty_fileuploads = []; foreach ($all_fields as $field) { - $record_field = $record_obj->getRecordField((int)$field->getId()); + $record_field = $record_obj->getRecordField((int) $field->getId()); /** @var ilDclBaseRecordFieldModel $record_field */ $record_field->addHiddenItemsToConfirmation($confirmation); @@ -467,8 +467,8 @@ public function saveConfirmation(ilDclBaseRecordModel $record_obj, string $fileh $confirmation->addHiddenItem('ilfilehash', $filehash); $confirmation->addHiddenItem('empty_fileuploads', htmlspecialchars(json_encode($empty_fileuploads))); - $confirmation->addHiddenItem('table_id', (string)$this->table_id); - $confirmation->addHiddenItem('tableview_id', (string)$this->tableview_id); + $confirmation->addHiddenItem('table_id', (string) $this->table_id); + $confirmation->addHiddenItem('tableview_id', (string) $this->tableview_id); $confirmation->addItem('save_confirmed', "1", $record_data); if ($this->ctrl->isAsynch()) { @@ -578,7 +578,7 @@ public function save(): void //edit values, they are valid we already checked them above foreach ($all_fields as $field) { - $record_obj->setRecordFieldValueFromForm((int)$field->getId(), $this->form); + $record_obj->setRecordFieldValueFromForm((int) $field->getId(), $this->form); } $this->saveConfirmation($record_obj, $hash); @@ -607,7 +607,7 @@ public function save(): void if ($field_setting->isVisibleInForm($create_mode) && (!$field_setting->isLocked($create_mode) || ilObjDataCollectionAccess::hasWriteAccess($this->parent_obj->getRefId()))) { // set all visible fields - $record_obj->setRecordFieldValueFromForm((int)$field->getId(), $this->form); + $record_obj->setRecordFieldValueFromForm((int) $field->getId(), $this->form); } elseif ($create_mode) { // set default values when creating $default_value = ilDclTableViewBaseDefaultValue::findSingle( diff --git a/Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php b/Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php index 58fbffcb3b58..ce3b9dc31516 100644 --- a/Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php +++ b/Modules/DataCollection/classes/Content/class.ilDclRecordListGUI.php @@ -258,7 +258,7 @@ public function importExcel(): void $file = $form->getInput("import_file"); $file_location = $file["tmp_name"]; $simulate = $form->getInput("simulate"); - $this->importRecords($file_location, (bool)$simulate); + $this->importRecords($file_location, (bool) $simulate); } else { $this->showImportExcel($form); } @@ -408,9 +408,9 @@ public function confirmDeleteRecords(): void $record_data .= $field->getTitle() . ": " . $record_representation->getConfirmationHTML() . "
"; } } - $conf->addItem('record_ids[]', (string)$record->getId(), $record_data); + $conf->addItem('record_ids[]', (string) $record->getId(), $record_data); } - $conf->addHiddenItem('table_id', (string)$this->table_id); + $conf->addHiddenItem('table_id', (string) $this->table_id); $conf->setConfirm($this->lng->txt('dcl_delete_records'), self::CMD_DELETE_RECORDS); $conf->setCancel($this->lng->txt('cancel'), self::CMD_CANCEL_DELETE); $this->tpl->setContent($conf->getHTML()); @@ -514,7 +514,7 @@ protected function getRecordListTableGUI(bool $use_tableview_filter): ilDclRecor $offset = $list->getOffset(); $num_records = count($table_obj->getPartialRecords( - (string)$this->getRefId(), + (string) $this->getRefId(), $list->getOrderField(), $list->getOrderDirection(), $limit, @@ -529,7 +529,7 @@ protected function getRecordListTableGUI(bool $use_tableview_filter): ilDclRecor } $data = $table_obj->getPartialRecords( - (string)$this->getRefId(), + (string) $this->getRefId(), $list->getOrderField(), $list->getOrderDirection(), $limit, diff --git a/Modules/DataCollection/classes/Content/class.ilDclRecordListTableGUI.php b/Modules/DataCollection/classes/Content/class.ilDclRecordListTableGUI.php index 6940c355f89c..14cfaff702d1 100644 --- a/Modules/DataCollection/classes/Content/class.ilDclRecordListTableGUI.php +++ b/Modules/DataCollection/classes/Content/class.ilDclRecordListTableGUI.php @@ -108,7 +108,7 @@ public function __construct( } } } else { - $default_sort_title = ilDclCache::getFieldCache((int)$fieldId)->getTitle(); + $default_sort_title = ilDclCache::getFieldCache((int) $fieldId)->getTitle(); } $this->setDefaultOrderField($default_sort_title); } diff --git a/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewDefinitionGUI.php b/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewDefinitionGUI.php index 868dfdaa4cd3..6ef717d6d159 100644 --- a/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewDefinitionGUI.php +++ b/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewDefinitionGUI.php @@ -110,7 +110,7 @@ public function confirmDelete(): void $conf->setFormAction($ilCtrl->getFormAction($this)); $conf->setHeaderText($lng->txt('dcl_confirm_delete_detailed_view_title')); - $conf->addItem('tableview', (string)$this->tableview_id, $lng->txt('dcl_confirm_delete_detailed_view_text')); + $conf->addItem('tableview', (string) $this->tableview_id, $lng->txt('dcl_confirm_delete_detailed_view_text')); $conf->setConfirm($lng->txt('delete'), 'deleteView'); $conf->setCancel($lng->txt('cancel'), 'cancelDelete'); @@ -208,7 +208,7 @@ public function saveTable(): void $data_type_id = intval($parts[2]); // Delete all field values associated with this id - $existing_values = ilDclTableViewBaseDefaultValue::findAll($data_type_id, (int)$id); + $existing_values = ilDclTableViewBaseDefaultValue::findAll($data_type_id, (int) $id); if (!is_null($existing_values)) { foreach ($existing_values as $existing_value) { @@ -237,7 +237,7 @@ public function saveTable(): void } else { $default_value->setValue($value); } - $default_value->setTviewSetId((int)$id); + $default_value->setTviewSetId((int) $id); $default_value->create(); } } diff --git a/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewTableGUI.php b/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewTableGUI.php index d178003e6252..5d1274509aed 100644 --- a/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewTableGUI.php +++ b/Modules/DataCollection/classes/CreateView/class.ilDclCreateViewTableGUI.php @@ -182,9 +182,9 @@ public function fillRowFromObject(ilDclTableViewFieldSetting $a_set): void if (!is_null($match)) { if ($item instanceof ilDclCheckboxInputGUI) { - $item->setChecked((bool)$match->getValue()); + $item->setChecked((bool) $match->getValue()); } else { - $item->setValue((string)$match->getValue()); + $item->setValue((string) $match->getValue()); } } diff --git a/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php b/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php index 380ca9958758..4fe421125b59 100644 --- a/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php +++ b/Modules/DataCollection/classes/DetailedView/class.ilDclDetailedViewDefinitionGUI.php @@ -140,7 +140,7 @@ public function confirmDelete(): void $conf->setFormAction($this->ctrl->getFormAction($this)); $conf->setHeaderText($this->lng->txt('dcl_confirm_delete_detailed_view_title')); - $conf->addItem('tableview', (string)$this->tableview_id, $this->lng->txt('dcl_confirm_delete_detailed_view_text')); + $conf->addItem('tableview', (string) $this->tableview_id, $this->lng->txt('dcl_confirm_delete_detailed_view_text')); $conf->setConfirm($this->lng->txt('delete'), 'deleteView'); $conf->setCancel($this->lng->txt('cancel'), 'cancelDelete'); diff --git a/Modules/DataCollection/classes/EditView/class.ilDclEditViewDefinitionGUI.php b/Modules/DataCollection/classes/EditView/class.ilDclEditViewDefinitionGUI.php index c67a1b655e47..9158eadad462 100644 --- a/Modules/DataCollection/classes/EditView/class.ilDclEditViewDefinitionGUI.php +++ b/Modules/DataCollection/classes/EditView/class.ilDclEditViewDefinitionGUI.php @@ -104,7 +104,7 @@ public function confirmDelete(): void $conf->setFormAction($ilCtrl->getFormAction($this)); $conf->setHeaderText($lng->txt('dcl_confirm_delete_detailed_view_title')); - $conf->addItem('tableview', (string)$this->tableview_id, $lng->txt('dcl_confirm_delete_detailed_view_text')); + $conf->addItem('tableview', (string) $this->tableview_id, $lng->txt('dcl_confirm_delete_detailed_view_text')); $conf->setConfirm($lng->txt('delete'), 'deleteView'); $conf->setCancel($lng->txt('cancel'), 'cancelDelete'); diff --git a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldModel.php b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldModel.php index 371f079608f0..607284749142 100644 --- a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldModel.php @@ -69,7 +69,7 @@ public function __construct(int $a_id = 0) $this->lng = $DIC->language(); if ($a_id != 0) { - $this->id = (string)$a_id; + $this->id = (string) $a_id; $this->doRead(); } } @@ -109,7 +109,7 @@ public static function _getFieldIdByTitle(string $title, int $table_id): int */ public function setId($a_id): void { - $this->id = (string)$a_id; + $this->id = (string) $a_id; } /** @@ -300,7 +300,7 @@ public function doRead(): void $this->setDescription($rec["description"]); } $this->setDatatypeId($rec["datatype_id"]); - $this->setUnique((bool)$rec["is_unique"]); + $this->setUnique((bool) $rec["is_unique"]); } $this->loadProperties(); @@ -500,7 +500,7 @@ public function setProperty(string $key, $value): ?ilDclFieldProperty } else { $property = new ilDclFieldProperty(); $property->setName($key); - $property->setFieldId((int)$this->getId()); + $property->setFieldId((int) $this->getId()); $property->setValue($value); $this->property[$key] = $property; @@ -572,7 +572,7 @@ public function cloneStructure(int $original_id): void $this->cloneProperties($original); // mandatory for all cloning functions - ilDclCache::setCloneOf($original_id, (int)$this->getId(), ilDclCache::TYPE_FIELD); + ilDclCache::setCloneOf($original_id, (int) $this->getId(), ilDclCache::TYPE_FIELD); } public function afterClone(array $records) @@ -590,7 +590,7 @@ public function cloneProperties(ilDclBaseFieldModel $originalField): void } foreach ($orgProps as $prop_name) { $fieldprop_obj = new ilDclFieldProperty(); - $fieldprop_obj->setFieldId((int)$this->getId()); + $fieldprop_obj->setFieldId((int) $this->getId()); $fieldprop_obj->setName($prop_name); $value = $originalField->getProperty($prop_name); diff --git a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldRepresentation.php b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldRepresentation.php index 715efcdf203f..c69f22edff04 100644 --- a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseFieldRepresentation.php @@ -155,7 +155,7 @@ protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mod { $opt = new ilRadioOption( $this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle()), - (string)$this->getField()->getDatatypeId() + (string) $this->getField()->getDatatypeId() ); $opt->setInfo($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle() . '_desc')); diff --git a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordFieldModel.php index ab8477ff6f53..7a01af81f69f 100644 --- a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordFieldModel.php @@ -182,7 +182,7 @@ public function serializeData($value) */ public function deserializeData($value) { - $deserialize = json_decode((string)$value, true); + $deserialize = json_decode((string) $value, true); if (is_array($deserialize)) { return $deserialize; } @@ -218,7 +218,7 @@ public function setValueFromForm(ilPropertyFormGUI $form): void public function getFormulaValue(): string { - return (string)$this->getExportValue(); + return (string) $this->getExportValue(); } /** @@ -236,7 +236,7 @@ public function parseExportValue($value) */ public function getValueFromExcel(ilExcel $excel, int $row, int $col) { - return (string)$excel->getCell($row, $col); + return (string) $excel->getCell($row, $col); } /** @@ -287,7 +287,7 @@ public function addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation) { ; if (!is_array($this->getValue())) { - $confirmation->addHiddenItem('field_' . $this->field->getId(), (string)$this->getValue()); + $confirmation->addHiddenItem('field_' . $this->field->getId(), (string) $this->getValue()); } else { foreach ($this->getValue() as $key => $value) { $confirmation->addHiddenItem('field_' . $this->field->getId() . "[$key]", $value); diff --git a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordModel.php b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordModel.php index 503148aa0f7a..801ca72eefd2 100644 --- a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordModel.php +++ b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordModel.php @@ -549,7 +549,7 @@ public function getStandardFieldHTML(string $field_id, array $options = []): str { switch ($field_id) { case 'id': - return (string)$this->getId(); + return (string) $this->getId(); case 'owner': return ilUserUtil::getNamePresentation($this->getOwner()); case 'last_edit_by': @@ -634,7 +634,7 @@ public function doDelete(bool $omit_notification = false): void $this->loadRecordFields(); foreach ($this->recordfields as $recordfield) { if ($recordfield->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB) { - $this->deleteMob((int)$recordfield->getValue()); + $this->deleteMob((int) $recordfield->getValue()); } $recordfield->delete(); diff --git a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordRepresentation.php b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordRepresentation.php index 13b07d0edf5d..78d6bb6c9be3 100644 --- a/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Base/class.ilDclBaseRecordRepresentation.php @@ -89,7 +89,7 @@ protected function getFormInput() */ public function getHTML(bool $link = true, array $options = []): string { - return (string)$this->getRecordField()->getValue(); + return (string) $this->getRecordField()->getValue(); } /** diff --git a/Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php b/Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php index 07f05d82e352..3959eeeda9d0 100644 --- a/Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php +++ b/Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php @@ -141,7 +141,7 @@ public function serializeData($value): string $value = json_encode($value); } - return (string)$value; + return (string) $value; } /** diff --git a/Modules/DataCollection/classes/Fields/DateSelection/class.ilDclDateSelectionRecordFieldModel.php b/Modules/DataCollection/classes/Fields/DateSelection/class.ilDclDateSelectionRecordFieldModel.php index cadc6a131925..e27f217eeb04 100644 --- a/Modules/DataCollection/classes/Fields/DateSelection/class.ilDclDateSelectionRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/DateSelection/class.ilDclDateSelectionRecordFieldModel.php @@ -26,7 +26,7 @@ class ilDclDateSelectionRecordFieldModel extends ilDclSelectionRecordFieldModel public function parseExportValue($value): string { $dates = []; - foreach (ilDclSelectionOption::getValues((int)$this->getField()->getId(), $value) as $value) { + foreach (ilDclSelectionOption::getValues((int) $this->getField()->getId(), $value) as $value) { $date = new ilDate($value, IL_CAL_DATE); $dates[] = $date->get(IL_CAL_DATE); } diff --git a/Modules/DataCollection/classes/Fields/Datetime/class.ilDclDatetimeRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Datetime/class.ilDclDatetimeRecordFieldModel.php index f2d631de89db..44e7ffa124b9 100644 --- a/Modules/DataCollection/classes/Fields/Datetime/class.ilDclDatetimeRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Datetime/class.ilDclDatetimeRecordFieldModel.php @@ -25,7 +25,7 @@ class ilDclDatetimeRecordFieldModel extends ilDclBaseRecordFieldModel */ public function parseValue($value): string { - return (string)$value; + return (string) $value; } public function getValueFromExcel(ilExcel $excel, int $row, int $col): ?string diff --git a/Modules/DataCollection/classes/Fields/File/class.ilDclFileRecordFieldModel.php b/Modules/DataCollection/classes/Fields/File/class.ilDclFileRecordFieldModel.php index b92e720899f1..b3d55cd118e4 100644 --- a/Modules/DataCollection/classes/Fields/File/class.ilDclFileRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/File/class.ilDclFileRecordFieldModel.php @@ -188,7 +188,7 @@ public function parseSortingValue($value, bool $link = true) public function afterClone(): void { - $field = ilDclCache::getCloneOf((int)$this->getField()->getId(), ilDclCache::TYPE_FIELD); + $field = ilDclCache::getCloneOf((int) $this->getField()->getId(), ilDclCache::TYPE_FIELD); $record = ilDclCache::getCloneOf($this->getRecord()->getId(), ilDclCache::TYPE_RECORD); $record_field = ilDclCache::getRecordFieldCache($record, $field); diff --git a/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordFieldModel.php index 61c327c12cb0..35cf2e86e72b 100644 --- a/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordFieldModel.php @@ -100,7 +100,7 @@ public function parseValue($value) $file_id = $file_obj->getId(); $return = $file_id; - // handover for save-confirmation + // handover for save-confirmation } else { if (is_array($file) && isset($file['tmp_name']) && $file['tmp_name'] != "") { $return = $file; @@ -151,13 +151,13 @@ public function setValue($value, bool $omit_parsing = false): void */ public function parseExportValue($value): ?string { - if (!$value || !ilObject2::_exists((int)$value) || ilObject2::_lookupType((int)$value) != "file") { + if (!$value || !ilObject2::_exists((int) $value) || ilObject2::_lookupType((int) $value) != "file") { return null; } $file = $value; if ($file != "-") { - $file_obj = new ilObjFile((int)$file, false); + $file_obj = new ilObjFile((int) $file, false); return $file_obj->getFileName(); } @@ -191,7 +191,7 @@ public function setValueFromForm(ilPropertyFormGUI $form): void */ public function afterClone(): void { - $field = ilDclCache::getCloneOf((int)$this->getField()->getId(), ilDclCache::TYPE_FIELD); + $field = ilDclCache::getCloneOf((int) $this->getField()->getId(), ilDclCache::TYPE_FIELD); $record = ilDclCache::getCloneOf($this->getRecord()->getId(), ilDclCache::TYPE_RECORD); $record_field = ilDclCache::getRecordFieldCache($record, $field); diff --git a/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordRepresentation.php b/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordRepresentation.php index c71e6209fe32..a655bdcb94a2 100644 --- a/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadRecordRepresentation.php @@ -42,11 +42,11 @@ public function parseFormInput($value) return $value; } - if (!ilObject2::_exists((int)$value) || ilObject2::_lookupType((int) $value) != "file") { + if (!ilObject2::_exists((int) $value) || ilObject2::_lookupType((int) $value) != "file") { return ""; } - $file_obj = new ilObjFile((int)$value, false); + $file_obj = new ilObjFile((int) $value, false); //$input = ilObjFile::_lookupAbsolutePath($value); return $file_obj->getFileName(); diff --git a/Modules/DataCollection/classes/Fields/Formula/class.ilDclFormulaRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Formula/class.ilDclFormulaRecordFieldModel.php index 451da69cbaf9..083689ab4553 100644 --- a/Modules/DataCollection/classes/Fields/Formula/class.ilDclFormulaRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Formula/class.ilDclFormulaRecordFieldModel.php @@ -30,7 +30,7 @@ public function __construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $f { parent::__construct($record, $field); - $this->expression = (string)$this->getField()->getProperty(ilDclBaseFieldModel::PROP_FORMULA_EXPRESSION); + $this->expression = (string) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_FORMULA_EXPRESSION); } public function addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation): void diff --git a/Modules/DataCollection/classes/Fields/IliasReference/class.ilDclIliasReferenceFieldModel.php b/Modules/DataCollection/classes/Fields/IliasReference/class.ilDclIliasReferenceFieldModel.php index 5e1dba1f84c9..b43dcef23fed 100644 --- a/Modules/DataCollection/classes/Fields/IliasReference/class.ilDclIliasReferenceFieldModel.php +++ b/Modules/DataCollection/classes/Fields/IliasReference/class.ilDclIliasReferenceFieldModel.php @@ -46,7 +46,7 @@ public function getRecordQuerySortObject( $sql_obj = new ilDclRecordQueryObject(); $sql_obj->setSelectStatement($select_str); $sql_obj->setJoinStatement($join_str); - $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction. ", ID ASC"); + $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction . ", ID ASC"); return $sql_obj; } diff --git a/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobFieldRepresentation.php b/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobFieldRepresentation.php index 03e1012160c1..c813d1ac7edc 100644 --- a/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobFieldRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobFieldRepresentation.php @@ -70,7 +70,7 @@ protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mod { $opt = new ilRadioOption( $this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle()), - (string)$this->getField()->getDatatypeId() + (string) $this->getField()->getDatatypeId() ); $opt->setInfo($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle() . '_desc')); diff --git a/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordFieldModel.php index 44c6b1a40297..eff5316e950f 100644 --- a/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordFieldModel.php @@ -153,7 +153,7 @@ public function parseValue($value) $mob->update(); $return = $mob->getId(); - // handover for save-confirmation + // handover for save-confirmation } else { if (is_array($media) && isset($media['tmp_name']) && $media['tmp_name'] != '') { $return = $media; diff --git a/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordRepresentation.php b/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordRepresentation.php index c406118b95bc..4fe03275ca32 100644 --- a/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Mob/class.ilDclMobRecordRepresentation.php @@ -44,7 +44,7 @@ public function getHTML(bool $link = true, array $options = []): string ); return '' . $value['name'] . ''; } @@ -112,10 +112,10 @@ public function getHTML(bool $link = true, array $options = []): string $width = "200px"; $height = "auto"; if ($field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) > 0) { - $width = $field->getProperty(ilDclBaseFieldModel::PROP_WIDTH)."px"; + $width = $field->getProperty(ilDclBaseFieldModel::PROP_WIDTH) . "px"; } if ($field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) > 0) { - $height = $field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT)."px"; + $height = $field->getProperty(ilDclBaseFieldModel::PROP_HEIGHT) . "px"; } $content = $this->renderer->render($components); return "
$content
"; diff --git a/Modules/DataCollection/classes/Fields/Number/class.ilDclNumberRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Number/class.ilDclNumberRecordFieldModel.php index ad052e7847cc..7a6e18339452 100644 --- a/Modules/DataCollection/classes/Fields/Number/class.ilDclNumberRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Number/class.ilDclNumberRecordFieldModel.php @@ -22,6 +22,6 @@ class ilDclNumberRecordFieldModel extends ilDclBaseRecordFieldModel { public function parseValue($value): ?float { - return ($value == '') ? null : (float)$value; //SW, Ilias Mantis #0011799: Return null otherwise '' is casted to 0 in DB + return ($value == '') ? null : (float) $value; //SW, Ilias Mantis #0011799: Return null otherwise '' is casted to 0 in DB } } diff --git a/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingFieldModel.php b/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingFieldModel.php index e26b2097cf9f..e3af712d10a7 100644 --- a/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingFieldModel.php @@ -31,7 +31,7 @@ public function getRecordQuerySortObject( $sql_obj = new ilDclRecordQueryObject(); $sql_obj->setSelectStatement($select_str); $sql_obj->setJoinStatement($join_str); - $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction. ", ID ASC"); + $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction . ", ID ASC"); return $sql_obj; } diff --git a/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordFieldModel.php index 3b7bdd5a5cf1..75485d907c60 100644 --- a/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordFieldModel.php @@ -71,7 +71,7 @@ public function getExportValue(): string $val = ilRating::getOverallRatingForObject( $this->getRecord()->getId(), "dcl_record", - (int)$this->getField()->getId(), + (int) $this->getField()->getId(), "dcl_field" ); @@ -86,7 +86,7 @@ public function getValue(): array return ilRating::getOverallRatingForObject( $this->getRecord()->getId(), "dcl_record", - (int)$this->getField()->getId(), + (int) $this->getField()->getId(), "dcl_field" ); } diff --git a/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordRepresentation.php b/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordRepresentation.php index 76514c9dc6f5..9050ffac9768 100644 --- a/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Rating/class.ilDclRatingRecordRepresentation.php @@ -26,7 +26,7 @@ public function getHTML(bool $link = true, array $options = []): string $rgui->setObject( $this->getRecordField()->getRecord()->getId(), "dcl_record", - (int)$this->getRecordField()->getField()->getId(), + (int) $this->getRecordField()->getField()->getId(), "dcl_field" ); $this->ctrl->setParameterByClass(ilRatingGUI::class, "field_id", $this->getRecordField()->getField()->getId()); diff --git a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldModel.php b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldModel.php index ada6d13b3177..226258f625f8 100644 --- a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldModel.php @@ -35,7 +35,7 @@ public function getRecordQuerySortObject( return null; } - $ref_field = ilDclCache::getFieldCache((int)$this->getProperty(self::PROP_REFERENCE)); + $ref_field = ilDclCache::getFieldCache((int) $this->getProperty(self::PROP_REFERENCE)); //ATM, some referenced fields can not be sorted (Ratings, Formulas and Plugins), PR would be nice if fixeable. if($ref_field->getStorageLocation() == 0) { @@ -124,7 +124,7 @@ public function getFieldRef(): ilDclBaseFieldModel public function afterClone(array $records): void { /** @var ilDclReferenceFieldModel $clone */ - $clone = ilDclCache::getCloneOf((int)$this->getId(), ilDclCache::TYPE_FIELD); + $clone = ilDclCache::getCloneOf((int) $this->getId(), ilDclCache::TYPE_FIELD); $reference_clone = ilDclCache::getCloneOf( (int) $clone->getProperty(ilDclBaseFieldModel::PROP_REFERENCE), ilDclCache::TYPE_FIELD diff --git a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldRepresentation.php b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldRepresentation.php index c072003b7607..99c3ddcb5884 100644 --- a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceFieldRepresentation.php @@ -41,7 +41,7 @@ public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): $fieldref = $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE); - $reffield = ilDclCache::getFieldCache((int)$fieldref); + $reffield = ilDclCache::getFieldCache((int) $fieldref); $options = []; if (!$this->getField()->getProperty(ilDclBaseFieldModel::PROP_N_REFERENCE)) { $options[""] = $this->lng->txt('dcl_please_select'); @@ -68,7 +68,7 @@ public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): break; case ilDclDatatype::INPUTFORMAT_TEXT: $value = $record->getRecordFieldValue($fieldref); - if ($record->getRecordField((int)$fieldref)->getField()->hasProperty(ilDclBaseFieldModel::PROP_URL)) { + if ($record->getRecordField((int) $fieldref)->getField()->hasProperty(ilDclBaseFieldModel::PROP_URL)) { if (!is_array($value)) { $value = ['title' => '', 'link' => $value]; } @@ -123,7 +123,7 @@ public function addFilterInputFieldToTable(ilTable2GUI $table) $this->getField()->getId() ); $ref_field_id = $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE); - $ref_field = ilDclCache::getFieldCache((int)$ref_field_id); + $ref_field = ilDclCache::getFieldCache((int) $ref_field_id); $ref_table = ilDclCache::getTableCache($ref_field->getTableId()); $options = []; foreach ($ref_table->getRecords() as $record) { diff --git a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordFieldModel.php index 107ed9a88ea5..524d39eddf78 100644 --- a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordFieldModel.php @@ -44,7 +44,7 @@ public function getExportValue(): string } foreach ($value as $val) { if ($val) { - $ref_rec = ilDclCache::getRecordCache((int)$val); + $ref_rec = ilDclCache::getRecordCache((int) $val); $ref_record_field = $ref_rec->getRecordField((int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE)); $exp_value = $ref_record_field->getExportValue(); $names[] = is_array($exp_value) ? array_shift($exp_value) : $exp_value; @@ -58,7 +58,7 @@ public function getExportValue(): string $ref_record_field = $ref_rec->getRecordField((int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE)); $exp_value = $ref_record_field->getExportValue(); - return (string)(is_array($exp_value) ? array_shift($exp_value) : $exp_value); + return (string) (is_array($exp_value) ? array_shift($exp_value) : $exp_value); } return ""; } @@ -125,7 +125,7 @@ public function getReferenceFromValue($value): int $table = ilDclCache::getTableCache($field->getTableId()); $record_id = 0; foreach ($table->getRecords() as $record) { - $record_value = $record->getRecordField((int)$field->getId())->getExportValue(); + $record_value = $record->getRecordField((int) $field->getId())->getExportValue(); // in case of a url-field if (is_array($record_value) && !is_array($value)) { $record_value = array_shift($record_value); @@ -140,7 +140,7 @@ public function getReferenceFromValue($value): int public function afterClone(): void { - $field_clone = ilDclCache::getCloneOf((int)$this->getField()->getId(), ilDclCache::TYPE_FIELD); + $field_clone = ilDclCache::getCloneOf((int) $this->getField()->getId(), ilDclCache::TYPE_FIELD); $record_clone = ilDclCache::getCloneOf($this->getRecord()->getId(), ilDclCache::TYPE_RECORD); if ($field_clone && $record_clone) { @@ -165,7 +165,7 @@ public function afterClone(): void protected function getCloneRecordId(?string $clone_reference): ?string { - $reference_record = ilDclCache::getCloneOf((int)$clone_reference, ilDclCache::TYPE_RECORD); + $reference_record = ilDclCache::getCloneOf((int) $clone_reference, ilDclCache::TYPE_RECORD); if ($reference_record) { return (string) $reference_record->getId(); } diff --git a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordRepresentation.php b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordRepresentation.php index 1c1e532f6ca0..5e8e7e36f4bc 100644 --- a/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Reference/class.ilDclReferenceRecordRepresentation.php @@ -36,7 +36,7 @@ public function getHTML(bool $link = true, array $options = []): string $items = []; foreach ($value as $k => $v) { - $ref_record = ilDclCache::getRecordCache((int)$v); + $ref_record = ilDclCache::getRecordCache((int) $v); if (!$ref_record->getId() || !$ref_record->getTableId() || !$record_field->getField() || !$record_field->getField()->getTableId()) { //the referenced record_field does not seem to exist. unset($value[$k]); diff --git a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldModel.php b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldModel.php index 1fa76c66c6be..fb344184d29b 100644 --- a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldModel.php @@ -86,7 +86,7 @@ public function isMulti(): bool public function checkFieldCreationInput(ilPropertyFormGUI $form): bool { - $options_post_var = "prop_".static::PROP_SELECTION_OPTIONS; + $options_post_var = "prop_" . static::PROP_SELECTION_OPTIONS; foreach ($form->getInput($options_post_var) as $value) { if ($value["selection_value"] == "") { $inputObj = $form->getItemByPostVar($options_post_var); @@ -145,7 +145,7 @@ public function fillPropertiesForm(ilPropertyFormGUI &$form): bool $properties = $this->getValidFieldProperties(); foreach ($properties as $prop) { if ($prop == static::PROP_SELECTION_OPTIONS) { - $options = ilDclSelectionOption::getAllForField((int)$this->getId()); + $options = ilDclSelectionOption::getAllForField((int) $this->getId()); $prop_values = []; foreach ($options as $option) { // the 'selection_value' is for a correct input @@ -172,10 +172,10 @@ public function setProperty(string $key, $value): ?ilDclFieldProperty switch ($key) { case static::PROP_SELECTION_OPTIONS: - ilDclSelectionOption::flushOptions((int)$this->getId()); + ilDclSelectionOption::flushOptions((int) $this->getId()); $sorting = 1; foreach ($value as $id => $val) { - ilDclSelectionOption::storeOption((int)$this->getId(), $id, $sorting, $val); + ilDclSelectionOption::storeOption((int) $this->getId(), $id, $sorting, $val); $sorting++; } // if the field is not being created reorder the options in the existing record fields @@ -203,10 +203,10 @@ public function setProperty(string $key, $value): ?ilDclFieldProperty */ public function reorderExistingValues(): void { - $options = ilDclSelectionOption::getAllForField((int)$this->getId()); + $options = ilDclSelectionOption::getAllForField((int) $this->getId()); // loop each record(-field) foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) { - $record_field = $record->getRecordField((int)$this->getId()); + $record_field = $record->getRecordField((int) $this->getId()); $record_field_value = $record_field->getValue(); if (is_array($record_field_value) && count($record_field_value) > 1) { @@ -229,7 +229,7 @@ public function reorderExistingValues(): void protected function multiPropertyChanged(bool $is_multi_now): void { foreach (ilDclCache::getTableCache($this->getTableId())->getRecords() as $record) { - $record_field = $record->getRecordField((int)$this->getId()); + $record_field = $record->getRecordField((int) $this->getId()); $record_field_value = $record_field->getValue(); if ($record_field_value && !is_array($record_field_value) && $is_multi_now) { @@ -252,7 +252,7 @@ public function getProperty(string $key): mixed { switch ($key) { case static::PROP_SELECTION_OPTIONS: - return ilDclSelectionOption::getAllForField((int)$this->getId()); + return ilDclSelectionOption::getAllForField((int) $this->getId()); default: return parent::getProperty($key); } @@ -286,18 +286,18 @@ public function getRecordQuerySortObject( public function cloneProperties(ilDclBaseFieldModel $originalField): void { parent::cloneProperties($originalField); - $options = ilDclSelectionOption::getAllForField((int)$originalField->getId()); + $options = ilDclSelectionOption::getAllForField((int) $originalField->getId()); foreach ($options as $opt) { $new_opt = new ilDclSelectionOption(); $new_opt->cloneOption($opt); - $new_opt->setFieldId((int)$this->getId()); + $new_opt->setFieldId((int) $this->getId()); $new_opt->store(); } } public function doDelete(): void { - foreach (ilDclSelectionOption::getAllForField((int)$this->getId()) as $option) { + foreach (ilDclSelectionOption::getAllForField((int) $this->getId()) as $option) { $option->delete(); } parent::doDelete(); diff --git a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldRepresentation.php b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldRepresentation.php index 3b3cadbfe7a2..84021a81e778 100644 --- a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionFieldRepresentation.php @@ -66,7 +66,7 @@ protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mod public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilFormPropertyGUI { /** @var ilDclSelectionOption[] $options */ - $options = ilDclSelectionOption::getAllForField((int)$this->getField()->getId()); + $options = ilDclSelectionOption::getAllForField((int) $this->getField()->getId()); switch ($this->getField()->getProperty(static::PROP_SELECTION_TYPE)) { case ilDclSelectionFieldModel::SELECTION_TYPE_MULTI: $input = new ilMultiSelectInputGUI( @@ -97,9 +97,9 @@ public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): default: $input = new ilRadioGroupInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId()); foreach ($options as $opt) { - $input->addOption(new ilRadioOption($opt->getValue(), (string)$opt->getOptId())); + $input->addOption(new ilRadioOption($opt->getValue(), (string) $opt->getOptId())); } - $input->setValue((string)array_keys($options)[0]); + $input->setValue((string) array_keys($options)[0]); break; } $this->setupInputField($input, $this->getField()); @@ -120,7 +120,7 @@ public function addFilterInputFieldToTable(ilTable2GUI $table) $this->getField()->getId() ); - $options = ilDclSelectionOption::getAllForField((int)$this->getField()->getId()); + $options = ilDclSelectionOption::getAllForField((int) $this->getField()->getId()); $array = ['' => $this->lng->txt('dcl_all_entries')]; foreach ($options as $opt) { $array[$opt->getOptId()] = $opt->getValue(); diff --git a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionOption.php b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionOption.php index 529ac3731c87..8fd8142c25eb 100644 --- a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionOption.php +++ b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionOption.php @@ -129,7 +129,7 @@ public static function storeOption(int $field_id, int $opt_id, int $sorting, str $option = new self(); } $option->setFieldId($field_id); - $option->setOptId((int)$opt_id); + $option->setOptId((int) $opt_id); $option->setSorting($sorting); $option->setValue($value); $option->store(); diff --git a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionRecordFieldModel.php index cfd32eef4ac0..9a66fadb3765 100644 --- a/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Selection/class.ilDclSelectionRecordFieldModel.php @@ -44,14 +44,14 @@ public function getValue() */ public function parseExportValue($value): string { - $values = ilDclSelectionOption::getValues((int)$this->getField()->getId(), $value); + $values = ilDclSelectionOption::getValues((int) $this->getField()->getId(), $value); return implode("; ", $values); } public function getValueFromExcel(ilExcel $excel, int $row, int $col) { - $string = (string)parent::getValueFromExcel($excel, $row, $col); + $string = (string) parent::getValueFromExcel($excel, $row, $col); $old = $string; if ($this->getField()->isMulti()) { $string = $this->getMultipleValuesFromString($string); diff --git a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldModel.php b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldModel.php index 91b1c58a10b8..782594f4bb4e 100644 --- a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldModel.php @@ -88,7 +88,7 @@ public function checkValidity($value, ?int $record_id = null): bool //for text it has to be case insensitive. $record_value = $record->getRecordFieldValue($this->getId()); - if (strtolower((string)$this->normalizeValue($record_value)) == strtolower((string)$this->normalizeValue(nl2br($value))) + if (strtolower((string) $this->normalizeValue($record_value)) == strtolower((string) $this->normalizeValue(nl2br($value))) && ($record->getId() != $record_id || $record_id == 0) ) { diff --git a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldRepresentation.php b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldRepresentation.php index 1d615bdb89ba..49c2ba646aa0 100644 --- a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextFieldRepresentation.php @@ -62,9 +62,9 @@ public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): if ($this->getField()->hasProperty(ilDclBaseFieldModel::PROP_LENGTH)) { $input->setInfo($this->lng->txt("dcl_max_text_length") . ": " . $this->getField()->getProperty(ilDclBaseFieldModel::PROP_LENGTH)); if (!$this->getField()->getProperty(ilDclBaseFieldModel::PROP_TEXTAREA)) { - $input->setMaxLength((int)$this->getField()->getProperty(ilDclBaseFieldModel::PROP_LENGTH)); + $input->setMaxLength((int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_LENGTH)); } else { - $input->setMaxNumOfChars((int)$this->getField()->getProperty(ilDclBaseFieldModel::PROP_LENGTH)); + $input->setMaxNumOfChars((int) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_LENGTH)); } } diff --git a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordFieldModel.php b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordFieldModel.php index 4dc69bca04f1..39837ff0dcbc 100644 --- a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordFieldModel.php +++ b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordFieldModel.php @@ -149,10 +149,10 @@ public function parseSortingValue($value, bool $link = true): string if (is_array($value)) { return $value['title'] ?? $value['link']; } else { - return (string)$value; + return (string) $value; } } else { - return (string)$value; + return (string) $value; } } } diff --git a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordRepresentation.php b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordRepresentation.php index 5e397c88fa95..81aa7743a35b 100644 --- a/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordRepresentation.php +++ b/Modules/DataCollection/classes/Fields/Text/class.ilDclTextRecordRepresentation.php @@ -33,10 +33,10 @@ public function getHTML(bool $link = true, array $options = []): string $field = $this->getField(); if ($field->hasProperty(ilDclBaseFieldModel::PROP_URL)) { if (is_array($value)) { - $link = (string)$value['link']; + $link = (string) $value['link']; $link_value = $value['title'] ?: $this->shortenLink($link); } else { - $link = (string)$value; + $link = (string) $value; $link_value = $this->shortenLink($link); } diff --git a/Modules/DataCollection/classes/Fields/class.ilDclFieldEditGUI.php b/Modules/DataCollection/classes/Fields/class.ilDclFieldEditGUI.php index a7fd5169d27c..15806e2d80a2 100644 --- a/Modules/DataCollection/classes/Fields/class.ilDclFieldEditGUI.php +++ b/Modules/DataCollection/classes/Fields/class.ilDclFieldEditGUI.php @@ -189,7 +189,7 @@ public function delete(): void global $DIC; $ilCtrl = $DIC['ilCtrl']; - $this->table->deleteField((int)$this->field_obj->getId()); + $this->table->deleteField((int) $this->field_obj->getId()); $ilCtrl->redirectByClass("ildclfieldlistgui", "listFields"); } @@ -226,7 +226,7 @@ public function initForm(string $a_mode = "create"): void } else { $this->form->setTitle($lng->txt('dcl_new_field')); $hidden_prop = new ilHiddenInputGUI("table_id"); - $hidden_prop->setValue((string)$this->field_obj->getTableId()); + $hidden_prop->setValue((string) $this->field_obj->getTableId()); $this->form->addItem($hidden_prop); $this->form->setFormAction($ilCtrl->getFormAction($this)); @@ -305,8 +305,8 @@ public function save(string $a_mode = "create"): void $this->field_obj->setTitle($title); $this->field_obj->setDescription($this->form->getInput("description")); - $this->field_obj->setDatatypeId((int)$this->form->getInput("datatype")); - $this->field_obj->setUnique((bool)$this->form->getInput("unique")); + $this->field_obj->setDatatypeId((int) $this->form->getInput("datatype")); + $this->field_obj->setUnique((bool) $this->form->getInput("unique")); if ($a_mode == "update") { $this->field_obj->doUpdate(); @@ -349,7 +349,7 @@ protected function checkInput(string $a_mode): bool $datatype_id = $this->form->getInput('datatype'); if ($datatype_id != null && is_numeric($datatype_id)) { $base_model = new ilDclBaseFieldModel(); - $base_model->setDatatypeId((int)$datatype_id); + $base_model->setDatatypeId((int) $datatype_id); $field_validation_class = ilDclFieldFactory::getFieldModelInstanceByClass($base_model); if (!$field_validation_class->checkFieldCreationInput($this->form)) { @@ -384,7 +384,7 @@ protected function checkAccess(): bool return ilObjDataCollectionAccess::hasAccessToField( $this->getDataCollectionObject()->getRefId(), $this->table_id, - (int)$field_id + (int) $field_id ); } else { return ilObjDataCollectionAccess::hasAccessToFields( diff --git a/Modules/DataCollection/classes/Fields/class.ilDclFieldListGUI.php b/Modules/DataCollection/classes/Fields/class.ilDclFieldListGUI.php index 3e5bd9e16425..acd1795a2567 100644 --- a/Modules/DataCollection/classes/Fields/class.ilDclFieldListGUI.php +++ b/Modules/DataCollection/classes/Fields/class.ilDclFieldListGUI.php @@ -125,7 +125,7 @@ public function confirmDeleteFields(): void foreach ($field_ids as $field_id) { /** @var ilDclBaseFieldModel $field */ $field = ilDclCache::getFieldCache($field_id); - $conf->addItem('dcl_field_ids[]', (string)$field_id, $field->getTitle()); + $conf->addItem('dcl_field_ids[]', (string) $field_id, $field->getTitle()); } $conf->setConfirm($this->lng->txt('delete'), 'deleteFields'); diff --git a/Modules/DataCollection/classes/Helpers/class.ilDclCache.php b/Modules/DataCollection/classes/Helpers/class.ilDclCache.php index 30e94132fb59..a0bfd7124124 100644 --- a/Modules/DataCollection/classes/Helpers/class.ilDclCache.php +++ b/Modules/DataCollection/classes/Helpers/class.ilDclCache.php @@ -281,7 +281,7 @@ public static function buildFieldFromRecord(array $rec): ilDclBaseFieldModel $field->setDescription($rec["description"]); } $field->setDatatypeId($rec["datatype_id"]); - $field->setUnique((bool)$rec["is_unique"]); + $field->setUnique((bool) $rec["is_unique"]); $fields_cache[$rec["id"]] = $field; return $field; diff --git a/Modules/DataCollection/classes/Helpers/class.ilDclGenericMultiInputGUI.php b/Modules/DataCollection/classes/Helpers/class.ilDclGenericMultiInputGUI.php index f99a291c115d..8e1787c80965 100644 --- a/Modules/DataCollection/classes/Helpers/class.ilDclGenericMultiInputGUI.php +++ b/Modules/DataCollection/classes/Helpers/class.ilDclGenericMultiInputGUI.php @@ -348,7 +348,7 @@ public function insert(ilTemplate $a_tpl): void foreach ($this->line_values as $i => $data) { $object = $this; $object->setValue($data); - $output .= $object->render((string)$i); + $output .= $object->render((string) $i); $counter++; } } else { diff --git a/Modules/DataCollection/classes/Table/class.ilDclTable.php b/Modules/DataCollection/classes/Table/class.ilDclTable.php index fccd6b14f60e..6e419c763fa4 100644 --- a/Modules/DataCollection/classes/Table/class.ilDclTable.php +++ b/Modules/DataCollection/classes/Table/class.ilDclTable.php @@ -104,27 +104,27 @@ public function doRead(): void if (null !== $rec["title"]) { $this->setTitle($rec["title"]); } - $this->setAddPerm((bool)$rec["add_perm"]); - $this->setEditPerm((bool)$rec["edit_perm"]); - $this->setDeletePerm((bool)$rec["delete_perm"]); - $this->setEditByOwner((bool)$rec["edit_by_owner"]); + $this->setAddPerm((bool) $rec["add_perm"]); + $this->setEditPerm((bool) $rec["edit_perm"]); + $this->setDeletePerm((bool) $rec["delete_perm"]); + $this->setEditByOwner((bool) $rec["edit_by_owner"]); if (null !== $rec["export_enabled"]) { $this->setExportEnabled((bool) $rec["export_enabled"]); } - $this->setImportEnabled((bool)$rec["import_enabled"]); - $this->setLimited((bool)$rec["limited"]); - $this->setLimitStart((string)$rec["limit_start"]); - $this->setLimitEnd((string)$rec["limit_end"]); - $this->setIsVisible((bool)$rec["is_visible"]); + $this->setImportEnabled((bool) $rec["import_enabled"]); + $this->setLimited((bool) $rec["limited"]); + $this->setLimitStart((string) $rec["limit_start"]); + $this->setLimitEnd((string) $rec["limit_end"]); + $this->setIsVisible((bool) $rec["is_visible"]); if (null !== $rec['description']) { $this->setDescription($rec['description']); } - $this->setDefaultSortField((string)$rec['default_sort_field_id']); + $this->setDefaultSortField((string) $rec['default_sort_field_id']); $this->setDefaultSortFieldOrder($rec['default_sort_field_order']); - $this->setPublicCommentsEnabled((bool)$rec['public_comments']); - $this->setViewOwnRecordsPerm((bool)$rec['view_own_records_perm']); - $this->setDeleteByOwner((bool)$rec['delete_by_owner']); - $this->setSaveConfirmation((bool)$rec['save_confirmation']); + $this->setPublicCommentsEnabled((bool) $rec['public_comments']); + $this->setViewOwnRecordsPerm((bool) $rec['view_own_records_perm']); + $this->setDeleteByOwner((bool) $rec['delete_by_owner']); + $this->setSaveConfirmation((bool) $rec['save_confirmation']); if (null !== $rec['table_order']) { $this->setOrder($rec['table_order']); } @@ -1067,7 +1067,7 @@ public function cloneStructure(ilDclTable $original): void } } - $this->setDefaultSortField((string)$default_sort_field); + $this->setDefaultSortField((string) $default_sort_field); $this->doUpdate(); // Clone Records with recordfields diff --git a/Modules/DataCollection/classes/Table/class.ilDclTableEditGUI.php b/Modules/DataCollection/classes/Table/class.ilDclTableEditGUI.php index 022fbbaff7e5..0b1ce409f975 100644 --- a/Modules/DataCollection/classes/Table/class.ilDclTableEditGUI.php +++ b/Modules/DataCollection/classes/Table/class.ilDclTableEditGUI.php @@ -317,15 +317,15 @@ public function save(string $a_mode = "create"): void $delete_by_owner = ($this->form->getInput('delete_perm_mode') == 'own'); $this->table->setDeleteByOwner($delete_by_owner); } - $this->table->setViewOwnRecordsPerm((bool)$this->form->getInput('view_own_records_perm')); - $this->table->setExportEnabled((bool)$this->form->getInput("export_enabled")); - $this->table->setImportEnabled((bool)$this->form->getInput("import_enabled")); + $this->table->setViewOwnRecordsPerm((bool) $this->form->getInput('view_own_records_perm')); + $this->table->setExportEnabled((bool) $this->form->getInput("export_enabled")); + $this->table->setImportEnabled((bool) $this->form->getInput("import_enabled")); $this->table->setDefaultSortField($this->form->getInput("default_sort_field")); $this->table->setDefaultSortFieldOrder($this->form->getInput("default_sort_field_order")); - $this->table->setLimited((bool)$this->form->getInput("limited")); + $this->table->setLimited((bool) $this->form->getInput("limited")); $this->table->setDescription($this->form->getInput('description')); - $this->table->setLimitStart((string)$this->form->getInput("limit_start")); - $this->table->setLimitEnd((string)$this->form->getInput("limit_end")); + $this->table->setLimitStart((string) $this->form->getInput("limit_start")); + $this->table->setLimitEnd((string) $this->form->getInput("limit_end")); if ($a_mode == "update") { $this->table->doUpdate(); $this->tpl->setOnScreenMessage('success', $this->lng->txt("dcl_msg_table_edited"), true); diff --git a/Modules/DataCollection/classes/Table/class.ilDclTableListGUI.php b/Modules/DataCollection/classes/Table/class.ilDclTableListGUI.php index 7d11926a26ce..79070d16300c 100644 --- a/Modules/DataCollection/classes/Table/class.ilDclTableListGUI.php +++ b/Modules/DataCollection/classes/Table/class.ilDclTableListGUI.php @@ -239,7 +239,7 @@ public function confirmDeleteTables(): void $conf->setHeaderText($this->lng->txt('dcl_tables_confirm_delete')); foreach ($tables as $table_id) { - $conf->addItem('dcl_table_ids[]', (string)$table_id, ilDclCache::getTableCache($table_id)->getTitle()); + $conf->addItem('dcl_table_ids[]', (string) $table_id, ilDclCache::getTableCache($table_id)->getTitle()); } $conf->setConfirm($this->lng->txt('delete'), 'deleteTables'); $conf->setCancel($this->lng->txt('cancel'), 'listTables'); diff --git a/Modules/DataCollection/classes/TableView/class.ilDclTableViewEditFormGUI.php b/Modules/DataCollection/classes/TableView/class.ilDclTableViewEditFormGUI.php index 93175a001392..a55d192eebab 100644 --- a/Modules/DataCollection/classes/TableView/class.ilDclTableViewEditFormGUI.php +++ b/Modules/DataCollection/classes/TableView/class.ilDclTableViewEditFormGUI.php @@ -63,7 +63,7 @@ protected function initForm(): void $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int()); foreach ($rbacreview->getParentRoleIds($ref_id) as $role_array) { $option = new ilCheckboxOption(ilObjRole::_getTranslation($role_array['title'])); - $option->setValue((string)$role_array['obj_id']); + $option->setValue((string) $role_array['obj_id']); $checkbox_group_input_gui->addOption($option); } diff --git a/Modules/DataCollection/classes/TableView/class.ilDclTableViewFieldSetting.php b/Modules/DataCollection/classes/TableView/class.ilDclTableViewFieldSetting.php index fdae9c7daa2d..d5627f16fb82 100644 --- a/Modules/DataCollection/classes/TableView/class.ilDclTableViewFieldSetting.php +++ b/Modules/DataCollection/classes/TableView/class.ilDclTableViewFieldSetting.php @@ -368,7 +368,7 @@ public function cloneStructure(ilDclTableViewFieldSetting $orig): int public function getFieldObject() { if (is_numeric($this->field)) { //normal field - return ilDclCache::getFieldCache((int)$this->field); + return ilDclCache::getFieldCache((int) $this->field); } else { //standard field global $DIC; $lng = $DIC['lng']; diff --git a/Modules/DataCollection/classes/TableView/class.ilDclTableViewGUI.php b/Modules/DataCollection/classes/TableView/class.ilDclTableViewGUI.php index 4b1c8c299bc9..114e8855d946 100644 --- a/Modules/DataCollection/classes/TableView/class.ilDclTableViewGUI.php +++ b/Modules/DataCollection/classes/TableView/class.ilDclTableViewGUI.php @@ -161,7 +161,7 @@ public function confirmDeleteTableviews(): void $conf->setHeaderText($this->lng->txt('dcl_tableviews_confirm_delete')); foreach ($tableviews as $tableview_id) { - $conf->addItem('dcl_tableview_ids[]', (string)$tableview_id, ilDclTableView::find($tableview_id)->getTitle()); + $conf->addItem('dcl_tableview_ids[]', (string) $tableview_id, ilDclTableView::find($tableview_id)->getTitle()); } $conf->setConfirm($this->lng->txt('delete'), 'deleteTableviews'); $conf->setCancel($this->lng->txt('cancel'), 'show'); diff --git a/Modules/DataCollection/classes/class.ilDataCollectionDataSet.php b/Modules/DataCollection/classes/class.ilDataCollectionDataSet.php index 46c7afccdc98..c174edce5a69 100644 --- a/Modules/DataCollection/classes/class.ilDataCollectionDataSet.php +++ b/Modules/DataCollection/classes/class.ilDataCollectionDataSet.php @@ -125,75 +125,75 @@ public function importRecord( switch ($a_entity) { case 'dcl': if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['id'])) { - $new_obj = ilObjectFactory::getInstanceByObjId((int)$new_id, false); + $new_obj = ilObjectFactory::getInstanceByObjId((int) $new_id, false); } else { $new_obj = new ilObjDataCollection(); $new_obj->create(true); } $new_obj->setTitle($a_rec['title']); $new_obj->setDescription($a_rec['description']); - $new_obj->setApproval((bool)$a_rec['approval']); - $new_obj->setPublicNotes((bool)$a_rec['public_notes']); - $new_obj->setNotification((bool)$a_rec['notification']); - $new_obj->setPublicNotes((bool)$a_rec['public_notes']); + $new_obj->setApproval((bool) $a_rec['approval']); + $new_obj->setPublicNotes((bool) $a_rec['public_notes']); + $new_obj->setNotification((bool) $a_rec['notification']); + $new_obj->setPublicNotes((bool) $a_rec['public_notes']); $new_obj->setOnline(false); - $new_obj->setRating((bool)$a_rec['rating']); + $new_obj->setRating((bool) $a_rec['rating']); $new_obj->update(); //clone mode, so no table will be created $this->import_dc_object = $new_obj; - $a_mapping->addMapping('Modules/DataCollection', 'dcl', $a_rec['id'], (string)$new_obj->getId()); + $a_mapping->addMapping('Modules/DataCollection', 'dcl', $a_rec['id'], (string) $new_obj->getId()); break; case 'il_dcl_table': $table = new ilDclTable(); $table->setTitle($a_rec['title']); $table->setObjId($this->import_dc_object->getId()); $table->setDescription($a_rec['description']); - $table->setAddPerm((bool)$a_rec['add_perm']); - $table->setEditPerm((bool)$a_rec['edit_perm']); - $table->setDeletePerm((bool)$a_rec['delete_perm']); - $table->setEditByOwner((bool)$a_rec['edit_by_owner']); - $table->setLimited((bool)$a_rec['limited']); + $table->setAddPerm((bool) $a_rec['add_perm']); + $table->setEditPerm((bool) $a_rec['edit_perm']); + $table->setDeletePerm((bool) $a_rec['delete_perm']); + $table->setEditByOwner((bool) $a_rec['edit_by_owner']); + $table->setLimited((bool) $a_rec['limited']); $table->setLimitStart($a_rec['limit_start']); $table->setLimitEnd($a_rec['limit_end']); - $table->setIsVisible((bool)$a_rec['is_visible']); - $table->setExportEnabled((bool)$a_rec['export_enabled']); - $table->setImportEnabled((bool)$a_rec['import_enabled']); + $table->setIsVisible((bool) $a_rec['is_visible']); + $table->setExportEnabled((bool) $a_rec['export_enabled']); + $table->setImportEnabled((bool) $a_rec['import_enabled']); $table->setDefaultSortField($a_rec['default_sort_field_id']); $table->setDefaultSortFieldOrder($a_rec['default_sort_field_order']); - $table->setPublicCommentsEnabled((bool)$a_rec['public_comments']); - $table->setViewOwnRecordsPerm((bool)$a_rec['view_own_records_perm']); - $table->setDeleteByOwner((bool)$a_rec['delete_by_owner']); - $table->setSaveConfirmation((bool)$a_rec['save_confirmation']); - $table->setOrder((int)$a_rec['table_order']); + $table->setPublicCommentsEnabled((bool) $a_rec['public_comments']); + $table->setViewOwnRecordsPerm((bool) $a_rec['view_own_records_perm']); + $table->setDeleteByOwner((bool) $a_rec['delete_by_owner']); + $table->setSaveConfirmation((bool) $a_rec['save_confirmation']); + $table->setOrder((int) $a_rec['table_order']); $table->doCreate(false, false); // false => Do not create views! They are imported later - $a_mapping->addMapping('Modules/DataCollection', 'il_dcl_table', $a_rec['id'], (string)$table->getId()); + $a_mapping->addMapping('Modules/DataCollection', 'il_dcl_table', $a_rec['id'], (string) $table->getId()); break; case 'il_dcl_tableview': $new_table_id = $a_mapping->getMapping('Modules/DataCollection', 'il_dcl_table', $a_rec['table_id']); if ($new_table_id) { $tableview = new ilDclTableView(); $tableview->setTitle($a_rec['title']); - $tableview->setTableId((int)$new_table_id); + $tableview->setTableId((int) $new_table_id); $tableview->setDescription($a_rec['description']); - $tableview->setTableviewOrder((int)$a_rec['tableview_order']); + $tableview->setTableviewOrder((int) $a_rec['tableview_order']); if (!is_array($a_rec['roles'])) { $a_rec['roles'] = json_decode($a_rec['roles']); } $tableview->setRoles($a_rec['roles']); $step_is_null = !array_key_exists('step_vs', $a_rec) || is_null($a_rec['step_vs']); - $step_is_null ? $tableview->setStepVs(true) : $tableview->setStepVs((bool)$a_rec['step_vs']); + $step_is_null ? $tableview->setStepVs(true) : $tableview->setStepVs((bool) $a_rec['step_vs']); $step_is_null = !array_key_exists('step_c', $a_rec) || is_null($a_rec['step_c']); - $step_is_null ? $tableview->setStepC(false) : $tableview->setStepC((bool)$a_rec['step_c']); + $step_is_null ? $tableview->setStepC(false) : $tableview->setStepC((bool) $a_rec['step_c']); $step_is_null = !array_key_exists('step_e', $a_rec) || is_null($a_rec['step_e']); - $step_is_null ? $tableview->setStepE(false) : $tableview->setStepE((bool)$a_rec['step_e']); + $step_is_null ? $tableview->setStepE(false) : $tableview->setStepE((bool) $a_rec['step_e']); $step_is_null = !array_key_exists('step_o', $a_rec) || is_null($a_rec['step_o']); - $step_is_null ? $tableview->setStepO(false) : $tableview->setStepO((bool)$a_rec['step_o']); + $step_is_null ? $tableview->setStepO(false) : $tableview->setStepO((bool) $a_rec['step_o']); $step_is_null = !array_key_exists('step_s', $a_rec) || is_null($a_rec['step_s']); - $step_is_null ? $tableview->setStepS(false) : $tableview->setStepS((bool)$a_rec['step_s']); + $step_is_null ? $tableview->setStepS(false) : $tableview->setStepS((bool) $a_rec['step_s']); $tableview->create(false); //do not create default setting as they are imported too @@ -211,14 +211,14 @@ public function importRecord( if ($new_table_id) { $field = new ilDclBaseFieldModel(); $field->setTableId((int) $new_table_id); - $field->setDatatypeId((int)$a_rec['datatype_id']); + $field->setDatatypeId((int) $a_rec['datatype_id']); $field->setTitle($a_rec['title']); $field->setDescription($a_rec['description']); - $field->setUnique((bool)$a_rec['is_unique']); + $field->setUnique((bool) $a_rec['is_unique']); $field->doCreate(); $a_mapping->addMapping('Modules/DataCollection', 'il_dcl_field', $a_rec['id'], $field->getId()); // Check if this field was used as default order by, if so, update to new id - $table = ilDclCache::getTableCache((int)$new_table_id); + $table = ilDclCache::getTableCache((int) $new_table_id); if ($table->getDefaultSortField() == $a_rec['id']) { $table->setDefaultSortField($field->getId()); $table->doUpdate(); @@ -233,8 +233,8 @@ public function importRecord( (int) $new_table_id, $new_field_id ?: $a_rec['field'] ); - $setting->setFieldOrder((int)$a_rec['field_order']); - $setting->setExportable((bool)$a_rec['exportable']); + $setting->setFieldOrder((int) $a_rec['field_order']); + $setting->setExportable((bool) $a_rec['exportable']); $setting->store(); } break; @@ -248,17 +248,17 @@ public function importRecord( if ($new_tableview_id) { $setting = new ilDclTableViewFieldSetting(); $setting->setTableviewId((int) $new_tableview_id); - $setting->setVisible((bool)$a_rec['visible']); + $setting->setVisible((bool) $a_rec['visible']); $setting->setField($new_field_id ?: $a_rec['field']); - $setting->setInFilter((bool)$a_rec['in_filter']); + $setting->setInFilter((bool) $a_rec['in_filter']); $setting->setFilterValue($a_rec['filter_value'] ?: null); $setting->setFilterChangeable((bool) $a_rec['filter_changeable']); - $setting->setRequiredCreate((bool)($a_rec['required_create'] ?? false)); - $setting->setLockedCreate((bool)($a_rec['locked_create'] ?? false)); - $setting->setVisibleCreate((bool)($a_rec['visible_create'] ?? true)); - $setting->setVisibleEdit((bool)($a_rec['visible_edit'] ?? true)); - $setting->setRequiredEdit((bool)($a_rec['required_edit'] ?? false)); - $setting->setLockedEdit((bool)($a_rec['locked_edit'] ?? false)); + $setting->setRequiredCreate((bool) ($a_rec['required_create'] ?? false)); + $setting->setLockedCreate((bool) ($a_rec['locked_create'] ?? false)); + $setting->setVisibleCreate((bool) ($a_rec['visible_create'] ?? true)); + $setting->setVisibleEdit((bool) ($a_rec['visible_edit'] ?? true)); + $setting->setRequiredEdit((bool) ($a_rec['required_edit'] ?? false)); + $setting->setLockedEdit((bool) ($a_rec['locked_edit'] ?? false)); $setting->setDefaultValue($a_rec['default_value'] ?? null); $setting->create(); $a_mapping->addMapping( @@ -349,8 +349,8 @@ public function importRecord( if ($new_field_id) { $opt = new ilDclSelectionOption(); $opt->setFieldId((int) $new_field_id); - $opt->setOptId((int)$a_rec['opt_id']); - $opt->setSorting((int)$a_rec['sorting']); + $opt->setOptId((int) $a_rec['opt_id']); + $opt->setSorting((int) $a_rec['sorting']); $opt->setValue($a_rec['value']); $opt->store(); } @@ -401,7 +401,7 @@ public function importRecord( $record_id = $a_mapping->getMapping('Modules/DataCollection', 'il_dcl_record', $a_rec['record_id']); $field_id = $a_mapping->getMapping('Modules/DataCollection', 'il_dcl_field', $a_rec['field_id']); if ($record_id && $field_id) { - $record = ilDclCache::getRecordCache((int)$record_id); + $record = ilDclCache::getRecordCache((int) $record_id); $field = ilDclCache::getFieldCache((int) $field_id); $record_field = new ilDclBaseRecordFieldModel($record, $field); $a_mapping->addMapping( @@ -488,7 +488,7 @@ public function importRecord( $value = (int) $value; } $stloc_default->setValue($value); - $stloc_default->setTviewSetId((int)$tview_set_id); + $stloc_default->setTviewSetId((int) $tview_set_id); $stloc_default->create(); } } @@ -504,7 +504,7 @@ public function beforeFinishImport(ilImportMapping $a_mapping): void { foreach ($this->import_temp_new_mob_ids as $new_mob_id) { if ($new_mob_id) { - ilObjMediaObject::_saveUsage((int)$new_mob_id, "dcl:html", $a_mapping->getTargetId()); + ilObjMediaObject::_saveUsage((int) $new_mob_id, "dcl:html", $a_mapping->getTargetId()); } } foreach ($this->import_temp_refs as $record_field_id => $old_record_id) { @@ -806,7 +806,7 @@ protected function getDependencies( $set = $this->db->query($sql); while ($rec = $this->db->fetchObject($set)) { - $stloc = ilDclCache::getFieldCache((int)$a_rec['field'])->getStorageLocation(); + $stloc = ilDclCache::getFieldCache((int) $a_rec['field'])->getStorageLocation(); if ($stloc != 0) { $value_str = "value$stloc"; $value = $rec->{$value_str}; @@ -815,7 +815,7 @@ protected function getDependencies( $tview_set_id = $rec->tview_set_id; // Save reocrd field id. Internal ID is not used currently - $this->caches["il_dcl_stloc"."$stloc"."_default"][$rec->tview_set_id] = [ + $this->caches["il_dcl_stloc" . "$stloc" . "_default"][$rec->tview_set_id] = [ 'id' => $id, 'tview_set_id' => $rec->tview_set_id, 'value' => $value, @@ -859,7 +859,7 @@ protected function _readData(string $a_entity, array $a_ids): void switch ($a_entity) { case 'dcl': foreach ($a_ids as $dcl_id) { - if (ilObject::_lookupType((int)$dcl_id) === 'dcl') { + if (ilObject::_lookupType((int) $dcl_id) === 'dcl') { $obj = new ilObjDataCollection((int) $dcl_id, false); $data = [ 'id' => $dcl_id, diff --git a/Modules/DataCollection/classes/class.ilDclExportTableGUI.php b/Modules/DataCollection/classes/class.ilDclExportTableGUI.php index 05f0b3c8a61d..932ec76b2f72 100644 --- a/Modules/DataCollection/classes/class.ilDclExportTableGUI.php +++ b/Modules/DataCollection/classes/class.ilDclExportTableGUI.php @@ -97,7 +97,7 @@ protected function fillRow(array $a_set): void ) . ".xlsx" : $a_set['file']; $this->tpl->setVariable('VAL_FILE', $filename); - $this->tpl->setVariable('VAL_SIZE', ilUtil::formatSize((int)$a_set['size'])); + $this->tpl->setVariable('VAL_SIZE', ilUtil::formatSize((int) $a_set['size'])); $this->tpl->setVariable( 'VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set['timestamp'], IL_CAL_UNIX)) diff --git a/Modules/DataCollection/classes/class.ilObjDataCollection.php b/Modules/DataCollection/classes/class.ilObjDataCollection.php index cdaf4cc5080d..55bdb4af6e67 100644 --- a/Modules/DataCollection/classes/class.ilObjDataCollection.php +++ b/Modules/DataCollection/classes/class.ilObjDataCollection.php @@ -38,11 +38,11 @@ protected function doRead(): void $data = $this->db->fetchObject($result); if ($data) { - $this->setOnline((bool)$data->is_online); - $this->setRating((bool)$data->rating); - $this->setApproval((bool)$data->approval); - $this->setPublicNotes((bool)$data->public_notes); - $this->setNotification((bool)$data->notification); + $this->setOnline((bool) $data->is_online); + $this->setRating((bool) $data->rating); + $this->setApproval((bool) $data->approval); + $this->setPublicNotes((bool) $data->public_notes); + $this->setNotification((bool) $data->notification); } } @@ -179,7 +179,7 @@ public function sendNotification($a_action, $a_table_id, $a_record_id = null): v $value = null; if ($field->isStandardField()) { $value = $record->getStandardFieldPlainText($field->getId()); - } elseif ($record_field = $record->getRecordField((int)$field->getId())) { + } elseif ($record_field = $record->getRecordField((int) $field->getId())) { $value = $record_field->getPlainText(); } diff --git a/Modules/DataCollection/classes/class.ilObjDataCollectionGUI.php b/Modules/DataCollection/classes/class.ilObjDataCollectionGUI.php index a9d5b693c548..375de51ab105 100644 --- a/Modules/DataCollection/classes/class.ilObjDataCollectionGUI.php +++ b/Modules/DataCollection/classes/class.ilObjDataCollectionGUI.php @@ -336,7 +336,7 @@ protected function addLocatorItems(): void $this->locator->addItem( $this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), - (string)$this->object->getRefId() + (string) $this->object->getRefId() ); } } @@ -372,13 +372,13 @@ public static function _goto(string $a_target): void } //redirect to info screen elseif ($access->checkAccess('visbile', "", $ref_id)) { - ilObjectGUI::_gotoRepositoryNode((int)$a_target, "infoScreen"); + ilObjectGUI::_gotoRepositoryNode((int) $a_target, "infoScreen"); } //redirect if no permission given else { $message = sprintf( $lng->txt("msg_no_perm_read_item"), - ilObject::_lookupTitle(ilObject::_lookupObjId((int)$a_target)) + ilObject::_lookupTitle(ilObject::_lookupObjId((int) $a_target)) ); $tpl->setOnScreenMessage('failure', $message, true); @@ -531,11 +531,11 @@ protected function getEditFormCustomValues(array &$a_values): void protected function updateCustom(ilPropertyFormGUI $form): void { - $this->object->setOnline((bool)$form->getInput("is_online")); - $this->object->setRating((bool)$form->getInput("rating")); - $this->object->setPublicNotes((bool)$form->getInput("public_notes")); - $this->object->setApproval((bool)$form->getInput("approval")); - $this->object->setNotification((bool)$form->getInput("notification")); + $this->object->setOnline((bool) $form->getInput("is_online")); + $this->object->setRating((bool) $form->getInput("rating")); + $this->object->setPublicNotes((bool) $form->getInput("public_notes")); + $this->object->setApproval((bool) $form->getInput("approval")); + $this->object->setNotification((bool) $form->getInput("notification")); $this->object_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();