ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestToplistGUI Class Reference

Scoring class for tests. More...

+ Collaboration diagram for ilTestToplistGUI:

Public Member Functions

 __construct ($a_object)
 
 showResultsToplistByScore ()
 
 showResultsToplistByTime ()
 

Protected Attributes

 $object
 

Private Member Functions

 prepareTable (ilTable2GUI $table_gui)
 
 formatTime ($seconds)
 
 getResultTableRow ($row, $i, $a_user_id)
 

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 (   $a_object)
Parameters
ilObjTestGUI$a_object

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

References $cmd, $ilCtrl, showResultsToplistByScore(), and showResultsToplistByTime().

23  {
24  $this->object = $a_object->object;
25  }
+ Here is the call graph for this function:

Member Function Documentation

◆ formatTime()

ilTestToplistGUI::formatTime (   $seconds)
private
Parameters
int$seconds
Returns
string

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

References $data, $result, $row, and getResultTableRow().

Referenced by getResultTableRow().

182  {
183  $retval = '';
184  $hours = intval(intval($seconds) / 3600);
185  $retval .= str_pad($hours, 2, "0", STR_PAD_LEFT). ":";
186  $minutes = intval(($seconds / 60) % 60);
187  $retval .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ":";
188  $seconds = intval($seconds % 60);
189  $retval .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
190  return $retval;
191  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResultTableRow()

ilTestToplistGUI::getResultTableRow (   $row,
  $i,
  $a_user_id 
)
private
Parameters
array$row
int$i
int$a_user_id
Returns
array

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

References $data, $result, $row, formatTime(), and IL_CAL_UNIX.

Referenced by formatTime().

274  {
275  $item = array();
276  $item['Rank'] = $i . '. ';
277 
278  if ($this->object->isHighscoreAnon() && $row['usr_id'] != $a_user_id)
279  {
280  $item['Participant'] = "-, -";
281  }
282  else
283  {
284  $item['Participant'] = $row['lastname'] . ', ' . $row['firstname'];
285  }
286 
287  if ($this->object->getHighscoreAchievedTS())
288  {
289  $item['Achieved'] = new ilDateTime($row['tstamp'], IL_CAL_UNIX);
290 
291  }
292 
293  if ($this->object->getHighscoreScore())
294  {
295  $item['Score'] = $row['reached_points'] . ' / ' . $row['max_points'];
296  }
297 
298  if ($this->object->getHighscorePercentage())
299  {
300  $item['Percentage'] = $row['percentage'] . '%';
301  }
302 
303  if ($this->object->getHighscoreHints())
304  {
305  $item['Hints'] = $row['hint_count'];
306  }
307 
308  if ($this->object->getHighscoreWTime())
309  {
310  $item['time'] = $this->formatTime($row['workingtime']);
311  }
312 
313  $item['Highlight'] = ($row['usr_id'] == $a_user_id) ? 'tblrowmarked' : '';
314  return $item;
315  }
const IL_CAL_UNIX
Date and time handling
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareTable()

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

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

References $lng, ilTable2GUI\addColumn(), ilTable2GUI\setEnableNumInfo(), and ilTableGUI\setLimit().

Referenced by showResultsToplistByScore(), and showResultsToplistByTime().

143  {
144  global $lng;
145 
146  $table_gui->addColumn($lng->txt('toplist_col_rank'));
147  $table_gui->addColumn($lng->txt('toplist_col_participant'));
148  if ($this->object->getHighscoreAchievedTS())
149  {
150  $table_gui->addColumn($lng->txt('toplist_col_achieved'));
151  }
152 
153  if ($this->object->getHighscoreScore())
154  {
155  $table_gui->addColumn($lng->txt('toplist_col_score'));
156  }
157 
158  if ($this->object->getHighscorePercentage())
159  {
160  $table_gui->addColumn($lng->txt('toplist_col_percentage'));
161  }
162 
163  if ($this->object->getHighscoreHints())
164  {
165  $table_gui->addColumn($lng->txt('toplist_col_hints'));
166  }
167 
168  if ($this->object->getHighscoreWTime())
169  {
170  $table_gui->addColumn($lng->txt('toplist_col_wtime'));
171  }
172  $table_gui->setEnableNumInfo(false);
173  $table_gui->setLimit(10);
174  }
setEnableNumInfo($a_val)
Set enable num info.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResultsToplistByScore()

ilTestToplistGUI::showResultsToplistByScore ( )

PhpUndefinedVariableInspection

PhpUndefinedVariableInspection

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

References $_GET, $data, $ilUser, $lng, $tpl, and prepareTable().

Referenced by __construct().

63  {
64  global $ilUser, $lng, $tpl;
65  require_once './Services/Table/classes/class.ilTable2GUI.php';
66  if ($this->object->getHighscoreTopTable())
67  {
68  $table_gui = new ilTable2GUI($this);
69  $this->prepareTable($table_gui);
70 
71  $data = $this->getGeneralToplistByPercentage($_GET['ref_id'], $ilUser->getId());
72 
73  $table_gui->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
74  $table_gui->setData($data);
75  $html = '<h3>'. sprintf($lng->txt('toplist_top_n_results'), $this->object->getHighscoreTopNum()) . '</h3>';
76 
77  $html .= $table_gui->getHTML();
78  }
79 
80  if ($this->object->getHighscoreOwnTable())
81  {
82  $table_gui2 = new ilTable2GUI($this);
83 
84  $this->prepareTable($table_gui2);
85 
86  $data2 = $this->getUserToplistByPercentage($_GET['ref_id'], $ilUser->getID());
87 
88  $table_gui2->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
89  $table_gui2->setData($data2);
90 
92  $html .= '<h3>' . $lng->txt('toplist_your_result') . '</h3>';
93  $html .= $table_gui2->getHTML();
94  }
95 
97  $tpl->setVariable("ADM_CONTENT", $html);
98  }
$_GET["client_id"]
prepareTable(ilTable2GUI $table_gui)
Class ilTable2GUI.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showResultsToplistByTime()

ilTestToplistGUI::showResultsToplistByTime ( )

PhpUndefinedVariableInspection

PhpUndefinedVariableInspection

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

References $_GET, $data, $ilUser, $lng, $tpl, and prepareTable().

Referenced by __construct().

101  {
102  global $ilUser, $lng, $tpl;
103  require_once './Services/Table/classes/class.ilTable2GUI.php';
104 
105  if ($this->object->getHighscoreTopTable())
106  {
107  $table_gui = new ilTable2GUI($this);
108  $this->prepareTable($table_gui);
109 
110  $data = $this->getGeneralToplistByWorkingtime($_GET['ref_id'], $ilUser->getId());
111 
112  $table_gui->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
113  $table_gui->setData($data);
114  $html = '<h3>'. sprintf($lng->txt('toplist_top_n_results'), $this->object->getHighscoreTopNum()) . '</h3>';
115 
116  $html .= $table_gui->getHTML();
117  }
118 
119  if ($this->object->getHighscoreOwnTable())
120  {
121  $table_gui2 = new ilTable2GUI($this);
122 
123  $this->prepareTable($table_gui2);
124 
125  $data2 = $this->getUserToplistByWorkingtime($_GET['ref_id'], $ilUser->getID());
126 
127  $table_gui2->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
128  $table_gui2->setData($data2);
129 
131  $html .= '<h3>' . $lng->txt('toplist_your_result') . '</h3>';
132  $html .= $table_gui2->getHTML();
133  }
135  $tpl->setVariable("ADM_CONTENT", $html);
136 
137  }
$_GET["client_id"]
prepareTable(ilTable2GUI $table_gui)
Class ilTable2GUI.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $object

ilTestToplistGUI::$object
protected

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


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