ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSurveyEvaluationResults Class Reference

Survey evaluation answers. More...

+ Collaboration diagram for ilSurveyEvaluationResults:

Public Member Functions

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

Protected Member Functions

 getScaleText ($a_value)
 
 getCatTitle ($a_value)
 

Protected Attributes

 $lng
 
 $question
 
 $users_answered
 
 $users_skipped
 
 $mode_value
 
 $mode_nr_of_selections
 
 $arithmetic_mean
 
 $median
 
 $variables = array()
 
 $answers = array()
 

Detailed Description

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 10 of file class.ilSurveyEvaluationResults.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyEvaluationResults::__construct ( SurveyQuestion  $a_question)

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

References $DIC.

28  {
29  global $DIC;
30 
31  $this->lng = $DIC->language();
32  $this->question = $a_question;
33  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ addAnswer()

ilSurveyEvaluationResults::addAnswer ( ilSurveyEvaluationResultsAnswer  $a_answer)

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

Referenced by SurveyQuestionEvaluation\parseResults().

151  {
152  $this->answers[] = $a_answer;
153  }
+ Here is the caller graph for this function:

◆ addVariable()

ilSurveyEvaluationResults::addVariable ( ilSurveyEvaluationResultsVariable  $a_variable)

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

Referenced by SurveyQuestionEvaluation\parseResults().

139  {
140  $this->variables[] = $a_variable;
141  }
+ Here is the caller graph for this function:

◆ getAnswers()

ilSurveyEvaluationResults::getAnswers ( )

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

References $answers.

Referenced by getUserResults().

156  {
157  if (sizeof($this->answers)) {
158  return $this->answers;
159  }
160  return [];
161  }
+ Here is the caller graph for this function:

◆ getCatTitle()

ilSurveyEvaluationResults::getCatTitle (   $a_value)
protected

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

177  {
178  if (!sizeof($this->variables)) {
179  return $a_value;
180  } else {
181  foreach ($this->variables as $var) {
182  if ($var->cat->scale == $a_value) {
183  return $var->cat->title;
184  }
185  }
186  }
187  }

◆ getMappedTextAnswers()

ilSurveyEvaluationResults::getMappedTextAnswers ( )

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

References $res, and getScaleText().

190  {
191  $res = array();
192 
193  foreach ($this->answers as $answer) {
194  if ($answer->text) {
195  $res[$this->getScaleText($answer->value)][] = $answer->text;
196  }
197  }
198 
199  return $res;
200  }
foreach($_POST as $key=> $value) $res
+ Here is the call graph for this function:

◆ getMean()

ilSurveyEvaluationResults::getMean ( )

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

References $arithmetic_mean.

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedian()

ilSurveyEvaluationResults::getMedian ( )

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

References $median.

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedianAsText()

ilSurveyEvaluationResults::getMedianAsText ( )

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

References $lng, and getScaleText().

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

121  {
122  $lng = $this->lng;
123 
124  if ($this->median === null) {
125  return;
126  }
127 
128  if (!is_array($this->median)) {
129  return $this->getScaleText($this->median);
130  } else {
131  return $lng->txt("median_between") . " " .
132  $this->getScaleText($this->median[0]) . " " .
133  $lng->txt("and") . " " .
134  $this->getScaleText($this->median[1]);
135  }
136  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getModeNrOfSelections()

ilSurveyEvaluationResults::getModeNrOfSelections ( )

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

References $mode_nr_of_selections.

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeValue()

ilSurveyEvaluationResults::getModeValue ( )

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

References $mode_value.

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeValueAsText()

ilSurveyEvaluationResults::getModeValueAsText ( )

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

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

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

74  {
75  if ($this->mode_value === null) {
76  return;
77  }
78 
79  $res = array();
80 
81  $mvalues = $this->mode_value;
82  if (!is_array($mvalues)) {
83  $mvalues = array($mvalues);
84  }
85  sort($mvalues, SORT_NUMERIC);
86  foreach ($mvalues as $value) {
87  $res[] = $this->getScaleText($value);
88  }
89 
90  return implode(", ", $res);
91  }
foreach($_POST as $key=> $value) $res
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestion()

ilSurveyEvaluationResults::getQuestion ( )

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

References $question.

◆ getScaleText()

ilSurveyEvaluationResults::getScaleText (   $a_value)
protected

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

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

164  {
165  if (!sizeof($this->variables)) {
166  return $a_value;
167  } else {
168  foreach ($this->variables as $var) {
169  if ($var->cat->scale == $a_value) {
170  return $var->cat->title . " [" . $a_value . "]";
171  }
172  }
173  }
174  }
+ Here is the caller graph for this function:

◆ getUserResults()

ilSurveyEvaluationResults::getUserResults (   $a_active_id)

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

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

203  {
204  $res = array();
205 
206  $answers = $this->getAnswers();
207  if ($answers) {
208  foreach ($answers as $answer) {
209  if ($answer->active_id == $a_active_id) {
210  $res[] = array(
211  $this->getScaleText($answer->value),
212  $answer->text,
213  $answer->value,
214  $this->getCatTitle($answer->value)
215  );
216  }
217  }
218  }
219 
220  return $res;
221  }
foreach($_POST as $key=> $value) $res
+ Here is the call graph for this function:

◆ getUsersAnswered()

ilSurveyEvaluationResults::getUsersAnswered ( )

◆ getUsersSkipped()

ilSurveyEvaluationResults::getUsersSkipped ( )

◆ getVariables()

ilSurveyEvaluationResults::getVariables ( )

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

References $variables.

144  {
145  if (sizeof($this->variables)) {
146  return $this->variables;
147  }
148  }

◆ setMean()

ilSurveyEvaluationResults::setMean (   $a_mean)

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

Referenced by SurveyMetricQuestionEvaluation\parseResults().

99  {
100  $this->arithmetic_mean = (float) $a_mean;
101  }
+ Here is the caller graph for this function:

◆ setMedian()

ilSurveyEvaluationResults::setMedian (   $a_value)

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

Referenced by SurveyQuestionEvaluation\parseResults().

109  {
110  $this->median = is_array($a_value)
111  ? $a_value
112  : trim($a_value);
113  }
+ Here is the caller graph for this function:

◆ setMode()

ilSurveyEvaluationResults::setMode (   $a_value,
  $a_nr_of_selections 
)

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

Referenced by SurveyQuestionEvaluation\parseResults().

61  {
62  $this->mode_value = is_array($a_value)
63  ? $a_value
64  : trim($a_value);
65  $this->mode_nr_of_selections = (int) $a_nr_of_selections;
66  }
+ Here is the caller graph for this function:

◆ setUsersAnswered()

ilSurveyEvaluationResults::setUsersAnswered (   $a_value)

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

Referenced by SurveyQuestionEvaluation\parseResults().

41  {
42  $this->users_answered = (int) $a_value;
43  }
+ Here is the caller graph for this function:

◆ setUsersSkipped()

ilSurveyEvaluationResults::setUsersSkipped (   $a_value)

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

Referenced by SurveyQuestionEvaluation\parseResults().

51  {
52  $this->users_skipped = (int) $a_value;
53  }
+ Here is the caller graph for this function:

Field Documentation

◆ $answers

ilSurveyEvaluationResults::$answers = array()
protected

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

Referenced by getAnswers(), and getUserResults().

◆ $arithmetic_mean

ilSurveyEvaluationResults::$arithmetic_mean
protected

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

Referenced by getMean().

◆ $lng

ilSurveyEvaluationResults::$lng
protected

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

Referenced by getMedianAsText().

◆ $median

ilSurveyEvaluationResults::$median
protected

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

Referenced by getMedian().

◆ $mode_nr_of_selections

ilSurveyEvaluationResults::$mode_nr_of_selections
protected

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

Referenced by getModeNrOfSelections().

◆ $mode_value

ilSurveyEvaluationResults::$mode_value
protected

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

Referenced by getModeValue(), and getModeValueAsText().

◆ $question

ilSurveyEvaluationResults::$question
protected

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

Referenced by getQuestion().

◆ $users_answered

ilSurveyEvaluationResults::$users_answered
protected

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

Referenced by getUsersAnswered().

◆ $users_skipped

ilSurveyEvaluationResults::$users_skipped
protected

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

Referenced by getUsersSkipped().

◆ $variables

ilSurveyEvaluationResults::$variables = array()
protected

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

Referenced by getVariables().


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