ILIAS  release_8 Revision v8.24
ilTestToplistGUI Class Reference
+ Collaboration diagram for ilTestToplistGUI:

Public Member Functions

 __construct (ilObjTest $testOBJ)
 
 executeCommand ()
 

Protected Member Functions

 showResultsToplistsCmd ()
 
 renderMedianMarkPanel ()
 
 renderResultsToplistByScore ()
 
 renderResultsToplistByTime ()
 
 buildTableGUI ()
 
 isTopTenRankingTableRequired ()
 
 isOwnRankingTableRequired ()
 

Protected Attributes

 $ctrl
 
 $tabs
 
 $tpl
 
 $lng
 
 $user
 
 $object
 
 $toplist
 

Private Attributes

 $uiFactory
 
 $uiRenderer
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilTestToplistGUI::__construct ( ilObjTest  $testOBJ)
Parameters
ilObjTest$testOBJ

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

51 {
52 global $DIC;
53 /* @var ILIAS\DI\Container $DIC */
54
55 $this->ctrl = $DIC['ilCtrl'];
56 $this->tpl = $DIC['tpl'];
57 $this->lng = $DIC['lng'];
58 $this->user = $DIC['ilUser'];
59 $this->uiFactory = $DIC->ui()->factory();
60 $this->uiRenderer = $DIC->ui()->renderer();
61
62 $this->object = $testOBJ;
63 $this->toplist = new ilTestTopList($testOBJ);
64 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ buildTableGUI()

ilTestToplistGUI::buildTableGUI ( )
protected
Returns
ilTestTopListTableGUI

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

201 {
202 $table = new ilTestTopListTableGUI($this, $this->object);
203
204 return $table;
205 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

+ Here is the caller graph for this function:

◆ executeCommand()

ilTestToplistGUI::executeCommand ( )

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

69 : void
70 {
71 if (!$this->object->getHighscoreEnabled()) {
72 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
73 $this->ctrl->redirectByClass(ilObjTestGUI::class);
74 }
75
76 $this->ctrl->saveParameter($this, 'active_id');
77
78 $cmd = $this->ctrl->getCmd();
79
80 switch ($cmd) {
81 default:
83 }
84 }

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

+ Here is the call graph for this function:

◆ isOwnRankingTableRequired()

ilTestToplistGUI::isOwnRankingTableRequired ( )
protected
Returns
bool

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

218 : bool
219 {
220 return $this->object->getHighscoreOwnTable();
221 }

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

+ Here is the caller graph for this function:

◆ isTopTenRankingTableRequired()

ilTestToplistGUI::isTopTenRankingTableRequired ( )
protected
Returns
bool

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

210 : bool
211 {
212 return $this->object->getHighscoreTopTable();
213 }

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

+ Here is the caller graph for this function:

◆ renderMedianMarkPanel()

ilTestToplistGUI::renderMedianMarkPanel ( )
protected
Returns
string

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

98 : string
99 {
100 $title = $this->lng->txt('tst_median_mark_panel');
101
102 // BH: this really is the "mark of median" ??!
103 $activeId = $this->object->getActiveIdOfUser($this->user->getId());
104 $data = $this->object->getCompleteEvaluationData();
105 $median = $data->getStatistics()->getStatistics()->median();
106 $pct = $data->getParticipant($activeId)->getMaxpoints() ? ($median / $data->getParticipant($activeId)->getMaxpoints()) * 100.0 : 0;
107 $mark = $this->object->mark_schema->getMatchingMark($pct);
108 $content = $mark->getShortName();
109
110 $panel = $this->uiFactory->panel()->standard(
111 $title,
112 $this->uiFactory->legacy($content)
113 );
114
115 return $this->uiRenderer->render($panel);
116 }
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198

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

Referenced by showResultsToplistsCmd().

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

◆ renderResultsToplistByScore()

ilTestToplistGUI::renderResultsToplistByScore ( )
protected
Returns
string

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

121 : string
122 {
123 $title = $this->lng->txt('toplist_by_score');
124 $html = '';
125
126 if ($this->isTopTenRankingTableRequired()) {
127 $topData = $this->toplist->getGeneralToplistByPercentage(
128 $this->object->getRefId(),
129 (int) $this->user->getId()
130 );
131
132 $table = $this->buildTableGUI();
133 $table->setData($topData);
134 $table->setTitle($title);
135
136 $html .= $table->getHTML();
137 }
138
139 if ($this->isOwnRankingTableRequired()) {
140 $ownData = $this->toplist->getUserToplistByPercentage(
141 $this->object->getRefId(),
142 (int) $this->user->getId()
143 );
144
145 $table = $this->buildTableGUI();
146 $table->setData($ownData);
147 if (!$this->isTopTenRankingTableRequired()) {
148 $table->setTitle($title);
149 }
150
151 $html .= $table->getHTML();
152 }
153
154 return $html;
155 }

References buildTableGUI(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by showResultsToplistsCmd().

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

◆ renderResultsToplistByTime()

ilTestToplistGUI::renderResultsToplistByTime ( )
protected
Returns
string

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

160 : string
161 {
162 $title = $this->lng->txt('toplist_by_time');
163 $html = '';
164
165 if ($this->isTopTenRankingTableRequired()) {
166 $topData = $this->toplist->getGeneralToplistByWorkingtime(
167 $this->object->getRefId(),
168 $this->user->getId()
169 );
170
171 $table = $this->buildTableGUI();
172 $table->setData($topData);
173 $table->setTitle($title);
174
175 $html .= $table->getHTML();
176 }
177
178 if ($this->isOwnRankingTableRequired()) {
179 $ownData = $this->toplist->getUserToplistByWorkingtime(
180 $this->object->getRefId(),
181 (int) $this->user->getId()
182 );
183
184 $table = $this->buildTableGUI();
185 $table->setData($ownData);
186
187 if (!$this->isTopTenRankingTableRequired()) {
188 $table->setTitle($title);
189 }
190
191 $html .= $table->getHTML();
192 }
193
194 return $html;
195 }

References buildTableGUI(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

Referenced by showResultsToplistsCmd().

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

◆ showResultsToplistsCmd()

ilTestToplistGUI::showResultsToplistsCmd ( )
protected

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

86 : void
87 {
88 $this->tpl->setContent(implode('', [
89 $this->renderMedianMarkPanel(),
92 ]));
93 }

References renderMedianMarkPanel(), renderResultsToplistByScore(), and renderResultsToplistByTime().

Referenced by executeCommand().

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

Field Documentation

◆ $ctrl

ilTestToplistGUI::$ctrl
protected

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

◆ $lng

ilTestToplistGUI::$lng
protected

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

◆ $object

ilTestToplistGUI::$object
protected

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

◆ $tabs

ilTestToplistGUI::$tabs
protected

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

◆ $toplist

ilTestToplistGUI::$toplist
protected

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

◆ $tpl

ilTestToplistGUI::$tpl
protected

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

◆ $uiFactory

ilTestToplistGUI::$uiFactory
private

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

◆ $uiRenderer

ilTestToplistGUI::$uiRenderer
private

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

◆ $user

ilTestToplistGUI::$user
protected

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


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