Public Member Functions | Data Fields

ASS_AnswerSimple Class Reference

Class for simple answers. More...

Inheritance diagram for ASS_AnswerSimple:

Public Member Functions

 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

 $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 <helmut.schottmueller@mac.com>
Version:
Id:
class.assAnswerSimple.php 12069 2006-09-14 23:29:30Z hschottm

class.assAnswerSimple.php Assessment

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


Member Function Documentation

ASS_AnswerSimple::ASS_AnswerSimple ( 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 $answertext A string defining the answer text
double $points The number of points given for the selected answer
integer $order A nonnegative value representing a possible display or sort order public

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

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

Referenced by ASS_AnswerBinaryState::ASS_AnswerBinaryState(), ASS_AnswerMultipleResponse::ASS_AnswerMultipleResponse(), 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:

ASS_AnswerSimple::checkPoints ( a_points  ) 

Checks, if the point value is numeric.

Checks, if the point value is numeric

Returns:
boolean true if the point value is numeric, false otherwise public
See also:
$points

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

Referenced by setPoints(), and ASS_AnswerMultipleResponse::setPointsUnchecked().

        {
                if (is_numeric($a_points))
                {
                        return TRUE;
                }
                else
                {
                        return FALSE;
                }
        }

Here is the caller graph for this function:

ASS_AnswerSimple::getAnswertext (  ) 

Gets the answer text.

Returns the answer text

Returns:
string answer text public
See also:
$answertext

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

        {
          //$tmpanswertext = "<![CDATA[".$this->answertext."]]>";
          $tmpanswertext = $this->answertext;
                return $tmpanswertext;
        }

ASS_AnswerSimple::getId (  ) 

Gets the answer id.

Returns the answer id

Returns:
integer answer id public
See also:
$id

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

        {
                return $this->id;
        }

ASS_AnswerSimple::getOrder (  ) 

Gets the sort/display order.

Returns a nonnegative order value for display or sorting

Returns:
integer order public
See also:
$order

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

        {
                return $this->order;
        }

ASS_AnswerSimple::getPoints (  ) 

Gets the points.

Returns the points

Returns:
double points public
See also:
$points

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

Referenced by ASS_AnswerMultipleResponse::getPointsChecked().

        {
                if (round($this->points) == $this->points)
                {
                        return sprintf("%d", $this->points);
                }
                else
                {
                        return sprintf("%.1f", round($this->points, 1));
                }
        }

Here is the caller graph for this function:

ASS_AnswerSimple::setAnswertext ( answertext = ""  ) 

Sets the answer text.

Sets the answer text

Parameters:
string $answertext The answer text public
See also:
$answertext

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

References $answertext.

        {
                $this->answertext = $answertext;
        }

ASS_AnswerSimple::setId ( id = -1  ) 

Sets the answer id.

Sets the answer id

Parameters:
integer $id answer id public
See also:
$id

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

References $order.

        {
                $this->order = $order;
        }

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 $order A nonnegative integer public
See also:
$order

Definition at line 192 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 $points The points given for the answer public
See also:
$points

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

References $points, and checkPoints().

Referenced by ASS_AnswerSimple(), 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

ASS_AnswerSimple::$answertext
ASS_AnswerSimple::$id
ASS_AnswerSimple::$order
ASS_AnswerSimple::$points

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