ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.assNumericRange.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 
21 {
29  protected $lowerlimit;
30 
38  protected $upperlimit;
39 
47  protected $points;
48 
56  protected $order;
57 
70  public function __construct($lowerlimit = 0.0, $upperlimit = 0.0, $points = 0.0, $order = 0)
71  {
72  $this->lowerlimit = $lowerlimit;
73  $this->upperlimit = $upperlimit;
74  $this->points = $points;
75  $this->order = $order;
76  }
77 
87  public function getLowerLimit()
88  {
89  return $this->lowerlimit;
90  }
91 
101  public function getUpperLimit()
102  {
103  return $this->upperlimit;
104  }
105 
115  public function getPoints()
116  {
117  return $this->points;
118  }
119 
129  public function getOrder()
130  {
131  return $this->order;
132  }
133 
143  public function setLowerLimit($limit)
144  {
145  $this->lowerlimit = $limit;
146  }
147 
157  public function setUpperLimit($limit)
158  {
159  $this->upperlimit = $limit;
160  }
161 
171  public function setPoints($points)
172  {
173  $this->points = $points;
174  }
175 
185  public function setOrder($order)
186  {
187  $this->order = $order;
188  }
189 
202  public function contains($value)
203  {
204  require_once './Services/Math/classes/class.EvalMath.php';
205  $eval = new EvalMath();
206  $eval->suppress_errors = true;
207  $result = $eval->e($value);
208  if (($result === false) || ($result === true)) {
209  return false;
210  }
211 
212  if (($result >= $eval->e($this->lowerlimit)) && ($result <= $eval->e($this->upperlimit))) {
213  return true;
214  } else {
215  return false;
216  }
217  }
218 }
setUpperLimit($limit)
Set the upper limit.
getOrder()
Get the order of the range.
Class for numeric ranges of questions.
$result
getLowerLimit()
Get the lower limit.
contains($value)
Checks for a given value within the range.
getUpperLimit()
Get the upper limit.
setOrder($order)
Set the order.
getPoints()
Get the points.
__construct($lowerlimit=0.0, $upperlimit=0.0, $points=0.0, $order=0)
assNumericRange constructor
setLowerLimit($limit)
Set the lower limit.
setPoints($points)
Set the points.