Skip to content

Commit

Permalink
unify fileuploads and remove deprecation (ILIAS-eLearning#8178)
Browse files Browse the repository at this point in the history
  • Loading branch information
iszmais authored Oct 10, 2024
1 parent e29d5d2 commit 7ef4fd1
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 559 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,7 @@ public function saveConfirmation(ilDclBaseRecordModel $record_obj, string $fileh
/** @var ilDclBaseRecordFieldModel $record_field */
$record_field->addHiddenItemsToConfirmation($confirmation);

if (($record_field instanceof ilDclFileuploadRecordFieldModel || $record_field instanceof ilDclMobRecordFieldModel)
&& $record_field->getValue() == null
) {
if ($record_field instanceof ilDclFileRecordFieldModel && $record_field->getValue() == null) {
$empty_fileuploads['field_' . $field->getId()] = [
"name" => "",
"type" => "",
Expand All @@ -460,7 +458,7 @@ public function saveConfirmation(ilDclBaseRecordModel $record_obj, string $fileh
}
$record_representation = ilDclFieldFactory::getRecordRepresentationInstance($record_field);

if ($record_representation->getConfirmationHTML() != false) {
if ($record_representation->getConfirmationHTML() !== '') {
$record_data .= $field->getTitle() . ": " . $record_representation->getConfirmationHTML() . "<br />";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,6 @@
*/
class ilDclFileFieldModel extends ilDclBaseFieldModel
{
public function getRecordQuerySortObject(
string $direction = "asc",
bool $sort_by_status = false
): ?ilDclRecordQueryObject {
$join_str = "LEFT JOIN il_dcl_record_field AS sort_record_field_{$this->getId()} ON (sort_record_field_{$this->getId()}.record_id = record.id AND sort_record_field_{$this->getId()}.field_id = "
. $this->db->quote($this->getId(), 'integer') . ") ";
$join_str .= "LEFT JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS sort_stloc_{$this->getId()} ON (sort_stloc_{$this->getId()}.record_field_id = sort_record_field_{$this->getId()}.id) ";
$join_str .= "LEFT JOIN il_resource_revision AS sort_object_data_{$this->getId()} ON (sort_object_data_{$this->getId()}.rid = sort_stloc_{$this->getId()}.value) ";
$select_str = " sort_object_data_{$this->getId()}.title AS field_{$this->getId()},";

$record_query = new ilDclRecordQueryObject();
$record_query->setSelectStatement($select_str);
$record_query->setJoinStatement($join_str);
$record_query->setOrderStatement("field_{$this->getId()} " . $direction . ", ID ASC");

return $record_query;
}

public function allowFilterInListView(): bool
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@

declare(strict_types=1);

/**
* @noinspection AutoloadingIssuesInspection
*/
class ilDclFileFieldRepresentation extends ilDclBaseFieldRepresentation
{
public function getInputField(
ilPropertyFormGUI $form,
?int $record_id = null
): ?ilFormPropertyGUI {
): ilFileInputGUI {
$input = new ilFileInputGUI(
$this->getField()->getTitle(),
'field_' . $this->getField()->getId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public function __construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $f
$this->upload = $DIC->upload();
}

public function getRecordRepresentation(): ?ilDclBaseRecordRepresentation
{
return new ilDclFileRecordRepresentation($this);
}

public function parseValue($value)
{
if ($value === -1) { // marked for deletion.
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7ef4fd1

Please sign in to comment.