ILIAS  Release_4_4_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.
- 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 ()

Protected Attributes

 $lowerBound
 $upperBound
- 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 51350 2014-07-11 12:42:35Z bheyser
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 57 of file class.assAnswerCloze.php.

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

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

Member Function Documentation

assAnswerCloze::getLowerBound ( )

Returns the lower bound.

Returns
null|string

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

References $lowerBound.

{
}
assAnswerCloze::getNumericValueFromAnswerText ( )
protected

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

References ASS_AnswerSimple\getAnswertext(), and ilUtil\stripSlashes().

Referenced by setUpperBound().

{
include_once("./Services/Math/classes/class.EvalMath.php");
$eval = new EvalMath();
$eval->suppress_errors = true;
return $eval->e(str_replace(",", ".", ilUtil::stripSlashes($this->getAnswertext(), 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 139 of file class.assAnswerCloze.php.

References $upperBound.

{
}
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 70 of file class.assAnswerCloze.php.

References ASS_AnswerSimple\getAnswertext().

{
$bound = str_replace(",", ".", $bound);
if ($bound > $this->getAnswertext() || strlen($bound) == 0)
{
$bound = $this->getAnswertext();
}
if ( is_numeric($bound) )
{
$this->lowerBound = $bound;
}
else
{
// unreachable
// $this->lowerBound = $this->getAnswertext();
}
}

+ 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 95 of file class.assAnswerCloze.php.

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

{
$bound = str_replace(",", ".", $bound);
$value = $this->getNumericValueFromAnswerText();
if ($bound < $value || strlen($bound) == 0)
{
$bound = $value;
}
if ( is_numeric($bound) )
{
$this->upperBound = $bound;
}
else
{
$this->upperBound = $this->getAnswertext();
}
}

+ Here is the call graph for this function:

Field Documentation

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: