• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/TestQuestionPool/classes/class.assAnswerSimple.php

Go to the documentation of this file.
00001 <?php
00002  /*
00003    +----------------------------------------------------------------------------+
00004    | ILIAS open source                                                          |
00005    +----------------------------------------------------------------------------+
00006    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne           |
00007    |                                                                            |
00008    | This program is free software; you can redistribute it and/or              |
00009    | modify it under the terms of the GNU General Public License                |
00010    | as published by the Free Software Foundation; either version 2             |
00011    | of the License, or (at your option) any later version.                     |
00012    |                                                                            |
00013    | This program is distributed in the hope that it will be useful,            |
00014    | but WITHOUT ANY WARRANTY; without even the implied warranty of             |
00015    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              |
00016    | GNU General Public License for more details.                               |
00017    |                                                                            |
00018    | You should have received a copy of the GNU General Public License          |
00019    | along with this program; if not, write to the Free Software                |
00020    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 
00021    +----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
00025 
00035 class ASS_AnswerSimple
00036 {
00044         var $answertext;
00045 
00053         var $points;
00054 
00062         var $order;
00063         
00071         var $id;
00072 
00083         function ASS_AnswerSimple (
00084                 $answertext = "",
00085                 $points = 0.0,
00086                 $order = 0,
00087                 $id = -1
00088         )
00089         {
00090                 $this->answertext = $answertext;
00091                 $this->setPoints($points);
00092                 $this->order = $order;
00093                 $this->id = $id;
00094         }
00095 
00105         function getId()
00106         {
00107                 return $this->id;
00108         }
00109         
00119         function getAnswertext()
00120         {
00121           //$tmpanswertext = "<![CDATA[".$this->answertext."]]>";
00122           $tmpanswertext = $this->answertext;
00123                 return $tmpanswertext;
00124         }
00125 
00135         function getPoints()
00136         {
00137                 if (round($this->points) == $this->points)
00138                 {
00139                         return sprintf("%d", $this->points);
00140                 }
00141                 else
00142                 {
00143                         return $this->points;
00144                 }
00145         }
00146         
00156         function checkPoints($a_points)
00157         {
00158                 if (is_numeric($a_points))
00159                 {
00160                         return TRUE;
00161                 }
00162                 else
00163                 {
00164                         return FALSE;
00165                 }
00166         }
00167 
00177         function getOrder()
00178         {
00179                 return $this->order;
00180         }
00181 
00191         function setOrder($order = 0)
00192         {
00193                 if ($order >= 0)
00194                 {
00195                         $this->order = $order;
00196                 }
00197         }
00198 
00208         function setId($id = -1)
00209         {
00210                 $this->order = $order;
00211         }
00212 
00222         function setAnswertext($answertext = "")
00223         {
00224                 $this->answertext = $answertext;
00225         }
00226 
00236         function setPoints($points = 0.0)
00237         {
00238                 $new_points = str_replace(",", ".", $points);
00239                 if ($this->checkPoints($new_points))
00240                 {
00241                         $this->points = $new_points;
00242                 }
00243                 else
00244                 {
00245                         $this->points = 0.0;
00246                 }
00247         }
00248 }
00249 
00250 ?>

Generated on Fri Dec 13 2013 17:56:53 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1