ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.SurveyMultipleChoiceQuestionEvaluation.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
27{
28 //
29 // EXPORT
30 //
31
33 array &$a_title_row,
34 array &$a_title_row2,
35 bool $a_do_title,
36 bool $a_do_label
37 ): void {
38 $lng = $this->lng;
39
40 $categories = $this->question->getCategories();
41 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
42 $cat = $categories->getCategory($i);
43
44 $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
45 $a_title_row2[] = "";
46
47 if ($cat->other) {
48 $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
49 $a_title_row2[] = $lng->txt('other');
50 }
51 }
52 }
53
57 public function addUserSpecificResults(
58 array &$a_row,
59 int $a_user_id,
60 $a_results
61 ): void {
62 $categories = $this->question->getCategories();
63
64 $answers = $a_results->getUserResults($a_user_id);
65 if (count($answers) === 0) {
66 $a_row[] = $this->getSkippedValue();
67
68 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
69 $cat = $categories->getCategory($i);
70 $a_row[] = "";
71
72 if ($cat->other) {
73 $a_row[] = "";
74 }
75 }
76 } else {
77 $a_row[] = "";
78
79 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
80 $cat = $categories->getCategory($i);
81 $found = false;
82 foreach ($answers as $answer) {
83 if ($answer[2] == $cat->scale) {
84 $a_row[] = $answer[2];
85 if ($cat->other) {
86 $a_row[] = $answer[1];
87 }
88 $found = true;
89 }
90 }
91 if (!$found) {
92 $a_row[] = ""; // "0" ?!
93 if ($cat->other) {
94 $a_row[] = "";
95 }
96 }
97 }
98 }
99 }
100
101 protected function supportsSumScore(): bool
102 {
103 return true;
104 }
105}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addUserSpecificResults(array &$a_row, int $a_user_id, $a_results)
getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, bool $a_do_title, bool $a_do_label)
Get title columns for user-specific export.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...