ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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

23  {
24  $this->question = $a_question;
25  }

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

Referenced by SurveyQuestionEvaluation\parseResults().

138  {
139  $this->variables[] = $a_variable;
140  }
+ 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  {
159  return $this->answers;
160  }
161  }
+ Here is the caller graph for this function:

◆ getCatTitle()

ilSurveyEvaluationResults::getCatTitle (   $a_value)
protected

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

182  {
183  if(!sizeof($this->variables))
184  {
185  return $a_value;
186  }
187  else
188  {
189  foreach($this->variables as $var)
190  {
191  if($var->cat->scale == $a_value)
192  {
193  return $var->cat->title;
194  }
195  }
196  }
197  }

◆ getMappedTextAnswers()

ilSurveyEvaluationResults::getMappedTextAnswers ( )

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

References $res, array, and getScaleText().

200  {
201  $res = array();
202 
203  foreach($this->answers as $answer)
204  {
205  if($answer->text)
206  {
207  $res[$this->getScaleText($answer->value)][] = $answer->text;
208  }
209  }
210 
211  return $res;
212  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getMean()

ilSurveyEvaluationResults::getMean ( )

Definition at line 98 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 110 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 115 of file class.ilSurveyEvaluationResults.php.

References $lng, and getScaleText().

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

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

◆ getModeNrOfSelections()

ilSurveyEvaluationResults::getModeNrOfSelections ( )

Definition at line 88 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 60 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 65 of file class.ilSurveyEvaluationResults.php.

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

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

66  {
67  if($this->mode_value === null)
68  {
69  return;
70  }
71 
72  $res = array();
73 
74  $mvalues = $this->mode_value;
75  if(!is_array($mvalues))
76  {
77  $mvalues = array($mvalues);
78  }
79  sort($mvalues, SORT_NUMERIC);
80  foreach($mvalues as $value)
81  {
82  $res[] = $this->getScaleText($value);
83  }
84 
85  return implode(", ", $res);
86  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestion()

ilSurveyEvaluationResults::getQuestion ( )

Definition at line 27 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  {
167  return $a_value;
168  }
169  else
170  {
171  foreach($this->variables as $var)
172  {
173  if($var->cat->scale == $a_value)
174  {
175  return $var->cat->title." [".$a_value."]";
176  }
177  }
178  }
179  }
+ Here is the caller graph for this function:

◆ getUserResults()

ilSurveyEvaluationResults::getUserResults (   $a_active_id)

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

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

215  {
216  $res = array();
217 
218  $answers = $this->getAnswers();
219  if($answers)
220  {
221  foreach($answers as $answer)
222  {
223  if($answer->active_id == $a_active_id)
224  {
225  $res[] = array(
226  $this->getScaleText($answer->value),
227  $answer->text,
228  $answer->value,
229  $this->getCatTitle($answer->value)
230  );
231  }
232  }
233  }
234 
235  return $res;
236  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getUsersAnswered()

ilSurveyEvaluationResults::getUsersAnswered ( )

◆ getUsersSkipped()

ilSurveyEvaluationResults::getUsersSkipped ( )

◆ getVariables()

ilSurveyEvaluationResults::getVariables ( )

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

References $variables.

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

◆ setMean()

ilSurveyEvaluationResults::setMean (   $a_mean)

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

Referenced by SurveyMetricQuestionEvaluation\parseResults().

94  {
95  $this->arithmetic_mean = (float)$a_mean;
96  }
+ Here is the caller graph for this function:

◆ setMedian()

ilSurveyEvaluationResults::setMedian (   $a_value)

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

Referenced by SurveyQuestionEvaluation\parseResults().

104  {
105  $this->median = is_array($a_value)
106  ? $a_value
107  : trim($a_value);
108  }
+ Here is the caller graph for this function:

◆ setMode()

ilSurveyEvaluationResults::setMode (   $a_value,
  $a_nr_of_selections 
)

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

Referenced by SurveyQuestionEvaluation\parseResults().

53  {
54  $this->mode_value = is_array($a_value)
55  ? $a_value
56  : trim($a_value);
57  $this->mode_nr_of_selections = (int)$a_nr_of_selections;
58  }
+ Here is the caller graph for this function:

◆ setUsersAnswered()

ilSurveyEvaluationResults::setUsersAnswered (   $a_value)

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

Referenced by SurveyQuestionEvaluation\parseResults().

33  {
34  $this->users_answered = (int)$a_value;
35  }
+ Here is the caller graph for this function:

◆ setUsersSkipped()

ilSurveyEvaluationResults::setUsersSkipped (   $a_value)

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

Referenced by SurveyQuestionEvaluation\parseResults().

43  {
44  $this->users_skipped = (int)$a_value;
45  }
+ Here is the caller graph for this function:

Field Documentation

◆ $answers

ilSurveyEvaluationResults::$answers = array()
protected

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

Referenced by getAnswers(), and getUserResults().

◆ $arithmetic_mean

ilSurveyEvaluationResults::$arithmetic_mean
protected

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

Referenced by getMean().

◆ $median

ilSurveyEvaluationResults::$median
protected

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

Referenced by getMedian().

◆ $mode_nr_of_selections

ilSurveyEvaluationResults::$mode_nr_of_selections
protected

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

Referenced by getModeNrOfSelections().

◆ $mode_value

ilSurveyEvaluationResults::$mode_value
protected

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

Referenced by getModeValue(), and getModeValueAsText().

◆ $question

ilSurveyEvaluationResults::$question
protected

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

Referenced by getQuestion().

◆ $users_answered

ilSurveyEvaluationResults::$users_answered
protected

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

Referenced by getUsersAnswered().

◆ $users_skipped

ilSurveyEvaluationResults::$users_skipped
protected

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

Referenced by getUsersSkipped().

◆ $variables

ilSurveyEvaluationResults::$variables = array()
protected

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

Referenced by getVariables().


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