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

Class for simple answers. 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.
 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 Attributes

 $answertext
 $points
 $order
 $id

Detailed Description

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
Version
Id:
class.assAnswerSimple.php 44249 2013-08-18 13:33:14Z mbecker

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

Constructor & Destructor Documentation

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
Returns
ASS_AnswerSimple

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

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

Referenced by ASS_AnswerOrdering\ASS_AnswerOrdering(), and ASS_AnswerTrueFalse\ASS_AnswerTrueFalse().

{
$this->answertext = $answertext;
$this->setPoints($points);
$this->order = $order;
$this->id = $id;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Function Documentation

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

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

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

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

{
return is_numeric($a_points);
}

+ Here is the caller graph for this function:

ASS_AnswerSimple::getAnswertext ( )

Gets the answer text.

Returns the answer text

Returns
string answer text
See Also
$answertext

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

References $answertext.

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

{
}

+ Here is the caller graph for this function:

ASS_AnswerSimple::getId ( )

Gets the answer id.

Returns the answer id

Returns
integer answer id
See Also
$id

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

References $id.

{
return $this->id;
}
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 143 of file class.assAnswerSimple.php.

References $order.

{
return $this->order;
}
ASS_AnswerSimple::getPoints ( )

Gets the points.

Returns the points

Returns
double points
See Also
$points

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

References $points.

Referenced by ASS_AnswerMultipleResponse\getPointsChecked().

{
return $this->points;
}

+ Here is the caller graph for this function:

ASS_AnswerSimple::setAnswertext (   $answertext = "")

Sets the answer text.

Sets the answer text

Parameters
string$answertextThe answer text
See Also
$answertext

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

References $answertext.

{
$this->answertext = $answertext;
}
ASS_AnswerSimple::setId (   $id = -1)

Sets the answer id.

Parameters
integer$idanswer id
See Also
$id

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

References $id.

{
$this->id = $id;
}
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

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

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

References $order.

{
if ($order >= 0)
{
$this->order = $order;
}
}
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

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

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

References $points, and checkPoints().

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

{
$new_points = str_replace(",", ".", $points);
if ($this->checkPoints($new_points))
{
$this->points = $new_points;
}
else
{
$this->points = 0.0;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation


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