ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable Class Reference
+ Inheritance diagram for ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable:
+ Collaboration diagram for ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable:

Public Member Functions

 __construct (protected readonly \ilLanguage $lng, protected readonly \ilCtrlInterface $ctrl, protected readonly UIFactory $ui_factory, protected readonly DataFactory $data_factory, protected readonly GlobalHttpState $http, protected readonly \ilTestPlayerAbstractGUI $parent_gui, protected readonly \ilObjTest $test, protected readonly array $data)
 
 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...
 
 buildComponents (bool $is_start_page)
 
 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...
 

Protected Member Functions

 getData (Range $range, Order $order)
 
 createShowQuestionLink (int $sequence)
 
 getColumns ()
 
 isShowDescriptionEnabled ()
 
 isPostponingEnabled ()
 
 isShowPointsEnabled ()
 
 isShowMarkerEnabled ()
 

Detailed Description

Definition at line 35 of file QuestionsOfAttemptTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::__construct ( protected readonly \ilLanguage  $lng,
protected readonly \ilCtrlInterface  $ctrl,
protected readonly UIFactory  $ui_factory,
protected readonly DataFactory  $data_factory,
protected readonly GlobalHttpState  $http,
protected readonly \ilTestPlayerAbstractGUI  $parent_gui,
protected readonly \ilObjTest  $test,
protected readonly array  $data 
)

Definition at line 37 of file QuestionsOfAttemptTable.php.

46 {
47 }

Member Function Documentation

◆ buildComponents()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::buildComponents ( bool  $is_start_page)
Returns
array<Component>

Definition at line 85 of file QuestionsOfAttemptTable.php.

87 : array {
88 $components = [
89 $this->ui_factory->button()->standard(
90 $is_start_page ? $this->lng->txt('goto_first_question') : $this->lng->txt('tst_resume_test'),
91 $this->ctrl->getLinkTarget($this->parent_gui, ilTestPlayerCommands::SHOW_QUESTION)
92 )
93 ];
94
95 $button_text = $this->lng->txt('finish_test');
96 // Examview enabled & !reviewed & requires_confirmation? test_submission_overview (review gui)
97 if ($this->parent_gui->getObject()->getMainSettings()->getFinishingSettings()->getShowAnswerOverview()) {
98 $components[] = $this->ui_factory->button()->standard(
99 $button_text,
100 $this->ctrl->getLinkTargetByClass(ilTestSubmissionReviewGUI::class, 'show')
101 );
102 } else {
103 $finish_test_modal = $this->parent_gui->buildFinishTestModal();
104 $components[] = $this->ui_factory->button()->standard($button_text, '')
105 ->withOnClick($finish_test_modal->getShowSignal());
106 $components[] = $finish_test_modal;
107 }
108
109 $components[] = $this->ui_factory->table()->data(
110 $this,
111 $this->lng->txt('question_summary'),
112 $this->getColumns(),
113 )
114 ->withRequest($this->http->request())
115 ->withId('listofquestions');
116
117 return $components;
118 }
$components
static http()
Fetches the global http state from ILIAS.

References $components, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ createShowQuestionLink()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::createShowQuestionLink ( int  $sequence)
protected

Definition at line 126 of file QuestionsOfAttemptTable.php.

126 : string
127 {
128 $this->ctrl->setParameter($this->parent_gui, 'sequence', $sequence);
129 $this->ctrl->setParameter($this->parent_gui, 'pmode', '');
130 return $this->ctrl->getLinkTarget($this->parent_gui, ilTestPlayerCommands::SHOW_QUESTION);
131 }

References ILIAS\Repository\ctrl(), and ilTestPlayerCommands\SHOW_QUESTION.

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

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

◆ getColumns()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::getColumns ( )
protected
Returns
array<Column>

Definition at line 136 of file QuestionsOfAttemptTable.php.

136 : array
137 {
138 $column_factory = $this->ui_factory->table()->column();
139 $icon_factory = $this->ui_factory->symbol()->icon();
140 $icon_checked = $icon_factory->custom('assets/images/standard/icon_checked.svg', $this->lng->txt('yes'));
141 $icon_unchecked = $icon_factory->custom('assets/images/standard/icon_unchecked.svg', $this->lng->txt('no'));
142 $icon_marked = $icon_factory->custom('assets/images/object/marked.svg', $this->lng->txt('tst_question_marked'));
143
144 $columns = [
145 'order' => $column_factory->number($this->lng->txt('tst_qst_order')),
146 'title' => $column_factory->link($this->lng->txt('tst_question')),
147 'description' => $column_factory->text($this->lng->txt('description')),
148 'postponed' => $column_factory->boolean(ucfirst($this->lng->txt('postponed')), $this->lng->txt('yes'), ''),
149 'points' => $column_factory->number($this->lng->txt('tst_maximum_points'))->withUnit($this->lng->txt('points_short')),
150 'answered' => $column_factory->boolean($this->lng->txt('answered'), $icon_checked, $icon_unchecked),
151 'marked' => $column_factory->boolean($this->lng->txt('tst_question_marker'), $icon_marked, ''),
152 ];
153
154 $optional_columns = [
155 'description' => $this->isShowDescriptionEnabled(),
156 'postponed' => $this->isPostponingEnabled(),
157 'points' => $this->isShowPointsEnabled(),
158 'marked' => $this->isShowMarkerEnabled(),
159 ];
160
161 $list = [];
162 foreach ($columns as $key => $column) {
163 if (isset($optional_columns[$key]) && !$optional_columns[$key]) {
164 continue;
165 }
166 $list[$key] = $column->withIsOptional(false, true)->withIsSortable(false);
167 }
168 return $list;
169 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getData()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::getData ( Range  $range,
Order  $order 
)
protected

Definition at line 120 of file QuestionsOfAttemptTable.php.

120 : array
121 {
122 // ignore order bc table is not sortable
123 return array_slice($this->data, $range->getStart(), $range->getLength());
124 }

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

+ Here is the call graph for this function:

◆ getRows()

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

57 : \Generator {
58 foreach ($this->getData($range, $order) as $question) {
59 $title = $this->ui_factory->link()->standard($question['title'], $this->createShowQuestionLink($question['sequence']));
60 $record = [
61 'order' => (int) $question['order'],
62 'title' => $title->withDisabled($question['disabled']),
63 'description' => $question['description'],
64 'points' => $question['points'],
65 'postponed' => (bool) $question['postponed'],
66 'answered' => (bool) $question['worked_through'],
67 'marked' => (bool) $question['marked'],
68 ];
69 yield $row_builder->buildDataRow((string) $question['order'], $record);
70 }
71 }
buildDataRow(string $id, array $record)

References ILIAS\UI\Component\Table\DataRowBuilder\buildDataRow(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\createShowQuestionLink(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getTotalRowCount()

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

77 : ?int {
78 //ignore filter bc table is not filterable
79 return count($this->data);
80 }

◆ isPostponingEnabled()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::isPostponingEnabled ( )
protected

Definition at line 176 of file QuestionsOfAttemptTable.php.

176 : bool
177 {
178 return $this->test->isPostponingEnabled();
179 }

◆ isShowDescriptionEnabled()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::isShowDescriptionEnabled ( )
protected

Definition at line 171 of file QuestionsOfAttemptTable.php.

171 : bool
172 {
173 return $this->test->getListOfQuestionsDescription();
174 }

◆ isShowMarkerEnabled()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::isShowMarkerEnabled ( )
protected

Definition at line 186 of file QuestionsOfAttemptTable.php.

186 : bool
187 {
188 return $this->test->getShowMarker();
189 }

◆ isShowPointsEnabled()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::isShowPointsEnabled ( )
protected

Definition at line 181 of file QuestionsOfAttemptTable.php.

181 : bool
182 {
183 return !$this->test->getTitleOutput();
184 }

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