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

Public Member Functions

 __construct ($identifier=self::DRAFT)
 
 getIdentifier ()
 
 getValidIdentifiers ()
 
 getMappedLomLifecycle ()
 
 getTranslation (ilLanguage $lng)
 
 getSelectOptions (ilLanguage $lng)
 
 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

const DRAFT = 'draft'
 
const REVIEW = 'review'
 
const REJECTED = 'rejected'
 
const FINAL = 'final'
 
const SHARABLE = 'sharable'
 
const OUTDATED = 'outdated'
 

Private Member Functions

 setIdentifier (string $identifier)
 
 getTranslationByIdentifier (ilLanguage $lng, string $identifier)
 
 validateIdentifier ($identifier)
 

Private Attributes

string $identifier
 

Detailed Description

Definition at line 28 of file class.ilAssQuestionLifecycle.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionLifecycle::__construct (   $identifier = self::DRAFT)

Definition at line 39 of file class.ilAssQuestionLifecycle.php.

References setIdentifier(), and validateIdentifier().

+ Here is the call graph for this function:

Member Function Documentation

◆ fromNormalized()

ilAssQuestionLifecycle::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 152 of file class.ilAssQuestionLifecycle.php.

155 : self
156 {
157 return new self($normalized['identifier']);
158 }

◆ getIdentifier()

ilAssQuestionLifecycle::getIdentifier ( )

Definition at line 45 of file class.ilAssQuestionLifecycle.php.

45 : string
46 {
47 return $this->identifier;
48 }

References $identifier.

Referenced by getMappedLomLifecycle(), getTranslation(), and toNormalized().

+ Here is the caller graph for this function:

◆ getMappedLomLifecycle()

ilAssQuestionLifecycle::getMappedLomLifecycle ( )

Definition at line 63 of file class.ilAssQuestionLifecycle.php.

References DRAFT, ilAssQuestionLomLifecycle\DRAFT, FINAL, ilAssQuestionLomLifecycle\FINAL, getIdentifier(), OUTDATED, REJECTED, REVIEW, SHARABLE, and ilAssQuestionLomLifecycle\UNAVAILABLE.

+ Here is the call graph for this function:

◆ getSelectOptions()

ilAssQuestionLifecycle::getSelectOptions ( ilLanguage  $lng)
Parameters
ilLanguage$lng
Returns
array<string, string>

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

116 : array
117 {
118 $selectOptions = [];
119
120 foreach ($this->getValidIdentifiers() as $identifier) {
121 $selectOptions[$identifier] = $this->getTranslationByIdentifier($lng, $identifier);
122 }
123
124 return $selectOptions;
125 }
getTranslationByIdentifier(ilLanguage $lng, string $identifier)

References $identifier, getTranslationByIdentifier(), and getValidIdentifiers().

Referenced by ilTestQuestionFilterLabelTranslator\getLifecycleFilterLabel().

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

◆ getTranslation()

ilAssQuestionLifecycle::getTranslation ( ilLanguage  $lng)

Definition at line 81 of file class.ilAssQuestionLifecycle.php.

81 : string
82 {
83 return $this->getTranslationByIdentifier($lng, $this->getIdentifier());
84 }

References getIdentifier(), and getTranslationByIdentifier().

+ Here is the call graph for this function:

◆ getTranslationByIdentifier()

ilAssQuestionLifecycle::getTranslationByIdentifier ( ilLanguage  $lng,
string  $identifier 
)
private

Definition at line 86 of file class.ilAssQuestionLifecycle.php.

86 : string
87 {
88 switch ($identifier) {
89 case self::DRAFT:
90 return $lng->txt('qst_lifecycle_draft');
91
92 case self::REVIEW:
93 return $lng->txt('qst_lifecycle_review');
94
95 case self::REJECTED:
96 return $lng->txt('qst_lifecycle_rejected');
97
98 case self::FINAL:
99 return $lng->txt('qst_lifecycle_final');
100
101 case self::SHARABLE:
102 return $lng->txt('qst_lifecycle_sharable');
103
104 case self::OUTDATED:
105 return $lng->txt('qst_lifecycle_outdated');
106
107 default:
108 return '';
109 }
110 }
global $lng
Definition: privfeed.php:26

References $identifier, $lng, DRAFT, FINAL, OUTDATED, REJECTED, REVIEW, and SHARABLE.

Referenced by getSelectOptions(), and getTranslation().

+ Here is the caller graph for this function:

◆ getValidIdentifiers()

ilAssQuestionLifecycle::getValidIdentifiers ( )
Returns
string[]

Definition at line 58 of file class.ilAssQuestionLifecycle.php.

References DRAFT, FINAL, OUTDATED, REJECTED, REVIEW, and SHARABLE.

Referenced by getSelectOptions(), and validateIdentifier().

+ Here is the caller graph for this function:

◆ setIdentifier()

ilAssQuestionLifecycle::setIdentifier ( string  $identifier)
private

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

50 : void
51 {
52 $this->identifier = $identifier;
53 }

References $identifier.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ toNormalized()

ilAssQuestionLifecycle::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 141 of file class.ilAssQuestionLifecycle.php.

144 : array|float|bool|int|string|null
145 {
146 return [
147 'identifier' => $this->getIdentifier(),
148 ];
149 }

References getIdentifier().

+ Here is the call graph for this function:

◆ validateIdentifier()

ilAssQuestionLifecycle::validateIdentifier (   $identifier)
private
Parameters
mixed$identifier
Exceptions
ilTestQuestionPoolInvalidArgumentException

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

131 : void
132 {
133 if (!in_array($identifier, $this->getValidIdentifiers(), true)) {
135 'Invalid ilias lifecycle given: ' . $identifier
136 );
137 }
138 }

References $identifier, and getValidIdentifiers().

Referenced by __construct().

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

Field Documentation

◆ $identifier

string ilAssQuestionLifecycle::$identifier
private

◆ DRAFT

◆ FINAL

◆ OUTDATED

◆ REJECTED

const ilAssQuestionLifecycle::REJECTED = 'rejected'

◆ REVIEW

const ilAssQuestionLifecycle::REVIEW = 'review'

◆ SHARABLE

const ilAssQuestionLifecycle::SHARABLE = 'sharable'

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