ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 require_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 }
setPoints($points=0.0)
Sets the points.
getId()
Gets the answer id.
getPoints()
Gets the points.
checkPoints($a_points)
Checks, if the point value is numeric.
Class for simple answers.
setOrder($order=0)
Sets the order.
__construct( $answertext="", $points=0.0, $order=0, $id=-1)
ASS_AnswerSimple constructor.
getAnswertext()
Gets the answer text.
setAnswertext($answertext="")
Sets the answer text.
getOrder()
Gets the sort/display order.
setId($id=-1)
Sets the answer id.