ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilSurveyEvaluationResults Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilSurveyEvaluationResults:

Public Member Functions

 __construct (SurveyQuestion $a_question)
 
 getQuestion ()
 
 setUsersAnswered (int $a_value)
 
 getUsersAnswered ()
 
 setUsersSkipped (int $a_value)
 
 getUsersSkipped ()
 
 setMode ( $a_value, int $a_nr_of_selections)
 
 getModeValue ()
 
 getModeValueAsText ()
 
 getModeNrOfSelections ()
 
 setMean (float $a_mean)
 
 getMean ()
 
 setMedian ($a_value)
 
 getMedian ()
 
 getMedianAsText ()
 
 addVariable (ilSurveyEvaluationResultsVariable $a_variable)
 
 getVariables ()
 
 addAnswer (ilSurveyEvaluationResultsAnswer $a_answer)
 
 getAnswers ()
 
 getScaleText ( $a_value)
 
 getMappedTextAnswers ()
 
 getUserResults (int $a_active_id)
 

Protected Member Functions

 getCatTitle (float $a_value)
 

Protected Attributes

ilLanguage $lng
 
SurveyQuestion $question
 
int $users_answered = 0
 
int $users_skipped = 0
 
 $mode_value
 
int $mode_nr_of_selections = 0
 
float $arithmetic_mean = 0
 
 $median
 
array $variables = array()
 
array $answers = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Survey evaluation answers

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 23 of file class.ilSurveyEvaluationResults.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyEvaluationResults::__construct ( SurveyQuestion  $a_question)

Definition at line 42 of file class.ilSurveyEvaluationResults.php.

References $DIC, and ILIAS\Repository\lng().

44  {
45  global $DIC;
46 
47  $this->lng = $DIC->language();
48  $this->question = $a_question;
49  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ addAnswer()

ilSurveyEvaluationResults::addAnswer ( ilSurveyEvaluationResultsAnswer  $a_answer)

Definition at line 179 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyQuestionEvaluation\parseResults().

181  : void {
182  $this->answers[] = $a_answer;
183  }
+ Here is the caller graph for this function:

◆ addVariable()

ilSurveyEvaluationResults::addVariable ( ilSurveyEvaluationResultsVariable  $a_variable)

Definition at line 168 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyQuestionEvaluation\parseResults().

170  : void {
171  $this->variables[] = $a_variable;
172  }
+ Here is the caller graph for this function:

◆ getAnswers()

ilSurveyEvaluationResults::getAnswers ( )

Definition at line 185 of file class.ilSurveyEvaluationResults.php.

Referenced by getUserResults().

185  : array
186  {
187  return $this->answers ?? [];
188  }
+ Here is the caller graph for this function:

◆ getCatTitle()

ilSurveyEvaluationResults::getCatTitle ( float  $a_value)
protected

Definition at line 209 of file class.ilSurveyEvaluationResults.php.

211  : string {
212  if (!count($this->variables)) {
213  return $a_value;
214  } else {
215  foreach ($this->variables as $var) {
216  if ($var->cat->scale == $a_value) {
217  return $var->cat->title;
218  }
219  }
220  }
221  return "";
222  }

◆ getMappedTextAnswers()

ilSurveyEvaluationResults::getMappedTextAnswers ( )

Definition at line 224 of file class.ilSurveyEvaluationResults.php.

References $res, and getScaleText().

224  : array
225  {
226  $res = array();
227 
228  foreach ($this->answers as $answer) {
229  if ($answer->text) {
230  $res[$this->getScaleText($answer->value)][] = $answer->text;
231  }
232  }
233 
234  return $res;
235  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getMean()

ilSurveyEvaluationResults::getMean ( )

Definition at line 127 of file class.ilSurveyEvaluationResults.php.

References $arithmetic_mean.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ilSurveyEvaluationGUI\parseResultsToExcel().

127  : float
128  {
129  return $this->arithmetic_mean;
130  }
+ Here is the caller graph for this function:

◆ getMedian()

ilSurveyEvaluationResults::getMedian ( )
Returns
array|string

Definition at line 145 of file class.ilSurveyEvaluationResults.php.

References $median.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedianAsText()

ilSurveyEvaluationResults::getMedianAsText ( )

Definition at line 150 of file class.ilSurveyEvaluationResults.php.

References $lng, getScaleText(), null, and ilLanguage\txt().

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ilSurveyEvaluationGUI\parseResultsToExcel().

150  : string
151  {
152  $lng = $this->lng;
153 
154  if ($this->median === null) {
155  return "";
156  }
157 
158  if (!is_array($this->median)) {
159  return $this->getScaleText($this->median);
160  }
161 
162  return $lng->txt("median_between") . " " .
163  $this->getScaleText($this->median[0]) . " " .
164  $lng->txt("and") . " " .
165  $this->getScaleText($this->median[1]);
166  }
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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModeNrOfSelections()

ilSurveyEvaluationResults::getModeNrOfSelections ( )

Definition at line 117 of file class.ilSurveyEvaluationResults.php.

References $mode_nr_of_selections.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ilSurveyEvaluationGUI\parseResultsToExcel().

117  : int
118  {
120  }
+ Here is the caller graph for this function:

◆ getModeValue()

ilSurveyEvaluationResults::getModeValue ( )
Returns
array|string

Definition at line 92 of file class.ilSurveyEvaluationResults.php.

References $mode_value.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeValueAsText()

ilSurveyEvaluationResults::getModeValueAsText ( )

Definition at line 97 of file class.ilSurveyEvaluationResults.php.

References $mode_value, $res, getScaleText(), null, and ILIAS\UI\examples\Symbol\Glyph\Sort\sort().

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ilSurveyEvaluationGUI\parseResultsToExcel().

97  : string
98  {
99  if ($this->mode_value === null) {
100  return "";
101  }
102 
103  $res = array();
104 
105  $mvalues = $this->mode_value;
106  if (!is_array($mvalues)) {
107  $mvalues = array($mvalues);
108  }
109  sort($mvalues, SORT_NUMERIC);
110  foreach ($mvalues as $value) {
111  $res[] = $this->getScaleText($value);
112  }
113 
114  return implode(", ", $res);
115  }
$res
Definition: ltiservices.php:66
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestion()

ilSurveyEvaluationResults::getQuestion ( )

Definition at line 51 of file class.ilSurveyEvaluationResults.php.

References $question.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard(), and ILIAS\Survey\Mode\AbstractUIModifier\getPanelText().

52  {
53  return $this->question;
54  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getScaleText()

ilSurveyEvaluationResults::getScaleText (   $a_value)
Parameters
mixed$a_value
Returns
string

Definition at line 194 of file class.ilSurveyEvaluationResults.php.

Referenced by getMappedTextAnswers(), getMedianAsText(), getModeValueAsText(), and getUserResults().

196  : string {
197  if (!count($this->variables)) {
198  return $a_value;
199  } else {
200  foreach ($this->variables as $var) {
201  if ($var->cat->scale == $a_value) {
202  return $var->cat->title . " [" . $a_value . "]";
203  }
204  }
205  }
206  return "";
207  }
+ Here is the caller graph for this function:

◆ getUserResults()

ilSurveyEvaluationResults::getUserResults ( int  $a_active_id)

Definition at line 237 of file class.ilSurveyEvaluationResults.php.

References $res, getAnswers(), and getScaleText().

239  : array {
240  $res = array();
241 
242  $answers = $this->getAnswers();
243  if ($answers) {
244  foreach ($answers as $answer) {
245  if ($answer->active_id == $a_active_id) {
246  $res[] = array(
247  $this->getScaleText($answer->value),
248  $answer->text,
249  $answer->value,
250  $this->getCatTitle($answer->value)
251  );
252  }
253  }
254  }
255 
256  return $res;
257  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getUsersAnswered()

ilSurveyEvaluationResults::getUsersAnswered ( )

Definition at line 61 of file class.ilSurveyEvaluationResults.php.

References $users_answered.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard().

61  : int
62  {
63  return $this->users_answered;
64  }
+ Here is the caller graph for this function:

◆ getUsersSkipped()

ilSurveyEvaluationResults::getUsersSkipped ( )

Definition at line 71 of file class.ilSurveyEvaluationResults.php.

References $users_skipped.

Referenced by ILIAS\Survey\Mode\AbstractUIModifier\getPanelCard().

71  : int
72  {
73  return $this->users_skipped;
74  }
+ Here is the caller graph for this function:

◆ getVariables()

ilSurveyEvaluationResults::getVariables ( )

Definition at line 174 of file class.ilSurveyEvaluationResults.php.

174  : array
175  {
176  return $this->variables ?? [];
177  }

◆ setMean()

ilSurveyEvaluationResults::setMean ( float  $a_mean)

Definition at line 122 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyMetricQuestionEvaluation\parseResults().

122  : void
123  {
124  $this->arithmetic_mean = $a_mean;
125  }
+ Here is the caller graph for this function:

◆ setMedian()

ilSurveyEvaluationResults::setMedian (   $a_value)
Parameters
string | array$a_value

Definition at line 135 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyQuestionEvaluation\parseResults().

135  : void
136  {
137  $this->median = is_array($a_value)
138  ? $a_value
139  : trim($a_value ?? "");
140  }
+ Here is the caller graph for this function:

◆ setMode()

ilSurveyEvaluationResults::setMode (   $a_value,
int  $a_nr_of_selections 
)
Parameters
array | string$a_value

Definition at line 79 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyQuestionEvaluation\parseResults().

82  : void {
83  $this->mode_value = is_array($a_value)
84  ? $a_value
85  : trim($a_value ?? "");
86  $this->mode_nr_of_selections = $a_nr_of_selections;
87  }
+ Here is the caller graph for this function:

◆ setUsersAnswered()

ilSurveyEvaluationResults::setUsersAnswered ( int  $a_value)

Definition at line 56 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyQuestionEvaluation\parseResults().

56  : void
57  {
58  $this->users_answered = $a_value;
59  }
+ Here is the caller graph for this function:

◆ setUsersSkipped()

ilSurveyEvaluationResults::setUsersSkipped ( int  $a_value)

Definition at line 66 of file class.ilSurveyEvaluationResults.php.

Referenced by SurveyQuestionEvaluation\parseResults().

66  : void
67  {
68  $this->users_skipped = $a_value;
69  }
+ Here is the caller graph for this function:

Field Documentation

◆ $answers

array ilSurveyEvaluationResults::$answers = array()
protected

Definition at line 40 of file class.ilSurveyEvaluationResults.php.

◆ $arithmetic_mean

float ilSurveyEvaluationResults::$arithmetic_mean = 0
protected

Definition at line 34 of file class.ilSurveyEvaluationResults.php.

Referenced by getMean().

◆ $lng

ilLanguage ilSurveyEvaluationResults::$lng
protected

Definition at line 25 of file class.ilSurveyEvaluationResults.php.

Referenced by getMedianAsText().

◆ $median

ilSurveyEvaluationResults::$median
protected

Definition at line 38 of file class.ilSurveyEvaluationResults.php.

Referenced by getMedian().

◆ $mode_nr_of_selections

int ilSurveyEvaluationResults::$mode_nr_of_selections = 0
protected

Definition at line 33 of file class.ilSurveyEvaluationResults.php.

Referenced by getModeNrOfSelections().

◆ $mode_value

ilSurveyEvaluationResults::$mode_value
protected

Definition at line 32 of file class.ilSurveyEvaluationResults.php.

Referenced by getModeValue(), and getModeValueAsText().

◆ $question

SurveyQuestion ilSurveyEvaluationResults::$question
protected

Definition at line 26 of file class.ilSurveyEvaluationResults.php.

Referenced by getQuestion().

◆ $users_answered

int ilSurveyEvaluationResults::$users_answered = 0
protected

Definition at line 27 of file class.ilSurveyEvaluationResults.php.

Referenced by getUsersAnswered().

◆ $users_skipped

int ilSurveyEvaluationResults::$users_skipped = 0
protected

Definition at line 28 of file class.ilSurveyEvaluationResults.php.

Referenced by getUsersSkipped().

◆ $variables

array ilSurveyEvaluationResults::$variables = array()
protected

Definition at line 39 of file class.ilSurveyEvaluationResults.php.


The documentation for this class was generated from the following file: