ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilUserQuestionResult Class Reference

Class ilUserQuestionResult. 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 = array()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilUserQuestionResult::__construct (   $question,
  $active_id,
  $pass 
)
Parameters
iQuestionCondition$question
int$active_id
int$pass

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

References $active_id, $pass, and $question.

47  {
48  $this->question = $question;
49  $this->active_id = $active_id;
50  $this->pass = $pass;
51  }

Member Function Documentation

◆ addKeyValue()

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

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

References array.

58  {
59  $this->solutions[] = array(
60  self::$USER_SOLUTION_IDENTIFIER_KEY => $key,
61  self::$USER_SOLUTION_IDENTIFIER_VALUE => $value
62  );
63  }
Create styles array
The data for the language used.

◆ getReachedPercentage()

ilUserQuestionResult::getReachedPercentage ( )
Returns
int

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

References $reached_percentage.

◆ getSolutionForKey()

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

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

118  {
119  foreach($this->solutions as $solution)
120  {
121  if($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key)
122  {
123  return $solution;
124  }
125  }
126  return null;
127  }

◆ getSolutions()

ilUserQuestionResult::getSolutions ( )
Returns
array

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

References $solutions.

108  {
109  return $this->solutions;
110  }

◆ getUserSolutionsByIdentifier()

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

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

References $solutions, and array.

87  {
88  if(
89  $identifier != self::$USER_SOLUTION_IDENTIFIER_KEY &&
90  $identifier != self::$USER_SOLUTION_IDENTIFIER_VALUE
91  )
92  {
93  throw new Exception(sprintf("Unkown Identifier %s", $identifier));
94  }
95 
96  $solutions = array();
97  foreach($this->solutions as $solution)
98  {
99  $solutions[] = $solution[$identifier];
100  }
101  return $solutions;
102  }
Create styles array
The data for the language used.

◆ hasSolutions()

ilUserQuestionResult::hasSolutions ( )
Returns
boolean

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

149  {
150  return count($this->solutions) > 0;
151  }

◆ removeByKey()

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

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

69  {
70  foreach($this->solutions as $array_key => $solution)
71  {
72  if($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key)
73  {
74  unset($this->solutions[$array_key]);
75  break;
76  }
77  }
78  }

◆ setReachedPercentage()

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

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

References $reached_percentage.

133  {
134  $this->reached_percentage = $reached_percentage;
135  }

Field Documentation

◆ $active_id

ilUserQuestionResult::$active_id
protected

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

Referenced by __construct().

◆ $pass

ilUserQuestionResult::$pass
protected

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

Referenced by __construct().

◆ $question

ilUserQuestionResult::$question
protected

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

Referenced by __construct().

◆ $reached_percentage

ilUserQuestionResult::$reached_percentage
protected

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

Referenced by getReachedPercentage(), and setReachedPercentage().

◆ $solutions

ilUserQuestionResult::$solutions = array()
protected

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

Referenced by getSolutions(), and getUserSolutionsByIdentifier().

◆ $USER_SOLUTION_IDENTIFIER_KEY

ilUserQuestionResult::$USER_SOLUTION_IDENTIFIER_KEY = "key"
static

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

◆ $USER_SOLUTION_IDENTIFIER_VALUE

ilUserQuestionResult::$USER_SOLUTION_IDENTIFIER_VALUE = "value"
static

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


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