ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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,)
 
 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...
 

Private Member Functions

 getColumns ()
 
 getActions ()
 
 getRecords ()
 

Detailed Description

Definition at line 34 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 39 of file QuestionsTable.php.

48  {
49  }

Member Function Documentation

◆ getActions()

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

Definition at line 119 of file QuestionsTable.php.

119  : array
120  {
121  $this->table_actions->getActions();
122  }

◆ getColumns()

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

Definition at line 87 of file QuestionsTable.php.

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

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

87  : array
88  {
89  $f = $this->ui_factory;
90  $columns = [
91  'question_id' => $f->table()->column()->text($this->lng->txt('question_id'))
92  ->withIsOptional(true, false),
93  'title' => $f->table()->column()->link($this->lng->txt('tst_question_title')),
94  'description' => $f->table()->column()->text($this->lng->txt('description'))
95  ->withIsOptional(true, false),
96  'complete' => $f->table()->column()->boolean(
97  $this->lng->txt('question_complete_title'),
98  $f->symbol()->icon()->custom('assets/images/standard/icon_checked.svg', '', 'small'),
99  $f->symbol()->icon()->custom('assets/images/standard/icon_alert.svg', '', 'small')
100  ),
101  'type_tag' => $f->table()->column()->text($this->lng->txt('tst_question_type')),
102  'points' => $f->table()->column()->text($this->lng->txt('points')),
103  'author' => $f->table()->column()->text($this->lng->txt('author'))
104  ->withIsOptional(true, false),
105  'lifecycle' => $f->table()->column()->text($this->lng->txt('qst_lifecycle'))
106  ->withIsOptional(true, false),
107  'qpl' => $f->table()->column()->link($this->lng->txt('qpl')),
108  'nr_of_answers' => $f->table()->column()->number($this->lng->txt('number_of_answers'))
109  ->withIsOptional(true, false),
110  'average_points' => $f->table()->column()->number($this->lng->txt('average_reached_points'))
111  ->withIsOptional(true, false),
112  'percentage_points_achieved' => $f->table()->column()->text($this->lng->txt('percentage_points_achieved'))
113  ->withIsOptional(true, false),
114  ];
115 
116  return $columns;
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecords()

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

Definition at line 124 of file QuestionsTable.php.

References Vendor\Package\$a, Vendor\Package\$b, and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

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

124  : \Generator
125  {
126  $records = $this->questionrepository
127  ->getQuestionPropertiesWithAggregatedResultsForTest($this->test_obj);
128  usort(
129  $records,
130  static fn(TestQuestionProperties $a, TestQuestionProperties $b): int =>
131  $a->getSequenceInformation()?->getPlaceInSequence() <=> $b->getSequenceInformation()?->getPlaceInSequence()
132  );
133  yield from $records;
134  }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
+ Here is the call graph for this function:
+ Here is the caller 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 70 of file QuestionsTable.php.

References ILIAS\Test\Questions\Presentation\QuestionsTable\getRecords(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

73  : \Generator {
74  foreach ($this->getRecords() as $record) {
75  $row = $record->getAsQuestionsTableRow(
76  $this->lng,
77  $this->ui_factory,
78  $this->refinery,
79  $this->table_actions->getQuestionTargetLinkBuilder(),
80  $row_builder,
81  $this->title_builder
82  );
83  yield $this->table_actions->setDisabledActions($row, $record);
84  }
85  }
+ Here is the call graph for this function:

◆ getTableComponent()

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

Definition at line 51 of file QuestionsTable.php.

References ILIAS\Test\Questions\Presentation\QuestionsTable\getColumns(), ILIAS\Repository\lng(), and ILIAS\UI\Component\Table\Ordering\withOrderingDisabled().

51  : Ordering
52  {
53  $table = $this->ui_factory->table()->ordering(
54  $this,
55  $this->table_actions->getOrderActionUrl(),
56  $this->lng->txt('list_of_questions'),
57  $this->getColumns(),
58  )
59  ->withId((string) $this->test_obj->getId())
60  ->withActions($this->table_actions->getActions())
61  ->withRequest($this->request);
62 
63  if ($this->test_obj->isRandomTest()) {
64  return $table->withOrderingDisabled(true);
65  }
66 
67  return $table;
68  }
+ Here is the call graph for this function:

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