ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.assAnswerSimple.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/Test/classes/inc.AssessmentConstants.php';
5
19{
27 protected $answertext;
28
36 protected $points;
37
45 protected $order;
46
54 protected $id;
55
68 public function __construct($answertext = "", $points = 0.0, $order = 0, $id = -1)
69 {
70 $this->answertext = $answertext;
71 $this->setPoints($points);
72 $this->order = $order;
73 $this->id = $id;
74 }
75
85 public function getId()
86 {
87 return $this->id;
88 }
89
99 public function getAnswertext()
100 {
101 return $this->answertext;
102 }
103
113 public function getPoints()
114 {
115 return $this->points;
116 }
117
129 public function checkPoints($a_points)
130 {
131 return is_numeric($a_points);
132 }
133
143 public function getOrder()
144 {
145 return $this->order;
146 }
147
159 public function setOrder($order = 0)
160 {
161 if ($order >= 0) {
162 $this->order = $order;
163 }
164 }
165
173 public function setId($id = -1)
174 {
175 $this->id = $id;
176 }
177
187 public function setAnswertext($answertext = "")
188 {
189 $this->answertext = $answertext;
190 }
191
203 public function setPoints($points = 0.0)
204 {
205 $new_points = str_replace(",", ".", $points);
206 if ($this->checkPoints($new_points)) {
207 $this->points = $new_points;
208 } else {
209 $this->points = 0.0;
210 }
211 }
212}
Class for simple answers.
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.
An exception for terminatinating execution or to throw for unit testing.