19 declare(strict_types=1);
48 $column_factory = $this->ui_factory->table()->column();
49 $iconActor = $this->ui_factory->symbol()->icon()->standard(Icon::USR,
'me');
52 'is_actor' => $column_factory->boolean(
'', $iconActor,
''),
53 'rank' => $column_factory->number($this->
lng->txt(
'toplist_col_rank'))->withUnit(
'.'),
54 'participant' => $column_factory->text($this->
lng->txt(
'toplist_col_participant')),
55 'achieved' => $column_factory->date(
56 $this->lng->txt(
'toplist_col_achieved'),
57 $this->data_factory->dateFormat()->withTime24($this->data_factory->dateFormat()->standard())
59 'score' => $column_factory->text($this->
lng->txt(
'toplist_col_score')),
60 'percentage' => $column_factory->number($this->lng->txt(
'toplist_col_percentage'))->withUnit(
'%'),
61 'hints' => $column_factory->number($this->
lng->txt(
'toplist_col_hints')),
62 'workingtime' => $column_factory->text($this->lng->txt(
'toplist_col_wtime')),
66 'achieved' => $this->test_obj->getHighscoreAchievedTS(),
67 'score' => $this->test_obj->getHighscoreScore(),
68 'percentage' => $this->test_obj->getHighscorePercentage(),
69 'hints' => $this->test_obj->getHighscoreHints(),
70 'workingtime' => $this->test_obj->getHighscoreWTime()
74 foreach ($columns as $key => $column) {
75 if (isset($optional_columns[$key]) && !$optional_columns[$key]) {
78 $list[$key] = $column->withIsOptional(
false,
true)->withIsSortable(
false);
85 array $visible_column_ids,
89 ?array $additional_parameters
94 'participant' => $this->test_obj->isHighscoreAnon() && (
int) $row[
'usr_id'] !== $this->
user->getId()
96 : $row[
'lastname'] .
', ' . $row[
'firstname'],
97 'is_actor' => ((
int) $row[
'usr_id'] === $this->
user->getId())
100 if (in_array(
'achieved', $visible_column_ids,
true)) {
101 $item[
'achieved'] = new \DateTimeImmutable(
'@' . $row[
'tstamp']);
103 if (in_array(
'score', $visible_column_ids,
true)) {
104 $item[
'score'] = $row[
'reached_points'] .
' / ' . $row[
'max_points'];
106 if (in_array(
'percentage', $visible_column_ids,
true)) {
107 $item[
'percentage'] = $row[
'percentage'];
109 if (in_array(
'hints', $visible_column_ids,
true)) {
110 $item[
'hints'] = $row[
'hint_count'];
112 if (in_array(
'workingtime', $visible_column_ids,
true)) {
113 $item[
'workingtime'] = $this->
formatTime($row[
'workingtime']);
129 return $this->order_by === TopListOrder::BY_SCORE
130 ? $this->
repository->getUserToplistByPercentage($this->test_obj, $this->
user->getId())
131 : $this->
repository->getUserToplistByWorkingtime($this->test_obj, $this->user->getId());
133 return $this->
repository->getGeneralToplist($this->test_obj, $this->order_by);
139 $hours = intdiv($seconds, 3600);
140 $minutes = intdiv($seconds % 3600, 60);
141 $seconds = $seconds % 60;
143 return sprintf(
'%02d:%02d:%02d', $hours, $minutes, $seconds);
getTotalRowCount(?array $filter_data, ?array $additional_parameters)
Mainly for the purpose of pagination-support, it is important to know about the total number of recor...
repository()
description: > Example for rendering a repository card
Both the subject and the direction need to be specified when expressing an order. ...
buildDataRow(string $id, array $record)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
A simple class to express a naive range of whole positive numbers.
__construct(protected readonly \ilObjTest $test_obj, protected readonly TestTopListRepository $repository, protected readonly \ilLanguage $lng, protected readonly \ilObjUser $user, protected readonly UIFactory $ui_factory, protected readonly UIRenderer $ui_renderer, protected readonly DataFactory $data_factory, protected readonly TopListType $list_type, protected readonly TopListOrder $order_by)