ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
163 $this->order = $order;
164 }
165 }
166
174 public function setId($id = -1)
175 {
176 $this->id = $id;
177 }
178
188 public function setAnswertext($answertext = "")
189 {
190 $this->answertext = $answertext;
191 }
192
204 public function setPoints($points = 0.0)
205 {
206 $new_points = str_replace(",", ".", $points);
207 if ($this->checkPoints($new_points))
208 {
209 $this->points = $new_points;
210 }
211 else
212 {
213 $this->points = 0.0;
214 }
215 }
216}
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.