Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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 ?>