ILIAS  Release_5_0_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 Member Functions

 manageTabs (ilTabsGUI $tabsGUI, ilCtrl $ctrl, ilLanguage $lng, $activeTabId)

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 61653 2016-03-07 08:30:14Z gitmgr

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

Constructor & Destructor Documentation

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

Definition at line 21 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 196 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 285 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::manageTabs ( ilTabsGUI  $tabsGUI,
ilCtrl  $ctrl,
ilLanguage  $lng,
  $activeTabId 
)
protected

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

References ilTabsGUI\addTab(), ilTabsGUI\clearTargets(), ilCtrl\getLinkTarget(), ilCtrl\getLinkTargetByClass(), ilTabsGUI\setBackTarget(), ilTabsGUI\setTabActive(), and ilLanguage\txt().

{
$tabsGUI->clearTargets();
$tabsGUI->setBackTarget(
$lng->txt('tst_results_back_introduction'), $ctrl->getLinkTargetByClass('ilObjTestGUI', 'infoScreen')
);
$tabsGUI->addTab(
'toplist_by_score', $lng->txt('toplist_by_score'), $ctrl->getLinkTarget($this, 'showResultsToplistByScore')
);
$tabsGUI->addTab(
'toplist_by_time', $lng->txt('toplist_by_time'), $ctrl->getLinkTarget($this, 'showResultsToplistByTime')
);
$tabsGUI->setTabActive($activeTabId);
}

+ Here is the call graph for this function:

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

Definition at line 158 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 ( )

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

References $_GET, $ilUser, $lng, $tpl, ilObjTest\HIGHSCORE_SHOW_OWN_TABLE, ilObjTest\HIGHSCORE_SHOW_TOP_TABLE, and prepareTable().

{
global $ilUser, $lng, $tpl;
$html = '';
if($this->object->getHighscoreMode() != ilObjTest::HIGHSCORE_SHOW_OWN_TABLE)
{
$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);
$table_gui->setTitle(sprintf($lng->txt('toplist_top_n_results'), $this->object->getHighscoreTopNum()));
$html .= $table_gui->getHTML();
}
if($this->object->getHighscoreMode() != ilObjTest::HIGHSCORE_SHOW_TOP_TABLE)
{
$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);
$table_gui2->setTitle($lng->txt('toplist_your_result'));
$html .= $table_gui2->getHTML();
}
$tpl->setVariable("ADM_CONTENT", $html);
}

+ Here is the call graph for this function:

ilTestToplistGUI::showResultsToplistByTime ( )

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

References $_GET, $ilUser, $lng, $tpl, ilObjTest\HIGHSCORE_SHOW_OWN_TABLE, ilObjTest\HIGHSCORE_SHOW_TOP_TABLE, and prepareTable().

{
global $ilUser, $lng, $tpl;
$html = '';
if($this->object->getHighscoreMode() != ilObjTest::HIGHSCORE_SHOW_OWN_TABLE)
{
$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);
$table_gui->setTitle(sprintf($lng->txt('toplist_top_n_results'), $this->object->getHighscoreTopNum()));
$html .= $table_gui->getHTML();
}
if($this->object->getHighscoreMode() != ilObjTest::HIGHSCORE_SHOW_TOP_TABLE)
{
$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);
$table_gui2->setTitle($lng->txt('toplist_your_result'));
$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 16 of file class.ilTestToplistGUI.php.


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