19 declare(strict_types=1);
33 public function __construct(
object $a_parent_obj,
string $a_parent_cmd)
37 $this->
ctrl = $DIC->ctrl();
38 $this->
lng = $DIC->language();
39 $ilCtrl = $DIC->ctrl();
40 $lng = $DIC->language();
41 $ui_factory = $DIC->ui()->factory();
42 $ui_renderer = $DIC->ui()->renderer();
46 $this->rendered_checked_icon = $ui_renderer->render(
47 $ui_factory->symbol()->icon()->custom(
49 $lng->
txt(
'poll_answer_selected_alt_text'),
54 $this->
setId(
"ilobjpollusr");
62 foreach ($this->
getParentObject()->getObject()->getAnswers() as $answer) {
63 $this->answer_ids[] = (
int) ($answer[
"id"] ?? 0);
64 $this->
addColumn((
string) ($answer[
"answer"] ??
''),
"answer" . (
int) ($answer[
"id"] ?? 0));
70 $this->
lng->txt(
"poll_question") .
": \"" .
74 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
75 $this->
setRowTemplate(
"tpl.user_row.html",
"components/ILIAS/Poll");
82 protected function getItems(array $a_answer_ids): void
87 $answers = (array) ($vote[
"answers"] ?? []);
88 unset($vote[
"answers"]);
90 foreach ($a_answer_ids as $answer_id) {
91 $vote[
"answer" . $answer_id] = in_array($answer_id, $answers);
100 protected function fillRow(array $a_set): void
102 $this->tpl->setCurrentBlock(
"answer_bl");
103 foreach ($this->answer_ids as $answer_id) {
104 if ($a_set[
"answer" . $answer_id]) {
105 $this->tpl->setVariable(
"ANSWER", $this->rendered_checked_icon);
107 $this->tpl->setVariable(
"ANSWER",
" ");
109 $this->tpl->parseCurrentBlock();
112 $this->tpl->setVariable(
"LOGIN", (
string) ($a_set[
"login"] ??
''));
113 $this->tpl->setVariable(
"FIRSTNAME", (
string) ($a_set[
"firstname"] ??
''));
114 $this->tpl->setVariable(
"LASTNAME", (
string) ($a_set[
"lastname"] ??
''));
119 $a_csv->
addColumn((
string) ($a_set[
"login"] ??
''));
120 $a_csv->
addColumn((
string) ($a_set[
"lastname"] ??
''));
121 $a_csv->
addColumn((
string) ($a_set[
"firstname"] ??
''));
122 foreach ($this->answer_ids as $answer_id) {
123 if ($a_set[
"answer" . $answer_id]) {
134 $a_excel->
setCell($a_row, 0, (
string) ($a_set[
"login"] ??
''));
135 $a_excel->
setCell($a_row, 1, (
string) ($a_set[
"lastname"] ??
''));
136 $a_excel->
setCell($a_row, 2, (
string) ($a_set[
"firstname"] ??
''));
139 foreach ($this->answer_ids as $answer_id) {
140 if ($a_set[
"answer" . $answer_id]) {
141 $a_excel->
setCell($a_row, ++$col,
true);
143 $a_excel->
setCell($a_row, ++$col,
false);
setExportFormats(array $formats)
Set available export formats.
string $rendered_checked_icon
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set)
loadLanguageModule(string $a_module)
Load language module.
__construct(object $a_parent_obj, string $a_parent_cmd)
setCell(int $a_row, int $col, $value, ?string $datatype=null, bool $disable_strip_tags_for_strings=false)
Set cell value.
getItems(array $a_answer_ids)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
fillRowCSV(ilCSVWriter $a_csv, array $a_set)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setDefaultOrderDirection(string $a_defaultorderdirection)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__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)
TableGUI class for poll users.