ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ASS_AnswerTrueFalse Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ($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
string $answertext
 
 $points
 
 $order
 
 $id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 35 of file class.assAnswerTrueFalse.php.

Constructor & Destructor Documentation

◆ __construct()

ASS_AnswerTrueFalse::__construct (   $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 56 of file class.assAnswerTrueFalse.php.

References ASS_AnswerSimple\$answertext, $correctness, ASS_AnswerSimple\$order, ASS_AnswerSimple\$points, and ILIAS\GlobalScreen\Provider\__construct().

57  {
59 
60  // force $this->correctness to be a string
61  // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!!
62  // (maybe that only happens for certain mysql versions)
63  $this->correctness = $correctness . "";
64  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getCorrectness()

ASS_AnswerTrueFalse::getCorrectness ( )

Gets the correctness.

Returns
boolean correctness

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

References $correctness.

◆ isCorrect()

ASS_AnswerTrueFalse::isCorrect ( )

Gets the correctness.

Returns
boolean correctness

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

References $correctness.

◆ isFalse()

ASS_AnswerTrueFalse::isFalse ( )

Gets the correctness.

Deprecated:
Use isIncorrect instead.
Returns
boolean correctness

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

References $correctness.

115  : bool
116  {
117  return !$this->correctness;
118  }

◆ isIncorrect()

ASS_AnswerTrueFalse::isIncorrect ( )

Gets the correctness.

Returns
boolean correctness

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

References $correctness.

91  : bool
92  {
93  return !$this->correctness;
94  }

◆ isTrue()

ASS_AnswerTrueFalse::isTrue ( )

Gets the correctness.

Deprecated:
Use isCorrect instead.
Returns
boolean correctness

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

References $correctness.

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

◆ setCorrectness()

ASS_AnswerTrueFalse::setCorrectness (   $correctness = false)

Sets the correctness.

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

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

References $correctness.

125  : void
126  {
127  // force $this->correctness to be a string
128  // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!!
129  // (maybe that only happens for certain mysql versions)
130  $this->correctness = $correctness . "";
131  }

◆ setFalse()

ASS_AnswerTrueFalse::setFalse ( )

Sets the answer as a incorrect answer.

Deprecated:
Use setCorrectness instead.

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

148  : void
149  {
150  $this->correctness = "0";
151  }

◆ setTrue()

ASS_AnswerTrueFalse::setTrue ( )

Sets the answer as a correct answer.

Deprecated:
Use setCorrectness instead.

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

138  : void
139  {
140  $this->correctness = "1";
141  }

Field Documentation

◆ $correctness

ASS_AnswerTrueFalse::$correctness

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