ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 
 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 36 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 
)

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

49 {
50 }

Member Function Documentation

◆ buildMedianMarkPanel()

ilTestToplistGUI::buildMedianMarkPanel ( )
protected

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

81 : Panel
82 {
83 $title = $this->lng->txt('tst_median_mark_panel');
84
85 // BH: this really is the "mark of median" ??!
86 $activeId = $this->test_obj->getActiveIdOfUser($this->user->getId());
87 $data = $this->test_obj->getCompleteEvaluationData();
88 $median = $data->getStatistics()->median();
89 $pct = $data->getParticipant($activeId)->getMaxpoints() ? ($median / $data->getParticipant($activeId)->getMaxpoints()) * 100.0 : 0;
90 $mark = $this->test_obj->getMarkSchema()->getMatchingMark($pct);
91 $content = $mark->getShortName();
92
93 return $this->ui_factory->panel()->standard(
94 $title,
95 $this->ui_factory->legacy()->content($content)
96 );
97 }
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 102 of file class.ilTestToplistGUI.php.

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

References buildTable(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), ILIAS\Repository\lng(), and ILIAS\Mail\Folder\USER.

+ Here is the call graph for this function:

◆ buildTable()

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

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

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

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 55 of file class.ilTestToplistGUI.php.

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

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

+ Here is the call graph for this function:

◆ isOwnRankingTableRequired()

ilTestToplistGUI::isOwnRankingTableRequired ( )
protected

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

148 : bool
149 {
150 return $this->test_obj->getHighscoreOwnTable();
151 }

Referenced by buildResultsToplists().

+ Here is the caller graph for this function:

◆ isTopTenRankingTableRequired()

ilTestToplistGUI::isTopTenRankingTableRequired ( )
protected

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

143 : bool
144 {
145 return $this->test_obj->getHighscoreTopTable();
146 }

Referenced by buildResultsToplists().

+ Here is the caller graph for this function:

◆ showResultsToplistsCmd()

ilTestToplistGUI::showResultsToplistsCmd ( )
protected

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

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

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