ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDclFileuploadFieldRepresentation Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilDclFileuploadFieldRepresentation:
+ Collaboration diagram for ilDclFileuploadFieldRepresentation:

Public Member Functions

 getInputField (ilPropertyFormGUI $form, ?int $record_id=null)
 
 addFilterInputFieldToTable (ilTable2GUI $table)
 
 passThroughFilter (ilDclBaseRecordModel $record, $filter)
 
- Public Member Functions inherited from ilDclBaseFieldRepresentation
 __construct (ilDclBaseFieldModel $field)
 
 addFilterInputFieldToTable (ilTable2GUI $table)
 Add filter input to TableGUI. More...
 
 passThroughFilter (ilDclBaseRecordModel $record, $filter)
 Checks if a filter affects a record. More...
 
 parseSortingValue (string $value, bool $link=true)
 
 getInputField (ilPropertyFormGUI $form, ?int $record_id=null)
 Returns field-input. More...
 
 addFieldCreationForm (ilSubEnabledFormPropertyGUI $form, ilObjDataCollection $dcl, string $mode="create")
 Adds the options for the field-types to the field-creation form. More...
 
 getPropertyInputFieldId (string $property)
 Return post-var for property-fields. More...
 
 getField ()
 Return BaseFieldModel. More...
 

Protected Member Functions

 requiredWorkaroundForInputField (ilFileInputGUI $input, ?int $record_id)
 
 buildFieldCreationInput (ilObjDataCollection $dcl, string $mode='create')
 
- Protected Member Functions inherited from ilDclBaseFieldRepresentation
 setupFilterInputField (?ilTableFilterItem $input)
 Set basic settings for filter-input-gui. More...
 
 setupInputField (ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
 Sets basic settings on field-input. More...
 
 getFilterInputFieldValue (ilTableFilterItem $input)
 
 buildFieldCreationInput (ilObjDataCollection $dcl, string $mode='create')
 Build the creation-input-field. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilDclBaseFieldRepresentation
ilDclBaseFieldModel $field
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ilComponentRepository $component_repository
 
ilComponentFactory $component_factory
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 19 of file class.ilDclFileuploadFieldRepresentation.php.

Member Function Documentation

◆ addFilterInputFieldToTable()

ilDclFileuploadFieldRepresentation::addFilterInputFieldToTable ( ilTable2GUI  $table)
Returns
array|string|null
Exceptions
Exception

Definition at line 58 of file class.ilDclFileuploadFieldRepresentation.php.

References ilTable2GUI\addFilterItemByMetaType(), ilTable2GUI\FILTER_TEXT, ilDclBaseFieldRepresentation\getField(), ilDclBaseFieldRepresentation\getFilterInputFieldValue(), ILIAS\Survey\Mode\getId(), and ilDclBaseFieldRepresentation\setupFilterInputField().

59  {
60  $input = $table->addFilterItemByMetaType(
61  "filter_" . $this->getField()->getId(),
63  false,
64  $this->getField()->getId()
65  );
66  $input->setSubmitFormOnEnter(true);
67 
68  $this->setupFilterInputField($input);
69 
70  return $this->getFilterInputFieldValue($input);
71  }
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
+ Here is the call graph for this function:

◆ buildFieldCreationInput()

ilDclFileuploadFieldRepresentation::buildFieldCreationInput ( ilObjDataCollection  $dcl,
string  $mode = 'create' 
)
protected

Definition at line 96 of file class.ilDclFileuploadFieldRepresentation.php.

References ILIAS\Repository\lng(), and ilDclBaseFieldModel\PROP_SUPPORTED_FILE_TYPES.

97  {
98  $opt = parent::buildFieldCreationInput($dcl, $mode);
99 
100  $prop_filetype = new ilTextInputGUI(
101  $this->lng->txt('dcl_supported_filetypes'),
103  );
104  $prop_filetype->setInfo($this->lng->txt('dcl_supported_filetypes_desc'));
105 
106  $opt->addSubItem($prop_filetype);
107 
108  return $opt;
109  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getInputField()

ilDclFileuploadFieldRepresentation::getInputField ( ilPropertyFormGUI  $form,
?int  $record_id = null 
)

Definition at line 21 of file class.ilDclFileuploadFieldRepresentation.php.

References ilDclBaseFieldRepresentation\getField(), ILIAS\Survey\Mode\getId(), and requiredWorkaroundForInputField().

22  {
23  $input = new ilFileInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
24  $input->setSuffixes($this->getField()->getSupportedExtensions());
25  $input->setAllowDeletion(true);
26 
27  $this->requiredWorkaroundForInputField($input, $record_id);
28 
29  return $input;
30  }
This class represents a file property in a property form.
requiredWorkaroundForInputField(ilFileInputGUI $input, ?int $record_id)
+ Here is the call graph for this function:

◆ passThroughFilter()

ilDclFileuploadFieldRepresentation::passThroughFilter ( ilDclBaseRecordModel  $record,
  $filter 
)
Parameters
string$filter

Definition at line 76 of file class.ilDclFileuploadFieldRepresentation.php.

References ilObject\_exists(), ilObject\_lookupType(), ilDclBaseFieldRepresentation\getField(), ILIAS\Survey\Mode\getId(), and ilDclBaseRecordModel\getRecordFieldValue().

76  : bool
77  {
78  $value = $record->getRecordFieldValue($this->getField()->getId());
79  $pass = false;
80  if (!ilObject2::_exists($value) || ilObject2::_lookupType($value) != "file") {
81  $pass = true;
82  }
83 
84  $file_obj = new ilObjFile($value, false);
85  $file_name = $file_obj->getTitle();
86  if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
87  $pass = true;
88  }
89 
90  return $pass;
91  }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
getRecordFieldValue(?int $field_id)
Get Field Value.
Class ilObjFile.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ requiredWorkaroundForInputField()

ilDclFileuploadFieldRepresentation::requiredWorkaroundForInputField ( ilFileInputGUI  $input,
?int  $record_id 
)
protected

Definition at line 32 of file class.ilDclFileuploadFieldRepresentation.php.

References ILIAS\Repository\ctrl(), ilDclBaseFieldRepresentation\getField(), ILIAS\Survey\Mode\getId(), ilDclCache\getRecordCache(), ilFormPropertyGUI\setDisabled(), ilFormPropertyGUI\setRequired(), and ilDclBaseFieldRepresentation\setupInputField().

Referenced by getInputField(), and ilDclMobFieldRepresentation\getInputField().

32  : void
33  {
34  if ($record_id) {
35  $record = ilDclCache::getRecordCache($record_id);
36  }
37 
38  $this->setupInputField($input, $this->getField());
39 
40  //WORKAROUND
41  // If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
42  if ($record_id && $record->getId()) {
43  $field_value = $record->getRecordFieldValue($this->getField()->getId());
44  if ($field_value) {
45  $input->setRequired(false);
46  }
47  }
48  // If this is an ajax request to return the form, input files are currently not supported
49  if ($this->ctrl->isAsynch()) {
50  $input->setDisabled(true);
51  }
52  }
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
setRequired(bool $a_required)
static getRecordCache(?int $record_id)
setDisabled(bool $a_disabled)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: