ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References $questiontype, null, and typeFromResponse().

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":
248  return self::QT_KPRIM_CHOICE;
249  case "LONG MENU QUESTION":
250  return self::QT_LONG_MENU;
251  case "SINGLE CHOICE QUESTION":
252  return self::QT_MULTIPLE_CHOICE_SR;
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  }
string $questiontype
typeFromResponse(ilQTIResponse $response)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getAuthor()

◆ getComment()

◆ getDuration()

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

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

References $duration.

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

◆ getIdent()

◆ getIliasSourceNic()

ilQTIItem::getIliasSourceNic ( )

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

References $iliasSourceNic.

Referenced by assClozeTestImport\fromXML().

307  : ?string
308  {
309  return $this->iliasSourceNic;
310  }
string $iliasSourceNic
+ Here is the caller graph for this function:

◆ getIliasSourceVersion()

ilQTIItem::getIliasSourceVersion ( )

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

References $iliasSourceVersion.

297  : ?string
298  {
300  }
string $iliasSourceVersion

◆ getLabel()

ilQTIItem::getLabel ( )

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

References $label.

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

◆ getMaxattempts()

◆ getMetadata()

ilQTIItem::getMetadata ( )

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

References $itemmetadata.

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

◆ getMetadataEntry()

ilQTIItem::getMetadataEntry ( string  $a_label)

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

References null.

Referenced by assQuestionImport\addGeneralMetadata(), assQuestionImport\fetchLifecycle(), assLongMenuImport\fromXML(), assFileUploadImport\fromXML(), assErrorTextImport\fromXML(), assFormulaQuestionImport\fromXML(), assMultipleChoiceImport\fromXML(), assOrderingHorizontalImport\fromXML(), assTextSubsetImport\fromXML(), assImagemapQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assKprimChoiceImport\fromXML(), assOrderingQuestionImport\fromXML(), assTextQuestionImport\fromXML(), assMatchingQuestionImport\fromXML(), and assClozeTestImport\fromXML().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getPresentation()

◆ getQuestiontext()

◆ getQuestiontype()

ilQTIItem::getQuestiontype ( )

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

References $questiontype.

Referenced by ilAsqService\determineQuestionTypeByQtiItem().

225  : ?string
226  {
227  return $this->questiontype;
228  }
string $questiontype
+ Here is the caller graph for this function:

◆ getTitle()

◆ getXmllang()

ilQTIItem::getXmllang ( )

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

References $xmllang.

205  : ?string
206  {
207  return $this->xmllang;
208  }
string $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.

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

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  }
comment()
description: > Example for rendring a comment glyph.
Definition: comment.php:41
+ 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.

References $iliasSourceNic.

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

◆ setIliasSourceVersion()

ilQTIItem::setIliasSourceVersion ( ?string  $iliasSourceVersion)

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

302  : void
303  {
304  $this->iliasSourceVersion = $iliasSourceVersion ?? '';
305  }
string $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.

References ilQTIResponse\getRCardinality(), ilQTIResponse\getResponsetype(), null, 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().

345  : ?string
346  {
347  switch ($response->getResponsetype()) {
349  switch ($response->getRCardinality()) {
350  case ilQTIResponse::R_CARDINALITY_ORDERED: return self::QT_ORDERING;
351  case ilQTIResponse::R_CARDINALITY_SINGLE: return self::QT_MULTIPLE_CHOICE_SR;
352  case ilQTIResponse::R_CARDINALITY_MULTIPLE: return self::QT_MULTIPLE_CHOICE_MR;
353  }
354  // no break
355  case ilQTIResponse::RT_RESPONSE_XY: return self::QT_IMAGEMAP;
357  switch ($response->getRCardinality()) {
358  case ilQTIResponse::R_CARDINALITY_ORDERED: return self::QT_TEXT;
359  case ilQTIResponse::R_CARDINALITY_SINGLE: return self::QT_CLOZE;
360  }
361  // no break
362  case ilQTIResponse::RT_RESPONSE_GRP: return self::QT_MATCHING;
363 
364  default: return null;
365  }
366  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ 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().

◆ $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.

◆ $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"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ 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"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ QT_KPRIM_CHOICE

const ilQTIItem::QT_KPRIM_CHOICE = "assKprimChoice"

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

◆ QT_LONG_MENU

const ilQTIItem::QT_LONG_MENU = "assLongMenu"

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

◆ QT_MATCHING

const ilQTIItem::QT_MATCHING = "assMatchingQuestion"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ QT_MULTIPLE_CHOICE_MR

const ilQTIItem::QT_MULTIPLE_CHOICE_MR = "assMultipleChoice"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ QT_MULTIPLE_CHOICE_SR

const ilQTIItem::QT_MULTIPLE_CHOICE_SR = "assSingleChoice"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ QT_NUMERIC

const ilQTIItem::QT_NUMERIC = "assNumeric"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ QT_ORDERING

const ilQTIItem::QT_ORDERING = "assOrderingQuestion"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ 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"

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

Referenced by ilQTIParser\handlerVerifyBeginTag().

◆ QT_TEXTSUBSET

const ilQTIItem::QT_TEXTSUBSET = "assTextSubset"

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

◆ QT_UNKNOWN

const ilQTIItem::QT_UNKNOWN = "unknown"

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

◆ VALID_QUESTION_TYPES

const ilQTIItem::VALID_QUESTION_TYPES
private
Initial value:
= [
self::QT_KPRIM_CHOICE,
self::QT_LONG_MENU,
self::QT_MULTIPLE_CHOICE_SR,
self::QT_MULTIPLE_CHOICE_MR,
self::QT_CLOZE,
self::QT_ERRORTEXT,
self::QT_MATCHING,
self::QT_ORDERING,
self::QT_ORDERING_HORIZONTAL,
self::QT_IMAGEMAP,
self::QT_TEXT,
self::QT_FILEUPLOAD,
self::QT_NUMERIC,
self::QT_FORMULA,
self::QT_TEXTSUBSET
]

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


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