ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveyResultsUserTableGUI.php
Go to the documentation of this file.
1<?php
2
23{
24 protected int $counter;
25
26 public function __construct(
27 ?object $a_parent_obj,
28 string $a_parent_cmd
29 ) {
30 global $DIC;
31
32 $this->setId("svy_usr");
33 parent::__construct($a_parent_obj, $a_parent_cmd);
34
35 $lng = $DIC->language();
36 $ilCtrl = $DIC->ctrl();
37
38 $this->lng = $lng;
39 $this->ctrl = $ilCtrl;
40 $this->counter = 1;
41
42 $this->setFormName('invitegroups');
43 $this->setStyle('table', 'fullwidth');
44
45 $this->setRowTemplate(
46 "tpl.il_svy_svy_results_user_row.html",
47 "components/ILIAS/Survey/Evaluation"
48 );
49
50 if (!is_null($a_parent_obj)) {
51 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
52 $this->addColumn($this->lng->txt("username"), 'username', '');
53 $this->addColumn($this->lng->txt("question"), '', '');
54 $this->addColumn($this->lng->txt("results"), '', '');
55 $this->addColumn($this->lng->txt("workingtime"), 'workingtime', '');
56 $this->addColumn($this->lng->txt("survey_results_finished"), 'finished', '');
57 $this->setShowRowsSelector(true);
58 } else {
59 $this->setLimit(9999);
60 $this->setEnableHeader(false);
61 $this->setEnableNumInfo(false);
62 $this->enabled["linkbar"] = false;
63 $this->addColumn($this->lng->txt("username"), '', '');
64 $this->addColumn($this->lng->txt("question"), '', '');
65 $this->addColumn($this->lng->txt("results"), '', '');
66 $this->addColumn($this->lng->txt("workingtime"), '', '');
67 $this->addColumn($this->lng->txt("survey_results_finished"), '', '');
68 }
69
70 $this->setDefaultOrderField('username');
71
72
73 $this->enable('header');
74 $this->disable('select_all');
75 }
76
77 protected function formatTime(?int $timeinseconds): string
78 {
79 if (is_null($timeinseconds)) {
80 return " ";
81 } elseif ($timeinseconds === 0) {
82 return $this->lng->txt('not_available');
83 } else {
84 return sprintf("%02d:%02d:%02d", (int) ($timeinseconds / 3600), (int) ($timeinseconds / 60) % 60, (int) $timeinseconds % 60);
85 }
86 }
87
88 protected function fillRow(array $a_set): void
89 {
90 $this->tpl->setVariable("USERNAME", $a_set['username']);
91 $this->tpl->setVariable("QUESTION", $a_set['question']);
92 $results = array_map(static function ($i): string {
93 return htmlentities($i);
94 }, $a_set["results"]);
95 $this->tpl->setVariable("RESULTS", $results
96 ? implode("<br />", $results)
98 $this->tpl->setVariable("WORKINGTIME", $this->formatTime($a_set['workingtime']));
99 $finished = "";
100 if ($a_set["finished"] !== null) {
101 if ($a_set["finished"] !== false) {
102 $finished .= ilDatePresentation::formatDate(new ilDateTime($a_set["finished"], IL_CAL_UNIX));
103 } else {
104 $finished = "-";
105 }
106 $this->tpl->setVariable("FINISHED", $finished);
107 } else {
108 $this->tpl->setVariable("FINISHED", "&nbsp;");
109 }
110
111 if (isset($a_set["subitems"])) {
112 $this->tpl->setCurrentBlock("tbl_content");
113 $this->tpl->parseCurrentBlock();
114
115 foreach ($a_set["subitems"] as $subitem) {
116 $this->fillRow($subitem);
117
118 $this->tpl->setCurrentBlock("tbl_content");
119 $this->css_row = ($this->css_row !== "tblrow1")
120 ? "tblrow1"
121 : "tblrow2";
122 $this->tpl->setVariable("CSS_ROW", $this->css_row);
123 $this->tpl->parseCurrentBlock();
124 }
125 }
126 }
127}
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static getSurveySkippedValue()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd)
fillRow(array $a_set)
Standard Version of Fill Row.
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.
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
setEnableNumInfo(bool $a_val)
setFormName(string $a_name="")
setFormAction(string $a_form_action, bool $a_multipart=false)
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)
setEnableHeader(bool $a_enableheader)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
ilLanguage $lng
enable(string $a_module_name)
setStyle(string $a_element, string $a_style)
disable(string $a_module_name)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$results
global $DIC
Definition: shib_login.php:26