ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDclCopyFieldRepresentation 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 ilDclCopyFieldRepresentation:
+ Collaboration diagram for ilDclCopyFieldRepresentation:

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

 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...
 

Private Attributes

const VALID_TYPES
 

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.ilDclCopyFieldRepresentation.php.

Member Function Documentation

◆ addFilterInputFieldToTable()

ilDclCopyFieldRepresentation::addFilterInputFieldToTable ( ilTable2GUI  $table)

Definition at line 73 of file class.ilDclCopyFieldRepresentation.php.

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

74  {
75  $input = $table->addFilterItemByMetaType(
76  "filter_" . $this->getField()->getId(),
78  false,
79  $this->getField()->getId()
80  );
81  $input->setSubmitFormOnEnter(true);
82 
83  $this->setupFilterInputField($input);
84 
85  return $this->getFilterInputFieldValue($input);
86  }
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()

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

Definition at line 100 of file class.ilDclCopyFieldRepresentation.php.

References ilDclBaseFieldRepresentation\$field, ilSubEnabledFormPropertyGUI\addSubItem(), ilDclBaseFieldModel\getDatatypeId(), ilDclBaseFieldRepresentation\getField(), ilDclBaseFieldModel\getId(), ilObjDataCollection\getTables(), ilDclBaseFieldModel\getTitle(), ILIAS\Repository\lng(), ilDclBaseFieldModel\PROP_N_REFERENCE, and ilDclBaseFieldModel\PROP_REFERENCE.

100  : ilRadioOption
101  {
102  $datetype_title = $this->getField()->getPresentationTitle();
103  $opt = new ilRadioOption($this->getField()->getPresentationTitle(), $this->getField()->getDatatypeId());
104  $opt->setInfo($this->getField()->getPresentationDescription());
105 
106  $options = [];
107  $tables = $dcl->getTables();
108  foreach ($tables as $table) {
109  foreach ($table->getRecordFields() as $field) {
110  if (in_array($field->getDatatypeId(), self::VALID_TYPES)) {
111  $options[$field->getId()] = $table->getTitle() . ' -> ' . $field->getTitle();
112  }
113  }
114  }
115 
116  $prop_table_selection = new ilSelectInputGUI(
117  $this->lng->txt('dcl_copy_title'),
119  );
120  $prop_table_selection->setOptions($options);
121  $opt->addSubItem($prop_table_selection);
122 
123  $prop_multi_select = new ilDclCheckboxInputGUI(
124  $this->lng->txt('dcl_multiple_selection'),
126  );
127  $opt->addSubItem($prop_multi_select);
128 
129  return $opt;
130  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDatatypeId()
Get datatype_id.
+ Here is the call graph for this function:

◆ getInputField()

ilDclCopyFieldRepresentation::getInputField ( ilPropertyFormGUI  $form,
?int  $record_id = null 
)
Returns
ilSelectInputGUI|ilMultiSelectInputGUI

Definition at line 31 of file class.ilDclCopyFieldRepresentation.php.

References ilDclBaseFieldRepresentation\getField(), ilDclCache\getFieldCache(), ILIAS\Survey\Mode\getId(), ilDclCache\getRecordCache(), ilDclCache\getTableCache(), ILIAS\Repository\lng(), ilDclBaseFieldModel\PROP_N_REFERENCE, ilDclBaseFieldModel\PROP_REFERENCE, and ilDclBaseFieldRepresentation\setupInputField().

32  {
33  if ($this->getField()->getProperty(ilDclBaseFieldModel::PROP_N_REFERENCE)) {
34  $input = new ilMultiSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
35  } else {
36  $input = new ilSelectInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
37  }
38 
39  $this->setupInputField($input, $this->getField());
40 
41  $options = [];
42  if (!$this->getField()->getProperty(ilDclBaseFieldModel::PROP_N_REFERENCE)) {
43  $options[''] = $this->lng->txt('dcl_please_select');
44  }
45 
46  $value = null;
47  $copy_id = $this->getField()->getProperty(ilDclBaseFieldModel::PROP_REFERENCE);
48  $copy_field = ilDclCache::getFieldCache($copy_id);
49  if ($copy_field->getTableId() !== 0) {
50  $copy_table = ilDclCache::getTableCache($copy_field->getTableId());
51  foreach ($copy_table->getRecords() as $record) {
52  $option = $record->getRecordField($copy_field->getId())->getPlainText();
53  if (!in_array($option, $options)) {
54  $options[$option] = $option;
55  }
56  }
57  } else {
58  $input->setAlert($this->lng->txt('dcl_origin_not_found'));
59  }
60 
61  if ($record_id !== null) {
62  $value = ilDclCache::getRecordCache($record_id)->getRecordFieldValue($this->getField()->getId());
63  if ($value !== '' && !array_key_exists($value, $options)) {
64  $options[$value] = $value . ' ' . $this->lng->txt('dcl_deprecated_copy');
65  }
66  }
67 
68  $input->setOptions($options);
69 
70  return $input;
71  }
static getFieldCache(int $field_id=0)
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getTableCache(int $table_id=null)
static getRecordCache(?int $record_id)
This class represents a property in a property form.
+ Here is the call graph for this function:

◆ passThroughFilter()

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

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

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

88  : bool
89  {
90  $pass = parent::passThroughFilter($record, $filter);
91 
92  $value = $record->getRecordFieldValue($this->getField()->getId());
93  if (!$filter || strpos(strtolower($value), strtolower($filter)) !== false) {
94  $pass = true;
95  }
96 
97  return $pass;
98  }
getRecordFieldValue(?int $field_id)
Get Field Value.
+ Here is the call graph for this function:

Field Documentation

◆ VALID_TYPES


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