ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.SurveySingleChoiceQuestionEvaluation.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "Modules/SurveyQuestionPool/classes/class.SurveyQuestionEvaluation.php";
5
13{
14 //
15 // EXPORT
16 //
17
18 public function getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label)
19 {
21
22 // this is for the separation of title and scale, see #20646
23 $a_title_row[] = $a_title_row[count($a_title_row) - 1];
24 $a_title_row2[] = $a_title_row2[count($a_title_row2) - 1];
25
26 $categories = $this->question->getCategories();
27 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
28 $cat = $categories->getCategory($i);
29 if ($cat->other) {
30 $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
31 $a_title_row2[] = $lng->txt('other');
32 }
33 }
34 }
35
36 public function addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
37 {
38 // check if text answer column is needed
39 $other = array();
40 $categories = $this->question->getCategories();
41 for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
42 $cat = $categories->getCategory($i);
43 if ($cat->other) {
44 $other[] = $cat->scale;
45 // outcommented due to #0021525
46// break;
47 }
48 }
49
50 $answer = $a_results->getUserResults($a_user_id);
51 if ($answer === null) {
52 $a_row[] = $this->getSkippedValue();
53 $a_row[] = ""; // see #20646
54 foreach ($other as $dummy) {
55 $a_row[] = "";
56 }
57 } else {
58 //$a_row[] = $answer[0][0]; // see #20646
59 $a_row[] = $answer[0][3]; // see #20646
60 $a_row[] = $answer[0][2]; // see #20646
61
62 foreach ($other as $scale) {
63 if ($scale == $answer[0][2]) {
64 $a_row[] = $answer[0][1];
65 } else {
66 $a_row[] = "";
67 }
68 }
69 }
70 }
71}
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: disco.tpl.php:19