ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLTIConsumerScoringTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5//use \ILIAS\UI\Component\Modal\RoundTrip;
16{
17 const TABLE_ID = 'cmix_scoring_table_';
18
23
27 private $_parent;
28
36 public function __construct(ilLTIConsumerScoringGUI $a_parent_obj, $a_parent_cmd, $isMultiActorReport, $tableId, $hasOutcomeAccess)
37 {
38 global $DIC; /* @var \ILIAS\DI\Container $DIC */
39
40 $this->isMultiActorReport = $isMultiActorReport;
41
42 $this->setId(self::TABLE_ID . $tableId);
43 parent::__construct($a_parent_obj, $a_parent_cmd);
44 $this->_parent = $a_parent_obj;
45
46 $DIC->language()->loadLanguageModule('assessment');
47
48 $this->setRowTemplate('tpl.lti_consumer_scoring_table_row.html', 'Modules/LTIConsumer');
49
50 if ($tableId === 'highscore') {
51 $this->setTitle(sprintf($DIC->language()->txt('toplist_top_n_results'), (int) $this->_parent->getObject()->getHighscoreTopNum()));
52 } else {
53 $this->setTitle($DIC->language()->txt('toplist_your_result'));
54 }
55
56 $this->initColumns();
57
58 $this->setExternalSegmentation(true);
59 $this->setExternalSorting(true);
60 $this->setMaxCount(0);
61 $this->resetOffset();
62 $this->setDefaultOrderField('rank');
63 $this->setDefaultOrderDirection('asc');
64
65 $this->hasOutcomeAccess = $hasOutcomeAccess;
66 }
67
68 protected function initColumns()
69 {
70 global $DIC; /* @var \ILIAS\DI\Container $DIC */
71
72 $this->addColumn($DIC->language()->txt('toplist_col_rank'));
73 $this->addColumn($DIC->language()->txt('toplist_col_participant'));
74
75 if ($this->_parent->getObject()->getHighscoreAchievedTS()) {
76 $this->addColumn($DIC->language()->txt('toplist_col_achieved'));
77 }
78
79 if ($this->_parent->getObject()->getHighscorePercentage()) {
80 $this->addColumn($DIC->language()->txt('toplist_col_percentage'));
81 }
82
83 if ($this->_parent->getObject()->getHighscoreWTime()) {
84 $this->addColumn($DIC->language()->txt('toplist_col_wtime'));
85 }
86
87 $this->setEnableNumInfo(false);
88 $this->setLimit((int) $this->_parent->getObject()->getHighscoreTopNum());
89 }
90
91 public function fillRow($data)
92 {
93 global $DIC; /* @var \ILIAS\DI\Container $DIC */
94
95 $this->tpl->setVariable('SCORE_RANK', $data['rank']);
96
97 $this->tpl->setCurrentBlock('personal');
98 $this->tpl->setVariable('SCORE_USER', $this->getUsername($data));
99 $this->tpl->parseCurrentBlock();
100
101 if ($this->_parent->getObject()->getHighscoreAchievedTS()) {
102 $this->tpl->setCurrentBlock('achieved');
103 $this->tpl->setVariable('SCORE_ACHIEVED', $data['date']);
104 $this->tpl->parseCurrentBlock();
105 }
106
107
108 if ($this->_parent->getObject()->getHighscorePercentage()) {
109 $this->tpl->setCurrentBlock('percentage');
110 $this->tpl->setVariable('SCORE_PERCENTAGE', (float) $data['score'] * 100);
111 $this->tpl->parseCurrentBlock();
112 }
113
114 if ($this->_parent->getObject()->getHighscoreWTime()) {
115 $this->tpl->setCurrentBlock('wtime');
116 $this->tpl->setVariable('SCORE_DURATION', $data['duration']);
117 $this->tpl->parseCurrentBlock();
118 }
119
120 $highlight = $data['ilias_user_id'] == $DIC->user()->getId() ? 'tblrowmarked' : '';
121 $this->tpl->setVariable('HIGHLIGHT', $highlight);
122 }
123
124 protected function getUsername($data)
125 {
126 global $DIC; /* @var \ILIAS\DI\Container $DIC */
127
128 if ($this->hasOutcomeAccess) {
129 $user = ilObjectFactory::getInstanceByObjId($data['ilias_user_id'], false);
130
131 if ($user) {
132 return $user->getFullname();
133 }
134
135 return $DIC->language()->txt('deleted_user');
136 }
137
138 return $data['user'];
139 }
140}
An exception for terminatinating execution or to throw for unit testing.
fillRow($data)
Standard Version of Fill Row.
__construct(ilLTIConsumerScoringGUI $a_parent_obj, $a_parent_cmd, $isMultiActorReport, $tableId, $hasOutcomeAccess)
ilLTIConsumerScoringTableGUI constructor.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilTable2GUI.
setExternalSorting($a_val)
Set external sorting.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setEnableNumInfo($a_val)
Set enable num info.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
resetOffset($a_in_determination=false)
Reset offset.
setLimit($a_limit=0, $a_default_limit=0)
set max.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setMaxCount($a_max_count)
set max.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc