ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  global $lng;
22 
23  $categories = $this->question->getCategories();
24  for ($i = 0; $i < $categories->getCategoryCount(); $i++)
25  {
26  $cat = $categories->getCategory($i);
27 
28  $a_title_row[] = $cat->title." [".$cat->scale."]";
29  $a_title_row2[] = "";
30 
31  if ($cat->other)
32  {
33  $a_title_row[] = $cat->title." [".$cat->scale."]";
34  $a_title_row2[] = $lng->txt('other');
35  }
36  }
37  }
38 
39  public function addUserSpecificResults(array &$a_row, $a_user_id, $a_results)
40  {
41  $categories = $this->question->getCategories();
42 
43  $answers = $a_results->getUserResults($a_user_id);
44  if($answers === null)
45  {
46  $a_row[] = $this->getSkippedValue();
47 
48  for ($i = 0; $i < $categories->getCategoryCount(); $i++)
49  {
50  $cat = $categories->getCategory($i);
51  $a_row[] = "";
52 
53  if($cat->other)
54  {
55  $a_row[] = "";
56  }
57  }
58  }
59  else
60  {
61  $a_row[] = "";
62 
63  for ($i = 0; $i < $categories->getCategoryCount(); $i++)
64  {
65  $cat = $categories->getCategory($i);
66  $found = false;
67  foreach($answers as $answer)
68  {
69  if($answer[2] == $cat->scale)
70  {
71  $a_row[] = $answer[2];
72  if ($cat->other)
73  {
74  $a_row[] = $answer[1];
75  }
76  $found = true;
77  }
78  }
79  if(!$found)
80  {
81  $a_row[] = ""; // "0" ?!
82  if ($cat->other)
83  {
84  $a_row[] = "";
85  }
86  }
87  }
88  }
89  }
90 }
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.
global $lng
Definition: privfeed.php:17