ILIAS  release_8 Revision v8.24
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)
 

Detailed Description

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

Member Function Documentation

◆ addItemfeedback()

ilQTIItem::addItemfeedback ( ilQTIItemfeedback  $a_itemfeedback)

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

158 : void
159 {
160 $this->itemfeedback[] = $a_itemfeedback;
161 }

◆ addMetadata()

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

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

303 : void
304 {
305 $this->itemmetadata[] = $a_metadata;
306 }

◆ addPresentationitem()

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

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

216 : void
217 {
218 $this->presentationitem[] = $a_presentationitem;
219 }

◆ addResprocessing()

ilQTIItem::addResprocessing ( ilQTIResprocessing  $a_resprocessing)

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

153 : void
154 {
155 $this->resprocessing[] = $a_resprocessing;
156 }

◆ addSuggestedSolution()

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

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

295 : void
296 {
297 $this->suggested_solutions[] = array("solution" => $a_solution, "gap_index" => $a_gap_index);
298 }

◆ determineQuestionType()

ilQTIItem::determineQuestionType ( )

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

221 : ?string
222 {
223 switch ($this->questiontype) {
224 case "ORDERING QUESTION":
225 return self::QT_ORDERING;
226 case "KPRIM CHOICE QUESTION":
228 case "LONG MENU QUESTION":
229 return self::QT_LONG_MENU;
230 case "SINGLE CHOICE QUESTION":
232 case "MULTIPLE CHOICE QUESTION":
233 break;
234 case "MATCHING QUESTION":
235 return self::QT_MATCHING;
236 case "CLOZE QUESTION":
237 return self::QT_CLOZE;
238 case "IMAGE MAP QUESTION":
239 return self::QT_IMAGEMAP;
240 case "TEXT QUESTION":
241 return self::QT_TEXT;
242 case "NUMERIC QUESTION":
243 return self::QT_NUMERIC;
244 case "TEXTSUBSET QUESTION":
245 return self::QT_TEXTSUBSET;
246 }
247 if (!$this->presentation) {
248 return self::QT_UNKNOWN;
249 }
250 foreach ($this->presentation->order as $entry) {
251 if ('response' === $entry["type"]) {
252 $result = $this->typeFromResponse($this->presentation->response[$entry["index"]]);
253 if (null !== $result) {
254 return $result;
255 }
256 }
257 }
258 if (strlen($this->questiontype) == 0) {
259 return self::QT_UNKNOWN;
260 }
261
262 return $this->questiontype;
263 }
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 270 of file class.ilQTIItem.php.

270 : string
271 {
272 return $this->author;
273 }
string $author

References $author.

◆ getComment()

ilQTIItem::getComment ( )

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

119 : string
120 {
121 return $this->comment;
122 }
string $comment

References $comment.

◆ getDuration()

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

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

138 : ?array
139 {
140 return $this->duration;
141 }

References $duration.

◆ getIdent()

ilQTIItem::getIdent ( )

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

85 : ?string
86 {
87 return $this->ident;
88 }

References $ident.

◆ getIliasSourceNic()

ilQTIItem::getIliasSourceNic ( )

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

285 : ?string
286 {
288 }
string $iliasSourceNic

References $iliasSourceNic.

◆ getIliasSourceVersion()

ilQTIItem::getIliasSourceVersion ( )

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

275 : ?string
276 {
278 }
string $iliasSourceVersion

References $iliasSourceVersion.

◆ getLabel()

ilQTIItem::getLabel ( )

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

178 : ?string
179 {
180 return $this->label;
181 }

References $label.

◆ getMaxattempts()

ilQTIItem::getMaxattempts ( )

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

168 : string
169 {
170 return $this->maxattempts;
171 }
string $maxattempts

References $maxattempts.

◆ getMetadata()

ilQTIItem::getMetadata ( )

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

308 : array
309 {
310 return $this->itemmetadata;
311 }
array $itemmetadata

References $itemmetadata.

◆ getMetadataEntry()

ilQTIItem::getMetadataEntry ( string  $a_label)

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

313 : ?string
314 {
315 foreach ($this->itemmetadata as $metadata) {
316 if ($metadata["label"] === $a_label) {
317 return $metadata["entry"];
318 }
319 }
320 return null;
321 }

Referenced by assQuestionImport\addGeneralMetadata(), and assQuestionImport\fetchLifecycle().

+ Here is the caller graph for this function:

◆ getPresentation()

ilQTIItem::getPresentation ( )

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

199 {
200 return $this->presentation;
201 }
ilQTIPresentation $presentation

References $presentation.

◆ getQuestiontext()

ilQTIItem::getQuestiontext ( )

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

149 {
150 return $this->questiontext;
151 }
ilQTIMaterial $questiontext

References $questiontext.

◆ getQuestiontype()

ilQTIItem::getQuestiontype ( )

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

208 : ?string
209 {
210 return $this->questiontype;
211 }

References $questiontype.

Referenced by ilAsqService\determineQuestionTypeByQtiItem().

+ Here is the caller graph for this function:

◆ getTitle()

ilQTIItem::getTitle ( )

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

95 : string
96 {
97 return $this->title;
98 }

References $title.

◆ getXmllang()

ilQTIItem::getXmllang ( )

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

188 : ?string
189 {
190 return $this->xmllang;
191 }
string $xmllang

References $xmllang.

◆ setAuthor()

ilQTIItem::setAuthor ( string  $a_author)

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

265 : void
266 {
267 $this->author = $a_author;
268 }

◆ setComment()

ilQTIItem::setComment ( string  $a_comment)

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

100 : void
101 {
102 if (preg_match("/(.*?)\=(.*)/", $a_comment, $matches)) {
103 // special comments written by ILIAS
104 switch ($matches[1]) {
105 case "ILIAS Version":
106 $this->ilias_version = $matches[2];
107 return;
108 case "Questiontype":
109 $this->questiontype = $matches[2];
110 return;
111 case "Author":
112 $this->author = $matches[2] ?? '';
113 return;
114 }
115 }
116 $this->comment = $a_comment;
117 }

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 124 of file class.ilQTIItem.php.

124 : void
125 {
126 if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $a_duration, $matches)) {
127 $this->duration = array(
128 "h" => $matches[4],
129 "m" => $matches[5],
130 "s" => $matches[6]
131 );
132 }
133 }

◆ setIdent()

ilQTIItem::setIdent ( string  $a_ident)

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

80 : void
81 {
82 $this->ident = $a_ident;
83 }

◆ setIliasSourceNic()

ilQTIItem::setIliasSourceNic ( ?string  $iliasSourceNic)

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

290 : void
291 {
292 $this->iliasSourceNic = $iliasSourceNic;
293 }

References $iliasSourceNic.

◆ setIliasSourceVersion()

ilQTIItem::setIliasSourceVersion ( ?string  $iliasSourceVersion)

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

280 : void
281 {
282 $this->iliasSourceVersion = $iliasSourceVersion ?? '';
283 }

References $iliasSourceVersion.

◆ setLabel()

ilQTIItem::setLabel ( string  $a_label)

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

173 : void
174 {
175 $this->label = $a_label;
176 }

◆ setMaxattempts()

ilQTIItem::setMaxattempts ( string  $a_maxattempts)

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

163 : void
164 {
165 $this->maxattempts = $a_maxattempts;
166 }

◆ setPresentation()

ilQTIItem::setPresentation ( ilQTIPresentation  $a_presentation)

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

193 : void
194 {
195 $this->presentation = $a_presentation;
196 }

◆ setQuestiontext()

ilQTIItem::setQuestiontext ( ilQTIMaterial  $a_questiontext)

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

143 : void
144 {
145 $this->questiontext = $a_questiontext;
146 }

◆ setQuestiontype()

ilQTIItem::setQuestiontype ( string  $a_questiontype)

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

203 : void
204 {
205 $this->questiontype = $a_questiontype;
206 }

◆ setTitle()

ilQTIItem::setTitle ( string  $a_title)

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

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

◆ setXmllang()

ilQTIItem::setXmllang ( string  $a_xmllang)

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

183 : void
184 {
185 $this->xmllang = $a_xmllang;
186 }

◆ typeFromResponse()

ilQTIItem::typeFromResponse ( ilQTIResponse  $response)
private

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

323 : ?string
324 {
325 switch ($response->getResponsetype()) {
327 switch ($response->getRCardinality()) {
331 }
332 // no break
335 switch ($response->getRCardinality()) {
338 }
339 // no break
341
342 default: return null;
343 }
344 }
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 56 of file class.ilQTIItem.php.

Referenced by getAuthor().

◆ $comment

string ilQTIItem::$comment = ''

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

Referenced by getComment().

◆ $duration

array ilQTIItem::$duration = null

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

Referenced by getDuration().

◆ $ident

string ilQTIItem::$ident = null

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

Referenced by getIdent().

◆ $ilias_version

string ilQTIItem::$ilias_version = null

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

◆ $iliasSourceNic

string ilQTIItem::$iliasSourceNic = null
protected

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

Referenced by getIliasSourceNic(), and setIliasSourceNic().

◆ $iliasSourceVersion

string ilQTIItem::$iliasSourceVersion = null
protected

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

Referenced by getIliasSourceVersion(), and setIliasSourceVersion().

◆ $itemfeedback

array ilQTIItem::$itemfeedback = []

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

◆ $itemmetadata

array ilQTIItem::$itemmetadata = []

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

Referenced by getMetadata().

◆ $label

string ilQTIItem::$label = null

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

Referenced by getLabel().

◆ $maxattempts

string ilQTIItem::$maxattempts = ''

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

Referenced by getMaxattempts().

◆ $presentation

ilQTIPresentation ilQTIItem::$presentation = null

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

Referenced by getPresentation().

◆ $presentationitem

array ilQTIItem::$presentationitem = []

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

◆ $questiontext

ilQTIMaterial ilQTIItem::$questiontext = null

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

Referenced by getQuestiontext().

◆ $questiontype

string ilQTIItem::$questiontype = null

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

Referenced by determineQuestionType(), and getQuestiontype().

◆ $response

array ilQTIItem::$response = []
protected

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

Referenced by typeFromResponse().

◆ $resprocessing

array ilQTIItem::$resprocessing = []

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

◆ $suggested_solutions

array ilQTIItem::$suggested_solutions = []

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

◆ $title

string ilQTIItem::$title = ''

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

Referenced by getTitle().

◆ $xmllang

string ilQTIItem::$xmllang = null

Definition at line 53 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 38 of file class.ilQTIItem.php.

Referenced by ilObjTestGUI\uploadTst().

◆ QT_FILEUPLOAD

const ilQTIItem::QT_FILEUPLOAD = "assFileUpload"

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

Referenced by ilObjTestGUI\uploadTst().

◆ QT_FORMULA

const ilQTIItem::QT_FORMULA = "assFormulaQuestion"

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

Referenced by ilObjTestGUI\uploadTst().

◆ QT_IMAGEMAP

const ilQTIItem::QT_IMAGEMAP = "assImagemapQuestion"

◆ QT_KPRIM_CHOICE

const ilQTIItem::QT_KPRIM_CHOICE = "assKprimChoice"

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

Referenced by determineQuestionType(), and ilObjTestGUI\uploadTst().

◆ QT_LONG_MENU

const ilQTIItem::QT_LONG_MENU = "assLongMenu"

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

Referenced by determineQuestionType(), and ilObjTestGUI\uploadTst().

◆ QT_MATCHING

const ilQTIItem::QT_MATCHING = "assMatchingQuestion"

◆ QT_MULTIPLE_CHOICE_MR

const ilQTIItem::QT_MULTIPLE_CHOICE_MR = "assMultipleChoice"

◆ QT_MULTIPLE_CHOICE_SR

const ilQTIItem::QT_MULTIPLE_CHOICE_SR = "assSingleChoice"

◆ QT_NUMERIC

const ilQTIItem::QT_NUMERIC = "assNumeric"

◆ QT_ORDERING

const ilQTIItem::QT_ORDERING = "assOrderingQuestion"

◆ QT_ORDERING_HORIZONTAL

const ilQTIItem::QT_ORDERING_HORIZONTAL = "assOrderingHorizontal"

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

Referenced by ilObjTestGUI\uploadTst().

◆ QT_TEXT

const ilQTIItem::QT_TEXT = "assTextQuestion"

◆ QT_TEXTSUBSET

const ilQTIItem::QT_TEXTSUBSET = "assTextSubset"

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

Referenced by determineQuestionType(), and ilObjTestGUI\uploadTst().

◆ QT_UNKNOWN

const ilQTIItem::QT_UNKNOWN = "unknown"

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

Referenced by determineQuestionType().


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