ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.SurveyMultipleChoiceQuestionEvaluation.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  //
27  // EXPORT
28  //
29 
31  array &$a_title_row,
32  array &$a_title_row2,
33  bool $a_do_title,
34  bool $a_do_label
35  ): void {
36  $lng = $this->lng;
37 
38  $categories = $this->question->getCategories();
39  for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
40  $cat = $categories->getCategory($i);
41 
42  $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
43  $a_title_row2[] = "";
44 
45  if ($cat->other) {
46  $a_title_row[] = $cat->title . " [" . $cat->scale . "]";
47  $a_title_row2[] = $lng->txt('other');
48  }
49  }
50  }
51 
55  public function addUserSpecificResults(
56  array &$a_row,
57  int $a_user_id,
58  $a_results
59  ): void {
60  $categories = $this->question->getCategories();
61 
62  $answers = $a_results->getUserResults($a_user_id);
63  if (count($answers) === 0) {
64  $a_row[] = $this->getSkippedValue();
65 
66  for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
67  $cat = $categories->getCategory($i);
68  $a_row[] = "";
69 
70  if ($cat->other) {
71  $a_row[] = "";
72  }
73  }
74  } else {
75  $a_row[] = "";
76 
77  for ($i = 0; $i < $categories->getCategoryCount(); $i++) {
78  $cat = $categories->getCategory($i);
79  $found = false;
80  foreach ($answers as $answer) {
81  if ($answer[2] == $cat->scale) {
82  $a_row[] = $answer[2];
83  if ($cat->other) {
84  $a_row[] = $answer[1];
85  }
86  $found = true;
87  }
88  }
89  if (!$found) {
90  $a_row[] = ""; // "0" ?!
91  if ($cat->other) {
92  $a_row[] = "";
93  }
94  }
95  }
96  }
97  }
98 
99  protected function supportsSumScore(): bool
100  {
101  return true;
102  }
103 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getUserSpecificVariableTitles(array &$a_title_row, array &$a_title_row2, bool $a_do_title, bool $a_do_label)
addUserSpecificResults(array &$a_row, int $a_user_id, $a_results)
getSkippedValue()
Get caption for skipped value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41