ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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:
class.ilTestToplistGUI.php 44716 2013-09-11 13:43:58Z mbecker

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

Constructor & Destructor Documentation

ilTestToplistGUI::__construct (   $a_object)
Parameters
ilObjTestGUI$a_object

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

{
$this->object = $a_object->object;
}

Member Function Documentation

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

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

Referenced by getResultTableRow().

{
$retval = '';
$hours = intval(intval($seconds) / 3600);
$retval .= str_pad($hours, 2, "0", STR_PAD_LEFT). ":";
$minutes = intval(($seconds / 60) % 60);
$retval .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ":";
$seconds = intval($seconds % 60);
$retval .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
return $retval;
}

+ Here is the caller graph for this function:

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 $row, formatTime(), and IL_CAL_UNIX.

{
$item = array();
$item['Rank'] = $i . '. ';
if ($this->object->isHighscoreAnon() && $row['usr_id'] != $a_user_id)
{
$item['Participant'] = "-, -";
}
else
{
$item['Participant'] = $row['lastname'] . ', ' . $row['firstname'];
}
if ($this->object->getHighscoreAchievedTS())
{
$item['Achieved'] = new ilDateTime($row['tstamp'], IL_CAL_UNIX);
}
if ($this->object->getHighscoreScore())
{
$item['Score'] = $row['reached_points'] . ' / ' . $row['max_points'];
}
if ($this->object->getHighscorePercentage())
{
$item['Percentage'] = $row['percentage'] . '%';
}
if ($this->object->getHighscoreHints())
{
$item['Hints'] = $row['hint_count'];
}
if ($this->object->getHighscoreWTime())
{
$item['time'] = $this->formatTime($row['workingtime']);
}
$item['Highlight'] = ($row['usr_id'] == $a_user_id) ? 'tblrowmarked' : '';
return $item;
}

+ Here is the call graph for this function:

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().

{
global $lng;
$table_gui->addColumn($lng->txt('toplist_col_rank'));
$table_gui->addColumn($lng->txt('toplist_col_participant'));
if ($this->object->getHighscoreAchievedTS())
{
$table_gui->addColumn($lng->txt('toplist_col_achieved'));
}
if ($this->object->getHighscoreScore())
{
$table_gui->addColumn($lng->txt('toplist_col_score'));
}
if ($this->object->getHighscorePercentage())
{
$table_gui->addColumn($lng->txt('toplist_col_percentage'));
}
if ($this->object->getHighscoreHints())
{
$table_gui->addColumn($lng->txt('toplist_col_hints'));
}
if ($this->object->getHighscoreWTime())
{
$table_gui->addColumn($lng->txt('toplist_col_wtime'));
}
$table_gui->setEnableNumInfo(false);
$table_gui->setLimit(10);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestToplistGUI::showResultsToplistByScore ( )

PhpUndefinedVariableInspection

PhpUndefinedVariableInspection

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

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

{
global $ilUser, $lng, $tpl;
require_once './Services/Table/classes/class.ilTable2GUI.php';
if ($this->object->getHighscoreTopTable())
{
$table_gui = new ilTable2GUI($this);
$this->prepareTable($table_gui);
$data = $this->getGeneralToplistByPercentage($_GET['ref_id'], $ilUser->getId());
$table_gui->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
$table_gui->setData($data);
$html = '<h3>'. sprintf($lng->txt('toplist_top_n_results'), $this->object->getHighscoreTopNum()) . '</h3>';
$html .= $table_gui->getHTML();
}
if ($this->object->getHighscoreOwnTable())
{
$table_gui2 = new ilTable2GUI($this);
$this->prepareTable($table_gui2);
$data2 = $this->getUserToplistByPercentage($_GET['ref_id'], $ilUser->getID());
$table_gui2->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
$table_gui2->setData($data2);
$html .= '<h3>' . $lng->txt('toplist_your_result') . '</h3>';
$html .= $table_gui2->getHTML();
}
$tpl->setVariable("ADM_CONTENT", $html);
}

+ Here is the call graph for this function:

ilTestToplistGUI::showResultsToplistByTime ( )

PhpUndefinedVariableInspection

PhpUndefinedVariableInspection

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

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

{
global $ilUser, $lng, $tpl;
require_once './Services/Table/classes/class.ilTable2GUI.php';
if ($this->object->getHighscoreTopTable())
{
$table_gui = new ilTable2GUI($this);
$this->prepareTable($table_gui);
$data = $this->getGeneralToplistByWorkingtime($_GET['ref_id'], $ilUser->getId());
$table_gui->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
$table_gui->setData($data);
$html = '<h3>'. sprintf($lng->txt('toplist_top_n_results'), $this->object->getHighscoreTopNum()) . '</h3>';
$html .= $table_gui->getHTML();
}
if ($this->object->getHighscoreOwnTable())
{
$table_gui2 = new ilTable2GUI($this);
$this->prepareTable($table_gui2);
$data2 = $this->getUserToplistByWorkingtime($_GET['ref_id'], $ilUser->getID());
$table_gui2->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
$table_gui2->setData($data2);
$html .= '<h3>' . $lng->txt('toplist_your_result') . '</h3>';
$html .= $table_gui2->getHTML();
}
$tpl->setVariable("ADM_CONTENT", $html);
}

+ Here is the call graph for this function:

Field Documentation

ilTestToplistGUI::$object
protected

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


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