ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.SurveyMultipleChoiceQuestionEvaluation.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "Modules/SurveyQuestionPool/classes/class.SurveyQuestionEvaluation.php";
5 
13 {
14 
15  //
16  // EXPORT
17  //
18 
19  public function getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label)
20  {
21  $lng = $this->lng;
22 
23  $categories = $this->question->getCategories();
24  for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
25  $cat = $categories->getCategory($i);
26 
27  $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
28  $a_title_row2[] = "";
29 
30  if ($cat->other) {
31  $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
32  $a_title_row2[] = $lng->txt('other');
33  }
34  }
35  }
36 
37  public function addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
38  {
39  $categories = $this->question->getCategories();
40 
41  $answers = $a_results->getUserResults($a_user_id);
42  if ($answers === null) {
43  $a_row[] = $this->getSkippedValue();
44 
45  for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
46  $cat = $categories->getCategory($i);
47  $a_row[] = "";
48 
49  if ($cat->other) {
50  $a_row[] = "";
51  }
52  }
53  } else {
54  $a_row[] = "";
55 
56  for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
57  $cat = $categories->getCategory($i);
58  $found = false;
59  foreach ($answers as $answer) {
60  if ($answer[2] == $cat->scale) {
61  $a_row[] = $answer[2];
62  if ($cat->other) {
63  $a_row[] = $answer[1];
64  }
65  $found = true;
66  }
67  }
68  if (!$found) {
69  $a_row[] = ""; // "0" ?!
70  if ($cat->other) {
71  $a_row[] = "";
72  }
73  }
74  }
75  }
76  }
77 }
getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, $a_do_title, $a_do_label)
Create styles array
The data for the language used.
getSkippedValue()
Get caption for skipped value.
$i
Definition: disco.tpl.php:19