ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.assAnswerTrueFalse.php
Go to the documentation of this file.
1<?php
2
34{
43
54 public function __construct($answertext = "", $points = 0.0, $order = 0, $correctness = false)
55 {
57
58 // force $this->correctness to be a string
59 // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!!
60 // (maybe that only happens for certain mysql versions)
61 $this->correctness = $correctness . "";
62 }
63
69 public function getCorrectness()
70 {
71 return $this->correctness;
72 }
73
79 public function isCorrect()
80 {
81 return $this->correctness;
82 }
83
89 public function isIncorrect(): bool
90 {
91 return !$this->correctness;
92 }
93
101 public function isTrue()
102 {
103 return $this->correctness;
104 }
105
113 public function isFalse(): bool
114 {
115 return !$this->correctness;
116 }
117
123 public function setCorrectness($correctness = false): void
124 {
125 // force $this->correctness to be a string
126 // ilDB->quote makes 1 from true and saving it to ENUM('1','0') makes that '0'!!!
127 // (maybe that only happens for certain mysql versions)
128 $this->correctness = $correctness . "";
129 }
130
136 public function setTrue(): void
137 {
138 $this->correctness = "1";
139 }
140
146 public function setFalse(): void
147 {
148 $this->correctness = "0";
149 }
150}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__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.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc