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

Formula Question Unit Category. More...

+ Inheritance diagram for assFormulaQuestionUnitCategory:
+ Collaboration diagram for assFormulaQuestionUnitCategory:

Public Member Functions

 initFormArray (array $data)
 
 setId (int $id)
 
 getId ()
 
 setCategory (string $category)
 
 getCategory ()
 
 getSanitizedCategory ()
 
 setQuestionFi (int $question_fi)
 
 getQuestionFi ()
 
 getDisplayString ()
 
 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 Member Functions

 sanitizeString (string $string)
 

Private Attributes

int $id = 0
 
string $category = ''
 
int $question_fi = 0
 

Detailed Description

Formula Question Unit Category.

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.assFormulaQuestionUnitCategory.php.

Member Function Documentation

◆ fromNormalized()

assFormulaQuestionUnitCategory::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 109 of file class.assFormulaQuestionUnitCategory.php.

112 : static
113 {
114 $clone = clone $this;
115 $clone->id = $transformations->denormalize($normalized['id'], Id::class)->getId();
116 $clone->category = $transformations->string($normalized['name']);
117 $clone->question_fi = $transformations->denormalize($normalized['question_id'], Id::class)->getId();
118
119 return $clone;
120 }
denormalize(array|float|bool|int|string|null $normalized, string|object $expected)

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

+ Here is the call graph for this function:

◆ getCategory()

assFormulaQuestionUnitCategory::getCategory ( )

◆ getDisplayString()

assFormulaQuestionUnitCategory::getDisplayString ( )

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

79 : string
80 {
81 global $DIC;
82
83 $category = $this->getCategory();
84 $txt = $DIC->language()->txt("qpl_qst_formulaquestion_{$category}");
85 return strcmp("-qpl_qst_formulaquestion_{$category}-", $txt) !== 0
86 ? $this->sanitizeString($txt)
87 : $this->getSanitizedCategory();
88 }
global $DIC
Definition: shib_login.php:26

References $category, $DIC, getCategory(), getSanitizedCategory(), and sanitizeString().

+ Here is the call graph for this function:

◆ getId()

assFormulaQuestionUnitCategory::getId ( )

Definition at line 49 of file class.assFormulaQuestionUnitCategory.php.

References $id.

Referenced by ilUnitConfigurationRepository\saveCategory().

+ Here is the caller graph for this function:

◆ getQuestionFi()

assFormulaQuestionUnitCategory::getQuestionFi ( )

◆ getSanitizedCategory()

assFormulaQuestionUnitCategory::getSanitizedCategory ( )

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

64 : string
65 {
66 return $this->sanitizeString($this->getCategory());
67 }

References getCategory(), and sanitizeString().

Referenced by getDisplayString().

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

◆ initFormArray()

assFormulaQuestionUnitCategory::initFormArray ( array  $data)

Definition at line 37 of file class.assFormulaQuestionUnitCategory.php.

37 : void
38 {
39 $this->id = (int) $data['category_id'];
40 $this->category = $data['category'];
41 $this->question_fi = (int) $data['question_fi'];
42 }
$data
Definition: storeScorm.php:45

References $data, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ sanitizeString()

assFormulaQuestionUnitCategory::sanitizeString ( string  $string)
private

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

90 : string
91 {
92 return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8');
93 }

Referenced by getDisplayString(), and getSanitizedCategory().

+ Here is the caller graph for this function:

◆ setCategory()

assFormulaQuestionUnitCategory::setCategory ( string  $category)

Definition at line 54 of file class.assFormulaQuestionUnitCategory.php.

54 : void
55 {
56 $this->category = $category;
57 }

References $category.

◆ setId()

assFormulaQuestionUnitCategory::setId ( int  $id)

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

44 : void
45 {
46 $this->id = $id;
47 }

References $id.

Referenced by ilUnitConfigurationRepository\saveNewUnitCategory().

+ Here is the caller graph for this function:

◆ setQuestionFi()

assFormulaQuestionUnitCategory::setQuestionFi ( int  $question_fi)

Definition at line 69 of file class.assFormulaQuestionUnitCategory.php.

69 : void
70 {
71 $this->question_fi = $question_fi;
72 }

References $question_fi.

◆ toNormalized()

assFormulaQuestionUnitCategory::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 96 of file class.assFormulaQuestionUnitCategory.php.

99 : array|float|bool|int|string|null
100 {
101 return [
102 'id' => $transformations->normalize(new Id($this->id, 'unit_category')),
103 'name' => $this->category,
104 'question_id' => $transformations->normalize(new Id($this->question_fi, 'question')),
105 ];
106 }
Wrapper object for an object identifier and an optional object type the identifier belongs to.
Definition: Id.php:33

References $category, and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\normalize().

+ Here is the call graph for this function:

Field Documentation

◆ $category

string assFormulaQuestionUnitCategory::$category = ''
private

◆ $id

int assFormulaQuestionUnitCategory::$id = 0
private

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

Referenced by getId(), and setId().

◆ $question_fi

int assFormulaQuestionUnitCategory::$question_fi = 0
private

Definition at line 35 of file class.assFormulaQuestionUnitCategory.php.

Referenced by getQuestionFi(), and setQuestionFi().


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