ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilAssKprimChoiceAnswer Class Reference
+ Inheritance diagram for ilAssKprimChoiceAnswer:
+ Collaboration diagram for ilAssKprimChoiceAnswer:

Public Member Functions

 setPosition ($position)
 
 getPosition ()
 
 setAnswertext ($answertext)
 
 getAnswertext ()
 
 setImageFile (?string $imageFile)
 
 getImageFile ()
 
 setImage (?string $image)
 
 getImage ()
 
 setImageFsDir ($imageFsDir)
 
 getImageFsDir ()
 
 setImageWebDir ($imageWebDir)
 
 getImageWebDir ()
 
 setThumbPrefix ($thumbPrefix)
 
 getThumbPrefix ()
 
 setCorrectness ($correctness)
 
 getCorrectness ()
 
 getImageFsPath ()
 
 getThumbFsPath ()
 
 getImageWebPath ()
 
 getThumbWebPath ()
 
 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...
 

Private Attributes

 $position
 
 $answertext
 
 $imageFile
 
 $imageFsDir
 
 $imageWebDir
 
 $thumbPrefix
 
 $correctness
 

Detailed Description

Definition at line 30 of file class.ilAssKprimChoiceAnswer.php.

Member Function Documentation

◆ fromNormalized()

ilAssKprimChoiceAnswer::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 171 of file class.ilAssKprimChoiceAnswer.php.

174 : static
175 {
176 $clone = clone $this;
177 $clone->position = $transformations->int($normalized['position']);
178 $clone->answertext = $transformations->nullableString($normalized['answertext']);
179 $clone->imageFile = $transformations->denormalize($normalized['image'], QuestionImage::class)?->getFilename();
180 $clone->correctness = $transformations->int($normalized['correctness']);
181 return $clone;
182 }
denormalize(array|float|bool|int|string|null $normalized, string|object $expected)

References ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\denormalize(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\int(), and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\nullableString().

+ Here is the call graph for this function:

◆ getAnswertext()

ilAssKprimChoiceAnswer::getAnswertext ( )

Definition at line 61 of file class.ilAssKprimChoiceAnswer.php.

References $answertext.

Referenced by assKprimChoice\addAnswer(), and assKprimChoice\getCorrectSolutionForTextOutput().

+ Here is the caller graph for this function:

◆ getCorrectness()

ilAssKprimChoiceAnswer::getCorrectness ( )

Definition at line 131 of file class.ilAssKprimChoiceAnswer.php.

References $correctness.

Referenced by assKprimChoice\getCorrectSolutionForTextOutput().

+ Here is the caller graph for this function:

◆ getImage()

ilAssKprimChoiceAnswer::getImage ( )

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

84 : ?string
85 {
86 return $this->getImageFile();
87 }

References getImageFile().

+ Here is the call graph for this function:

◆ getImageFile()

ilAssKprimChoiceAnswer::getImageFile ( )

Definition at line 71 of file class.ilAssKprimChoiceAnswer.php.

71 : ?string
72 {
73 return $this->imageFile !== null
74 ? basename($this->imageFile)
75 : null;
76 }

Referenced by getImage(), getImageFsPath(), getImageWebPath(), getThumbFsPath(), and getThumbWebPath().

+ Here is the caller graph for this function:

◆ getImageFsDir()

ilAssKprimChoiceAnswer::getImageFsDir ( )

Definition at line 95 of file class.ilAssKprimChoiceAnswer.php.

References $imageFsDir.

Referenced by getImageFsPath(), and getThumbFsPath().

+ Here is the caller graph for this function:

◆ getImageFsPath()

ilAssKprimChoiceAnswer::getImageFsPath ( )

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

136 : string
137 {
138 return $this->getImageFsDir() . $this->getImageFile();
139 }

References getImageFile(), and getImageFsDir().

Referenced by assKprimChoice\handleFileUpload().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageWebDir()

ilAssKprimChoiceAnswer::getImageWebDir ( )

Definition at line 105 of file class.ilAssKprimChoiceAnswer.php.

References $imageWebDir.

Referenced by getImageWebPath(), and getThumbWebPath().

+ Here is the caller graph for this function:

◆ getImageWebPath()

ilAssKprimChoiceAnswer::getImageWebPath ( )

Definition at line 146 of file class.ilAssKprimChoiceAnswer.php.

146 : string
147 {
148 return $this->getImageWebDir() . $this->getImageFile();
149 }

References getImageFile(), and getImageWebDir().

+ Here is the call graph for this function:

◆ getPosition()

ilAssKprimChoiceAnswer::getPosition ( )

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

References $position.

◆ getThumbFsPath()

ilAssKprimChoiceAnswer::getThumbFsPath ( )

Definition at line 141 of file class.ilAssKprimChoiceAnswer.php.

141 : string
142 {
143 return $this->getImageFsDir() . $this->getThumbPrefix() . $this->getImageFile();
144 }

References getImageFile(), getImageFsDir(), and getThumbPrefix().

+ Here is the call graph for this function:

◆ getThumbPrefix()

ilAssKprimChoiceAnswer::getThumbPrefix ( )
Returns
mixed

Definition at line 121 of file class.ilAssKprimChoiceAnswer.php.

References $thumbPrefix.

Referenced by getThumbFsPath(), and getThumbWebPath().

+ Here is the caller graph for this function:

◆ getThumbWebPath()

ilAssKprimChoiceAnswer::getThumbWebPath ( )

Definition at line 151 of file class.ilAssKprimChoiceAnswer.php.

151 : string
152 {
153 return $this->getImageWebDir() . $this->getThumbPrefix() . $this->getImageFile();
154 }

References getImageFile(), getImageWebDir(), and getThumbPrefix().

+ Here is the call graph for this function:

◆ setAnswertext()

ilAssKprimChoiceAnswer::setAnswertext (   $answertext)

Definition at line 56 of file class.ilAssKprimChoiceAnswer.php.

56 : void
57 {
58 $this->answertext = $answertext;
59 }

References $answertext.

Referenced by assKprimChoice\addAnswer().

+ Here is the caller graph for this function:

◆ setCorrectness()

ilAssKprimChoiceAnswer::setCorrectness (   $correctness)

Definition at line 126 of file class.ilAssKprimChoiceAnswer.php.

126 : void
127 {
128 $this->correctness = $correctness;
129 }

References $correctness.

◆ setImage()

ilAssKprimChoiceAnswer::setImage ( ?string  $image)

Definition at line 79 of file class.ilAssKprimChoiceAnswer.php.

79 : void
80 {
81 $this->setImageFile($image);
82 }

References setImageFile().

+ Here is the call graph for this function:

◆ setImageFile()

ilAssKprimChoiceAnswer::setImageFile ( ?string  $imageFile)

Definition at line 66 of file class.ilAssKprimChoiceAnswer.php.

66 : void
67 {
68 $this->imageFile = $imageFile;
69 }

References $imageFile.

Referenced by assKprimChoice\handleFileUpload(), and setImage().

+ Here is the caller graph for this function:

◆ setImageFsDir()

ilAssKprimChoiceAnswer::setImageFsDir (   $imageFsDir)

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

90 : void
91 {
92 $this->imageFsDir = $imageFsDir;
93 }

References $imageFsDir.

Referenced by assKprimChoice\handleFileUpload().

+ Here is the caller graph for this function:

◆ setImageWebDir()

ilAssKprimChoiceAnswer::setImageWebDir (   $imageWebDir)

Definition at line 100 of file class.ilAssKprimChoiceAnswer.php.

100 : void
101 {
102 $this->imageWebDir = $imageWebDir;
103 }

References $imageWebDir.

◆ setPosition()

ilAssKprimChoiceAnswer::setPosition (   $position)

Definition at line 46 of file class.ilAssKprimChoiceAnswer.php.

46 : void
47 {
48 $this->position = $position;
49 }

References $position.

◆ setThumbPrefix()

ilAssKprimChoiceAnswer::setThumbPrefix (   $thumbPrefix)
Parameters
mixed$thumbPrefix

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

113 : void
114 {
115 $this->thumbPrefix = $thumbPrefix;
116 }

References $thumbPrefix.

◆ toNormalized()

ilAssKprimChoiceAnswer::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 156 of file class.ilAssKprimChoiceAnswer.php.

159 : array|float|bool|int|string|null
160 {
161 return [
162 'position' => $this->position,
163 'answertext' => $this->answertext,
164 'image' => $this->imageFile
165 ? $transformations->normalize(new QuestionImage($this->imageFile, $context['question_id'] ?? null))
166 : null,
167 'correctness' => $this->correctness,
168 ];
169 }
Wrapper object for an image file within a question (e.g.

References $answertext, $correctness, $position, and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\normalize().

+ Here is the call graph for this function:

Field Documentation

◆ $answertext

ilAssKprimChoiceAnswer::$answertext
private

Definition at line 34 of file class.ilAssKprimChoiceAnswer.php.

Referenced by getAnswertext(), setAnswertext(), and toNormalized().

◆ $correctness

ilAssKprimChoiceAnswer::$correctness
private

Definition at line 44 of file class.ilAssKprimChoiceAnswer.php.

Referenced by getCorrectness(), setCorrectness(), and toNormalized().

◆ $imageFile

ilAssKprimChoiceAnswer::$imageFile
private

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

Referenced by setImageFile().

◆ $imageFsDir

ilAssKprimChoiceAnswer::$imageFsDir
private

Definition at line 38 of file class.ilAssKprimChoiceAnswer.php.

Referenced by getImageFsDir(), and setImageFsDir().

◆ $imageWebDir

ilAssKprimChoiceAnswer::$imageWebDir
private

Definition at line 40 of file class.ilAssKprimChoiceAnswer.php.

Referenced by getImageWebDir(), and setImageWebDir().

◆ $position

ilAssKprimChoiceAnswer::$position
private

Definition at line 32 of file class.ilAssKprimChoiceAnswer.php.

Referenced by getPosition(), setPosition(), and toNormalized().

◆ $thumbPrefix

ilAssKprimChoiceAnswer::$thumbPrefix
private

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

Referenced by getThumbPrefix(), and setThumbPrefix().


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