ILIAS  release_4-3 Revision
 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

 assAnswerCloze ($answertext="", $points=0.0, $order=0)
 assAnswerCloze constructor
 setLowerBound ($bound)
 setUpperBound ($bound)
 getLowerBound ()
 getUpperBound ()
- Public Member Functions inherited from ASS_AnswerSimple
 ASS_AnswerSimple ($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.

Data Fields

 $lowerBound
 $upperBound
- Data Fields inherited from ASS_AnswerSimple
 $answertext
 $points
 $order
 $id

Protected Member Functions

 getNumericValueFromAnswerText ()

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
Version
$Id$
See Also
ASS_AnswerBinaryState

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

Member Function Documentation

assAnswerCloze::assAnswerCloze (   $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 public

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

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

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

+ Here is the call graph for this function:

assAnswerCloze::getLowerBound ( )

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

References $lowerBound.

{
}
assAnswerCloze::getNumericValueFromAnswerText ( )
protected

Definition at line 124 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 ( )

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

References $upperBound.

{
}
assAnswerCloze::setLowerBound (   $bound)
Parameters
$boundA string defining the lower bound of an answer for numeric gaps. : Refactor method to throw exceptions on non-numeric values to get rid of magic.

Definition at line 80 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)
Parameters
$boundA string defining the upper bound of an answer for numeric gaps. : Refactor method to throw exceptions on non-numeric values to get rid of magic.

Definition at line 103 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

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

Referenced by getLowerBound().

assAnswerCloze::$upperBound

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

Referenced by getUpperBound().


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