ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
20 global $lng;
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 {
29 $cat = $categories->getCategory($i);
30 if ($cat->other)
31 {
32 $a_title_row[] = $cat->title." [".$cat->scale."]";
33 $a_title_row2[] = $lng->txt('other');
34 }
35 }
36 }
37
38 public function addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
39 {
40 // check if text answer column is needed
41 $other = array();
42 $categories = $this->question->getCategories();
43 for ($i = 0; $i < $categories->getCategoryCount(); $i++)
44 {
45 $cat = $categories->getCategory($i);
46 if ($cat->other)
47 {
48 $other[] = $cat->scale;
49 // outcommented due to #0021525
50// break;
51 }
52 }
53
54 $answer = $a_results->getUserResults($a_user_id);
55 if($answer === null)
56 {
57 $a_row[] = $this->getSkippedValue();
58 $a_row[] = ""; // see #20646
59 foreach($other as $dummy)
60 {
61 $a_row[] = "";
62 }
63 }
64 else
65 {
66 //$a_row[] = $answer[0][0]; // see #20646
67 $a_row[] = $answer[0][3]; // see #20646
68 $a_row[] = $answer[0][2]; // see #20646
69
70 foreach($other as $scale)
71 {
72 if($scale == $answer[0][2])
73 {
74 $a_row[] = $answer[0][1];
75 }
76 else
77 {
78 $a_row[] = "";
79 }
80 }
81 }
82 }
83}
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.
global $lng
Definition: privfeed.php:17