ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestTopListTableGUI.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
7{
9 private $test;
10
16 public function __construct(ilTestToplistGUI $a_parent_obj, ilObjTest $test)
17 {
18 $this->test = $test;
19
20 $this->setId('tst_top_list_' . $this->test->getRefId());
21 parent::__construct($a_parent_obj, '', '');
22
23 $this->setRowTemplate('tpl.toplist_tbl_rows.html', 'Modules/Test');
24
25 $this->setEnableNumInfo(false);
26 $this->disable('sort');
27 $this->setLimit($this->test->getHighscoreTopNum());
28
29 $this->buildColumns();
30 }
31
32 private function buildColumns() : void
33 {
34 $this->addColumn($this->lng->txt('toplist_col_rank'));
35 $this->addColumn($this->lng->txt('toplist_col_participant'));
36
37 if ($this->test->getHighscoreAchievedTS()) {
38 $this->addColumn($this->lng->txt('toplist_col_achieved'));
39 }
40
41 if ($this->test->getHighscoreScore()) {
42 $this->addColumn($this->lng->txt('toplist_col_score'));
43 }
44
45 if ($this->test->getHighscorePercentage()) {
46 $this->addColumn($this->lng->txt('toplist_col_percentage'));
47 }
48
49 if ($this->test->getHighscoreHints()) {
50 $this->addColumn($this->lng->txt('toplist_col_hints'));
51 }
52
53 if ($this->test->getHighscoreWTime()) {
54 $this->addColumn($this->lng->txt('toplist_col_wtime'));
55 }
56 }
57
61 protected function fillRow($a_set)
62 {
63 $rowHighlightClass = '';
64
65 if ($a_set['is_actor']) {
66 $rowHighlightClass = 'tblrowmarked';
67 }
68 $this->tpl->setVariable('VAL_HIGHLIGHT', $rowHighlightClass);
69
70 $this->tpl->setVariable('VAL_RANK', (string) $a_set['rank']);
71 $this->tpl->setVariable('VAL_PARTICIPANT', (string) $a_set['participant']);
72
73 if ($this->test->getHighscoreAchievedTS()) {
74 $this->tpl->setVariable('VAL_ACHIEVED', (string) ilDatePresentation::formatDate($a_set['achieved']));
75 }
76
77 if ($this->test->getHighscoreScore()) {
78 $this->tpl->setVariable('VAL_SCORE', (string) $a_set['score']);
79 }
80
81 if ($this->test->getHighscorePercentage()) {
82 $this->tpl->setVariable('VAL_PERCENTAGE', (string) $a_set['percentage']);
83 }
84
85 if ($this->test->getHighscoreHints()) {
86 $this->tpl->setVariable('VAL_HINTS', (string) $a_set['hints']);
87 }
88
89 if ($this->test->getHighscoreWTime()) {
90 $this->tpl->setVariable('VAL_TIME', (string) $a_set['time']);
91 }
92 }
93}
An exception for terminatinating execution or to throw for unit testing.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
Class ilTable2GUI.
setEnableNumInfo($a_val)
Set enable num info.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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="", $a_tooltip_with_html=false)
Add a column to the header.
setId($a_val)
Set id.
disable($a_module_name)
diesables particular modules of table
Class ilTestTopListTableGUI.
__construct(ilTestToplistGUI $a_parent_obj, ilObjTest $test)
ilTestTopListTableGUI constructor.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc