ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $key, and 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.
$key
Definition: croninfo.php:18

◆ getReachedPercentage()

ilUserQuestionResult::getReachedPercentage ( )
Returns
int

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

References $reached_percentage.

◆ getSolutionForKey()

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

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

References $key.

114  {
115  foreach ($this->solutions as $solution) {
116  if ($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key) {
117  return $solution;
118  }
119  }
120  return null;
121  }
$key
Definition: croninfo.php:18

◆ getSolutions()

ilUserQuestionResult::getSolutions ( )
Returns
array

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

References $solutions.

104  {
105  return $this->solutions;
106  }

◆ getUserSolutionsByIdentifier()

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

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

References $solutions, and array.

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

◆ hasSolutions()

ilUserQuestionResult::hasSolutions ( )
Returns
boolean

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

143  {
144  return count($this->solutions) > 0;
145  }

◆ removeByKey()

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

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

References $key.

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

◆ setReachedPercentage()

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

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

References $reached_percentage.

127  {
128  $this->reached_percentage = $reached_percentage;
129  }

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: