ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Settings\Vocabularies\DataRetrieval Class Reference
+ Inheritance diagram for ILIAS\MetaData\Settings\Vocabularies\DataRetrieval:
+ Collaboration diagram for ILIAS\MetaData\Settings\Vocabularies\DataRetrieval:

Public Member Functions

 __construct (VocabManager $vocab_manager, Presentation $presentation, UIFactory $ui_factory)
 
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 

Protected Member Functions

 getVocabs (?Range $range=null)
 

Protected Attributes

const int MAX_PREVIEW_VALUES = 5
 
VocabManager $vocab_manager
 
Presentation $presentation
 
UIFactory $ui_factory
 
array $vocabs
 

Detailed Description

Definition at line 31 of file DataRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::__construct ( VocabManager  $vocab_manager,
Presentation  $presentation,
UIFactory  $ui_factory 
)

Member Function Documentation

◆ getRows()

ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::getRows ( DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
?array  $filter_data,
?array  $additional_parameters 
)

This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g.

yield $row_builder->buildStandardRow($row_id, $record).

Parameters
string[]$visible_column_ids

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 54 of file DataRetrieval.php.

61 : \Generator {
62 $checked_icon = $this->ui_factory->symbol()->icon()->custom(
63 'assets/images/standard/icon_checked.svg',
64 $this->presentation->txt('yes'),
65 'small'
66 );
67 $unchecked_icon = $this->ui_factory->symbol()->icon()->custom(
68 'assets/images/standard/icon_unchecked.svg',
69 $this->presentation->txt('yes'),
70 'small'
71 );
72
73 $infos = $this->vocab_manager->infos();
74 foreach ($this->getVocabs($range) as $vocab) {
75 $record = [];
76
77 $record['element'] = $this->presentation->makeSlotPresentable($vocab->slot());
78 $record['type'] = $this->presentation->makeTypePresentable($vocab->type());
79 $record['source'] = $vocab->source();
80 $record['preview'] = implode(
81 ', ',
82 $this->presentation->makeValuesPresentable($vocab, self::MAX_PREVIEW_VALUES)
83 );
84 $record['active'] = $vocab->isActive() ? $checked_icon : $unchecked_icon;
85 if ($infos->isCustomInputApplicable($vocab)) {
86 $record['custom_input'] = $vocab->allowsCustomInputs() ? $checked_icon : $unchecked_icon;
87 }
88
89 yield $row_builder->buildDataRow(
90 $vocab->id(),
91 $record
92 )->withDisabledAction(
93 'delete',
94 !$infos->canBeDeleted($vocab)
95 )->withDisabledAction(
96 'activate',
97 $vocab->isActive()
98 )->withDisabledAction(
99 'deactivate',
100 !$vocab->isActive() ||
101 !$infos->isDeactivatable($vocab)
102 )->withDisabledAction(
103 'allow_custom_input',
104 !$infos->isCustomInputApplicable($vocab) ||
105 $vocab->allowsCustomInputs()
106 )->withDisabledAction(
107 'disallow_custom_input',
108 !$infos->isCustomInputApplicable($vocab) ||
109 !$infos->canDisallowCustomInput($vocab) ||
110 !$vocab->allowsCustomInputs()
111 );
112 };
113 }
$vocab
buildDataRow(string $id, array $record)

References $vocab, and ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::getTotalRowCount ( ?array  $filter_data,
?array  $additional_parameters 
)

Mainly for the purpose of pagination-support, it is important to know about the total number of records available.

Given the nature of a DataTable, which is, opposite to a PresentationTable, rather administrative than explorative, this information will increase user experience quite a bit. However, you may return null, if the call is to costly, but expect the View Control to look a little different in this case.

Make sure that potential filters or user restrictions are being applied to the count.

Implements ILIAS\UI\Component\Table\DataRetrieval.

Definition at line 115 of file DataRetrieval.php.

115 : ?int
116 {
117 return count($this->getVocabs());
118 }

◆ getVocabs()

ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::getVocabs ( ?Range  $range = null)
protected

Definition at line 120 of file DataRetrieval.php.

120 : array
121 {
122 if (isset($this->vocabs)) {
124 } else {
125 $vocabs = iterator_to_array($this->vocab_manager->getAllVocabularies(), false);
126 }
127
128 if ($range) {
129 $vocabs = array_slice($vocabs, $range->getStart(), $range->getLength());
130 }
131
132 return $this->vocabs = $vocabs;
133 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

+ Here is the call graph for this function:

Field Documentation

◆ $presentation

Presentation ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::$presentation
protected

◆ $ui_factory

UIFactory ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::$ui_factory
protected

◆ $vocab_manager

VocabManager ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::$vocab_manager
protected

◆ $vocabs

array ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::$vocabs
protected

Definition at line 42 of file DataRetrieval.php.

◆ MAX_PREVIEW_VALUES

const int ILIAS\MetaData\Settings\Vocabularies\DataRetrieval::MAX_PREVIEW_VALUES = 5
protected

Definition at line 33 of file DataRetrieval.php.


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