ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ASS_AnswerSimple Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ASS_AnswerSimple:
+ Collaboration diagram for ASS_AnswerSimple:

Public Member Functions

 __construct ($answertext="", $points=0.0, $order=0, $id=-1)
 ASS_AnswerSimple constructor. More...
 
 getId ()
 Gets the answer id. More...
 
 getAnswertext ()
 Gets the answer text. More...
 
 getPoints ()
 Gets the points. More...
 
 checkPoints ($a_points)
 Checks, if the point value is numeric. More...
 
 getOrder ()
 Gets the sort/display order. More...
 
 setOrder ($order=0)
 Sets the order. More...
 
 setId ($id=-1)
 Sets the answer id. More...
 
 setAnswertext ($answertext="")
 Sets the answer text. More...
 
 setPoints ($points=0.0)
 Sets the points. More...
 

Protected Attributes

string $answertext
 
 $points
 
 $order
 
 $id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for simple answers

ASS_AnswerSimple is a class for simple answers used for example in cloze tests with text gap.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

Definition at line 31 of file class.assAnswerSimple.php.

Constructor & Destructor Documentation

◆ __construct()

ASS_AnswerSimple::__construct (   $answertext = "",
  $points = 0.0,
  $order = 0,
  $id = -1 
)

ASS_AnswerSimple constructor.

The constructor takes possible arguments an creates an instance of the ASS_AnswerSimple object.

Parameters
string$answertextA string defining the answer text
double$pointsThe number of points given for the selected answer
integer$orderA nonnegative value representing a possible display or sort order
integer$idThe database id of the answer

Reimplemented in ASS_AnswerTrueFalse.

Definition at line 72 of file class.assAnswerSimple.php.

73 {
74 $this->answertext = $answertext;
75 $this->setPoints($points);
76 $this->order = $order;
77 $this->id = $id;
78 }
setPoints($points=0.0)
Sets the points.

References $answertext, $id, $order, $points, and setPoints().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkPoints()

ASS_AnswerSimple::checkPoints (   $a_points)

Checks, if the point value is numeric.

Parameters
$a_pointsdouble Points which are checked if they're numeric.
Returns
boolean true if the point value is numeric, false otherwise
See also
$points

@TODO Find usages and see if this method can be set deprecated due to the simpleton-pattern it is on is_numeric.

Definition at line 133 of file class.assAnswerSimple.php.

133 : bool
134 {
135 return is_numeric($a_points);
136 }

Referenced by setPoints(), ASS_AnswerImagemap\setPointsUnchecked(), and ASS_AnswerMultipleResponse\setPointsUnchecked().

+ Here is the caller graph for this function:

◆ getAnswertext()

ASS_AnswerSimple::getAnswertext ( )

Gets the answer text.

Returns the answer text

Returns
string answer text
See also
$answertext

Definition at line 103 of file class.assAnswerSimple.php.

103 : string
104 {
105 return $this->answertext;
106 }

References $answertext.

Referenced by ilAssClozeTestFeedback\buildSelectGapOptionFeedbackLabel(), ilAssClozeTestFeedback\buildTextGapGivenAnswerFeedbackLabel(), assAnswerCloze\getNumericValueFromAnswerText(), assAnswerCloze\setLowerBound(), and assAnswerCloze\setUpperBound().

+ Here is the caller graph for this function:

◆ getId()

ASS_AnswerSimple::getId ( )

Gets the answer id.

Returns the answer id

Returns
integer answer id
See also
$id

Definition at line 89 of file class.assAnswerSimple.php.

89 : int
90 {
91 return $this->id;
92 }

References $id.

◆ getOrder()

ASS_AnswerSimple::getOrder ( )

Gets the sort/display order.

Returns a nonnegative order value for display or sorting

Returns
integer order
See also
$order

Definition at line 147 of file class.assAnswerSimple.php.

147 : int
148 {
149 return $this->order;
150 }

References $order.

◆ getPoints()

ASS_AnswerSimple::getPoints ( )

Gets the points.

Returns the points

Returns
double points
See also
$points

Definition at line 117 of file class.assAnswerSimple.php.

117 : float
118 {
119 return $this->points;
120 }

References $points.

Referenced by ASS_AnswerMultipleResponse\getPointsChecked().

+ Here is the caller graph for this function:

◆ setAnswertext()

ASS_AnswerSimple::setAnswertext (   $answertext = "")

Sets the answer text.

Sets the answer text

Parameters
string$answertextThe answer text
See also
$answertext

Definition at line 191 of file class.assAnswerSimple.php.

191 : void
192 {
193 $this->answertext = $answertext;
194 }

References $answertext.

Referenced by assClozeTestGUI\saveNumericGapCorrectionFormProperty().

+ Here is the caller graph for this function:

◆ setId()

ASS_AnswerSimple::setId (   $id = -1)

Sets the answer id.

Parameters
integer$idanswer id
See also
$id

Definition at line 177 of file class.assAnswerSimple.php.

177 : void
178 {
179 $this->id = $id;
180 }

References $id.

◆ setOrder()

ASS_AnswerSimple::setOrder (   $order = 0)

Sets the order.

Sets the nonnegative order value which can be used for sorting or displaying multiple answers

Parameters
integer$orderA nonnegative integer
See also
$order

@TODO Find usage and see if we can get rid of "magic ignorance" of the input value.

Definition at line 163 of file class.assAnswerSimple.php.

163 : void
164 {
165 if ($order >= 0) {
166 $this->order = $order;
167 }
168 }

References $order.

◆ setPoints()

ASS_AnswerSimple::setPoints (   $points = 0.0)

Sets the points.

Sets the points given for selecting the answer. You can even use negative values for wrong answers.

Parameters
double$pointsThe points given for the answer
See also
$points

@TODO Find usages and see if we can get rid of "magic nullification" here.

Definition at line 207 of file class.assAnswerSimple.php.

207 : void
208 {
209 $new_points = str_replace(",", ".", $points);
210 if ($this->checkPoints($new_points)) {
211 $this->points = $new_points;
212 } else {
213 $this->points = 0.0;
214 }
215 }
checkPoints($a_points)
Checks, if the point value is numeric.

References $points, and checkPoints().

Referenced by __construct(), assClozeTestGUI\saveNumericGapCorrectionFormProperty(), and ASS_AnswerMultipleResponse\setPointsChecked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $answertext

◆ $id

◆ $order

◆ $points


The documentation for this class was generated from the following file: