ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ASS_AnswerBinaryState Class Reference

Class for true/false or yes/no answers. More...

+ Inheritance diagram for ASS_AnswerBinaryState:
+ Collaboration diagram for ASS_AnswerBinaryState:

Public Member Functions

 __construct ($answertext="", $points=0.0, $order=0, $state=0, $id=-1)
 ASS_AnswerBinaryState constructor. More...
 
 getState ()
 Gets the state. More...
 
 isStateChecked ()
 Gets the state. More...
 
 isStateSet ()
 Gets the state. More...
 
 isStateUnset ()
 Gets the state. More...
 
 isStateUnchecked ()
 Gets the state. More...
 
 setState ($state=0)
 Sets the state. More...
 
 setChecked ()
 Sets the answer as a checked answer. More...
 
 setSet ()
 Sets the answer as a set answer. More...
 
 setUnset ()
 Sets the answer as a unset answer. More...
 
 setUnchecked ()
 Sets the answer as a unchecked answer. More...
 
- Public Member Functions inherited from ASS_AnswerSimple
 __construct ($answertext="", $points=0.0, $order=0, $id=-1)
 ASS_AnswerSimple constructor. More...
 
 getId ()
 Gets the answer id. More...
 
 getAnswertext ()
 Gets the answer text. More...
 
 getPoints ()
 Gets the points. More...
 
 checkPoints ($a_points)
 Checks, if the point value is numeric. More...
 
 getOrder ()
 Gets the sort/display order. More...
 
 setOrder ($order=0)
 Sets the order. More...
 
 setId ($id=-1)
 Sets the answer id. More...
 
 setAnswertext ($answertext="")
 Sets the answer text. More...
 
 setPoints ($points=0.0)
 Sets the points. More...
 

Protected Attributes

 $state
 
- Protected Attributes inherited from ASS_AnswerSimple
 $answertext
 
 $points
 
 $order
 
 $id
 

Detailed Description

Class for true/false or yes/no answers.

ASS_AnswerBinaryState is a class for answers with a binary state indicator (checked/unchecked, set/unset)

Todo:

Get rid of duplicate methods (hiding behind different names.

Rework class to use a true binary state (boolean) instead of integer

Rename class to something that matches the filename properly.

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$
See also
ASS_AnswerSimple

Definition at line 26 of file class.assAnswerBinaryState.php.

Constructor & Destructor Documentation

◆ __construct()

ASS_AnswerBinaryState::__construct (   $answertext = "",
  $points = 0.0,
  $order = 0,
  $state = 0,
  $id = -1 
)

ASS_AnswerBinaryState constructor.

The constructor takes possible arguments an creates an instance of the ASS_AnswerBinaryState 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$stateA integer value indicating the state of the answer
integer$idThe database id of the answer
Returns
ASS_AnswerBinaryState

Definition at line 50 of file class.assAnswerBinaryState.php.

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

Member Function Documentation

◆ getState()

ASS_AnswerBinaryState::getState ( )

Gets the state.

Returns the state of the answer

Returns
boolean state
See also
$state

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

References $state.

◆ isStateChecked()

ASS_AnswerBinaryState::isStateChecked ( )

Gets the state.

Returns the answer state

Returns
boolean state
See also
$state

Definition at line 77 of file class.assAnswerBinaryState.php.

References $state.

◆ isStateSet()

ASS_AnswerBinaryState::isStateSet ( )

Gets the state.

Returns the answer state

Returns
boolean state
See also
$state

Definition at line 90 of file class.assAnswerBinaryState.php.

References $state.

◆ isStateUnchecked()

ASS_AnswerBinaryState::isStateUnchecked ( )

Gets the state.

Returns the answer state

Returns
boolean state
See also
$state

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

References $state.

117  {
118  return !$this->state;
119  }

◆ isStateUnset()

ASS_AnswerBinaryState::isStateUnset ( )

Gets the state.

Returns the answer state

Returns
boolean state
See also
$state

Definition at line 103 of file class.assAnswerBinaryState.php.

References $state.

104  {
105  return !$this->state;
106  }

◆ setChecked()

ASS_AnswerBinaryState::setChecked ( )

Sets the answer as a checked answer.

Sets the state value of the answer to 1

See also
$state

Definition at line 142 of file class.assAnswerBinaryState.php.

143  {
144  $this->state = 1;
145  }

◆ setSet()

ASS_AnswerBinaryState::setSet ( )

Sets the answer as a set answer.

Sets the state value of the answer to 1

See also
$state

Definition at line 154 of file class.assAnswerBinaryState.php.

155  {
156  $this->state = 1;
157  }

◆ setState()

ASS_AnswerBinaryState::setState (   $state = 0)

Sets the state.

Sets the state of the answer using 1 or 0 as indicator

Parameters
bool | int$stateA integer value indicating the state of the answer
See also
$state

Definition at line 130 of file class.assAnswerBinaryState.php.

References $state.

131  {
132  $this->state = $state;
133  }

◆ setUnchecked()

ASS_AnswerBinaryState::setUnchecked ( )

Sets the answer as a unchecked answer.

Sets the state value of the answer to 0

See also
$state

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

179  {
180  $this->state = 0;
181  }

◆ setUnset()

ASS_AnswerBinaryState::setUnset ( )

Sets the answer as a unset answer.

Sets the state value of the answer to 0

See also
$state

Definition at line 166 of file class.assAnswerBinaryState.php.

167  {
168  $this->state = 0;
169  }

Field Documentation

◆ $state

ASS_AnswerBinaryState::$state
protected

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