ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.assAnswerTrueFalse.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
5 require_once './Modules/Test/classes/inc.AssessmentConstants.php';
6 
22 {
30  public $correctness;
31 
42  public function __construct($answertext = "", $points = 0.0, $order = 0, $correctness = false)
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  }
51 
57  public function getCorrectness()
58  {
59  return $this->correctness;
60  }
61 
67  public function isCorrect()
68  {
69  return $this->correctness;
70  }
71 
77  public function isIncorrect()
78  {
79  return !$this->correctness;
80  }
81 
89  public function isTrue()
90  {
91  return $this->correctness;
92  }
93 
101  public function isFalse()
102  {
103  return !$this->correctness;
104  }
105 
111  public function setCorrectness($correctness = false)
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  }
118 
124  public function setTrue()
125  {
126  $this->correctness = "1";
127  }
128 
134  public function setFalse()
135  {
136  $this->correctness = "0";
137  }
138 }
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.
Class for simple answers.
setFalse()
Sets the answer as a incorrect answer.
isIncorrect()
Gets the correctness.
isTrue()
Gets the correctness.
Class for true/false or yes/no answers.
isCorrect()
Gets the correctness.