ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
5require_once './Modules/Test/classes/inc.AssessmentConstants.php';
6
22{
31
42 public function __construct($answertext = "", $points = 0.0, $order = 0, $correctness = false)
43 {
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}
Class for simple answers.
Class for true/false or yes/no answers.
__construct($answertext="", $points=0.0, $order=0, $correctness=false)
ASS_AnswerTrueFalse constructor.
isCorrect()
Gets the correctness.
setTrue()
Sets the answer as a correct answer.
isTrue()
Gets the correctness.
isFalse()
Gets the correctness.
isIncorrect()
Gets the correctness.
setFalse()
Sets the answer as a incorrect answer.
setCorrectness($correctness=false)
Sets the correctness.
getCorrectness()
Gets the correctness.
An exception for terminatinating execution or to throw for unit testing.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc