ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assAnswerCloze Class Reference

Class for cloze question numeric answers. More...

+ Inheritance diagram for assAnswerCloze:
+ Collaboration diagram for assAnswerCloze:

Public Member Functions

 __construct ($answertext="", $points=0.0, $order=0)
 assAnswerCloze constructor
 setLowerBound ($bound)
 Sets the lower boind.
 setUpperBound ($bound)
 Sets the upper bound.
 getLowerBound ()
 Returns the lower bound.
 getUpperBound ()
 Returns the upper bound.
 setGapSize ($gap_size)
 getGapSize ()
- Public Member Functions inherited from ASS_AnswerSimple
 __construct ($answertext="", $points=0.0, $order=0, $id=-1)
 ASS_AnswerSimple constructor.
 getId ()
 Gets the answer id.
 getAnswertext ()
 Gets the answer text.
 getPoints ()
 Gets the points.
 checkPoints ($a_points)
 Checks, if the point value is numeric.
 getOrder ()
 Gets the sort/display order.
 setOrder ($order=0)
 Sets the order.
 setId ($id=-1)
 Sets the answer id.
 setAnswertext ($answertext="")
 Sets the answer text.
 setPoints ($points=0.0)
 Sets the points.

Protected Member Functions

 getNumericValueFromAnswerText ()
 getNumericValueFromText ($text)

Protected Attributes

 $lowerBound
 $upperBound
 $gap_size
- Protected Attributes inherited from ASS_AnswerSimple
 $answertext
 $points
 $order
 $id

Detailed Description

Class for cloze question numeric answers.

assAnswerCloze is a class for cloze questions numeric answers.

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
Version
Id:
class.assAnswerCloze.php 61468 2015-12-15 09:26:35Z gitmgr
See Also
ASS_AnswerBinaryState

Rework class to represent bounds as numerics instead of strings.

Definition at line 23 of file class.assAnswerCloze.php.

Constructor & Destructor Documentation

assAnswerCloze::__construct (   $answertext = "",
  $points = 0.0,
  $order = 0 
)

assAnswerCloze constructor

The constructor takes possible arguments an creates an instance of the assAnswerCloze 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
Returns
assAnswerCloze See if the initialization of the bounds to null can be avoided to have them string/numeric at all times.

Definition at line 64 of file class.assAnswerCloze.php.

References ASS_AnswerSimple\$answertext, ASS_AnswerSimple\$order, and ASS_AnswerSimple\$points.

{
$this->lowerBound = NULL;
$this->upperBound = NULL;
$this->gap_size = 0;
}

Member Function Documentation

assAnswerCloze::getGapSize ( )
Returns
int

Definition at line 160 of file class.assAnswerCloze.php.

References $gap_size.

{
}
assAnswerCloze::getLowerBound ( )

Returns the lower bound.

Returns
null|string

Definition at line 134 of file class.assAnswerCloze.php.

References $lowerBound.

{
}
assAnswerCloze::getNumericValueFromAnswerText ( )
protected

Definition at line 115 of file class.assAnswerCloze.php.

References ASS_AnswerSimple\getAnswertext(), and getNumericValueFromText().

Referenced by setLowerBound(), and setUpperBound().

{
return $this->getNumericValueFromText($this->getAnswertext());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assAnswerCloze::getNumericValueFromText (   $text)
protected

Definition at line 120 of file class.assAnswerCloze.php.

References ilUtil\stripSlashes().

Referenced by getNumericValueFromAnswerText(), setLowerBound(), and setUpperBound().

{
include_once("./Services/Math/classes/class.EvalMath.php");
$eval = new EvalMath();
$eval->suppress_errors = true;
return $eval->e(str_replace(",", ".", ilUtil::stripSlashes($text, FALSE)));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

assAnswerCloze::getUpperBound ( )

Returns the upper bound.

Returns
null|string

Definition at line 144 of file class.assAnswerCloze.php.

References $upperBound.

{
}
assAnswerCloze::setGapSize (   $gap_size)
Parameters
int$gap_size

Definition at line 152 of file class.assAnswerCloze.php.

References $gap_size.

{
$this->gap_size = $gap_size;
}
assAnswerCloze::setLowerBound (   $bound)

Sets the lower boind.

Parameters
$boundstring A string defining the lower bound of an answer for numeric gaps. : Refactor method to get rid of "locale magic".

Definition at line 79 of file class.assAnswerCloze.php.

References ASS_AnswerSimple\getAnswertext(), getNumericValueFromAnswerText(), and getNumericValueFromText().

{
$boundvalue = $this->getNumericValueFromText($bound);
$value = $this->getNumericValueFromAnswerText();
if ($boundvalue === false || $boundvalue > $value)
{
$this->lowerBound = $this->getAnswertext();
}
else
{
$this->lowerBound = $bound;
}
}

+ Here is the call graph for this function:

assAnswerCloze::setUpperBound (   $bound)

Sets the upper bound.

Parameters
$boundstring A string defining the upper bound of an answer for numeric gaps. : Refactor method to get rid of "locale magic".

Definition at line 100 of file class.assAnswerCloze.php.

References ASS_AnswerSimple\getAnswertext(), getNumericValueFromAnswerText(), and getNumericValueFromText().

{
$boundvalue = $this->getNumericValueFromText($bound);
$value = $this->getNumericValueFromAnswerText();
if ($boundvalue === false || $boundvalue < $value)
{
$this->upperBound = $this->getAnswertext();
}
else
{
$this->upperBound = $bound;
}
}

+ Here is the call graph for this function:

Field Documentation

assAnswerCloze::$gap_size
protected

Definition at line 49 of file class.assAnswerCloze.php.

Referenced by getGapSize(), and setGapSize().

assAnswerCloze::$lowerBound
protected

Definition at line 33 of file class.assAnswerCloze.php.

Referenced by getLowerBound().

assAnswerCloze::$upperBound
protected

Definition at line 43 of file class.assAnswerCloze.php.

Referenced by getUpperBound().


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