From d468f6176a519f42d23a9f61b850fe238e941780 Mon Sep 17 00:00:00 2001 From: Nils Haagen Date: Thu, 4 Jul 2024 11:07:18 +0200 Subject: [PATCH] T&A, 39119: tax-filter respecting entire tree --- Modules/TestQuestionPool/classes/QuestionTable.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Modules/TestQuestionPool/classes/QuestionTable.php b/Modules/TestQuestionPool/classes/QuestionTable.php index 1ad27a89d360..ddecaa29377f 100644 --- a/Modules/TestQuestionPool/classes/QuestionTable.php +++ b/Modules/TestQuestionPool/classes/QuestionTable.php @@ -90,7 +90,10 @@ public function getFilter(ilUIService $ui_service, string $action): Filter ]; foreach($taxs as $tax_entry) { $tax = new ilObjTaxonomy($tax_entry['tax_id']); - $children = $tax->getTree()->getChilds($tax->getTree()->readRootId()); + $children = array_filter( + $tax->getTree()->getFilteredSubTree($tax->getTree()->readRootId()), + fn($ar) => $ar['type'] === 'taxn' + ); $nodes = implode('-', array_map(fn($node) => $node['obj_id'], $children)); $tax_id = $tax_entry['tax_id'] . '-0-' . $nodes; @@ -99,7 +102,10 @@ public function getFilter(ilUIService $ui_service, string $action): Filter foreach($children as $subtax) { $stax_id = $subtax['tax_id'] . '-' . $subtax['obj_id']; - $stax_title = ' └─ ' . $subtax['title']; + $stax_title = str_repeat('  ', ($subtax['depth'] - 2) * 2) + . ' └─ ' + . $subtax['title']; + $tax_filter_options[$stax_id] = $stax_title; } }