32 protected string|array|
null $median =
null;
41 $this->
lng = $DIC->language();
42 $this->question = $a_question;
52 $this->users_answered = $a_value;
62 $this->users_skipped = $a_value;
75 int $a_nr_of_selections
77 $this->mode_value = is_array($a_value)
79 : trim($a_value ??
"");
80 $this->mode_nr_of_selections = $a_nr_of_selections;
88 return $this->mode_value;
93 if ($this->mode_value ===
null) {
99 $mvalues = $this->mode_value;
100 if (!is_array($mvalues)) {
101 $mvalues = array($mvalues);
103 sort($mvalues, SORT_NUMERIC);
104 foreach ($mvalues as $value) {
105 $res[] = $this->getScaleText($value);
108 return implode(
", ",
$res);
113 return $this->mode_nr_of_selections;
118 $this->arithmetic_mean = $a_mean;
123 return $this->arithmetic_mean;
131 $this->median = is_array($a_value)
133 : trim($a_value ??
"");
141 return $this->median;
148 if ($this->median ===
null) {
152 if (!is_array($this->median)) {
153 return $this->getScaleText($this->median);
156 return $lng->txt(
"median_between") .
" " .
157 $this->getScaleText($this->median[0]) .
" " .
158 $lng->txt(
"and") .
" " .
159 $this->getScaleText($this->median[1]);
165 $this->variables[] = $a_variable;
170 return $this->variables ?? [];
176 $this->answers[] = $a_answer;
181 return $this->answers ?? [];
191 if (!count($this->variables)) {
194 foreach ($this->variables as $var) {
195 if ($var->cat->scale == $a_value) {
196 return $var->cat->title .
" [" . $a_value .
"]";
206 if (!count($this->variables)) {
209 foreach ($this->variables as $var) {
210 if ($var->cat->scale == $a_value) {
211 return $var->cat->title;
222 foreach ($this->answers as $answer) {
224 $res[$this->getScaleText($answer->value)][] = $answer->text;
236 $answers = $this->getAnswers();
238 foreach ($answers as $answer) {
239 if ($answer->active_id == $a_active_id) {
241 $this->getScaleText($answer->value),
244 $this->getCatTitle($answer->value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(SurveyQuestion $a_question)
getCatTitle(float $a_value)
int $mode_nr_of_selections
setUsersSkipped(int $a_value)
addVariable(ilSurveyEvaluationResultsVariable $a_variable)
addAnswer(ilSurveyEvaluationResultsAnswer $a_answer)
getUserResults(int $a_active_id)
setMedian(string|array $a_value)
string array null $median
array string null $mode_value
setMode( $a_value, int $a_nr_of_selections)
setUsersAnswered(int $a_value)
if(!file_exists('../ilias.ini.php'))