ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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

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.

{
$this->question = $question;
$this->active_id = $active_id;
$this->pass = $pass;
}

Member Function Documentation

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

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

{
$this->solutions[] = array(
self::$USER_SOLUTION_IDENTIFIER_KEY => $key,
self::$USER_SOLUTION_IDENTIFIER_VALUE => $value
);
}
ilUserQuestionResult::getReachedPercentage ( )
Returns
int

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

References $reached_percentage.

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

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

{
foreach($this->solutions as $solution)
{
if($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key)
{
return $solution;
}
}
return null;
}
ilUserQuestionResult::getSolutions ( )
Returns
array

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

References $solutions.

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

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

References $solutions.

{
if(
$identifier != self::$USER_SOLUTION_IDENTIFIER_KEY &&
$identifier != self::$USER_SOLUTION_IDENTIFIER_VALUE
)
{
throw new Exception(sprintf("Unkown Identifier %s", $identifier));
}
$solutions = array();
foreach($this->solutions as $solution)
{
$solutions[] = $solution[$identifier];
}
return $solutions;
}
ilUserQuestionResult::hasSolutions ( )
Returns
boolean

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

{
return count($this->solutions) > 0;
}
ilUserQuestionResult::removeByKey (   $key)
Parameters
string$key

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

{
foreach($this->solutions as $array_key => $solution)
{
if($solution[self::$USER_SOLUTION_IDENTIFIER_KEY] == $key)
{
unset($this->solutions[$array_key]);
break;
}
}
}
ilUserQuestionResult::setReachedPercentage (   $reached_percentage)
Parameters
int$reached_percentage

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

References $reached_percentage.

{
$this->reached_percentage = $reached_percentage;
}

Field Documentation

ilUserQuestionResult::$active_id
protected

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

Referenced by __construct().

ilUserQuestionResult::$pass
protected

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

Referenced by __construct().

ilUserQuestionResult::$question
protected

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

Referenced by __construct().

ilUserQuestionResult::$reached_percentage
protected

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

Referenced by getReachedPercentage(), and setReachedPercentage().

ilUserQuestionResult::$solutions = array()
protected

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

Referenced by getSolutions(), and getUserSolutionsByIdentifier().

ilUserQuestionResult::$USER_SOLUTION_IDENTIFIER_KEY = "key"
static

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

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: