19declare(strict_types=1);
33use Psr\Http\Message\ServerRequestInterface;
42 private readonly UIFactory $ui_factory,
44 private readonly ServerRequestInterface
$request,
48 private readonly TestQuestionsRepository $questionrepository,
57 $listing = $this->ui_factory->listing()->property()
59 $this->
lng->txt(
'tst_num_questions'),
60 $this->refinery->kindlyTo()->string()->transform(
61 $this->test_obj->getQuestionCount()
65 if ($this->test_obj->isRandomTest()) {
69 return $listing->withProperty(
70 $this->
lng->txt(
'maximum_points'),
71 $this->refinery->kindlyTo()->string()->transform(
74 fn(
float $c, TestQuestionProperties $v):
float
75 =>
$c + $v->getGeneralQuestionProperties()->getAvailablePoints(),
85 $table = $this->ui_factory->table()->ordering(
87 $this->table_actions->getOrderActionUrl(),
91 ->
withId((
string) $this->test_obj->getId())
92 ->withActions($this->table_actions->getActions())
93 ->withRequest($this->request);
97 if ($this->test_obj->isRandomTest()
98 || $this->test_obj->evalTotalPersons() !== 0) {
99 return $table->withOrderingDisabled(
true);
107 array $visible_column_ids
110 $row = $record->getAsQuestionsTableRow(
114 $this->table_actions->getQuestionTargetLinkBuilder(),
118 yield $this->table_actions->setDisabledActions($row, $record);
124 $f = $this->ui_factory;
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')
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),
156 $this->table_actions->getActions();
161 if ($this->records ===
null) {
162 $this->loadRecords();
164 yield
from $this->records;
169 $this->records = $this->questionrepository
170 ->getQuestionPropertiesWithAggregatedResultsForTest($this->test_obj);
173 static fn(TestQuestionProperties
$a, TestQuestionProperties
$b):
int =>
174 $a->getSequenceInformation()?->getPlaceInSequence() <=>
$b->getSequenceInformation()?->getPlaceInSequence()
Builds a Color from either hex- or rgb values.
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 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,)
foreach( $report as $row)
This describes a Table to specify the order of its data (rows).
withId(string $id)
The DataTable comes with a storage to keep e.g.
$request
@ilCtrl_Calls ilObjLearningSequenceContentGUI: ilObjLearningSequenceConditionsGUI
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples