ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 (string|array $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
 
array string null $mode_value = null
 
int $mode_nr_of_selections = 0
 
float $arithmetic_mean = 0
 
string array null $median = null
 
array $variables = []
 
array $answers = []
 

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

38 {
39 global $DIC;
40
41 $this->lng = $DIC->language();
42 $this->question = $a_question;
43 }
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 173 of file class.ilSurveyEvaluationResults.php.

175 : void {
176 $this->answers[] = $a_answer;
177 }

◆ addVariable()

ilSurveyEvaluationResults::addVariable ( ilSurveyEvaluationResultsVariable  $a_variable)

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

164 : void {
165 $this->variables[] = $a_variable;
166 }

◆ getAnswers()

ilSurveyEvaluationResults::getAnswers ( )

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

179 : array
180 {
181 return $this->answers ?? [];
182 }

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

205 : string {
206 if (!count($this->variables)) {
207 return $a_value;
208 } else {
209 foreach ($this->variables as $var) {
210 if ($var->cat->scale == $a_value) {
211 return $var->cat->title;
212 }
213 }
214 }
215 return "";
216 }

◆ getMappedTextAnswers()

ilSurveyEvaluationResults::getMappedTextAnswers ( )

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

218 : array
219 {
220 $res = array();
221
222 foreach ($this->answers as $answer) {
223 if ($answer->text) {
224 $res[$this->getScaleText($answer->value)][] = $answer->text;
225 }
226 }
227
228 return $res;
229 }
$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 121 of file class.ilSurveyEvaluationResults.php.

121 : float
122 {
124 }

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedian()

ilSurveyEvaluationResults::getMedian ( )
Returns
array|string

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

139 : string|array
140 {
141 return $this->median;
142 }

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getMedianAsText()

ilSurveyEvaluationResults::getMedianAsText ( )

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

144 : string
145 {
147
148 if ($this->median === null) {
149 return "";
150 }
151
152 if (!is_array($this->median)) {
153 return $this->getScaleText($this->median);
154 }
155
156 return $lng->txt("median_between") . " " .
157 $this->getScaleText($this->median[0]) . " " .
158 $lng->txt("and") . " " .
159 $this->getScaleText($this->median[1]);
160 }
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 111 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 86 of file class.ilSurveyEvaluationResults.php.

86 : array|string|null
87 {
88 return $this->mode_value;
89 }

Referenced by ilSurveyEvaluationGUI\parseResultsToExcel().

+ Here is the caller graph for this function:

◆ getModeValueAsText()

ilSurveyEvaluationResults::getModeValueAsText ( )

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

91 : string
92 {
93 if ($this->mode_value === null) {
94 return "";
95 }
96
97 $res = array();
98
99 $mvalues = $this->mode_value;
100 if (!is_array($mvalues)) {
101 $mvalues = array($mvalues);
102 }
103 sort($mvalues, SORT_NUMERIC);
104 foreach ($mvalues as $value) {
105 $res[] = $this->getScaleText($value);
106 }
107
108 return implode(", ", $res);
109 }

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

46 {
47 return $this->question;
48 }
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 188 of file class.ilSurveyEvaluationResults.php.

190 : string {
191 if (!count($this->variables)) {
192 return $a_value;
193 } else {
194 foreach ($this->variables as $var) {
195 if ($var->cat->scale == $a_value) {
196 return $var->cat->title . " [" . $a_value . "]";
197 }
198 }
199 }
200 return "";
201 }

◆ getUserResults()

ilSurveyEvaluationResults::getUserResults ( int  $a_active_id)

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

233 : array {
234 $res = array();
235
236 $answers = $this->getAnswers();
237 if ($answers) {
238 foreach ($answers as $answer) {
239 if ($answer->active_id == $a_active_id) {
240 $res[] = array(
241 $this->getScaleText($answer->value),
242 $answer->text,
243 $answer->value,
244 $this->getCatTitle($answer->value)
245 );
246 }
247 }
248 }
249
250 return $res;
251 }

◆ getUsersAnswered()

ilSurveyEvaluationResults::getUsersAnswered ( )

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

References $users_answered.

◆ getUsersSkipped()

ilSurveyEvaluationResults::getUsersSkipped ( )

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

References $users_skipped.

◆ getVariables()

ilSurveyEvaluationResults::getVariables ( )

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

168 : array
169 {
170 return $this->variables ?? [];
171 }

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

+ Here is the caller graph for this function:

◆ setMean()

ilSurveyEvaluationResults::setMean ( float  $a_mean)

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

116 : void
117 {
118 $this->arithmetic_mean = $a_mean;
119 }

◆ setMedian()

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

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

129 : void
130 {
131 $this->median = is_array($a_value)
132 ? $a_value
133 : trim($a_value ?? "");
134 }

◆ setMode()

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

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

76 : void {
77 $this->mode_value = is_array($a_value)
78 ? $a_value
79 : trim($a_value ?? "");
80 $this->mode_nr_of_selections = $a_nr_of_selections;
81 }

◆ setUsersAnswered()

ilSurveyEvaluationResults::setUsersAnswered ( int  $a_value)

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

50 : void
51 {
52 $this->users_answered = $a_value;
53 }

◆ setUsersSkipped()

ilSurveyEvaluationResults::setUsersSkipped ( int  $a_value)

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

60 : void
61 {
62 $this->users_skipped = $a_value;
63 }

Field Documentation

◆ $answers

array ilSurveyEvaluationResults::$answers = []
protected

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

◆ $arithmetic_mean

float ilSurveyEvaluationResults::$arithmetic_mean = 0
protected

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

◆ $lng

ilLanguage ilSurveyEvaluationResults::$lng
protected

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

◆ $median

string array null ilSurveyEvaluationResults::$median = null
protected

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

◆ $mode_nr_of_selections

int ilSurveyEvaluationResults::$mode_nr_of_selections = 0
protected

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

◆ $mode_value

array string null ilSurveyEvaluationResults::$mode_value = null
protected

Definition at line 29 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 = []
protected

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


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