ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
ASS_AnswerTrueFalse Class Reference

Class for true/false or yes/no answers. More...

+ Inheritance diagram for ASS_AnswerTrueFalse:
+ Collaboration diagram for ASS_AnswerTrueFalse:

Public Member Functions

 ASS_AnswerTrueFalse ( $answertext="", $points=0.0, $order=0, $correctness=false)
 ASS_AnswerTrueFalse constructor. More...
 
 getCorrectness ()
 Gets the correctness. More...
 
 isCorrect ()
 Gets the correctness. More...
 
 isIncorrect ()
 Gets the correctness. More...
 
 isTrue ()
 Gets the correctness. More...
 
 isFalse ()
 Gets the correctness. More...
 
 setCorrectness ($correctness=FALSE)
 Sets the correctness. More...
 
 setTrue ()
 Sets the answer as a correct answer. More...
 
 setFalse ()
 Sets the answer as a incorrect answer. More...
 
- Public Member Functions inherited from ASS_AnswerSimple
 __construct ( $answertext="", $points=0.0, $order=0, $id=-1)
 ASS_AnswerSimple constructor. More...
 
 getId ()
 Gets the answer id. More...
 
 getAnswertext ()
 Gets the answer text. More...
 
 getPoints ()
 Gets the points. More...
 
 checkPoints ($a_points)
 Checks, if the point value is numeric. More...
 
 getOrder ()
 Gets the sort/display order. More...
 
 setOrder ($order=0)
 Sets the order. More...
 
 setId ($id=-1)
 Sets the answer id. More...
 
 setAnswertext ($answertext="")
 Sets the answer text. More...
 
 setPoints ($points=0.0)
 Sets the points. More...
 

Data Fields

 $correctness
 

Additional Inherited Members

- Protected Attributes inherited from ASS_AnswerSimple
 $answertext
 
 $points
 
 $order
 
 $id
 

Detailed Description

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.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

: Get rid of integers in favor of booleans here.

Definition at line 21 of file class.assAnswerTrueFalse.php.

Member Function Documentation

◆ ASS_AnswerTrueFalse()

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.

Parameters
string$answertextA string defining the answer text
double$pointsThe number of points given for the selected answer
boolean$correctnessA boolean value indicating the correctness of the answer
integer$orderA nonnegative value representing a possible display or sort order

Definition at line 42 of file class.assAnswerTrueFalse.php.

References ASS_AnswerSimple\$answertext, ASS_AnswerSimple\$order, and ASS_AnswerSimple\$points.

43  {
44  parent::__construct($answertext, $points, $order);
45 
46  // force $this->correctness to be a string
47  // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!!
48  // (maybe that only happens for certain mysql versions)
49  $this->correctness = $correctness."";
50  }

◆ getCorrectness()

ASS_AnswerTrueFalse::getCorrectness ( )

Gets the correctness.

Returns
boolean correctness

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

References $correctness.

◆ isCorrect()

ASS_AnswerTrueFalse::isCorrect ( )

Gets the correctness.

Returns
boolean correctness

Definition at line 67 of file class.assAnswerTrueFalse.php.

References $correctness.

◆ isFalse()

ASS_AnswerTrueFalse::isFalse ( )

Gets the correctness.

Deprecated:
Use isIncorrect instead.
Returns
boolean correctness

Definition at line 101 of file class.assAnswerTrueFalse.php.

References $correctness.

102  {
103  return !$this->correctness;
104  }

◆ isIncorrect()

ASS_AnswerTrueFalse::isIncorrect ( )

Gets the correctness.

Returns
boolean correctness

Definition at line 77 of file class.assAnswerTrueFalse.php.

References $correctness.

78  {
79  return !$this->correctness;
80  }

◆ isTrue()

ASS_AnswerTrueFalse::isTrue ( )

Gets the correctness.

Deprecated:
Use isCorrect instead.
Returns
boolean correctness

Definition at line 89 of file class.assAnswerTrueFalse.php.

References $correctness.

◆ setCorrectness()

ASS_AnswerTrueFalse::setCorrectness (   $correctness = FALSE)

Sets the correctness.

Parameters
boolean$correctnessA boolean value indicating the correctness of the answer

Definition at line 111 of file class.assAnswerTrueFalse.php.

112  {
113  // force $this->correctness to be a string
114  // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!!
115  // (maybe that only happens for certain mysql versions)
116  $this->correctness = $correctness."";
117  }

◆ setFalse()

ASS_AnswerTrueFalse::setFalse ( )

Sets the answer as a incorrect answer.

Deprecated:
Use setCorrectness instead.

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

135  {
136  $this->correctness = "0";
137  }

◆ setTrue()

ASS_AnswerTrueFalse::setTrue ( )

Sets the answer as a correct answer.

Deprecated:
Use setCorrectness instead.

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

125  {
126  $this->correctness = "1";
127  }

Field Documentation

◆ $correctness

ASS_AnswerTrueFalse::$correctness

Definition at line 30 of file class.assAnswerTrueFalse.php.

Referenced by getCorrectness(), isCorrect(), isFalse(), isIncorrect(), and isTrue().


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