ILIAS  release_7 Revision v7.30-3-g800a261c036
class.SurveySingleChoiceQuestionEvaluation.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
12 //
13 // EXPORT
14 //
15
16 public function getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label)
17 {
19
20 // this is for the separation of title and scale, see #20646
21 $a_title_row[] = $a_title_row[count($a_title_row) - 1];
22 $a_title_row2[] = $a_title_row2[count($a_title_row2) - 1];
23
24 $categories = $this->question->getCategories();
25 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
26 $cat = $categories->getCategory($i);
27 if ($cat->other) {
28 $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
29 $a_title_row2[] = $lng->txt('other');
30 }
31 }
32 }
33
34 public function addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
35 {
36 // check if text answer column is needed
37 $other = array();
38 $categories = $this->question->getCategories();
39 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
40 $cat = $categories->getCategory($i);
41 if ($cat->other) {
42 $other[] = $cat->scale;
43 // outcommented due to #0021525
44// break;
45 }
46 }
47
48 $answer = $a_results->getUserResults($a_user_id);
49 if ($answer === null) {
50 $a_row[] = $this->getSkippedValue();
51 $a_row[] = ""; // see #20646
52 foreach ($other as $dummy) {
53 $a_row[] = "";
54 }
55 } else {
56 //$a_row[] = $answer[0][0]; // see #20646
57 $a_row[] = $answer[0][3]; // see #20646
58 $a_row[] = $answer[0][2]; // see #20646
59
60 foreach ($other as $scale) {
61 if ($scale == $answer[0][2]) {
62 $a_row[] = $answer[0][1];
63 } else {
64 $a_row[] = "";
65 }
66 }
67 }
68 }
69
73 protected function supportsSumScore() : bool
74 {
75 return true;
76 }
77}
An exception for terminatinating execution or to throw for unit testing.
getSkippedValue()
Get caption for skipped value.
addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label)
Get title columns for user-specific export.
$i
Definition: metadata.php:24