ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSumScoreTableGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once('./Services/Table/classes/class.ilTable2GUI.php');
25
35{
37
44 public function __construct($a_parent_obj, $a_parent_cmd, $is_anonymized)
45 {
46 global $DIC;
47
48 $this->setId("svy_sum_score");
49 parent::__construct($a_parent_obj, $a_parent_cmd);
50
51 $lng = $DIC->language();
52 $ilCtrl = $DIC->ctrl();
53
54 $this->is_anonymized = $is_anonymized;
55 $this->lng = $lng;
56 $this->ctrl = $ilCtrl;
57 $this->counter = 1;
58
59 $this->addColumn($this->lng->txt("username"), 'username', '');
60 $this->addColumn($this->lng->txt("svy_sum_score"), 'score', '');
61 $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
62
63 $this->setRowTemplate("tpl.sum_score_row.html", "Modules/Survey");
64
65 $this->setDefaultOrderField('username');
66
67 $this->setShowRowsSelector(true);
68 }
69
74 public function setSumScores($scores)
75 {
76 $this->setData($scores);
77 }
78
84 public function fillRow($data)
85 {
86 if ($data['score'] === null) {
87 $data['score'] = "n.a.";
88 }
89 $this->tpl->setVariable("SUM_SCORE", $data['score']);
90 $this->tpl->setVariable("PARTICIPANT", $data['username']);
91 }
92
93 protected function fillHeaderExcel(ilExcel $a_excel, &$a_row)
94 {
95 $a_excel->setCell($a_row, 0, $this->lng->txt("username"));
96 $a_excel->setCell($a_row, 1, $this->lng->txt("sum_score"));
97 $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord(2 - 1) . $a_row);
98 }
99
100 protected function fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
101 {
102 if ($a_set['score'] === null) {
103 $a_set['score'] = "n.a.";
104 }
105 $a_excel->setCell($a_row, 0, $a_set["username"]);
106 $a_excel->setCell($a_row, 1, $a_set["score"]);
107 }
108
109 protected function fillHeaderCSV($a_csv)
110 {
111 $a_csv->addColumn($this->lng->txt("username"));
112 $a_csv->addColumn($this->lng->txt("score"));
113 }
114
115 protected function fillRowCSV($a_csv, $a_set)
116 {
117 if ($a_set['score'] === null) {
118 $a_set['score'] = "n.a.";
119 }
120 $a_csv->addColumn($a_set["title"]);
121 $a_csv->addColumn($a_set["score"]);
122 }
123}
An exception for terminatinating execution or to throw for unit testing.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
setBold($a_coords)
Set cell(s) to bold.
getColumnCoord($a_col)
Get column "name" from number.
fillHeaderExcel(ilExcel $a_excel, &$a_row)
Excel Version of Fill Header.
fillRowCSV($a_csv, $a_set)
CSV Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd, $is_anonymized)
ilSumScoreTableGUI constructor.
setSumScores($scores)
Set sum scores.
fillHeaderCSV($a_csv)
CSV Version of Fill Header.
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
Excel Version of Fill Row.
Class ilTable2GUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setExportFormats(array $formats)
Set available export formats.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
setId($a_val)
Set id.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc