ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

44 {
45 global $DIC;
46
47 $this->lng = $DIC->language();
48 $this->question = $a_question;
49 }
global $DIC
Definition: shib_login.php:26

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

+ 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.

181 : void {
182 $this->answers[] = $a_answer;
183 }

◆ addVariable()

ilSurveyEvaluationResults::addVariable ( ilSurveyEvaluationResultsVariable  $a_variable)

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

170 : void {
171 $this->variables[] = $a_variable;
172 }

◆ getAnswers()

ilSurveyEvaluationResults::getAnswers ( )

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

185 : array
186 {
187 return $this->answers ?? [];
188 }

Referenced by SurveyMetricQuestionEvaluation\getChart(), and SurveyMetricQuestionEvaluation\getExportGrid().

+ 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.

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:69

References $res.

Referenced by SurveyQuestionEvaluation\getTextAnswers().

+ Here is the caller graph for this function:

◆ getMean()

ilSurveyEvaluationResults::getMean ( )

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

127 : float
128 {
130 }

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedian()

ilSurveyEvaluationResults::getMedian ( )
Returns
array|string

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

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedianAsText()

ilSurveyEvaluationResults::getMedianAsText ( )

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

150 : string
151 {
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...

References $lng.

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeNrOfSelections()

ilSurveyEvaluationResults::getModeNrOfSelections ( )

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

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeValue()

ilSurveyEvaluationResults::getModeValue ( )
Returns
array|string

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

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeValueAsText()

ilSurveyEvaluationResults::getModeValueAsText ( )

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

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 }

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

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ 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.

52 {
53 return $this->question;
54 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $question.

Referenced by SurveyMetricQuestionEvaluation\getChart(), and SurveyQuestionEvaluation\getChart().

+ 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.

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 }

◆ getUserResults()

ilSurveyEvaluationResults::getUserResults ( int  $a_active_id)

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

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 }

◆ getUsersAnswered()

ilSurveyEvaluationResults::getUsersAnswered ( )

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

References $users_answered.

◆ getUsersSkipped()

ilSurveyEvaluationResults::getUsersSkipped ( )

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

References $users_skipped.

◆ getVariables()

ilSurveyEvaluationResults::getVariables ( )

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

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

Referenced by SurveyQuestionEvaluation\getChart(), and SurveyQuestionEvaluation\getExportGrid().

+ Here is the caller graph for this function:

◆ setMean()

ilSurveyEvaluationResults::setMean ( float  $a_mean)

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

122 : void
123 {
124 $this->arithmetic_mean = $a_mean;
125 }

◆ setMedian()

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

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

135 : void
136 {
137 $this->median = is_array($a_value)
138 ? $a_value
139 : trim($a_value ?? "");
140 }

◆ setMode()

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

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

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 }

◆ setUsersAnswered()

ilSurveyEvaluationResults::setUsersAnswered ( int  $a_value)

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

56 : void
57 {
58 $this->users_answered = $a_value;
59 }

◆ setUsersSkipped()

ilSurveyEvaluationResults::setUsersSkipped ( int  $a_value)

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

66 : void
67 {
68 $this->users_skipped = $a_value;
69 }

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.

◆ $lng

ilLanguage ilSurveyEvaluationResults::$lng
protected

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

◆ $median

ilSurveyEvaluationResults::$median
protected

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

◆ $mode_nr_of_selections

int ilSurveyEvaluationResults::$mode_nr_of_selections = 0
protected

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

◆ $mode_value

ilSurveyEvaluationResults::$mode_value
protected

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

◆ $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: