Class for true/false or yes/no answers. More...
Public Member Functions | |
ASS_AnswerTrueFalse ($answertext="", $points=0.0, $order=0, $correctness=FALSE) | |
ASS_AnswerTrueFalse constructor. | |
get_correctness () | |
Gets the correctness. | |
is_correct () | |
Gets the correctness. | |
is_true () | |
Gets the correctness. | |
is_incorrect () | |
Gets the correctness. | |
is_false () | |
Gets the correctness. | |
set_correctness ($correctness=FALSE) | |
Sets the correctness. | |
set_true () | |
Sets the answer as a correct answer. | |
set_false () | |
Sets the answer as a incorrect answer. | |
Data Fields | |
$correctness |
Class for true/false or yes/no answers.
ASS_AnswerTrueFalse is a class for true/false or yes/no answers used for example in multiple choice tests.
class.assAnswerTrueFalse.php Assessment
Definition at line 37 of file class.assAnswerTrueFalse.php.
ASS_AnswerTrueFalse::ASS_AnswerTrueFalse | ( | $ | answertext = "" , |
|
$ | points = 0.0 , |
|||
$ | order = 0 , |
|||
$ | correctness = FALSE | |||
) |
ASS_AnswerTrueFalse constructor.
The constructor takes possible arguments an creates an instance of the ASS_AnswerTrueFalse object.
string | $answertext A string defining the answer text | |
double | $points The number of points given for the selected answer | |
boolean | $correctness A boolean value indicating the correctness of the answer | |
integer | $order A nonnegative value representing a possible display or sort order public |
Definition at line 58 of file class.assAnswerTrueFalse.php.
References ASS_AnswerSimple::$answertext, $correctness, ASS_AnswerSimple::$order, ASS_AnswerSimple::$points, and ASS_AnswerSimple::ASS_AnswerSimple().
{ $this->ASS_AnswerSimple($answertext, $points, $order); // force $this->correctness to be a string // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!! // (maybe that only happens for certain mysql versions) $this->correctness = $correctness.""; }
ASS_AnswerTrueFalse::get_correctness | ( | ) |
Gets the correctness.
Returns the correctness of the answer
Definition at line 82 of file class.assAnswerTrueFalse.php.
{
return $this->correctness;
}
ASS_AnswerTrueFalse::is_correct | ( | ) |
Gets the correctness.
Returns TRUE if the answer is correct
Definition at line 95 of file class.assAnswerTrueFalse.php.
{
return $this->correctness;
}
ASS_AnswerTrueFalse::is_false | ( | ) |
Gets the correctness.
Returns TRUE if the answer is incorrect
Definition at line 134 of file class.assAnswerTrueFalse.php.
{
return !$this->correctness;
}
ASS_AnswerTrueFalse::is_incorrect | ( | ) |
Gets the correctness.
Returns TRUE if the answer is incorrect
Definition at line 121 of file class.assAnswerTrueFalse.php.
{
return !$this->correctness;
}
ASS_AnswerTrueFalse::is_true | ( | ) |
Gets the correctness.
Returns TRUE if the answer is correct
Definition at line 108 of file class.assAnswerTrueFalse.php.
{
return $this->correctness;
}
ASS_AnswerTrueFalse::set_correctness | ( | $ | correctness = FALSE |
) |
Sets the correctness.
Sets the correctness of the answer using TRUE or FALSE values to indicate that the answer is correct or incorrect.
boolean | $correctness A boolean value indicating the correctness of the answer public |
Definition at line 148 of file class.assAnswerTrueFalse.php.
References $correctness.
{ // force $this->correctness to be a string // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!! // (maybe that only happens for certain mysql versions) $this->correctness = $correctness.""; }
ASS_AnswerTrueFalse::set_false | ( | ) |
Sets the answer as a incorrect answer.
Sets the correctness value of the answer to FALSE
public
Definition at line 176 of file class.assAnswerTrueFalse.php.
{
$this->correctness = "0";
}
ASS_AnswerTrueFalse::set_true | ( | ) |
Sets the answer as a correct answer.
Sets the correctness value of the answer to TRUE
public
Definition at line 164 of file class.assAnswerTrueFalse.php.
{
$this->correctness = "1";
}
ASS_AnswerTrueFalse::$correctness |
Definition at line 45 of file class.assAnswerTrueFalse.php.
Referenced by ASS_AnswerTrueFalse(), and set_correctness().