ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable Class Reference
+ Inheritance diagram for ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable:
+ Collaboration diagram for ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable:

Public Member Functions

 __construct (private readonly \ilCtrlInterface $ctrl, private readonly \ilLanguage $lng, private readonly UIFactory $ui_factory, private readonly DataFactory $data_factory, private readonly ServerRequestInterface $request, private readonly TitleColumnsBuilder $title_builder, private readonly \ilTestQuestionFilterLabelTranslator $taxonomy_translator, private readonly PoolDefinitionList $source_pool_definition_list, private readonly bool $editable, private readonly bool $show_amount)
 
 getRows (OrderingRowBuilder $row_builder, array $visible_column_ids)
 This is called by the (ordering-)table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getComponent ()
 
 applySubmit (RequestDataCollector $request)
 

Private Member Functions

 getData ()
 
 getColumns ()
 
 getActions ()
 
 getTarget (string $cmd)
 

Private Attributes

URI $target
 
URLBuilder $url_builder
 
URLBuilderToken $id_token
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::__construct ( private readonly \ilCtrlInterface  $ctrl,
private readonly \ilLanguage  $lng,
private readonly UIFactory  $ui_factory,
private readonly DataFactory  $data_factory,
private readonly ServerRequestInterface  $request,
private readonly TitleColumnsBuilder  $title_builder,
private readonly \ilTestQuestionFilterLabelTranslator  $taxonomy_translator,
private readonly PoolDefinitionList  $source_pool_definition_list,
private readonly bool  $editable,
private readonly bool  $show_amount 
)

Definition at line 43 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\$id_token, and ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\$url_builder.

54  {
55  $this->target = $this->data_factory->uri((string) $this->request->getUri());
56  $this->url_builder = new URLBuilder($this->target);
57  [$this->url_builder, $this->id_token] = $this->url_builder->acquireParameters(
58  ['src_pool_def'],
59  'id'
60  );
61  }

Member Function Documentation

◆ applySubmit()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::applySubmit ( RequestDataCollector  $request)

Definition at line 125 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getComponent(), and ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getData().

125  : void
126  {
127  $quest_pos = array_flip($this->getComponent()->getData());
128 
129  foreach ($this->source_pool_definition_list as $source_pool_definition) {
130  $pool_id = $source_pool_definition->getId();
131  $sequence_pos = array_key_exists($pool_id, $quest_pos) ? $quest_pos[$pool_id] : 0;
132  $source_pool_definition->setSequencePosition($sequence_pos);
133  }
134  }
+ Here is the call graph for this function:

◆ getActions()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::getActions ( )
private
Returns
array<string, Action>

Definition at line 166 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\$id_token, ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getTarget(), and ILIAS\Repository\lng().

Referenced by ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getComponent().

166  : array
167  {
168  return [
169  'delete' => $this->ui_factory->table()->action()->standard(
170  $this->lng->txt('delete'),
171  $this->url_builder->withURI($this->getTarget(ConfigGUI::CMD_DELETE_SRC_POOL_DEF)),
173  ),
174  'edit' => $this->ui_factory->table()->action()->single(
175  $this->lng->txt('edit'),
176  $this->url_builder->withURI($this->getTarget(ConfigGUI::CMD_SHOW_EDIT_SRC_POOL_DEF_FORM)),
178  )
179  ];
180  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumns()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::getColumns ( )
private
Returns
array<string, Column>

Definition at line 139 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References ILIAS\Repository\lng().

Referenced by ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getComponent().

139  : array
140  {
141  $column_factory = $this->ui_factory->table()->column();
142  $columns_definition = [
143  'sequence_position' => $column_factory->number($this->lng->txt('position'))->withUnit('.'),
144  'source_pool_label' => $column_factory->link($this->lng->txt('tst_source_question_pool')),
145  'taxonomy_filter' => $column_factory->text(
146  $this->lng->txt('tst_filter_taxonomy') . ' / ' . $this->lng->txt('tst_filter_tax_node')
147  ),
148  'lifecycle_filter' => $column_factory->text($this->lng->txt('qst_lifecycle')),
149  'type_filter' => $column_factory->text($this->lng->txt('tst_filter_question_type')),
150  'question_amount' => $column_factory->number($this->lng->txt('tst_question_amount')),
151  ];
152 
153  $columns_conditions = [
154  'sequence_position' => !$this->editable,
155  'question_amount' => $this->show_amount,
156  ];
157 
158  return array_filter($columns_definition, function ($key) use ($columns_conditions) {
159  return !isset($columns_conditions[$key]) || $columns_conditions[$key];
160  }, ARRAY_FILTER_USE_KEY);
161  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::getComponent ( )

Definition at line 110 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getActions(), ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getColumns(), ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getTarget(), and ILIAS\Repository\lng().

Referenced by ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\applySubmit().

110  : OrderingTable
111  {
112  return $this->ui_factory->table()
113  ->ordering(
114  $this,
115  $this->getTarget(ConfigGUI::CMD_SAVE_SRC_POOL_DEF_LIST),
116  $this->lng->txt('tst_src_quest_pool_def_list_table'),
117  $this->getColumns(),
118  )
119  ->withActions($this->getActions())
120  ->withRequest($this->request)
121  ->withOrderingDisabled(!$this->editable)
122  ->withId('src_pool_def_list');
123  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getData()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::getData ( )
private

Definition at line 84 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References Vendor\Package\$a, Vendor\Package\$b, and $data.

Referenced by ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\applySubmit(), and ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getRows().

84  : array
85  {
86  $data = [];
87 
88  foreach ($this->source_pool_definition_list as $source_pool_definition) {
89  $taxonomie_filter = $source_pool_definition->getOriginalTaxonomyFilter();
90  if ($taxonomie_filter === []) {
91  $taxonomie_filter = $source_pool_definition->getMappedTaxonomyfilter();
92  }
93  $set = [];
94  $set['def_id'] = $source_pool_definition->getId();
95  $set['sequence_position'] = $source_pool_definition->getSequencePosition();
96  $set['source_pool_label'] = $source_pool_definition->getPoolTitle();
97  $set['taxonomy_filter'] = $taxonomie_filter;
98  $set['lifecycle_filter'] = $source_pool_definition->getLifecycleFilter();
99  $set['type_filter'] = $source_pool_definition->getTypeFilter();
100  // fau.
101  $set['question_amount'] = $source_pool_definition->getQuestionAmount();
102  $set['pool_id'] = $source_pool_definition->getPoolId();
103  $data[] = $set;
104  }
105 
106  usort($data, fn($a, $b) => $a['sequence_position'] <=> $b['sequence_position']);
107  return $data;
108  }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
+ Here is the caller graph for this function:

◆ getRows()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::getRows ( OrderingRowBuilder  $row_builder,
array  $visible_column_ids 
)

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

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

Implements ILIAS\UI\Component\Table\OrderingRetrieval.

Definition at line 63 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

References ILIAS\UI\Component\Table\OrderingRowBuilder\buildOrderingRow(), ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getData(), and ILIAS\Repository\int().

63  : \Generator
64  {
65  foreach ($this->getData() as $qp) {
66  $record = [
67  'sequence_position' => (int) $qp['sequence_position'],
68  'source_pool_label' => $this->title_builder->buildAccessCheckedQuestionpoolTitleAsLink(
69  $qp['pool_id'],
70  $qp['source_pool_label']
71  ),
72  'taxonomy_filter' => $this->taxonomy_translator->getTaxonomyFilterLabel(
73  $qp['taxonomy_filter'],
74  '<br />'
75  ),
76  'lifecycle_filter' => $this->taxonomy_translator->getLifecycleFilterLabel($qp['lifecycle_filter']),
77  'type_filter' => $this->taxonomy_translator->getTypeFilterLabel($qp['type_filter']),
78  'question_amount' => (int) $qp['question_amount']
79  ];
80  yield $row_builder->buildOrderingRow((string) $qp['def_id'], $record);
81  }
82  }
+ Here is the call graph for this function:

◆ getTarget()

ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::getTarget ( string  $cmd)
private

Definition at line 182 of file RandomQuestionSetSourcePoolDefinitionListTable.php.

Referenced by ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getActions(), and ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable\getComponent().

182  : URI
183  {
184  return $this->target->withParameter('cmd', $cmd);
185  }
+ Here is the caller graph for this function:

Field Documentation

◆ $id_token

◆ $target

URI ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::$target
private

◆ $url_builder

URLBuilder ILIAS\Test\Questions\RandomQuestionSetSourcePoolDefinitionListTable::$url_builder
private

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