ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 }