ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilTestToplistGUI Class Reference
+ Collaboration diagram for ilTestToplistGUI:

Public Member Functions

 __construct (protected readonly ilObjTest $test_obj, protected readonly TestTopListRepository $repository, protected readonly ilCtrlInterface $ctrl, protected readonly ilGlobalTemplateInterface $tpl, 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 GlobalHttpState $http_state, protected readonly ParticipantRepository $participant_repository)
 
 executeCommand ()
 

Protected Member Functions

 showResultsToplistsCmd ()
 
 buildMedianMarkPanel ()
 
 buildResultsToplists (TopListOrder $order_by)
 
 buildTable (string $title, TopListType $list_type, TopListOrder $order_by)
 
 isTopTenRankingTableRequired ()
 
 isOwnRankingTableRequired ()
 

Detailed Description

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de \

Definition at line 37 of file class.ilTestToplistGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestToplistGUI::__construct ( protected readonly ilObjTest  $test_obj,
protected readonly TestTopListRepository  $repository,
protected readonly ilCtrlInterface  $ctrl,
protected readonly ilGlobalTemplateInterface  $tpl,
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 GlobalHttpState  $http_state,
protected readonly ParticipantRepository  $participant_repository 
)

Definition at line 39 of file class.ilTestToplistGUI.php.

51 {
52 }

Member Function Documentation

◆ buildMedianMarkPanel()

ilTestToplistGUI::buildMedianMarkPanel ( )
protected

Definition at line 83 of file class.ilTestToplistGUI.php.

83 : Panel
84 {
85 $title = $this->lng->txt('tst_median_mark_panel');
86
87 // BH: this really is the "mark of median" ??!
88 $activeId = $this->test_obj->getActiveIdOfUser($this->user->getId());
89 $data = $this->test_obj->getCompleteEvaluationData();
90 $median = $data->getStatistics()->median();
91 $pct = $data->getParticipant($activeId)->getMaxpoints() ? ($median / $data->getParticipant($activeId)->getMaxpoints()) * 100.0 : 0;
92 $mark = $this->test_obj->getMarkSchema()->getMatchingMark($pct);
93 $content = $mark->getShortName();
94
95 return $this->ui_factory->panel()->standard(
96 $title,
97 $this->ui_factory->legacy()->content($content)
98 );
99 }
This describes how a panel could be modified during construction of UI.
Definition: Panel.php:31

References $data, ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ buildResultsToplists()

ilTestToplistGUI::buildResultsToplists ( TopListOrder  $order_by)
protected
Returns
array<Data>

Definition at line 104 of file class.ilTestToplistGUI.php.

104 : array
105 {
106 $tables = [];
107
108 if ($this->isTopTenRankingTableRequired()) {
109 $tables[] = $this->buildTable(
110 $this->lng->txt('toplist_by_' . $order_by->getLabel()),
111 TopListType::GENERAL,
112 $order_by
113 )->withId('tst_top_list' . $this->test_obj->getRefId());
114 }
115
116 if ($this->isOwnRankingTableRequired()) {
117 $tables[] = $this->buildTable(
118 count($tables) == 0 ? $this->lng->txt('toplist_by_' . $order_by->getLabel()) : '',
120 $order_by
121 )->withId('tst_own_list' . $this->test_obj->getRefId());
122 }
123
124 return $tables;
125 }
buildTable(string $title, TopListType $list_type, TopListOrder $order_by)

References buildTable(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), ILIAS\Repository\lng(), and ILIAS\Test\Results\Toplist\USER.

+ Here is the call graph for this function:

◆ buildTable()

ilTestToplistGUI::buildTable ( string  $title,
TopListType  $list_type,
TopListOrder  $order_by 
)
protected

Definition at line 127 of file class.ilTestToplistGUI.php.

127 : Data
128 {
129 $table = new DataRetrieval(
130 $this->test_obj,
131 $this->repository,
132 $this->lng,
133 $this->user,
134 $this->ui_factory,
135 $this->ui_renderer,
136 $this->data_factory,
137 $list_type,
138 $order_by,
139 $this->participant_repository
140 );
141 return $this->ui_factory->table()
142 ->data($table, $title, $table->getColumns())
143 ->withRequest($this->http_state->request());
144 }
This describes a Data Table.
Definition: Data.php:33

References ILIAS\Repository\lng(), ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\user().

Referenced by buildResultsToplists().

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

◆ executeCommand()

ilTestToplistGUI::executeCommand ( )

Definition at line 57 of file class.ilTestToplistGUI.php.

57 : void
58 {
59 if (!$this->test_obj->getHighscoreEnabled()) {
60 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
61 $this->ctrl->redirectByClass(ilObjTestGUI::class);
62 }
63
64 $this->ctrl->saveParameter($this, 'active_id');
65
66 $cmd = $this->ctrl->getCmd();
67
68 switch ($cmd) {
69 default:
71 }
72 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and showResultsToplistsCmd().

+ Here is the call graph for this function:

◆ isOwnRankingTableRequired()

ilTestToplistGUI::isOwnRankingTableRequired ( )
protected

Definition at line 151 of file class.ilTestToplistGUI.php.

151 : bool
152 {
153 return $this->test_obj->getHighscoreOwnTable();
154 }

Referenced by buildResultsToplists().

+ Here is the caller graph for this function:

◆ isTopTenRankingTableRequired()

ilTestToplistGUI::isTopTenRankingTableRequired ( )
protected

Definition at line 146 of file class.ilTestToplistGUI.php.

146 : bool
147 {
148 return $this->test_obj->getHighscoreTopTable();
149 }

Referenced by buildResultsToplists().

+ Here is the caller graph for this function:

◆ showResultsToplistsCmd()

ilTestToplistGUI::showResultsToplistsCmd ( )
protected

Definition at line 74 of file class.ilTestToplistGUI.php.

74 : void
75 {
76 $this->tpl->setContent($this->ui_renderer->render([
77 $this->buildMedianMarkPanel(),
78 ...$this->buildResultsToplists(TopListOrder::BY_SCORE),
79 ...$this->buildResultsToplists(TopListOrder::BY_TIME),
80 ]));
81 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

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