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

Class ilTestTopList. More...

+ Collaboration diagram for ilTestTopList:

Public Member Functions

 __construct (ilObjTest $a_object)
 

Protected Attributes

 $object
 

Private Member Functions

 getResultTableRow ($row, $i, $a_user_id)
 
 formatTime ($seconds)
 

Detailed Description

Class ilTestTopList.

Definition at line 7 of file class.ilTestTopList.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestTopList::__construct ( ilObjTest  $a_object)
Parameters
ilObjTest$a_object

Definition at line 15 of file class.ilTestTopList.php.

References $data, $DIC, $i, $ilDB, $result, $row, and getResultTableRow().

16  {
17  $this->object = $a_object;
18  }
+ Here is the call graph for this function:

Member Function Documentation

◆ formatTime()

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

Definition at line 448 of file class.ilTestTopList.php.

Referenced by getResultTableRow().

449  {
450  $retval = '';
451  $hours = intval(intval($seconds) / 3600);
452  $retval .= str_pad($hours, 2, "0", STR_PAD_LEFT) . ":";
453  $minutes = intval(($seconds / 60) % 60);
454  $retval .= str_pad($minutes, 2, "0", STR_PAD_LEFT) . ":";
455  $seconds = intval($seconds % 60);
456  $retval .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
457  return $retval;
458  }
+ Here is the caller graph for this function:

◆ getResultTableRow()

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

Definition at line 409 of file class.ilTestTopList.php.

References $i, $row, formatTime(), and IL_CAL_UNIX.

Referenced by __construct().

410  {
411  $item = array();
412  $item['Rank'] = $i . '. ';
413 
414  if ($this->object->isHighscoreAnon() && $row['usr_id'] != $a_user_id) {
415  $item['Participant'] = "-, -";
416  } else {
417  $item['Participant'] = $row['lastname'] . ', ' . $row['firstname'];
418  }
419 
420  if ($this->object->getHighscoreAchievedTS()) {
421  $item['Achieved'] = new ilDateTime($row['tstamp'], IL_CAL_UNIX);
422  }
423 
424  if ($this->object->getHighscoreScore()) {
425  $item['Score'] = $row['reached_points'] . ' / ' . $row['max_points'];
426  }
427 
428  if ($this->object->getHighscorePercentage()) {
429  $item['Percentage'] = $row['percentage'] . '%';
430  }
431 
432  if ($this->object->getHighscoreHints()) {
433  $item['Hints'] = $row['hint_count'];
434  }
435 
436  if ($this->object->getHighscoreWTime()) {
437  $item['time'] = $this->formatTime($row['workingtime']);
438  }
439 
440  $item['Highlight'] = ($row['usr_id'] == $a_user_id) ? 'tblrowmarked' : '';
441  return $item;
442  }
const IL_CAL_UNIX
Date and time handling
$row
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $object

ilTestTopList::$object
protected

Definition at line 10 of file class.ilTestTopList.php.


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