ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 12 of file class.ilTestToplistGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, and user().

37  {
38  global $DIC;
39  /* @var ILIAS\DI\Container $DIC */
40 
41  $this->ctrl = $DIC['ilCtrl'];
42  $this->tpl = $DIC['tpl'];
43  $this->lng = $DIC['lng'];
44  $this->user = $DIC['ilUser'];
45  $this->uiFactory = $DIC->ui()->factory();
46  $this->uiRenderer = $DIC->ui()->renderer();
47 
48  $this->object = $testOBJ;
49  $this->toplist = new ilTestTopList($testOBJ);
50  }
Class ilTestTopList.
user()
Definition: user.php:4
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ buildTableGUI()

ilTestToplistGUI::buildTableGUI ( )
protected
Returns
ilTestTopListTableGUI

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

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

187  {
188  $table = new ilTestTopListTableGUI($this, $this->object);
189 
190  return $table;
191  }
Class ilTestTopListTableGUI.
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestToplistGUI::executeCommand ( )

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

References ilUtil\sendFailure(), and showResultsToplistsCmd().

55  : void
56  {
57  if (!$this->object->getHighscoreEnabled()) {
58  ilUtil::sendFailure($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:
68  $this->showResultsToplistsCmd();
69  }
70  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ isOwnRankingTableRequired()

ilTestToplistGUI::isOwnRankingTableRequired ( )
protected
Returns
bool

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

References ilObjTest\HIGHSCORE_SHOW_ALL_TABLES, and ilObjTest\HIGHSCORE_SHOW_OWN_TABLE.

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

212  : bool
213  {
214  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_OWN_TABLE) {
215  return true;
216  }
217 
218  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_ALL_TABLES) {
219  return true;
220  }
221 
222  return false;
223  }
const HIGHSCORE_SHOW_OWN_TABLE
const HIGHSCORE_SHOW_ALL_TABLES
+ Here is the caller graph for this function:

◆ isTopTenRankingTableRequired()

ilTestToplistGUI::isTopTenRankingTableRequired ( )
protected
Returns
bool

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

References ilObjTest\HIGHSCORE_SHOW_ALL_TABLES, and ilObjTest\HIGHSCORE_SHOW_TOP_TABLE.

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

196  : bool
197  {
198  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_TOP_TABLE) {
199  return true;
200  }
201 
202  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_ALL_TABLES) {
203  return true;
204  }
205 
206  return false;
207  }
const HIGHSCORE_SHOW_TOP_TABLE
const HIGHSCORE_SHOW_ALL_TABLES
+ Here is the caller graph for this function:

◆ renderMedianMarkPanel()

ilTestToplistGUI::renderMedianMarkPanel ( )
protected
Returns
string

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

References $data, and user().

Referenced by showResultsToplistsCmd().

84  : string
85  {
86  $title = $this->lng->txt('tst_median_mark_panel');
87 
88  // BH: this really is the "mark of median" ??!
89  $activeId = $this->object->getActiveIdOfUser($this->user->getId());
90  $data = $this->object->getCompleteEvaluationData();
91  $median = $data->getStatistics()->getStatistics()->median();
92  $pct = $data->getParticipant($activeId)->getMaxpoints() ? ($median / $data->getParticipant($activeId)->getMaxpoints()) * 100.0 : 0;
93  $mark = $this->object->mark_schema->getMatchingMark($pct);
94  $content = $mark->getShortName();
95 
96  $panel = $this->uiFactory->panel()->standard(
97  $title,
98  $this->uiFactory->legacy($content)
99  );
100 
101  return $this->uiRenderer->render($panel);
102  }
$data
Definition: storeScorm.php:23
user()
Definition: user.php:4
+ 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 107 of file class.ilTestToplistGUI.php.

References buildTableGUI(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), and user().

Referenced by showResultsToplistsCmd().

107  : string
108  {
109  $title = $this->lng->txt('toplist_by_score');
110  $html = '';
111 
112  if ($this->isTopTenRankingTableRequired()) {
113  $topData = $this->toplist->getGeneralToplistByPercentage(
114  (int) $this->object->getRefId(),
115  (int) $this->user->getId()
116  );
117 
118  $table = $this->buildTableGUI();
119  $table->setData($topData);
120  $table->setTitle($title);
121 
122  $html .= $table->getHTML();
123  }
124 
125  if ($this->isOwnRankingTableRequired()) {
126  $ownData = $this->toplist->getUserToplistByPercentage(
127  (int) $this->object->getRefId(),
128  (int) $this->user->getId()
129  );
130 
131  $table = $this->buildTableGUI();
132  $table->setData($ownData);
133  if (!$this->isTopTenRankingTableRequired()) {
134  $table->setTitle($title);
135  }
136 
137  $html .= $table->getHTML();
138  }
139 
140  return $html;
141  }
user()
Definition: user.php:4
+ 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 146 of file class.ilTestToplistGUI.php.

References buildTableGUI(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), and user().

Referenced by showResultsToplistsCmd().

146  : string
147  {
148  $title = $this->lng->txt('toplist_by_time');
149  $html = '';
150 
151  if ($this->isTopTenRankingTableRequired()) {
152  $topData = $this->toplist->getGeneralToplistByWorkingtime(
153  $this->object->getRefId(),
154  $this->user->getId()
155  );
156 
157  $table = $this->buildTableGUI();
158  $table->setData($topData);
159  $table->setTitle($title);
160 
161  $html .= $table->getHTML();
162  }
163 
164  if ($this->isOwnRankingTableRequired()) {
165  $ownData = $this->toplist->getUserToplistByWorkingtime(
166  (int) $this->object->getRefId(),
167  (int) $this->user->getId()
168  );
169 
170  $table = $this->buildTableGUI();
171  $table->setData($ownData);
172 
173  if (!$this->isTopTenRankingTableRequired()) {
174  $table->setTitle($title);
175  }
176 
177  $html .= $table->getHTML();
178  }
179 
180  return $html;
181  }
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResultsToplistsCmd()

ilTestToplistGUI::showResultsToplistsCmd ( )
protected

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

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

Referenced by executeCommand().

72  : void
73  {
74  $this->tpl->setContent(implode('', [
75  $this->renderMedianMarkPanel(),
78  ]));
79  }
+ 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 15 of file class.ilTestToplistGUI.php.

◆ $lng

ilTestToplistGUI::$lng
protected

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

◆ $object

ilTestToplistGUI::$object
protected

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

◆ $tabs

ilTestToplistGUI::$tabs
protected

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

◆ $toplist

ilTestToplistGUI::$toplist
protected

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

◆ $tpl

ilTestToplistGUI::$tpl
protected

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

◆ $uiFactory

ilTestToplistGUI::$uiFactory
private

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

◆ $uiRenderer

ilTestToplistGUI::$uiRenderer
private

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

◆ $user

ilTestToplistGUI::$user
protected

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


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