ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable Class Reference
+ Inheritance diagram for ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable:
+ Collaboration diagram for ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable:

Public Member Functions

 __construct (protected UIFactory $ui_factory, protected UIRenderer $ui_renderer, protected DataFactory $data_factory, protected Refinery $refinery, protected URLBuilder $url_builder, protected URLBuilderToken $action_parameter_token, protected URLBuilderToken $row_id_token, protected \ilDBInterface $db, protected \ilLanguage $lng, protected \ilComponentRepository $component_repository, protected \ilComponentFactory $component_factory, protected \ilRbacSystem $rbac, protected \ilObjUser $current_user, protected TaxonomyService $taxonomy, protected NotesService $notes_service, protected int $parent_obj_id, protected int $request_ref_id)
 
 getSummary ()
 
 getTable ()
 
 getFilter (\ilUIService $ui_service, string $action)
 Filters should be part of the Table; for now, since they are not fully integrated, they are rendered and applied seperately. More...
 
 getColumns ()
 
 getRows (Table\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
- Public Member Functions inherited from ilAssQuestionList
 __construct (private ilDBInterface $db, private ilLanguage $lng, private Refinery $refinery, private ilComponentRepository $component_repository, private ilComponentFactory $component_factory, private ?NotesService $notes_service=null)
 
 setOrder (?Order $order=null)
 
 setRange (?Range $range=null)
 
 getParentObjId ()
 
 setParentObjId (?int $parentObjId)
 
 setParentObjectType (string $parentObjType)
 
 setParentObjIdsFilter (array $parentObjIdsFilter)
 
 setQuestionInstanceTypeFilter (?string $questionInstanceTypeFilter)
 
 setIncludeQuestionIdsFilter (array $questionIdsFilter)
 
 setExcludeQuestionIdsFilter (array $excludeQuestionIdsFilter)
 
 addFieldFilter (string $fieldName, mixed $fieldValue)
 
 addTaxonomyFilter ($taxId, $taxNodes, $parentObjId, $parentObjType)
 
 addTaxonomyFilterNoTaxonomySet (bool $flag)
 
 setAvailableTaxonomyIds (array $availableTaxonomyIds)
 
 setAnswerStatusActiveId (?int $answerStatusActiveId)
 
 setAnswerStatusFilter (string $answerStatusFilter)
 
 setJoinObjectData (bool $a_val)
 Set if object data table should be joined. More...
 
 load ()
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 
 setCommentFilter (?int $commented=null)
 
 getDataArrayForQuestionId (int $questionId)
 
 getQuestionDataArray ()
 
 isInList (int $questionId)
 
 getTitle (string $a_comp_id, string $a_item_type, int $a_item_id)
 Get title of an assigned item. More...
 
 getTitle (string $a_comp_id, string $a_item_type, int $a_item_id)
 Get title of an assigned item. More...
 

Protected Member Functions

 getData (Order $order, Range $range)
 
 getActions ()
 
 buildAction (string $act, string $lng_var, string $type, bool $async=false)
 
 postOrder (array $list, \ILIAS\Data\Order $order)
 
- Protected Member Functions inherited from ilAssQuestionList
 getParentObjFilterExpression ()
 
 getTaxItems (string $parentType, int $parentObjId, int $taxId, int $taxNode)
 
 buildBasicQuery ()
 
 getNumberOfCommentsForQuestion (int $question_id)
 
 isActiveQuestionType (array $questionData)
 

Private Member Functions

 treeify (&$pointer, $stack)
 
 toNestedList (array $nodes)
 
 taxNodeReader ($tree, $sortfield, $node_id)
 
 singleTaxonomyRepresentation (int $tax_id, array $stored_tax_data, string $check_marker)
 
 taxonomyRepresentation (array $taxonomy_data)
 
 getSummaryData ()
 
 showCommentAction ()
 

Additional Inherited Members

- Data Fields inherited from ilAssQuestionList
const QUESTION_ANSWER_STATUS_NON_ANSWERED = 'nonAnswered'
 answer status domain for single questions More...
 
const QUESTION_ANSWER_STATUS_WRONG_ANSWERED = 'wrongAnswered'
 
const QUESTION_ANSWER_STATUS_CORRECT_ANSWERED = 'correctAnswered'
 
const ANSWER_STATUS_FILTER_ALL_NON_CORRECT = 'allNonCorrect'
 answer status filter value domain More...
 
const ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY = 'nonAnswered'
 
const ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY = 'wrongAnswered'
 
const QUESTION_INSTANCE_TYPE_ORIGINALS = 'QST_INSTANCE_TYPE_ORIGINALS'
 
const QUESTION_INSTANCE_TYPE_DUPLICATES = 'QST_INSTANCE_TYPE_DUPLICATES'
 
const QUESTION_INSTANCE_TYPE_ALL = 'QST_INSTANCE_TYPE_ALL'
 
const QUESTION_COMMENTED_ONLY = '1'
 
const QUESTION_COMMENTED_EXCLUDED = '2'
 
- Protected Attributes inherited from ilAssQuestionList
bool $join_obj_data = true
 
string $filter_comments = null
 
array $questions = []
 

Detailed Description

Definition at line 37 of file QuestionTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::__construct ( protected UIFactory  $ui_factory,
protected UIRenderer  $ui_renderer,
protected DataFactory  $data_factory,
protected Refinery  $refinery,
protected URLBuilder  $url_builder,
protected URLBuilderToken  $action_parameter_token,
protected URLBuilderToken  $row_id_token,
protected \ilDBInterface  $db,
protected \ilLanguage  $lng,
protected \ilComponentRepository  $component_repository,
protected \ilComponentFactory  $component_factory,
protected \ilRbacSystem  $rbac,
protected \ilObjUser  $current_user,
protected TaxonomyService  $taxonomy,
protected NotesService  $notes_service,
protected int  $parent_obj_id,
protected int  $request_ref_id 
)

Definition at line 39 of file QuestionTable.php.

57 {
58 $lng->loadLanguageModule('qpl');
60 $db,
61 $lng,
63 $component_repository,
64 $component_factory,
65 $notes_service
66 );
67 $this->setParentObjId($this->parent_obj_id);
68 $this->setAvailableTaxonomyIds($taxonomy->getUsageOfObject($parent_obj_id));
69 }
setParentObjId(?int $parentObjId)
setAvailableTaxonomyIds(array $availableTaxonomyIds)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:26

References ILIAS\$db, $lng, ILIAS\UI\examples\Layout\Page\Mail\$refinery, ILIAS\GlobalScreen\Provider\__construct(), ilAssQuestionList\setAvailableTaxonomyIds(), and ilAssQuestionList\setParentObjId().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildAction()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::buildAction ( string  $act,
string  $lng_var,
string  $type,
bool  $async = false 
)
protected

Definition at line 407 of file QuestionTable.php.

407 : array
408 {
409 $action = $this->ui_factory->table()->action()
410 ->$type(
411 $this->lng->txt($lng_var),
412 $this->url_builder->withParameter($this->action_parameter_token, $act),
413 $this->row_id_token
414 );
415 if ($async) {
416 $action = $action->withAsync(true);
417 }
418
419 return [$act => $action];
420 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getActions()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getActions ( )
protected

Definition at line 387 of file QuestionTable.php.

387 : array
388 {
389 $write_access = $this->rbac->checkAccess('write', $this->request_ref_id);
390 return array_merge(
391 $this->buildAction('copy', 'copy', 'standard'),
392 $write_access ? $this->buildAction('move', 'move', 'standard') : [],
393 $write_access ? $this->buildAction('delete', 'delete', 'standard') : [],
394 $this->buildAction('export', 'export', 'multi'),
395 $this->buildAction('preview', 'preview', 'single'),
396 $this->buildAction('statistics', 'statistics', 'single'),
397 $write_access ? $this->buildAction('edit_question', 'edit_question', 'single') : [],
398 $write_access ? $this->buildAction('edit_page', 'edit_page', 'single') : [],
399 $write_access ? $this->buildAction('feedback', 'tst_feedback', 'single') : [],
400 $write_access ? $this->buildAction(\ilBulkEditQuestionsGUI::CMD_EDITTAUTHOR, 'bulkedit_author', 'multi') : [],
401 $write_access ? $this->buildAction(\ilBulkEditQuestionsGUI::CMD_EDITLIFECYCLE, 'bulkedit_lifecycle', 'multi') : [],
402 $write_access ? $this->buildAction(\ilBulkEditQuestionsGUI::CMD_EDITTAXONOMIES, 'bulkedit_taxonomies', 'multi') : [],
403 $this->showCommentAction() ? $this->buildAction('comments', 'comments', 'single', true) : []
404 );
405 }
buildAction(string $act, string $lng_var, string $type, bool $async=false)

References ilBulkEditQuestionsGUI\CMD_EDITLIFECYCLE, ilBulkEditQuestionsGUI\CMD_EDITTAUTHOR, ilBulkEditQuestionsGUI\CMD_EDITTAXONOMIES, and ILIAS\Repository\rbac().

Referenced by ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumns()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getColumns ( )

Definition at line 182 of file QuestionTable.php.

182 : array
183 {
184 $f = $this->ui_factory->table()->column();
185 $df = $this->data_factory->dateFormat();
186 $icon_yes = $this->ui_factory->symbol()->icon()->custom(\ilUtil::getImagePath('standard/icon_checked.svg'), 'yes');
187 $icon_no = $this->ui_factory->symbol()->icon()->custom(\ilUtil::getImagePath('standard/icon_unchecked.svg'), 'no');
188
189 return [
190 'title' => $f->link($this->lng->txt('title')),
191 'description' => $f->text($this->lng->txt('description'))->withIsOptional(true, true),
192 'question_type' => $f->text($this->lng->txt('question_type'))->withIsOptional(true, true),
193 'points' => $f->number($this->lng->txt('points'))->withDecimals(2)->withIsOptional(true, true),
194 'author' => $f->text($this->lng->txt('author'))->withIsOptional(true, true),
195 'lifecycle' => $f->text($this->lng->txt('qst_lifecycle'))->withIsOptional(true, true),
196 'taxonomies' => $f->text($this->lng->txt('qpl_settings_subtab_taxonomies'))->withIsOptional(true, true),
197 'feedback' => $f->boolean($this->lng->txt('tst_feedback'), $icon_yes, $icon_no)->withIsOptional(true, true),
198 'created' => $f->date(
199 $this->lng->txt('create_date'),
200 $this->current_user->getDateTimeFormat()
201 )->withIsOptional(true, true),
202 'tstamp' => $f->date(
203 $this->lng->txt('last_update'),
204 $this->current_user->getDateTimeFormat()
205 )->withIsOptional(true, true),
206 'comments' => $f->number($this->lng->txt('comments'))->withIsOptional(true, false),
207 ];
208 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References Vendor\Package\$f, ilUtil\getImagePath(), and ILIAS\Repository\lng().

Referenced by ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getData()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getData ( Order  $order,
Range  $range 
)
protected

Definition at line 352 of file QuestionTable.php.

355 : array {
356 if ($this->questions === []) {
357 $this->load();
358 }
359
360 [$offset, $length] = $range->unpack();
361 return array_slice(
362 $this->postOrder(
363 $this->getQuestionDataArray(),
364 $order
365 ),
366 $offset,
367 $length > 0 ? $length : null
368 );
369 }
postOrder(array $list, \ILIAS\Data\Order $order)

◆ getFilter()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getFilter ( \ilUIService  $ui_service,
string  $action 
)

Filters should be part of the Table; for now, since they are not fully integrated, they are rendered and applied seperately.

Definition at line 108 of file QuestionTable.php.

108 : Filter
109 {
110 $lifecycle_options = array_merge(
111 ['' => $this->lng->txt('qst_lifecycle_filter_all')],
112 new \ilAssQuestionLifecycle()->getSelectOptions($this->lng)
113 );
114 $question_type_options = [
115 '' => $this->lng->txt('filter_all_question_types')
116 ];
117 $question_types = \ilObjQuestionPool::_getQuestionTypes();
118 foreach ($question_types as $translation => $row) {
119 $question_type_options[$row['type_tag']] = $translation;
120 }
121
122 $field_factory = $this->ui_factory->input()->field();
123 $filter_inputs = [
124 'title' => $field_factory->text($this->lng->txt("title")),
125 'description' => $field_factory->text($this->lng->txt("description")),
126 'author' => $field_factory->text($this->lng->txt("author")),
127 'lifecycle' => $field_factory->select($this->lng->txt("qst_lifecycle"), $lifecycle_options),
128 'type' => $field_factory->select($this->lng->txt("type"), $question_type_options),
129 'commented' => $field_factory->select(
130 $this->lng->txt("ass_comments"),
131 [
132 \ilAssQuestionList::QUESTION_COMMENTED_ONLY => $this->lng->txt('qpl_filter_commented_only'),
133 \ilAssQuestionList::QUESTION_COMMENTED_EXCLUDED => $this->lng->txt('qpl_filter_commented_exclude')
134 ]
135 )
136 ];
137
138 $taxs = $this->taxonomy->getUsageOfObject($this->parent_obj_id, true);
139 $tax_filter_options = [
140 'null' => '<b>' . $this->lng->txt('tax_filter_notax') . '</b>'
141 ];
142
143 foreach ($taxs as $tax_entry) {
144 $tax = new \ilObjTaxonomy($tax_entry['tax_id']);
145 $tax_tree = $tax->getTree();
146 $sortfield = $tax->getSortingMode() === \ilObjTaxonomy::SORT_ALPHABETICAL ? 'title' : 'order_nr';
147 $children = $this->taxNodeReader($tax_tree, $sortfield, $tax_tree->readRootId());
148 $nodes = implode('-', array_map(fn($node) => $node['obj_id'], $children));
149
150 $tax_id = $tax_entry['tax_id'] . '-0-' . $nodes;
151 $tax_title = '<b>' . $tax_entry['title'] . '</b>';
152 if ($children === []) {
153 continue;
154 }
155 $tax_filter_options[$tax_id] = $tax_title;
156
157 foreach ($children as $subtax) {
158 $stax_id = $subtax['tax_id'] . '-' . $subtax['obj_id'];
159 $stax_title = str_repeat('&nbsp; ', ($subtax['depth'] - 2) * 2)
160 . ' &boxur;&HorizontalLine; '
161 . $subtax['title'];
162
163 $tax_filter_options[$stax_id] = $stax_title;
164 }
165 }
166 $filter_inputs['taxonomies'] = $field_factory->multiSelect($this->lng->txt("tax_filter"), $tax_filter_options);
167
168 $active = array_fill(0, count($filter_inputs), true);
169
170 $filter = $ui_service->filter()->standard(
171 "question_table_filter_{$this->request_ref_id}",
172 $action,
173 $filter_inputs,
174 $active,
175 true,
176 true
177 );
178 return $filter;
179 }
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)

References ilObjQuestionPool\_getQuestionTypes(), ilUIService\filter(), ILIAS\Repository\lng(), ilAssQuestionList\QUESTION_COMMENTED_EXCLUDED, ilAssQuestionList\QUESTION_COMMENTED_ONLY, ilObjTaxonomy\SORT_ALPHABETICAL, ILIAS\Scripts\PHPStan\str_repeat, and ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\taxNodeReader().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getRows ( Table\DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Definition at line 309 of file QuestionTable.php.

317 : \Generator {
318 $timezone = new \DateTimeZone($this->current_user->getTimeZone());
319 foreach ($this->getData($order, $range) as $record) {
320 $row_id = (string) $record['question_id'];
321 $record['created'] = (new \DateTimeImmutable("@{$record['created']}"))->setTimezone($timezone);
322 $record['tstamp'] = (new \DateTimeImmutable("@{$record['tstamp']}"))->setTimezone($timezone);
323 $lifecycle = new \ilAssQuestionLifecycle($record['lifecycle']);
324 $record['lifecycle'] = $lifecycle->getTranslation($this->lng);
325
326 $title = $record['title'];
327 $to_question = $this->url_builder
328 ->withParameter($this->action_parameter_token, 'preview')
329 ->withParameter($this->row_id_token, $row_id)
330 ->buildURI()->__toString();
331 if (!(bool) $record['complete']) {
332 $title .= ' (' . $this->lng->txt('warning_question_not_complete') . ')';
333 }
334 $record['title'] = $this->ui_factory->link()->standard($title, $to_question);
335 $record['taxonomies'] = $this->taxonomyRepresentation($record['taxonomies']);
336
337 yield $row_builder->buildDataRow($row_id, $record);
338 }
339 }
$lifecycle

References $lifecycle, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getSummary()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getSummary ( )

Definition at line 71 of file QuestionTable.php.

71 : PropertyListing
72 {
73 $questions = $this->getSummaryData();
74
75 return $this->ui_factory->listing()->property()
76 ->withProperty(
77 $this->lng->txt('tst_num_questions'),
78 $this->refinery->kindlyTo()->string()->transform(
79 count($questions)
80 )
81 )->withProperty(
82 $this->lng->txt('maximum_points'),
83 $this->refinery->kindlyTo()->string()->transform(
84 array_reduce(
86 fn(float $c, array $v): float => $c + $v['points'],
87 0.0
88 )
89 )
90 );
91 }

References Vendor\Package\$c, ilAssQuestionList\$questions, ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getSummaryData(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getSummaryData()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getSummaryData ( )
private

Definition at line 371 of file QuestionTable.php.

371 : array
372 {
373 $questions = [];
374 $res = $this->db->query(
375 "{$this->buildBasicQuery()} AND {$this->getParentObjFilterExpression()}"
376 );
377 while (($row = $this->db->fetchAssoc($res)) !== null) {
378 if (!$this->isActiveQuestionType($row)) {
379 continue;
380 }
381
382 $questions[$row['question_id']] = $row;
383 }
384 return $questions;
385 }
isActiveQuestionType(array $questionData)
foreach($_POST as $key=> $value) $res

References $res.

Referenced by ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getSummary().

+ Here is the caller graph for this function:

◆ getTable()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getTable ( )

Definition at line 93 of file QuestionTable.php.

93 : Table\Data
94 {
95 return $this->ui_factory->table()->data(
96 $this,
97 '',
98 $this->getColumns()
99 )
100 ->withActions($this->getActions())
101 ->withId('qpt' . $this->parent_obj_id . '_' . $this->request_ref_id);
102 }

References ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getActions(), ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getColumns(), and ILIAS\UI\Component\Table\Data\withActions().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::getTotalRowCount ( mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $additional_parameters 
)

Reimplemented from ilAssQuestionList.

Definition at line 341 of file QuestionTable.php.

345 : ?int {
346 if ($this->questions === []) {
347 $this->load();
348 }
349 return count($this->getQuestionDataArray());
350 }

◆ postOrder()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::postOrder ( array  $list,
\ILIAS\Data\Order  $order 
)
protected

Definition at line 422 of file QuestionTable.php.

422 : array
423 {
424 [$aspect, $direction] = $order->join('', function ($i, $k, $v) {
425 return [$k, $v];
426 });
427 usort($list, static function (array $a, array $b) use ($aspect): int {
428 if (is_numeric($a[$aspect]) || is_bool($a[$aspect])) {
429 return $a[$aspect] <=> $b[$aspect];
430 }
431 if (is_array($a[$aspect])) {
432 return $a[$aspect] <=> $b[$aspect];
433 }
434
435 $aspect_a = '';
436 $aspect_b = '';
437 if ($a[$aspect] !== null) {
438 $aspect_a = $a[$aspect];
439 }
440 if ($b[$aspect] !== null) {
441 $aspect_b = $b[$aspect];
442 }
443
444 return strcoll($aspect_a, $aspect_b);
445 });
446
447 if ($direction === $order::DESC) {
448 $list = array_reverse($list);
449 }
450 return $list;
451 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

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

◆ showCommentAction()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::showCommentAction ( )
private

Definition at line 453 of file QuestionTable.php.

453 : bool
454 {
455 return $this->notes_service->domain()->commentsActive($this->parent_obj_id)
456 || $this->rbac->checkAccess('write', $this->request_ref_id);
457 }

References ILIAS\Repository\rbac().

+ Here is the call graph for this function:

◆ singleTaxonomyRepresentation()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::singleTaxonomyRepresentation ( int  $tax_id,
array  $stored_tax_data,
string  $check_marker 
)
private

Definition at line 258 of file QuestionTable.php.

262 : string {
263 $tax = new \ilObjTaxonomy($tax_id);
264 $tax_tree = $tax->getTree();
265 $sortfield = $tax->getSortingMode() === \ilObjTaxonomy::SORT_ALPHABETICAL ? 'title' : 'order_nr';
266 $taxnodes = $this->taxNodeReader($tax_tree, $sortfield, $tax_tree->readRootId());
267
268 $nodes = [];
269 foreach ($taxnodes as $taxnode) {
270 $taxdata = array_filter(
271 $stored_tax_data,
272 fn($data_child) => $data_child['node_id'] === $taxnode['obj_id']
273 );
274
275 foreach (array_keys($taxdata) as $node_obj_id) {
276 $path = array_map(
277 fn($n) => in_array($n['obj_id'], array_keys($stored_tax_data)) ? $check_marker . $n['title'] : $n['title'],
278 $tax_tree->getPathFull($node_obj_id),
279 );
280 $path[0] = \ilObject::_lookupTitle($tax_id);
281 $this->treeify($nodes, $path);
282 }
283 }
284 return $this->toNestedList($nodes);
285 }
static _lookupTitle(int $obj_id)

◆ taxNodeReader()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::taxNodeReader (   $tree,
  $sortfield,
  $node_id 
)
private

Definition at line 237 of file QuestionTable.php.

237 : array
238 {
239 $ret = [];
240 $nodes = $tree->getChildsByTypeFilter($node_id, ['taxn']);
241 usort(
242 $nodes,
243 fn($a, $b) => strcmp(
244 (string) $a[$sortfield],
245 (string) $b[$sortfield]
246 )
247 );
248
249 foreach ($nodes as $node) {
250 $ret[] = $node;
251 foreach ($this->taxNodeReader($tree, $sortfield, $node['obj_id']) as $c) {
252 $ret[] = $c;
253 }
254 }
255 return $ret;
256 }

References Vendor\Package\$a, Vendor\Package\$b, Vendor\Package\$c, and ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\taxNodeReader().

Referenced by ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getFilter(), and ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\taxNodeReader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ taxonomyRepresentation()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::taxonomyRepresentation ( array  $taxonomy_data)
private

Definition at line 287 of file QuestionTable.php.

287 : string
288 {
289 $check = $this->ui_renderer->render(
290 $this->ui_factory->symbol()->icon()->custom(\ilUtil::getImagePath('standard/icon_checked.svg'), 'checked')
291 );
292
293 $taxonomies = [];
294 $taxs = $this->taxonomy->getUsageOfObject($this->parent_obj_id, true);
295 foreach ($taxs as $tax_entry) {
296 $tax_id = $tax_entry['tax_id'];
297 if (!array_key_exists($tax_id, $taxonomy_data)) {
298 continue;
299 }
300 $taxonomies[] = $this->singleTaxonomyRepresentation(
301 $tax_id,
302 $taxonomy_data[$tax_id],
303 $check
304 );
305 }
306 return implode('', $taxonomies);
307 }
$check
Definition: buildRTE.php:81
singleTaxonomyRepresentation(int $tax_id, array $stored_tax_data, string $check_marker)

References $check, and ilUtil\getImagePath().

+ Here is the call graph for this function:

◆ toNestedList()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::toNestedList ( array  $nodes)
private

Definition at line 222 of file QuestionTable.php.

222 : string
223 {
224 $entries = [];
225 foreach ($nodes as $k => $n) {
226 if ($n === []) {
227 $entries[] = $k;
228 } else {
229 $entries[] = $k . $this->toNestedList($n);
230 }
231 }
232 return $this->ui_renderer->render(
233 $this->ui_factory->listing()->unordered($entries)
234 );
235 }

References ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\toNestedList().

Referenced by ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\toNestedList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ treeify()

ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable::treeify ( &  $pointer,
  $stack 
)
private

Definition at line 210 of file QuestionTable.php.

211 {
212 $hop = array_shift($stack);
213 if (!$hop) {
214 return;
215 }
216 if (! array_key_exists($hop, $pointer)) {
217 $pointer[$hop] = [];
218 }
219 $this->treeify($pointer[$hop], $stack);
220 }

References ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\treeify().

Referenced by ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\treeify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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