19 declare(strict_types=1);
51 private readonly PoolDefinitionList $source_pool_definition_list,
52 private readonly
bool $editable,
53 private readonly
bool $show_amount
55 $this->target = $this->data_factory->uri((
string) $this->request->getUri());
56 $this->url_builder =
new URLBuilder($this->target);
65 foreach ($this->
getData() as $qp) {
67 'sequence_position' => (
int) $qp[
'sequence_position'],
68 'source_pool_label' => $this->title_builder->buildAccessCheckedQuestionpoolTitleAsLink(
70 $qp[
'source_pool_label']
72 'taxonomy_filter' => $this->taxonomy_translator->getTaxonomyFilterLabel(
73 $qp[
'taxonomy_filter'],
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']
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();
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();
101 $set[
'question_amount'] = $source_pool_definition->getQuestionAmount();
102 $set[
'pool_id'] = $source_pool_definition->getPoolId();
106 usort(
$data, fn(
$a,
$b) =>
$a[
'sequence_position'] <=>
$b[
'sequence_position']);
112 return $this->ui_factory->table()
115 $this->
getTarget(ConfigGUI::CMD_SAVE_SRC_POOL_DEF_LIST),
116 $this->
lng->txt(
'tst_src_quest_pool_def_list_table'),
120 ->withRequest($this->request)
121 ->withOrderingDisabled(!$this->editable)
122 ->withId(
'src_pool_def_list');
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);
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')
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')),
153 $columns_conditions = [
154 'sequence_position' => !$this->editable,
155 'question_amount' => $this->show_amount,
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);
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)),
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)),
184 return $this->target->withParameter(
'cmd', $cmd);
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_buil...
__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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
applySubmit(RequestDataCollector $request)
buildOrderingRow(string $id, array $record)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
URLBuilderToken $id_token