ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.assAnswerSimple.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 
24 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
25 
36 {
45 
53  var $points;
54 
62  var $order;
63 
71  var $id;
72 
83  function ASS_AnswerSimple (
84  $answertext = "",
85  $points = 0.0,
86  $order = 0,
87  $id = -1
88  )
89  {
90  $this->answertext = $answertext;
91  $this->setPoints($points);
92  $this->order = $order;
93  $this->id = $id;
94  }
95 
105  function getId()
106  {
107  return $this->id;
108  }
109 
119  function getAnswertext()
120  {
121  //$tmpanswertext = "<![CDATA[".$this->answertext."]]>";
122  $tmpanswertext = $this->answertext;
123  return $tmpanswertext;
124  }
125 
135  function getPoints()
136  {
137  return $this->points;
138  }
139 
149  function checkPoints($a_points)
150  {
151  return is_numeric($a_points);
152  }
153 
163  function getOrder()
164  {
165  return $this->order;
166  }
167 
177  function setOrder($order = 0)
178  {
179  if ($order >= 0)
180  {
181  $this->order = $order;
182  }
183  }
184 
194  function setId($id = -1)
195  {
196  $this->order = $order;
197  }
198 
208  function setAnswertext($answertext = "")
209  {
210  $this->answertext = $answertext;
211  }
212 
222  function setPoints($points = 0.0)
223  {
224  $new_points = str_replace(",", ".", $points);
225  if ($this->checkPoints($new_points))
226  {
227  $this->points = $new_points;
228  }
229  else
230  {
231  $this->points = 0.0;
232  }
233  }
234 }
235 
236 ?>