ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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
 
ilObjUser $user
 
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 74 of file class.ilDclCopyFieldRepresentation.php.

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

75  {
76  $input = $table->addFilterItemByMetaType(
77  "filter_" . $this->getField()->getId(),
79  false,
80  $this->getField()->getId()
81  );
82  $input->setSubmitFormOnEnter(true);
83 
84  $this->setupFilterInputField($input);
85 
86  return $this->getFilterInputFieldValue($input);
87  }
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 101 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, ilDclBaseFieldModel\PROP_REFERENCE, and ilSelectInputGUI\setOptions().

101  : ilRadioOption
102  {
103  $datetype_title = $this->getField()->getPresentationTitle();
104  $opt = new ilRadioOption($this->getField()->getPresentationTitle(), $this->getField()->getDatatypeId());
105  $opt->setInfo($this->getField()->getPresentationDescription());
106 
107  $options = [];
108  $tables = $dcl->getTables();
109  foreach ($tables as $table) {
110  foreach ($table->getRecordFields() as $field) {
111  if (in_array($field->getDatatypeId(), self::VALID_TYPES)) {
112  $options[$field->getId()] = $table->getTitle() . ' -> ' . $field->getTitle();
113  }
114  }
115  }
116 
117  $prop_table_selection = new ilSelectInputGUI(
118  $this->lng->txt('dcl_copy_title'),
120  );
121  $prop_table_selection->setOptions($options);
122  $opt->addSubItem($prop_table_selection);
123 
124  $prop_multi_select = new ilDclCheckboxInputGUI(
125  $this->lng->txt('dcl_multiple_selection'),
127  );
128  $opt->addSubItem($prop_multi_select);
129 
130  return $opt;
131  }
This class represents an option in a radio group.
This class represents a selection list property in a property form.
setOptions(array $a_options)
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 32 of file class.ilDclCopyFieldRepresentation.php.

References ilDclBaseFieldRepresentation\getField(), ilDclCache\getFieldCache(), ILIAS\Survey\Mode\getId(), ilDclCache\getRecordCache(), ilDclCache\getTableCache(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ILIAS\Repository\lng(), null, ilDclBaseFieldModel\PROP_N_REFERENCE, ilDclBaseFieldModel\PROP_REFERENCE, and ilDclBaseFieldRepresentation\setupInputField().

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

◆ passThroughFilter()

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

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

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

89  : bool
90  {
91  $pass = parent::passThroughFilter($record, $filter);
92 
93  $value = $record->getRecordFieldValue($this->getField()->getId());
94  if (!$filter || strpos(strtolower($value), strtolower($filter)) !== false) {
95  $pass = true;
96  }
97 
98  return $pass;
99  }
getRecordFieldValue(?string $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: