ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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", "Modules/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 }
setData(array $a_data)
addColumn(string $a_col)
setExportFormats(array $formats)
Set available export formats.
__construct(object $a_parent_obj, string $a_parent_cmd, bool $is_anonymized)
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
getColumnCoord(int $a_col)
Get column "name" from number.
fillHeaderCSV(ilCSVWriter $a_csv)
setCell(int $a_row, int $a_col, $a_value, ?string $a_datatype=null)
Set cell value.
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setId(string $a_val)
global $DIC
Definition: feed.php:28
fillHeaderExcel(ilExcel $a_excel, int &$a_row)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setBold(string $a_coords)
Set cell(s) to bold.
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
__construct(Container $dic, ilPlugin $plugin)
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)