ILIAS  release_8 Revision v8.19
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 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.

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

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
+ 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.

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

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...
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestToplistGUI::executeCommand ( )

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

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

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:
82  $this->showResultsToplistsCmd();
83  }
84  }
+ Here is the call graph for this function:

◆ isOwnRankingTableRequired()

ilTestToplistGUI::isOwnRankingTableRequired ( )
protected
Returns
bool

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

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

218  : bool
219  {
220  return $this->object->getHighscoreOwnTable();
221  }
+ Here is the caller graph for this function:

◆ isTopTenRankingTableRequired()

ilTestToplistGUI::isTopTenRankingTableRequired ( )
protected
Returns
bool

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

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

210  : bool
211  {
212  return $this->object->getHighscoreTopTable();
213  }
+ Here is the caller graph for this function:

◆ renderMedianMarkPanel()

ilTestToplistGUI::renderMedianMarkPanel ( )
protected
Returns
string

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

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

Referenced by showResultsToplistsCmd().

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
+ 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.

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

Referenced by showResultsToplistsCmd().

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  }
+ 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.

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

Referenced by showResultsToplistsCmd().

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  }
+ 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.

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

Referenced by executeCommand().

86  : void
87  {
88  $this->tpl->setContent(implode('', [
89  $this->renderMedianMarkPanel(),
92  ]));
93  }
+ 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: