ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.assAnswerSimple.php
Go to the documentation of this file.
1<?php
2
30{
31 protected string $answertext;
32
40 protected $points;
41
49 protected $order;
50
58 protected $id;
59
70 public function __construct($answertext = "", $points = 0.0, $order = 0, $id = -1)
71 {
72 $this->answertext = $answertext;
73 $this->setPoints($points);
74 $this->order = $order;
75 $this->id = $id;
76 }
77
87 public function getId(): int
88 {
89 return $this->id;
90 }
91
101 public function getAnswertext(): string
102 {
103 return $this->answertext;
104 }
105
115 public function getPoints(): float
116 {
117 return $this->points;
118 }
119
131 public function checkPoints($a_points): bool
132 {
133 return is_numeric($a_points);
134 }
135
145 public function getOrder(): int
146 {
147 return $this->order;
148 }
149
161 public function setOrder($order = 0): void
162 {
163 if ($order >= 0) {
164 $this->order = $order;
165 }
166 }
167
175 public function setId($id = -1): void
176 {
177 $this->id = $id;
178 }
179
189 public function setAnswertext($answertext = ""): void
190 {
191 $this->answertext = $answertext;
192 }
193
205 public function setPoints($points = 0.0): void
206 {
207 $new_points = str_replace(",", ".", $points);
208 if ($this->checkPoints($new_points)) {
209 $this->points = $new_points;
210 } else {
211 $this->points = 0.0;
212 }
213 }
214}
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.