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

Public Member Functions

 __construct ($question, $active_id, $pass)
 
 addKeyValue ($key, $value)
 
 removeByKey ($key)
 
 getUserSolutionsByIdentifier ($identifier)
 
 getSolutions ()
 
 getSolutionForKey ($key)
 
 setReachedPercentage ($reached_percentage)
 
 getReachedPercentage ()
 
 hasSolutions ()
 

Static Public Attributes

static $USER_SOLUTION_IDENTIFIER_KEY = "key"
 
static $USER_SOLUTION_IDENTIFIER_VALUE = "value"
 

Protected Attributes

 $question
 
 $active_id
 
 $pass
 
 $reached_percentage
 
 $solutions = []
 

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 Class ilUserQuestionResult

Date: 10.01.14 Time: 10:03

Author
Thomas Joußen tjous.nosp@m.sen@.nosp@m.datab.nosp@m.ay.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilUserQuestionResult::__construct (   $question,
  $active_id,
  $pass 
)

Definition at line 57 of file class.ilUserQuestionResult.php.

58 {
59 $this->question = $question;
60 $this->active_id = $active_id;
61 $this->pass = $pass;
62 }

References $active_id, $pass, and $question.

Member Function Documentation

◆ addKeyValue()

ilUserQuestionResult::addKeyValue (   $key,
  $value 
)
Parameters
mixed$key
mixed$value

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

68 : void
69 {
70 $this->solutions[] = [
71 self::$USER_SOLUTION_IDENTIFIER_KEY => $key,
72 self::$USER_SOLUTION_IDENTIFIER_VALUE => $value
73 ];
74 }

◆ getReachedPercentage()

ilUserQuestionResult::getReachedPercentage ( )
Returns
int

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

145 : int
146 {
148 }

References $reached_percentage.

◆ getSolutionForKey()

ilUserQuestionResult::getSolutionForKey (   $key)
Parameters
int$key
Returns
array

Definition at line 124 of file class.ilUserQuestionResult.php.

124 : ?array
125 {
126 foreach ($this->solutions as $solution) {
127 if ($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key) {
128 return $solution;
129 }
130 }
131 return null;
132 }

◆ getSolutions()

ilUserQuestionResult::getSolutions ( )
Returns
array

Definition at line 114 of file class.ilUserQuestionResult.php.

114 : array
115 {
116 return $this->solutions;
117 }

References $solutions.

◆ getUserSolutionsByIdentifier()

ilUserQuestionResult::getUserSolutionsByIdentifier (   $identifier)
Parameters
string$identifier
Returns
array
Exceptions
Exception

Definition at line 95 of file class.ilUserQuestionResult.php.

95 : array
96 {
97 if (
98 $identifier != self::$USER_SOLUTION_IDENTIFIER_KEY &&
99 $identifier != self::$USER_SOLUTION_IDENTIFIER_VALUE
100 ) {
101 throw new Exception(sprintf("Unkown Identifier %s", $identifier));
102 }
103
104 $solutions = [];
105 foreach ($this->solutions as $solution) {
106 $solutions[] = $solution[$identifier];
107 }
108 return $solutions;
109 }

References $solutions.

◆ hasSolutions()

ilUserQuestionResult::hasSolutions ( )
Returns
boolean

Definition at line 153 of file class.ilUserQuestionResult.php.

153 : bool
154 {
155 return count($this->solutions) > 0;
156 }

◆ removeByKey()

ilUserQuestionResult::removeByKey (   $key)
Parameters
string$key

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

79 : void
80 {
81 foreach ($this->solutions as $array_key => $solution) {
82 if ($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key) {
83 unset($this->solutions[$array_key]);
84 break;
85 }
86 }
87 }

◆ setReachedPercentage()

ilUserQuestionResult::setReachedPercentage (   $reached_percentage)
Parameters
int$reached_percentage

Definition at line 137 of file class.ilUserQuestionResult.php.

137 : void
138 {
139 $this->reached_percentage = $reached_percentage;
140 }

References $reached_percentage.

Field Documentation

◆ $active_id

ilUserQuestionResult::$active_id
protected

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

Referenced by __construct().

◆ $pass

ilUserQuestionResult::$pass
protected

Definition at line 45 of file class.ilUserQuestionResult.php.

Referenced by __construct().

◆ $question

ilUserQuestionResult::$question
protected

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

Referenced by __construct().

◆ $reached_percentage

ilUserQuestionResult::$reached_percentage
protected

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

Referenced by getReachedPercentage(), and setReachedPercentage().

◆ $solutions

ilUserQuestionResult::$solutions = []
protected

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

Referenced by getSolutions(), and getUserSolutionsByIdentifier().

◆ $USER_SOLUTION_IDENTIFIER_KEY

ilUserQuestionResult::$USER_SOLUTION_IDENTIFIER_KEY = "key"
static

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

◆ $USER_SOLUTION_IDENTIFIER_VALUE

ilUserQuestionResult::$USER_SOLUTION_IDENTIFIER_VALUE = "value"
static

Definition at line 29 of file class.ilUserQuestionResult.php.


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