ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclFileuploadFieldRepresentation Class Reference

Class ilDclFileuploadFieldRepresentaion. More...

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

Public Member Functions

 getInputField (ilPropertyFormGUI $form, $record_id=0)
 
 addFilterInputFieldToTable (ilTable2GUI $table)
 
 passThroughFilter (ilDclBaseRecordModel $record, $filter)
 
 buildFieldCreationInput (ilObjDataCollection $dcl, $mode='create')
 
- 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 ($value, $link=true)
 
 getInputField (ilPropertyFormGUI $form, $record_id=0)
 Returns field-input. More...
 
 addFieldCreationForm ($form, ilObjDataCollection $dcl, $mode="create")
 Adds the options for the field-types to the field-creation form. More...
 
 getPropertyInputFieldId ($property)
 Return post-var for property-fields. More...
 
 getField ()
 Return BaseFieldModel. More...
 

Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from ilDclBaseFieldRepresentation
 $field
 
 $lng
 
 $ctrl
 

Detailed Description

Class ilDclFileuploadFieldRepresentaion.

Author
Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

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

Member Function Documentation

◆ addFilterInputFieldToTable()

ilDclFileuploadFieldRepresentation::addFilterInputFieldToTable ( ilTable2GUI  $table)

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

References $input, ilTable2GUI\addFilterItemByMetaType(), ilTable2GUI\FILTER_TEXT, ilDclBaseFieldRepresentation\getField(), ilDclBaseFieldRepresentation\getFilterInputFieldValue(), and ilDclBaseFieldRepresentation\setupFilterInputField().

54  {
55  $input = $table->addFilterItemByMetaType("filter_" . $this->getField()->getId(), ilTable2GUI::FILTER_TEXT, false, $this->getField()->getId());
56  $input->setSubmitFormOnEnter(true);
57 
59 
60  return $this->getFilterInputFieldValue($input);
61  }
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
setupFilterInputField(ilFormPropertyGUI $input)
Set basic settings for filter-input-gui.
+ Here is the call graph for this function:

◆ buildFieldCreationInput()

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

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

References ilDclBaseFieldModel\PROP_SUPPORTED_FILE_TYPES, and ilFormPropertyGUI\setInfo().

89  {
90  $opt = parent::buildFieldCreationInput($dcl, $mode);
91 
92  $prop_filetype = new ilTextInputGUI($this->lng->txt('dcl_supported_filetypes'), 'prop_' . ilDclBaseFieldModel::PROP_SUPPORTED_FILE_TYPES);
93  $prop_filetype->setInfo($this->lng->txt('dcl_supported_filetypes_desc'));
94 
95  $opt->addSubItem($prop_filetype);
96 
97  return $opt;
98  }
setInfo($a_info)
Set Information Text.
This class represents a text property in a property form.
+ Here is the call graph for this function:

◆ getInputField()

ilDclFileuploadFieldRepresentation::getInputField ( ilPropertyFormGUI  $form,
  $record_id = 0 
)

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

References $input, ilDclBaseFieldRepresentation\getField(), and requiredWorkaroundForInputField().

16  {
17  $input = new ilFileInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
18  $input->setSuffixes($this->getField()->getSupportedExtensions());
19  $input->setAllowDeletion(true);
20 
21  $this->requiredWorkaroundForInputField($input, $record_id);
22 
23  return $input;
24  }
This class represents a file property in a property form.
+ Here is the call graph for this function:

◆ passThroughFilter()

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

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

References $pass, ilObject2\_exists(), ilObject2\_lookupType(), ilDclBaseFieldRepresentation\getField(), and ilDclBaseRecordModel\getRecordFieldValue().

68  {
69  $value = $record->getRecordFieldValue($this->getField()->getId());
70  $pass = false;
71  if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
72  $pass = true;
73  }
74 
75  $file_obj = new ilObjFile($value, false);
76  $file_name = $file_obj->getTitle();
77  if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
78  $pass = true;
79  }
80 
81  return $pass;
82  }
static _lookupType($a_id, $a_reference=false)
getRecordFieldValue($field_id)
Get Field Value.
static _exists($a_id, $a_reference=false, $a_type=null)
+ Here is the call graph for this function:

◆ requiredWorkaroundForInputField()

ilDclFileuploadFieldRepresentation::requiredWorkaroundForInputField (   $input,
  $record_id 
)
protected

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

References $input, ilDclBaseFieldRepresentation\getField(), ilDclCache\getRecordCache(), and ilDclBaseFieldRepresentation\setupInputField().

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

28  {
29  if ($record_id) {
30  $record = ilDclCache::getRecordCache($record_id);
31  }
32 
33  $this->setupInputField($input, $this->getField());
34 
35  //WORKAROUND
36  // 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.
37  if ($record_id && $record->getId()) {
38  $field_value = $record->getRecordFieldValue($this->getField()->getId());
39  if ($field_value) {
40  $input->setRequired(false);
41  }
42  }
43  // If this is an ajax request to return the form, input files are currently not supported
44  if ($this->ctrl->isAsynch()) {
45  $input->setDisabled(true);
46  }
47  }
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
static getRecordCache($record_id=0)
+ 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: