ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
class.SurveySingleChoiceQuestionEvaluation.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 // this is for the separation of title and scale, see #20646
41 $a_title_row[] = $a_title_row[count($a_title_row) - 1];
42 $a_title_row2[] = $a_title_row2[count($a_title_row2) - 1];
43
44 $categories = $this->question->getCategories();
45 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
46 $cat = $categories->getCategory($i);
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 // check if text answer column is needed
63 $other = array();
64 $categories = $this->question->getCategories();
65 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
66 $cat = $categories->getCategory($i);
67 if ($cat->other) {
68 $other[] = $cat->scale;
69 // outcommented due to #0021525
70 // break;
71 }
72 }
73
74 $answer = $a_results->getUserResults($a_user_id);
75 if (count($answer) === 0) {
76 $a_row[] = $this->getSkippedValue();
77 $a_row[] = ""; // see #20646
78 foreach ($other as $dummy) {
79 $a_row[] = "";
80 }
81 } else {
82 //$a_row[] = $answer[0][0]; // see #20646
83 $a_row[] = $answer[0][3]; // see #20646
84 $a_row[] = $answer[0][2]; // see #20646
85
86 foreach ($other as $scale) {
87 if ($scale == $answer[0][2]) {
88 $a_row[] = $answer[0][1];
89 } else {
90 $a_row[] = "";
91 }
92 }
93 }
94 }
95
96 protected function supportsSumScore(): bool
97 {
98 return true;
99 }
100}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
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...