ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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...
 

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.

References $vocab, ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow(), and ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\getVocabs().

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

References ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\getVocabs().

115  : ?int
116  {
117  return count($this->getVocabs());
118  }
+ Here is the call graph for this function:

◆ getVocabs()

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

Definition at line 120 of file DataRetrieval.php.

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\$vocabs, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

Referenced by ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\getRows(), and ILIAS\MetaData\Settings\Vocabularies\DataRetrieval\getTotalRowCount().

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  }
+ Here is the call graph for this function:
+ Here is the caller 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

◆ 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: