ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\TestQuestionPool\Skills\SkillUsagesTable Class Reference
+ Inheritance diagram for ILIAS\TestQuestionPool\Skills\SkillUsagesTable:
+ Collaboration diagram for ILIAS\TestQuestionPool\Skills\SkillUsagesTable:

Public Member Functions

 __construct (private readonly UIFactory $ui_factory, private readonly \ilLanguage $lng, private readonly \ilAssQuestionSkillAssignmentList $assignment_list)
 
 getComponent ()
 
 getColumns ()
 
 collectRecords (?array $filter_data, ?array $additional_parameters)
 
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 
 getRows (DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (mixed $additional_viewcontrol_data, mixed $filter_data, mixed $additional_parameters)
 Mainly for the purpose of pagination-support, it is important to know about the total number of records available. More...
 

Private Member Functions

 orderRecords (array $records, Order $order)
 
 limitRecords (array $records, Range $range)
 
 getRecords (Order $order, Range $range, ?array $filter_data, ?array $additional_parameters)
 

Detailed Description

Definition at line 30 of file SkillUsagesTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::__construct ( private readonly UIFactory  $ui_factory,
private readonly \ilLanguage  $lng,
private readonly \ilAssQuestionSkillAssignmentList  $assignment_list 
)

Definition at line 32 of file SkillUsagesTable.php.

36 {
37 }

Member Function Documentation

◆ collectRecords()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::collectRecords ( ?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 60 of file SkillUsagesTable.php.

60 : array
61 {
62 return $this->assignment_list->getUniqueAssignedSkills();
63 }

Referenced by ILIAS\TestQuestionPool\Skills\SkillUsagesTable\getRecords().

+ Here is the caller graph for this function:

◆ getColumns()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::getColumns ( )

Definition at line 48 of file SkillUsagesTable.php.

48 : array
49 {
50 $column_factory = $this->ui_factory->table()->column();
51
52 return [
53 'skill_title' => $column_factory->text($this->lng->txt('qpl_qst_skl_usg_skill_col')),
54 'skill_path' => $column_factory->text($this->lng->txt('tst_competence_tree')),
55 'num_assigns' => $column_factory->number($this->lng->txt('qpl_qst_skl_usg_numq_col')),
56 'max_points' => $column_factory->number($this->lng->txt('qpl_qst_skl_usg_sklpnt_col'))
57 ];
58 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getComponent()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::getComponent ( )

Definition at line 39 of file SkillUsagesTable.php.

39 : Data
40 {
41 return $this->ui_factory->table()->data(
42 $this,
43 $this->lng->txt('qpl_skl_sub_tab_usages'),
44 $this->getColumns()
45 );
46 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getRecords()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::getRecords ( Order  $order,
Range  $range,
?array  $filter_data,
?array  $additional_parameters 
)
private

Definition at line 85 of file SkillUsagesTable.php.

85 : array
86 {
87 return $this->limitRecords(
88 $this->orderRecords(
89 $this->collectRecords($filter_data, $additional_parameters),
90 $order
91 ),
92 $range
93 );
94 }
collectRecords(?array $filter_data, ?array $additional_parameters)

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\TestQuestionPool\Skills\SkillUsagesTable\collectRecords(), ILIAS\TestQuestionPool\Skills\SkillUsagesTable\limitRecords(), and ILIAS\TestQuestionPool\Skills\SkillUsagesTable\orderRecords().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::getRows ( DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $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 96 of file SkillUsagesTable.php.

104 : \Generator {
105 foreach ($this->getRecords($order, $range, $filter_data, $additional_parameters) as $row_id => $record) {
106 yield $row_builder->buildDataRow((string) $row_id, $record);
107 }
108 }
getRecords(Order $order, Range $range, ?array $filter_data, ?array $additional_parameters)

References ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow().

+ Here is the call graph for this function:

◆ getTotalRowCount()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::getTotalRowCount ( mixed  $additional_viewcontrol_data,
mixed  $filter_data,
mixed  $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 110 of file SkillUsagesTable.php.

114 : ?int {
115 return count($this->collectRecords($filter_data, $additional_parameters));
116 }

◆ limitRecords()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::limitRecords ( array  $records,
Range  $range 
)
private

Definition at line 80 of file SkillUsagesTable.php.

80 : array
81 {
82 return array_slice($records, $range->getStart(), $range->getLength());
83 }

References ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

Referenced by ILIAS\TestQuestionPool\Skills\SkillUsagesTable\getRecords().

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

◆ orderRecords()

ILIAS\TestQuestionPool\Skills\SkillUsagesTable::orderRecords ( array  $records,
Order  $order 
)
private

Definition at line 65 of file SkillUsagesTable.php.

65 : array
66 {
67 [$order_field, $order_direction] = $order->join(
68 '',
69 static fn(string $index, string $key, string $value): array => [$key, $value]
70 );
71
72 usort(
73 $records,
74 static fn(array $a, array $b): int => ($a[$order_field] ?? '') <=> ($b[$order_field] ?? '')
75 );
76
77 return $order_direction === $order::DESC ? array_reverse($records) : $records;
78 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, and ILIAS\Data\Order\join().

Referenced by ILIAS\TestQuestionPool\Skills\SkillUsagesTable\getRecords().

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