ILIAS  release_8 Revision v8.24
class.assAnswerSimple.php
Go to the documentation of this file.
1<?php
2
19require_once './Modules/Test/classes/inc.AssessmentConstants.php';
20
32{
33 protected string $answertext;
34
42 protected $points;
43
51 protected $order;
52
60 protected $id;
61
72 public function __construct($answertext = "", $points = 0.0, $order = 0, $id = -1)
73 {
74 $this->answertext = $answertext;
75 $this->setPoints($points);
76 $this->order = $order;
77 $this->id = $id;
78 }
79
89 public function getId(): int
90 {
91 return $this->id;
92 }
93
103 public function getAnswertext(): string
104 {
105 return $this->answertext;
106 }
107
117 public function getPoints(): float
118 {
119 return $this->points;
120 }
121
133 public function checkPoints($a_points): bool
134 {
135 return is_numeric($a_points);
136 }
137
147 public function getOrder(): int
148 {
149 return $this->order;
150 }
151
163 public function setOrder($order = 0): void
164 {
165 if ($order >= 0) {
166 $this->order = $order;
167 }
168 }
169
177 public function setId($id = -1): void
178 {
179 $this->id = $id;
180 }
181
191 public function setAnswertext($answertext = ""): void
192 {
193 $this->answertext = $answertext;
194 }
195
207 public function setPoints($points = 0.0): void
208 {
209 $new_points = str_replace(",", ".", $points);
210 if ($this->checkPoints($new_points)) {
211 $this->points = $new_points;
212 } else {
213 $this->points = 0.0;
214 }
215 }
216}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOrder($order=0)
Sets the order.
__construct($answertext="", $points=0.0, $order=0, $id=-1)
ASS_AnswerSimple constructor.
getOrder()
Gets the sort/display order.
getPoints()
Gets the points.
checkPoints($a_points)
Checks, if the point value is numeric.
setId($id=-1)
Sets the answer id.
getId()
Gets the answer id.
setAnswertext($answertext="")
Sets the answer text.
setPoints($points=0.0)
Sets the points.
getAnswertext()
Gets the answer text.