ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSumScoreTableGUI.php
Go to the documentation of this file.
1<?php
2
24{
25 protected int $counter;
26
27 public function __construct(
28 object $a_parent_obj,
29 string $a_parent_cmd,
30 bool $is_anonymized
31 ) {
32 global $DIC;
33
34 $this->setId("svy_sum_score");
35 parent::__construct($a_parent_obj, $a_parent_cmd);
36
37 $lng = $DIC->language();
38 $ilCtrl = $DIC->ctrl();
39
40 $this->lng = $lng;
41 $this->ctrl = $ilCtrl;
42 $this->counter = 1;
43
44 $this->addColumn($this->lng->txt("username"), 'username', '');
45 $this->addColumn($this->lng->txt("svy_sum_score"), 'score', '');
46 $this->setExportFormats(array(self::EXPORT_CSV, self::EXPORT_EXCEL));
47
48 $this->setRowTemplate("tpl.sum_score_row.html", "components/ILIAS/Survey");
49
50 $this->setDefaultOrderField('username');
51
52 $this->setShowRowsSelector(true);
53 }
54
55 public function setSumScores(array $scores): void
56 {
57 $this->setData($scores);
58 }
59
60 protected function fillRow(array $a_set): void
61 {
62 if ($a_set['score'] === null) {
63 $a_set['score'] = "n.a.";
64 }
65 $this->tpl->setVariable("SUM_SCORE", $a_set['score']);
66 $this->tpl->setVariable("PARTICIPANT", $a_set['username']);
67 }
68
69 protected function fillHeaderExcel(ilExcel $a_excel, int &$a_row): void
70 {
71 $a_excel->setCell($a_row, 0, $this->lng->txt("username"));
72 $a_excel->setCell($a_row, 1, $this->lng->txt("sum_score"));
73 $a_excel->setBold("A" . $a_row . ":" . $a_excel->getColumnCoord(2 - 1) . $a_row);
74 }
75
76 protected function fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set): void
77 {
78 if ($a_set['score'] === null) {
79 $a_set['score'] = "n.a.";
80 }
81 $a_excel->setCell($a_row, 0, $a_set["username"]);
82 $a_excel->setCell($a_row, 1, $a_set["score"]);
83 }
84
85 protected function fillHeaderCSV(ilCSVWriter $a_csv): void
86 {
87 $a_csv->addColumn($this->lng->txt("username"));
88 $a_csv->addColumn($this->lng->txt("score"));
89 }
90
91 protected function fillRowCSV(ilCSVWriter $a_csv, array $a_set): void
92 {
93 if ($a_set['score'] === null) {
94 $a_set['score'] = "n.a.";
95 }
96 $a_csv->addColumn($a_set["title"]);
97 $a_csv->addColumn($a_set["score"]);
98 }
99}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addColumn(string $a_col)
setBold(string $a_coords)
Set cell(s) to bold.
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
getColumnCoord(int $a_col)
Get column "name" from number.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
CSV Version of Fill Row.
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
Excel Version of Fill Row.
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
Excel Version of Fill Header.
fillHeaderCSV(ilCSVWriter $a_csv)
CSV Version of Fill Header.
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(object $a_parent_obj, string $a_parent_cmd, bool $is_anonymized)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setExportFormats(array $formats)
Set available export formats.
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
ilLanguage $lng
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26