ILIAS  release_8 Revision v8.23
class.assAnswerTrueFalse.php
Go to the documentation of this file.
1 <?php
2 
19 require_once './Modules/Test/classes/inc.AssessmentConstants.php';
20 
36 {
44  public $correctness;
45 
56  public function __construct($answertext = "", $points = 0.0, $order = 0, $correctness = false)
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  }
65 
71  public function getCorrectness()
72  {
73  return $this->correctness;
74  }
75 
81  public function isCorrect()
82  {
83  return $this->correctness;
84  }
85 
91  public function isIncorrect(): bool
92  {
93  return !$this->correctness;
94  }
95 
103  public function isTrue()
104  {
105  return $this->correctness;
106  }
107 
115  public function isFalse(): bool
116  {
117  return !$this->correctness;
118  }
119 
125  public function setCorrectness($correctness = false): 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  }
132 
138  public function setTrue(): void
139  {
140  $this->correctness = "1";
141  }
142 
148  public function setFalse(): void
149  {
150  $this->correctness = "0";
151  }
152 }
getCorrectness()
Gets the correctness.
setTrue()
Sets the answer as a correct answer.
isFalse()
Gets the correctness.
setCorrectness($correctness=false)
Sets the correctness.
__construct($answertext="", $points=0.0, $order=0, $correctness=false)
ASS_AnswerTrueFalse constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFalse()
Sets the answer as a incorrect answer.
__construct(Container $dic, ilPlugin $plugin)
isIncorrect()
Gets the correctness.
isTrue()
Gets the correctness.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isCorrect()
Gets the correctness.