ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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, ?array $filter_data, ?array $additional_parameters)
 This is called by the table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 getTotalRowCount (?array $filter_data, ?array $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)
 

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 81 of file QuestionsOfAttemptTable.php.

References $components, ILIAS\Repository\ctrl(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\getColumns(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ilTestPlayerCommands\SHOW_QUESTION.

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

◆ createShowQuestionLink()

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

Definition at line 122 of file QuestionsOfAttemptTable.php.

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

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

122  : string
123  {
124  $this->ctrl->setParameter($this->parent_gui, 'sequence', $sequence);
125  $this->ctrl->setParameter($this->parent_gui, 'pmode', '');
126  return $this->ctrl->getLinkTarget($this->parent_gui, ilTestPlayerCommands::SHOW_QUESTION);
127  }
+ 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 132 of file QuestionsOfAttemptTable.php.

References ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\isPostponingEnabled(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\isShowDescriptionEnabled(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\isShowMarkerEnabled(), ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable\isShowPointsEnabled(), and ILIAS\Repository\lng().

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

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

◆ getData()

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

Definition at line 116 of file QuestionsOfAttemptTable.php.

References ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

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

116  : array
117  {
118  // ignore order bc table is not sortable
119  return array_slice($this->data, $range->getStart(), $range->getLength());
120  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRows()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::getRows ( DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
?array  $filter_data,
?array  $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.

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

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

◆ getTotalRowCount()

ILIAS\Test\Questions\Presentation\QuestionsOfAttemptTable::getTotalRowCount ( ?array  $filter_data,
?array  $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 72 of file QuestionsOfAttemptTable.php.

72  : ?int
73  {
74  //ignore filter bc table is not filterable
75  return count($this->data);
76  }

◆ isPostponingEnabled()

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

Definition at line 172 of file QuestionsOfAttemptTable.php.

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

172  : bool
173  {
174  return $this->test->isPostponingEnabled();
175  }
+ Here is the caller graph for this function:

◆ isShowDescriptionEnabled()

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

Definition at line 167 of file QuestionsOfAttemptTable.php.

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

167  : bool
168  {
169  return $this->test->getListOfQuestionsDescription();
170  }
+ Here is the caller graph for this function:

◆ isShowMarkerEnabled()

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

Definition at line 182 of file QuestionsOfAttemptTable.php.

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

182  : bool
183  {
184  return $this->test->getShowMarker();
185  }
+ Here is the caller graph for this function:

◆ isShowPointsEnabled()

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

Definition at line 177 of file QuestionsOfAttemptTable.php.

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

177  : bool
178  {
179  return !$this->test->getTitleOutput();
180  }
+ Here is the caller graph for this function:

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