ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 

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 ( )
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.

81  : array
82  {
83  $components = [
84  $this->ui_factory->button()->standard(
85  $this->lng->txt('tst_resume_test'),
86  $this->ctrl->getLinkTarget($this->parent_gui, ilTestPlayerCommands::SHOW_QUESTION)
87  )
88  ];
89 
90  $button_text = $this->lng->txt('finish_test');
91  // Examview enabled & !reviewed & requires_confirmation? test_submission_overview (review gui)
92  if ($this->parent_gui->getObject()->getMainSettings()->getFinishingSettings()->getShowAnswerOverview()) {
93  $components[] = $this->ui_factory->button()->standard(
94  $button_text,
95  $this->ctrl->getLinkTargetByClass(ilTestSubmissionReviewGUI::class, 'show')
96  );
97  } else {
98  $finish_test_modal = $this->parent_gui->buildFinishTestModal();
99  $components[] = $this->ui_factory->button()->standard($button_text, '')
100  ->withOnClick($finish_test_modal->getShowSignal());
101  $components[] = $finish_test_modal;
102  }
103 
104  $components[] = $this->ui_factory->table()->data(
105  $this,
106  $this->lng->txt('question_summary'),
107  $this->getColumns(),
108  )
109  ->withRequest($this->http->request())
110  ->withId('listofquestions');
111 
112  return $components;
113  }
$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 121 of file QuestionsOfAttemptTable.php.

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

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

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

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

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

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

115  : array
116  {
117  // ignore order bc table is not sortable
118  return array_slice($this->data, $range->getStart(), $range->getLength());
119  }
+ 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 171 of file QuestionsOfAttemptTable.php.

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

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

◆ isShowDescriptionEnabled()

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

Definition at line 166 of file QuestionsOfAttemptTable.php.

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

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

◆ isShowMarkerEnabled()

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

Definition at line 181 of file QuestionsOfAttemptTable.php.

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

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

◆ isShowPointsEnabled()

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

Definition at line 176 of file QuestionsOfAttemptTable.php.

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

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

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