ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 Add filter input to TableGUI. More...
 
 passThroughFilter (ilDclBaseRecordModel $record, $filter)
 Checks if a filter affects a record. More...
 
- 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')
 Build the creation-input-field. More...
 
- 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)

Add filter input to TableGUI.

Parameters
ilTable2GUI$table
Returns
null

Reimplemented from ilDclBaseFieldRepresentation.

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

80 {
81 $input = $table->addFilterItemByMetaType(
82 "filter_" . $this->getField()->getId(),
84 false,
85 $this->getField()->getId()
86 );
87 $input->setSubmitFormOnEnter(true);
88
89 $this->setupFilterInputField($input);
90
91 return $this->getFilterInputFieldValue($input);
92 }
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.

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

+ Here is the call graph for this function:

◆ buildFieldCreationInput()

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

Build the creation-input-field.

Reimplemented from ilDclBaseFieldRepresentation.

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

107 {
108 $datetype_title = $this->getField()->getPresentationTitle();
109 $opt = new ilRadioOption($this->getField()->getPresentationTitle(), $this->getField()->getDatatypeId());
110 $opt->setInfo($this->getField()->getPresentationDescription());
111
112 $options = [];
113 $tables = $dcl->getTables();
114 foreach ($tables as $table) {
115 foreach ($table->getRecordFields() as $field) {
116 if (in_array($field->getDatatypeId(), self::VALID_TYPES)) {
117 $options[$field->getId()] = $table->getTitle() . ' -> ' . $field->getTitle();
118 }
119 }
120 }
121
122 $prop_table_selection = new ilSelectInputGUI(
123 $this->lng->txt('dcl_copy_title'),
125 );
126 $prop_table_selection->setOptions($options);
127 $opt->addSubItem($prop_table_selection);
128
129 $prop_multi_select = new ilDclCheckboxInputGUI(
130 $this->lng->txt('dcl_multiple_selection'),
132 );
133 $opt->addSubItem($prop_multi_select);
134
135 return $opt;
136 }
This class represents an option in a radio group.
This class represents a selection list property in a property form.

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

+ Here is the call graph for this function:

◆ getInputField()

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

Reimplemented from ilDclBaseFieldRepresentation.

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

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

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

+ Here is the call graph for this function:

◆ passThroughFilter()

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

Checks if a filter affects a record.

Parameters
int | string | array$filter

Reimplemented from ilDclBaseFieldRepresentation.

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

94 : bool
95 {
96 $pass = parent::passThroughFilter($record, $filter);
97
98 $value = $record->getRecordFieldValue($this->getField()->getId());
99 if (!$filter || strpos(strtolower($value), strtolower($filter)) !== false) {
100 $pass = true;
101 }
102
103 return $pass;
104 }
getRecordFieldValue(?string $field_id)
Get Field Value.

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

+ Here is the call graph for this function:

Field Documentation

◆ VALID_TYPES


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