ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ASS_AnswerMatching Class Reference

Class for matching question answers. More...

+ Inheritance diagram for ASS_AnswerMatching:
+ Collaboration diagram for ASS_AnswerMatching:

Public Member Functions

 __construct ( $points=0.0, $term_id=0, $picture_or_definition="", $picture_or_definition_id=0)
 ASS_AnswerMatching constructor. More...
 
 getPoints ()
 Gets the points. More...
 
 getTermId ()
 Gets the term id. More...
 
 getPicture ()
 Gets the picture. More...
 
 getDefinition ()
 Gets the definition. More...
 
 getPictureId ()
 Gets the picture identifier. More...
 
 getDefinitionId ()
 Gets the definition identifier. More...
 
 setTermId ($term_id=0)
 Sets the term id. More...
 
 setPictureId (int $picture_id=0)
 Sets the picture id Sets the nonnegative picture identifier which can be used for sorting or displaying matching pairs. More...
 
 setDefinitionId (int $definition_id=0)
 Sets the definition id Sets the nonnegative definition identifier which can be used for sorting or displaying matching pairs. More...
 
 setPicture (string $picture="")
 Sets the picture Sets the picture. More...
 
 setDefinition (string $definition="")
 Sets the definition Sets the definition. More...
 
 setPoints (float $points=0.0)
 Sets the points Sets the points given for selecting the answer. More...
 
 toNormalized (Transformations $transformations, array $context=[])
 Convert the internal state of the implementing object into a language-neutral array structure. More...
 
 fromNormalized (array $normalized, Transformations $transformations)
 Restore the object from its normalized representation. More...
 
 toNormalized (Transformations $transformations, array $context=[])
 Convert the internal state of the implementing object into a language-neutral array structure. More...
 
 fromNormalized (array $normalized, Transformations $transformations)
 Restore the object from its normalized representation. More...
 

Data Fields

float $points
 
 $picture_or_definition
 
 $term_id
 
 $picture_or_definition_id
 

Detailed Description

Class for matching question answers.

ASS_AnswerSimple is a class for matching question 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 \

Definition at line 31 of file class.assAnswerMatching.php.

Constructor & Destructor Documentation

◆ __construct()

ASS_AnswerMatching::__construct (   $points = 0.0,
  $term_id = 0,
  $picture_or_definition = "",
  $picture_or_definition_id = 0 
)

ASS_AnswerMatching constructor.

The constructor takes possible arguments an creates an instance of the ASS_AnswerMatching 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
string$matchingtextA string defining the matching text for the answer text @access public

Definition at line 73 of file class.assAnswerMatching.php.

78 {
79 $this->term_id = $term_id;
80 $this->picture_or_definition = $picture_or_definition;
81 $this->picture_or_definition_id = $picture_or_definition_id;
82 $this->points = $points;
83 }

References $picture_or_definition, $picture_or_definition_id, $points, and $term_id.

Member Function Documentation

◆ fromNormalized()

ASS_AnswerMatching::fromNormalized ( array  $normalized,
Transformations  $transformations 
)

Restore the object from its normalized representation.

Parameters
array<array-key,mixed>$normalized

Implements ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\FromNormalized.

Definition at line 259 of file class.assAnswerMatching.php.

262 : static
263 {
264 $clone = clone $this;
265 $clone->setPoints($transformations->float($normalized['points']));
266 $clone->setPicture($transformations->string($normalized['picture_or_definition']));
267 $clone->setPictureId($transformations->int($normalized['picture_or_definition_id']));
268 $clone->setTermId($transformations->int($normalized['term_id']));
269 return $clone;
270 }

References ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\float(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\int(), and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\string().

+ Here is the call graph for this function:

◆ getDefinition()

ASS_AnswerMatching::getDefinition ( )

Gets the definition.

Returns the definition

Returns
string definition @access public
See also
$picture_or_definition

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

132 : string
133 {
135 }

References $picture_or_definition.

◆ getDefinitionId()

ASS_AnswerMatching::getDefinitionId ( )

Gets the definition identifier.

Returns the definition identifier

Returns
integer definition identifier @access public
See also
$picture_or_definition_id

Definition at line 158 of file class.assAnswerMatching.php.

158 : int
159 {
161 }

References $picture_or_definition_id.

◆ getPicture()

ASS_AnswerMatching::getPicture ( )

Gets the picture.

Returns the picture

Returns
string picture @access public
See also
$picture_or_definition

Definition at line 119 of file class.assAnswerMatching.php.

119 : string
120 {
122 }

References $picture_or_definition.

◆ getPictureId()

ASS_AnswerMatching::getPictureId ( )

Gets the picture identifier.

Returns the picture identifier

Returns
integer picture identifier @access public
See also
$picture_or_definition_id

Definition at line 145 of file class.assAnswerMatching.php.

145 : int
146 {
148 }

References $picture_or_definition_id.

◆ getPoints()

ASS_AnswerMatching::getPoints ( )

Gets the points.

Returns the points

Returns
double points @access public
See also
$points

Definition at line 93 of file class.assAnswerMatching.php.

93 : float
94 {
95 return $this->points;
96 }

References $points.

◆ getTermId()

ASS_AnswerMatching::getTermId ( )

Gets the term id.

Returns a nonnegative identifier for the term

Returns
integer order @access public
See also
$term_id

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

106 : int
107 {
108 return $this->term_id;
109 }

References $term_id.

◆ setDefinition()

ASS_AnswerMatching::setDefinition ( string  $definition = "")

Sets the definition Sets the definition.

Parameters
string$definitionDefinition @access public
See also
$picture_or_definition

Definition at line 226 of file class.assAnswerMatching.php.

226 : void
227 {
228 $this->picture_or_definition = $definition;
229 }

◆ setDefinitionId()

ASS_AnswerMatching::setDefinitionId ( int  $definition_id = 0)

Sets the definition id Sets the nonnegative definition identifier which can be used for sorting or displaying matching pairs.

Parameters
integer$definition_idA nonnegative integer @access public
See also
$picture_or_definition_id

Definition at line 200 of file class.assAnswerMatching.php.

200 : void
201 {
202 if ($definition_id >= 0) {
203 $this->picture_or_definition_id = $definition_id;
204 }
205 }

◆ setPicture()

ASS_AnswerMatching::setPicture ( string  $picture = "")

Sets the picture Sets the picture.

Parameters
string$picturePicture @access public
See also
$picture_or_definition

Definition at line 214 of file class.assAnswerMatching.php.

214 : void
215 {
216 $this->picture_or_definition = $picture;
217 }

◆ setPictureId()

ASS_AnswerMatching::setPictureId ( int  $picture_id = 0)

Sets the picture id Sets the nonnegative picture identifier which can be used for sorting or displaying matching pairs.

Parameters
integer$picture_idA nonnegative integer @access public
See also
$picture_or_definition_id

Definition at line 186 of file class.assAnswerMatching.php.

186 : void
187 {
188 if ($picture_id >= 0) {
189 $this->picture_or_definition_id = $picture_id;
190 }
191 }

◆ setPoints()

ASS_AnswerMatching::setPoints ( float  $points = 0.0)

Sets the points Sets the points given for selecting the answer.

Parameters
double$pointsThe points given for the answer @access public
See also
$points

Definition at line 239 of file class.assAnswerMatching.php.

239 : void
240 {
241 $this->points = $points;
242 }

References $points.

◆ setTermId()

ASS_AnswerMatching::setTermId (   $term_id = 0)

Sets the term id.

Sets the nonnegative term identifier which can be used for sorting or displaying matching pairs

Parameters
integer$term_idA nonnegative integer @access public
See also
$term_id

Definition at line 172 of file class.assAnswerMatching.php.

172 : void
173 {
174 if ($term_id >= 0) {
175 $this->term_id = $term_id;
176 }
177 }

References $term_id.

◆ toNormalized()

ASS_AnswerMatching::toNormalized ( Transformations  $transformations,
array  $context = [] 
)

Convert the internal state of the implementing object into a language-neutral array structure.

The resulting array must contain only null, scalar values (string, int, float, bool) and nested arrays following the same rules.

Parameters
array<string,mixed>$context
Returns
array<array-key, mixed>|float|bool|int|string|null

Implements ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\ToNormalized.

Definition at line 245 of file class.assAnswerMatching.php.

248 : array|float|bool|int|string|null
249 {
250 return [
251 'points' => $this->points,
252 'picture_or_definition' => $this->picture_or_definition,
253 'picture_or_definition_id' => $this->picture_or_definition_id,
254 'term_id' => $this->term_id,
255 ];
256 }

References $picture_or_definition, $picture_or_definition_id, $points, and $term_id.

Field Documentation

◆ $picture_or_definition

ASS_AnswerMatching::$picture_or_definition

Definition at line 42 of file class.assAnswerMatching.php.

Referenced by __construct(), getDefinition(), getPicture(), and toNormalized().

◆ $picture_or_definition_id

ASS_AnswerMatching::$picture_or_definition_id

◆ $points

float ASS_AnswerMatching::$points

Definition at line 33 of file class.assAnswerMatching.php.

Referenced by __construct(), getPoints(), setPoints(), and toNormalized().

◆ $term_id

ASS_AnswerMatching::$term_id

Definition at line 51 of file class.assAnswerMatching.php.

Referenced by __construct(), getTermId(), setTermId(), and toNormalized().


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