ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilQTIItem Class Reference
+ Collaboration diagram for ilQTIItem:

Public Member Functions

 setIdent (string $a_ident)
 
 getIdent ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setComment (string $a_comment)
 
 getComment ()
 
 setDuration (string $a_duration)
 
 getDuration ()
 
 setQuestiontext (ilQTIMaterial $a_questiontext)
 
 getQuestiontext ()
 
 addResprocessing (ilQTIResprocessing $a_resprocessing)
 
 addItemfeedback (ilQTIItemfeedback $a_itemfeedback)
 
 setMaxattempts (string $a_maxattempts)
 
 getMaxattempts ()
 
 setLabel (string $a_label)
 
 getLabel ()
 
 setXmllang (string $a_xmllang)
 
 getXmllang ()
 
 setPresentation (ilQTIPresentation $a_presentation)
 
 getPresentation ()
 
 setQuestiontype (string $a_questiontype)
 
 getQuestiontype ()
 
 addPresentationitem ($a_presentationitem)
 
 determineQuestionType ()
 
 setAuthor (string $a_author)
 
 getAuthor ()
 
 getIliasSourceVersion ()
 
 setIliasSourceVersion (?string $iliasSourceVersion)
 
 getIliasSourceNic ()
 
 setIliasSourceNic (?string $iliasSourceNic)
 
 addSuggestedSolution (ilQTIMattext $a_solution, int $a_gap_index)
 
 addMetadata (array $a_metadata)
 
 getMetadata ()
 
 getMetadataEntry (string $a_label)
 

Data Fields

const QT_UNKNOWN = "unknown"
 
const QT_KPRIM_CHOICE = "assKprimChoice"
 
const QT_LONG_MENU = "assLongMenu"
 
const QT_MULTIPLE_CHOICE_SR = "assSingleChoice"
 
const QT_MULTIPLE_CHOICE_MR = "assMultipleChoice"
 
const QT_CLOZE = "assClozeTest"
 
const QT_ERRORTEXT = "assErrorText"
 
const QT_MATCHING = "assMatchingQuestion"
 
const QT_ORDERING = "assOrderingQuestion"
 
const QT_ORDERING_HORIZONTAL = "assOrderingHorizontal"
 
const QT_IMAGEMAP = "assImagemapQuestion"
 
const QT_TEXT = "assTextQuestion"
 
const QT_FILEUPLOAD = "assFileUpload"
 
const QT_NUMERIC = "assNumeric"
 
const QT_FORMULA = "assFormulaQuestion"
 
const QT_TEXTSUBSET = "assTextSubset"
 
string $ident = null
 
string $title = ''
 
string $maxattempts = ''
 
string $label = null
 
string $xmllang = null
 
string $comment = ''
 
string $ilias_version = null
 
string $author = ''
 
string $questiontype = null
 
array $duration = null
 
ilQTIMaterial $questiontext = null
 
array $resprocessing = []
 
array $itemfeedback = []
 
ilQTIPresentation $presentation = null
 
array $presentationitem = []
 
array $suggested_solutions = []
 
array $itemmetadata = []
 

Protected Attributes

string $iliasSourceVersion = null
 
string $iliasSourceNic = null
 
array $response = []
 

Private Member Functions

 typeFromResponse (ilQTIResponse $response)
 

Private Attributes

const VALID_QUESTION_TYPES
 

Detailed Description

Definition at line 29 of file class.ilQTIItem.php.

Member Function Documentation

◆ addItemfeedback()

ilQTIItem::addItemfeedback ( ilQTIItemfeedback  $a_itemfeedback)

Definition at line 175 of file class.ilQTIItem.php.

175 : void
176 {
177 $this->itemfeedback[] = $a_itemfeedback;
178 }

◆ addMetadata()

ilQTIItem::addMetadata ( array  $a_metadata)
Parameters
array{labelstring, entry: string} $a_metadata

Definition at line 325 of file class.ilQTIItem.php.

325 : void
326 {
327 $this->itemmetadata[] = $a_metadata;
328 }

◆ addPresentationitem()

ilQTIItem::addPresentationitem (   $a_presentationitem)
Parameters
ilQTIResponse | ilQTIMaterial | null$a_presentationitem

Definition at line 233 of file class.ilQTIItem.php.

233 : void
234 {
235 $this->presentationitem[] = $a_presentationitem;
236 }

◆ addResprocessing()

ilQTIItem::addResprocessing ( ilQTIResprocessing  $a_resprocessing)

Definition at line 170 of file class.ilQTIItem.php.

170 : void
171 {
172 $this->resprocessing[] = $a_resprocessing;
173 }

◆ addSuggestedSolution()

ilQTIItem::addSuggestedSolution ( ilQTIMattext  $a_solution,
int  $a_gap_index 
)

Definition at line 317 of file class.ilQTIItem.php.

317 : void
318 {
319 $this->suggested_solutions[] = ["solution" => $a_solution, "gap_index" => $a_gap_index];
320 }

◆ determineQuestionType()

ilQTIItem::determineQuestionType ( )

Definition at line 238 of file class.ilQTIItem.php.

238 : ?string
239 {
240 if (in_array($this->questiontype, self::VALID_QUESTION_TYPES)) {
241 return $this->questiontype;
242 }
243
244 switch ($this->questiontype) {
245 case "ORDERING QUESTION":
246 return self::QT_ORDERING;
247 case "KPRIM CHOICE QUESTION":
249 case "LONG MENU QUESTION":
250 return self::QT_LONG_MENU;
251 case "SINGLE CHOICE QUESTION":
253 case "MULTIPLE CHOICE QUESTION":
254 break;
255 case "MATCHING QUESTION":
256 return self::QT_MATCHING;
257 case "CLOZE QUESTION":
258 return self::QT_CLOZE;
259 case "IMAGE MAP QUESTION":
260 return self::QT_IMAGEMAP;
261 case "TEXT QUESTION":
262 return self::QT_TEXT;
263 case "NUMERIC QUESTION":
264 return self::QT_NUMERIC;
265 case "TEXTSUBSET QUESTION":
266 return self::QT_TEXTSUBSET;
267 }
268 if (!$this->presentation) {
269 return self::QT_UNKNOWN;
270 }
271 foreach ($this->presentation->order as $entry) {
272 if ('response' !== $entry["type"]) {
273 continue;
274 }
275 $result = $this->typeFromResponse($this->presentation->response[$entry["index"]]);
276 if ($result !== null) {
277 return $result;
278 }
279 }
280 if ($this->questiontype === '') {
281 return self::QT_UNKNOWN;
282 }
283
284 return $this->questiontype;
285 }
const QT_MULTIPLE_CHOICE_SR
const QT_LONG_MENU
const QT_KPRIM_CHOICE
const QT_NUMERIC
string $questiontype
const QT_MATCHING
const QT_ORDERING
const QT_IMAGEMAP
const QT_UNKNOWN
const QT_TEXTSUBSET
typeFromResponse(ilQTIResponse $response)

References $questiontype, QT_CLOZE, QT_IMAGEMAP, QT_KPRIM_CHOICE, QT_LONG_MENU, QT_MATCHING, QT_MULTIPLE_CHOICE_SR, QT_NUMERIC, QT_ORDERING, QT_TEXT, QT_TEXTSUBSET, QT_UNKNOWN, and typeFromResponse().

+ Here is the call graph for this function:

◆ getAuthor()

ilQTIItem::getAuthor ( )

Definition at line 292 of file class.ilQTIItem.php.

292 : string
293 {
294 return $this->author;
295 }
string $author

References $author.

◆ getComment()

ilQTIItem::getComment ( )

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

136 : string
137 {
138 return $this->comment;
139 }
string $comment

References $comment.

◆ getDuration()

ilQTIItem::getDuration ( )
Returns
null|array{h: string, m: string, s: string}

Definition at line 155 of file class.ilQTIItem.php.

155 : ?array
156 {
157 return $this->duration;
158 }

References $duration.

◆ getIdent()

ilQTIItem::getIdent ( )

Definition at line 102 of file class.ilQTIItem.php.

102 : ?string
103 {
104 return $this->ident;
105 }

References $ident.

◆ getIliasSourceNic()

ilQTIItem::getIliasSourceNic ( )

Definition at line 307 of file class.ilQTIItem.php.

307 : ?string
308 {
310 }
string $iliasSourceNic

References $iliasSourceNic.

◆ getIliasSourceVersion()

ilQTIItem::getIliasSourceVersion ( )

Definition at line 297 of file class.ilQTIItem.php.

297 : ?string
298 {
300 }
string $iliasSourceVersion

References $iliasSourceVersion.

◆ getLabel()

ilQTIItem::getLabel ( )

Definition at line 195 of file class.ilQTIItem.php.

195 : ?string
196 {
197 return $this->label;
198 }

References $label.

◆ getMaxattempts()

ilQTIItem::getMaxattempts ( )

Definition at line 185 of file class.ilQTIItem.php.

185 : string
186 {
187 return $this->maxattempts;
188 }
string $maxattempts

References $maxattempts.

◆ getMetadata()

ilQTIItem::getMetadata ( )

Definition at line 330 of file class.ilQTIItem.php.

330 : array
331 {
332 return $this->itemmetadata;
333 }
array $itemmetadata

References $itemmetadata.

◆ getMetadataEntry()

ilQTIItem::getMetadataEntry ( string  $a_label)

Definition at line 335 of file class.ilQTIItem.php.

335 : ?string
336 {
337 foreach ($this->itemmetadata as $metadata) {
338 if ($metadata["label"] === $a_label) {
339 return $metadata["entry"];
340 }
341 }
342 return null;
343 }

Referenced by assQuestionImport\addGeneralMetadata(), assQuestionImport\fetchLifecycle(), assTextQuestionImport\fetchTermScoring(), and assFormulaQuestionImport\fromXML().

+ Here is the caller graph for this function:

◆ getPresentation()

ilQTIItem::getPresentation ( )

Definition at line 215 of file class.ilQTIItem.php.

216 {
217 return $this->presentation;
218 }
ilQTIPresentation $presentation

References $presentation.

◆ getQuestiontext()

ilQTIItem::getQuestiontext ( )

Definition at line 165 of file class.ilQTIItem.php.

166 {
167 return $this->questiontext;
168 }
ilQTIMaterial $questiontext

References $questiontext.

◆ getQuestiontype()

ilQTIItem::getQuestiontype ( )

Definition at line 225 of file class.ilQTIItem.php.

225 : ?string
226 {
227 return $this->questiontype;
228 }

References $questiontype.

◆ getTitle()

ilQTIItem::getTitle ( )

Definition at line 112 of file class.ilQTIItem.php.

112 : string
113 {
114 return $this->title;
115 }

References $title.

◆ getXmllang()

ilQTIItem::getXmllang ( )

Definition at line 205 of file class.ilQTIItem.php.

205 : ?string
206 {
207 return $this->xmllang;
208 }
string $xmllang

References $xmllang.

◆ setAuthor()

ilQTIItem::setAuthor ( string  $a_author)

Definition at line 287 of file class.ilQTIItem.php.

287 : void
288 {
289 $this->author = $a_author;
290 }

◆ setComment()

ilQTIItem::setComment ( string  $a_comment)

Definition at line 117 of file class.ilQTIItem.php.

117 : void
118 {
119 if (preg_match("/(.*?)\=(.*)/", $a_comment, $matches)) {
120 // special comments written by ILIAS
121 switch ($matches[1]) {
122 case "ILIAS Version":
123 $this->ilias_version = $matches[2];
124 return;
125 case "Questiontype":
126 $this->questiontype = $matches[2];
127 return;
128 case "Author":
129 $this->author = $matches[2] ?? '';
130 return;
131 }
132 }
133 $this->comment = $a_comment;
134 }

References ILIAS\UI\examples\Symbol\Glyph\Comment\comment().

+ Here is the call graph for this function:

◆ setDuration()

ilQTIItem::setDuration ( string  $a_duration)

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

141 : void
142 {
143 if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $a_duration, $matches)) {
144 $this->duration = [
145 "h" => $matches[4],
146 "m" => $matches[5],
147 "s" => $matches[6]
148 ];
149 }
150 }

◆ setIdent()

ilQTIItem::setIdent ( string  $a_ident)

Definition at line 97 of file class.ilQTIItem.php.

97 : void
98 {
99 $this->ident = $a_ident;
100 }

◆ setIliasSourceNic()

ilQTIItem::setIliasSourceNic ( ?string  $iliasSourceNic)

Definition at line 312 of file class.ilQTIItem.php.

312 : void
313 {
314 $this->iliasSourceNic = $iliasSourceNic;
315 }

References $iliasSourceNic.

◆ setIliasSourceVersion()

ilQTIItem::setIliasSourceVersion ( ?string  $iliasSourceVersion)

Definition at line 302 of file class.ilQTIItem.php.

302 : void
303 {
304 $this->iliasSourceVersion = $iliasSourceVersion ?? '';
305 }

References $iliasSourceVersion.

◆ setLabel()

ilQTIItem::setLabel ( string  $a_label)

Definition at line 190 of file class.ilQTIItem.php.

190 : void
191 {
192 $this->label = $a_label;
193 }

◆ setMaxattempts()

ilQTIItem::setMaxattempts ( string  $a_maxattempts)

Definition at line 180 of file class.ilQTIItem.php.

180 : void
181 {
182 $this->maxattempts = $a_maxattempts;
183 }

◆ setPresentation()

ilQTIItem::setPresentation ( ilQTIPresentation  $a_presentation)

Definition at line 210 of file class.ilQTIItem.php.

210 : void
211 {
212 $this->presentation = $a_presentation;
213 }

◆ setQuestiontext()

ilQTIItem::setQuestiontext ( ilQTIMaterial  $a_questiontext)

Definition at line 160 of file class.ilQTIItem.php.

160 : void
161 {
162 $this->questiontext = $a_questiontext;
163 }

◆ setQuestiontype()

ilQTIItem::setQuestiontype ( string  $a_questiontype)

Definition at line 220 of file class.ilQTIItem.php.

220 : void
221 {
222 $this->questiontype = $a_questiontype;
223 }

◆ setTitle()

ilQTIItem::setTitle ( string  $a_title)

Definition at line 107 of file class.ilQTIItem.php.

107 : void
108 {
109 $this->title = $a_title;
110 }

◆ setXmllang()

ilQTIItem::setXmllang ( string  $a_xmllang)

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

200 : void
201 {
202 $this->xmllang = $a_xmllang;
203 }

◆ typeFromResponse()

ilQTIItem::typeFromResponse ( ilQTIResponse  $response)
private

Definition at line 345 of file class.ilQTIItem.php.

345 : ?string
346 {
347 switch ($response->getResponsetype()) {
349 switch ($response->getRCardinality()) {
353 }
354 // no break
357 switch ($response->getRCardinality()) {
360 }
361 // no break
363
364 default: return null;
365 }
366 }
const QT_MULTIPLE_CHOICE_MR

References $response, QT_CLOZE, QT_IMAGEMAP, QT_MATCHING, QT_MULTIPLE_CHOICE_MR, QT_MULTIPLE_CHOICE_SR, QT_ORDERING, QT_TEXT, ilQTIResponse\R_CARDINALITY_MULTIPLE, ilQTIResponse\R_CARDINALITY_ORDERED, ilQTIResponse\R_CARDINALITY_SINGLE, ilQTIResponse\RT_RESPONSE_GRP, ilQTIResponse\RT_RESPONSE_LID, ilQTIResponse\RT_RESPONSE_STR, and ilQTIResponse\RT_RESPONSE_XY.

Referenced by determineQuestionType().

+ Here is the caller graph for this function:

Field Documentation

◆ $author

string ilQTIItem::$author = ''

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

Referenced by getAuthor().

◆ $comment

string ilQTIItem::$comment = ''

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

Referenced by getComment().

◆ $duration

array ilQTIItem::$duration = null

Definition at line 76 of file class.ilQTIItem.php.

Referenced by getDuration().

◆ $ident

string ilQTIItem::$ident = null

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

Referenced by getIdent().

◆ $ilias_version

string ilQTIItem::$ilias_version = null

Definition at line 72 of file class.ilQTIItem.php.

◆ $iliasSourceNic

string ilQTIItem::$iliasSourceNic = null
protected

Definition at line 94 of file class.ilQTIItem.php.

Referenced by getIliasSourceNic(), and setIliasSourceNic().

◆ $iliasSourceVersion

string ilQTIItem::$iliasSourceVersion = null
protected

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

Referenced by getIliasSourceVersion(), and setIliasSourceVersion().

◆ $itemfeedback

array ilQTIItem::$itemfeedback = []

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

◆ $itemmetadata

array ilQTIItem::$itemmetadata = []

Definition at line 92 of file class.ilQTIItem.php.

Referenced by getMetadata().

◆ $label

string ilQTIItem::$label = null

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

Referenced by getLabel().

◆ $maxattempts

string ilQTIItem::$maxattempts = ''

Definition at line 68 of file class.ilQTIItem.php.

Referenced by getMaxattempts().

◆ $presentation

ilQTIPresentation ilQTIItem::$presentation = null

Definition at line 82 of file class.ilQTIItem.php.

Referenced by getPresentation().

◆ $presentationitem

array ilQTIItem::$presentationitem = []

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

◆ $questiontext

ilQTIMaterial ilQTIItem::$questiontext = null

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

Referenced by getQuestiontext().

◆ $questiontype

string ilQTIItem::$questiontype = null

Definition at line 74 of file class.ilQTIItem.php.

Referenced by determineQuestionType(), and getQuestiontype().

◆ $response

array ilQTIItem::$response = []
protected

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

Referenced by typeFromResponse().

◆ $resprocessing

array ilQTIItem::$resprocessing = []

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

◆ $suggested_solutions

array ilQTIItem::$suggested_solutions = []

Definition at line 88 of file class.ilQTIItem.php.

◆ $title

string ilQTIItem::$title = ''

Definition at line 67 of file class.ilQTIItem.php.

Referenced by getTitle().

◆ $xmllang

string ilQTIItem::$xmllang = null

Definition at line 70 of file class.ilQTIItem.php.

Referenced by getXmllang().

◆ QT_CLOZE

const ilQTIItem::QT_CLOZE = "assClozeTest"

◆ QT_ERRORTEXT

const ilQTIItem::QT_ERRORTEXT = "assErrorText"

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

◆ QT_FILEUPLOAD

const ilQTIItem::QT_FILEUPLOAD = "assFileUpload"

Definition at line 43 of file class.ilQTIItem.php.

◆ QT_FORMULA

const ilQTIItem::QT_FORMULA = "assFormulaQuestion"

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

◆ QT_IMAGEMAP

const ilQTIItem::QT_IMAGEMAP = "assImagemapQuestion"

◆ QT_KPRIM_CHOICE

const ilQTIItem::QT_KPRIM_CHOICE = "assKprimChoice"

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

Referenced by determineQuestionType().

◆ QT_LONG_MENU

const ilQTIItem::QT_LONG_MENU = "assLongMenu"

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

Referenced by determineQuestionType().

◆ QT_MATCHING

const ilQTIItem::QT_MATCHING = "assMatchingQuestion"

◆ QT_MULTIPLE_CHOICE_MR

const ilQTIItem::QT_MULTIPLE_CHOICE_MR = "assMultipleChoice"

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

Referenced by ilQTIParser\handlerVerifyBeginTag(), and typeFromResponse().

◆ QT_MULTIPLE_CHOICE_SR

const ilQTIItem::QT_MULTIPLE_CHOICE_SR = "assSingleChoice"

◆ QT_NUMERIC

const ilQTIItem::QT_NUMERIC = "assNumeric"

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

Referenced by determineQuestionType(), and ilQTIParser\handlerVerifyBeginTag().

◆ QT_ORDERING

const ilQTIItem::QT_ORDERING = "assOrderingQuestion"

◆ QT_ORDERING_HORIZONTAL

const ilQTIItem::QT_ORDERING_HORIZONTAL = "assOrderingHorizontal"

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

◆ QT_TEXT

const ilQTIItem::QT_TEXT = "assTextQuestion"

◆ QT_TEXTSUBSET

const ilQTIItem::QT_TEXTSUBSET = "assTextSubset"

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

Referenced by determineQuestionType().

◆ QT_UNKNOWN

const ilQTIItem::QT_UNKNOWN = "unknown"

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

Referenced by determineQuestionType().

◆ VALID_QUESTION_TYPES


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