ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTestToplistGUI Class Reference

Scoring class for tests. More...

+ 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 Member Functions

 prepareTable (ilTable2GUI $table_gui)
 

Detailed Description

Scoring class for tests.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, and user().

53  {
54  global $DIC; /* @var ILIAS\DI\Container $DIC */
55  $this->ctrl = $DIC['ilCtrl'];
56  $this->tpl = $DIC['tpl'];
57  $this->lng = $DIC['lng'];
58  $this->user = $DIC['ilUser'];
59 
60  $this->object = $testOBJ;
61  $this->toplist = new ilTestTopList($testOBJ);
62  }
Class ilTestTopList.
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ buildTableGUI()

ilTestToplistGUI::buildTableGUI ( )
protected
Returns
ilTable2GUI

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

References prepareTable().

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

211  {
212  $table_gui = new ilTable2GUI($this);
213  $this->prepareTable($table_gui);
214  $table_gui->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
215  return $table_gui;
216  }
prepareTable(ilTable2GUI $table_gui)
Class ilTable2GUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestToplistGUI::executeCommand ( )

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

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

65  {
66  if (!$this->object->getHighscoreEnabled()) {
67  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
68  $this->ctrl->redirectByClass('ilObjTestGUI');
69  }
70 
71  $this->ctrl->saveParameter($this, 'active_id');
72 
73  $cmd = $this->ctrl->getCmd();
74 
75  switch ($cmd) {
76  default:
77  $this->showResultsToplistsCmd();
78  }
79  }
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 237 of file class.ilTestToplistGUI.php.

References ilObjTest\HIGHSCORE_SHOW_ALL_TABLES, and ilObjTest\HIGHSCORE_SHOW_OWN_TABLE.

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

238  {
239  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_OWN_TABLE) {
240  return true;
241  }
242 
243  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_ALL_TABLES) {
244  return true;
245  }
246 
247  return false;
248  }
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 221 of file class.ilTestToplistGUI.php.

References ilObjTest\HIGHSCORE_SHOW_ALL_TABLES, and ilObjTest\HIGHSCORE_SHOW_TOP_TABLE.

Referenced by renderResultsToplistByScore(), and renderResultsToplistByTime().

222  {
223  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_TOP_TABLE) {
224  return true;
225  }
226 
227  if ($this->object->getHighscoreMode() == ilObjTest::HIGHSCORE_SHOW_ALL_TABLES) {
228  return true;
229  }
230 
231  return false;
232  }
const HIGHSCORE_SHOW_TOP_TABLE
const HIGHSCORE_SHOW_ALL_TABLES
+ Here is the caller graph for this function:

◆ prepareTable()

ilTestToplistGUI::prepareTable ( ilTable2GUI  $table_gui)
private
Parameters
ilTable2GUI$table_gui

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

References ilTable2GUI\addColumn(), ilTable2GUI\setEnableNumInfo(), and ilTable2GUI\setLimit().

Referenced by buildTableGUI().

181  {
182  $table_gui->addColumn($this->lng->txt('toplist_col_rank'));
183  $table_gui->addColumn($this->lng->txt('toplist_col_participant'));
184  if ($this->object->getHighscoreAchievedTS()) {
185  $table_gui->addColumn($this->lng->txt('toplist_col_achieved'));
186  }
187 
188  if ($this->object->getHighscoreScore()) {
189  $table_gui->addColumn($this->lng->txt('toplist_col_score'));
190  }
191 
192  if ($this->object->getHighscorePercentage()) {
193  $table_gui->addColumn($this->lng->txt('toplist_col_percentage'));
194  }
195 
196  if ($this->object->getHighscoreHints()) {
197  $table_gui->addColumn($this->lng->txt('toplist_col_hints'));
198  }
199 
200  if ($this->object->getHighscoreWTime()) {
201  $table_gui->addColumn($this->lng->txt('toplist_col_wtime'));
202  }
203  $table_gui->setEnableNumInfo(false);
204  $table_gui->setLimit(10);
205  }
setEnableNumInfo($a_val)
Set enable num info.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setLimit($a_limit=0, $a_default_limit=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderMedianMarkPanel()

ilTestToplistGUI::renderMedianMarkPanel ( )
protected

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

References $data, $DIC, and $title.

Referenced by showResultsToplistsCmd().

91  {
92  global $DIC; /* @var ILIAS\DI\Container $DIC */
93 
94  $title = $DIC->language()->txt('tst_median_mark_panel');
95 
96  // BH: this really is the "mark of median" ??!
97  $activeId = $this->object->getActiveIdOfUser($DIC->user()->getId());
98  $data = $this->object->getCompleteEvaluationData();
99  $median = $data->getStatistics()->getStatistics()->median();
100  $pct = $data->getParticipant($activeId)->getMaxpoints() ? ($median / $data->getParticipant($activeId)->getMaxpoints()) * 100.0 : 0;
101  $mark = $this->object->mark_schema->getMatchingMark($pct);
102  $content = $mark->getShortName();
103 
104  $panel = $DIC->ui()->factory()->panel()->standard(
105  $title,
106  $DIC->ui()->factory()->legacy($content)
107  );
108 
109  return $DIC->ui()->renderer()->render($panel);
110  }
global $DIC
Definition: saml.php:7
$data
Definition: bench.php:6
+ Here is the caller graph for this function:

◆ renderResultsToplistByScore()

ilTestToplistGUI::renderResultsToplistByScore ( )
protected

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

References $_GET, $data, $html, $title, buildTableGUI(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), and user().

Referenced by showResultsToplistsCmd().

113  {
114  $title = $this->lng->txt('toplist_by_score');
115  $html = '';
116 
117  if ($this->isTopTenRankingTableRequired()) {
118  $data = $this->toplist->getGeneralToplistByPercentage($_GET['ref_id'], $this->user->getId());
119 
120  $table_gui = $this->buildTableGUI();
121 
122  $table_gui->setData($data);
123  $table_gui->setTitle($title);
124 
125  $html .= $table_gui->getHTML();
126  }
127 
128  if ($this->isOwnRankingTableRequired()) {
129  $table_gui = $this->buildTableGUI();
130 
131  $table_gui->setData(
132  $this->toplist->getUserToplistByPercentage($_GET['ref_id'], $this->user->getID())
133  );
134 
135  if (!$this->isTopTenRankingTableRequired()) {
136  $table_gui->setTitle($title);
137  }
138 
139  $html .= $table_gui->getHTML();
140  }
141 
142  return $html;
143  }
$_GET["client_id"]
user()
Definition: user.php:4
$html
Definition: example_001.php:87
$data
Definition: bench.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderResultsToplistByTime()

ilTestToplistGUI::renderResultsToplistByTime ( )
protected

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

References $_GET, $html, $title, buildTableGUI(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), and user().

Referenced by showResultsToplistsCmd().

146  {
147  $title = $this->lng->txt('toplist_by_time');
148  $html = '';
149 
150  if ($this->isTopTenRankingTableRequired()) {
151  $topData = $this->toplist->getGeneralToplistByWorkingtime($_GET['ref_id'], $this->user->getId());
152 
153  $table_gui = $this->buildTableGUI();
154  $table_gui->setData($topData);
155  $table_gui->setTitle($title);
156 
157  $html .= $table_gui->getHTML();
158  }
159 
160  if ($this->isOwnRankingTableRequired()) {
161  $ownData = $this->toplist->getUserToplistByWorkingtime($_GET['ref_id'], $this->user->getID());
162 
163  $table_gui = $this->buildTableGUI();
164 
165  $table_gui->setData($ownData);
166 
167  if (!$this->isTopTenRankingTableRequired()) {
168  $table_gui->setTitle($title);
169  }
170 
171  $html .= $table_gui->getHTML();
172  }
173 
174  return $html;
175  }
$_GET["client_id"]
user()
Definition: user.php:4
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResultsToplistsCmd()

ilTestToplistGUI::showResultsToplistsCmd ( )
protected

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

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

Referenced by executeCommand().

82  {
83  $html = $this->renderMedianMarkPanel();
86 
87  $this->tpl->setVariable("ADM_CONTENT", $html);
88  }
$html
Definition: example_001.php:87
+ 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 19 of file class.ilTestToplistGUI.php.

◆ $lng

ilTestToplistGUI::$lng
protected

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

◆ $object

ilTestToplistGUI::$object
protected

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

◆ $tabs

ilTestToplistGUI::$tabs
protected

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

◆ $toplist

ilTestToplistGUI::$toplist
protected

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

◆ $tpl

ilTestToplistGUI::$tpl
protected

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

◆ $user

ilTestToplistGUI::$user
protected

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


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