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

Public Member Functions

 __construct (private readonly UIFactory $ui_factory, private readonly Refinery $refinery, private readonly ServerRequestInterface $request, private readonly QuestionsTableActions $table_actions, private readonly Language $lng, private readonly \ilObjTest $test_obj, private readonly TestQuestionsRepository $questionrepository, private readonly TitleColumnsBuilder $title_builder,)
 
 getSummary ()
 
 getTableComponent ()
 
 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...
 
 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...
 

Private Member Functions

 getColumns ()
 
 getActions ()
 
 getRecords ()
 
 loadRecords ()
 

Private Attributes

array $records = null
 

Detailed Description

Definition at line 35 of file QuestionsTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Questions\Presentation\QuestionsTable::__construct ( private readonly UIFactory  $ui_factory,
private readonly Refinery  $refinery,
private readonly ServerRequestInterface  $request,
private readonly QuestionsTableActions  $table_actions,
private readonly Language  $lng,
private readonly \ilObjTest  $test_obj,
private readonly TestQuestionsRepository  $questionrepository,
private readonly TitleColumnsBuilder  $title_builder 
)
Parameters
array$data<string, mixed>

Definition at line 41 of file QuestionsTable.php.

50 {
51 }

Member Function Documentation

◆ getActions()

ILIAS\Test\Questions\Presentation\QuestionsTable::getActions ( )
private

Definition at line 154 of file QuestionsTable.php.

154 : array
155 {
156 $this->table_actions->getActions();
157 }

◆ getColumns()

ILIAS\Test\Questions\Presentation\QuestionsTable::getColumns ( )
private

Definition at line 122 of file QuestionsTable.php.

122 : array
123 {
124 $f = $this->ui_factory;
125 $columns = [
126 'question_id' => $f->table()->column()->text($this->lng->txt('question_id'))
127 ->withIsOptional(true, false),
128 'title' => $f->table()->column()->link($this->lng->txt('tst_question_title')),
129 'description' => $f->table()->column()->text($this->lng->txt('description'))
130 ->withIsOptional(true, false),
131 'complete' => $f->table()->column()->boolean(
132 $this->lng->txt('question_complete_title'),
133 $f->symbol()->icon()->custom('assets/images/standard/icon_checked.svg', '', 'small'),
134 $f->symbol()->icon()->custom('assets/images/standard/icon_alert.svg', '', 'small')
135 ),
136 'type_tag' => $f->table()->column()->text($this->lng->txt('tst_question_type')),
137 'points' => $f->table()->column()->number($this->lng->txt('points'))->withDecimals(2),
138 'author' => $f->table()->column()->text($this->lng->txt('author'))
139 ->withIsOptional(true, false),
140 'lifecycle' => $f->table()->column()->text($this->lng->txt('qst_lifecycle'))
141 ->withIsOptional(true, false),
142 'qpl' => $f->table()->column()->link($this->lng->txt('qpl')),
143 'nr_of_answers' => $f->table()->column()->number($this->lng->txt('number_of_answers'))
144 ->withIsOptional(true, false),
145 'average_points' => $f->table()->column()->number($this->lng->txt('average_reached_points'))->withDecimals(2)
146 ->withIsOptional(true, false),
147 'percentage_points_achieved' => $f->table()->column()->text($this->lng->txt('percentage_points_achieved'))
148 ->withIsOptional(true, false),
149 ];
150
151 return $columns;
152 }

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

+ Here is the call graph for this function:

◆ getRecords()

ILIAS\Test\Questions\Presentation\QuestionsTable::getRecords ( )
private

Definition at line 159 of file QuestionsTable.php.

159 : \Generator
160 {
161 if ($this->records === null) {
162 $this->loadRecords();
163 }
164 yield from $this->records;
165 }

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

+ Here is the call graph for this function:

◆ getRows()

ILIAS\Test\Questions\Presentation\QuestionsTable::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 105 of file QuestionsTable.php.

108 : \Generator {
109 foreach ($this->getRecords() as $record) {
110 $row = $record->getAsQuestionsTableRow(
111 $this->lng,
112 $this->ui_factory,
113 $this->refinery,
114 $this->table_actions->getQuestionTargetLinkBuilder(),
115 $row_builder,
116 $this->title_builder
117 );
118 yield $this->table_actions->setDisabledActions($row, $record);
119 }
120 }

References ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getSummary()

ILIAS\Test\Questions\Presentation\QuestionsTable::getSummary ( )

Definition at line 53 of file QuestionsTable.php.

53 : PropertyListing
54 {
55 $this->loadRecords();
56
57 $listing = $this->ui_factory->listing()->property()
58 ->withProperty(
59 $this->lng->txt('tst_num_questions'),
60 $this->refinery->kindlyTo()->string()->transform(
61 $this->test_obj->getQuestionCount()
62 )
63 );
64
65 if ($this->test_obj->isRandomTest()) {
66 return $listing;
67 }
68
69 return $listing->withProperty(
70 $this->lng->txt('maximum_points'),
71 $this->refinery->kindlyTo()->string()->transform(
72 array_reduce(
73 $this->records,
74 fn(float $c, TestQuestionProperties $v): float
75 => $c + $v->getGeneralQuestionProperties()->getAvailablePoints(),
76 0.0
77 )
78 )
79 );
80
81 }

References Vendor\Package\$c, ILIAS\Repository\lng(), and ILIAS\Test\Questions\Presentation\QuestionsTable\loadRecords().

+ Here is the call graph for this function:

◆ getTableComponent()

ILIAS\Test\Questions\Presentation\QuestionsTable::getTableComponent ( )

Definition at line 83 of file QuestionsTable.php.

83 : Ordering
84 {
85 $table = $this->ui_factory->table()->ordering(
86 $this,
87 $this->table_actions->getOrderActionUrl(),
88 '',
89 $this->getColumns()
90 )
91 ->withId((string) $this->test_obj->getId())
92 ->withActions($this->table_actions->getActions())
93 ->withRequest($this->request);
94
95
96
97 if ($this->test_obj->isRandomTest()
98 || $this->test_obj->evalTotalPersons() !== 0) {
99 return $table->withOrderingDisabled(true);
100 }
101
102 return $table;
103 }

References ILIAS\UI\Component\Table\Ordering\withId().

+ Here is the call graph for this function:

◆ loadRecords()

ILIAS\Test\Questions\Presentation\QuestionsTable::loadRecords ( )
private

Definition at line 167 of file QuestionsTable.php.

167 : void
168 {
169 $this->records = $this->questionrepository
170 ->getQuestionPropertiesWithAggregatedResultsForTest($this->test_obj);
171 usort(
172 $this->records,
173 static fn(TestQuestionProperties $a, TestQuestionProperties $b): int =>
174 $a->getSequenceInformation()?->getPlaceInSequence() <=> $b->getSequenceInformation()?->getPlaceInSequence()
175 );
176 }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

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

Referenced by ILIAS\Test\Questions\Presentation\QuestionsTable\getSummary().

+ Here is the caller graph for this function:

Field Documentation

◆ $records

array ILIAS\Test\Questions\Presentation\QuestionsTable::$records = null
private

Definition at line 37 of file QuestionsTable.php.


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