19 declare(strict_types=1);
49 self::QT_KPRIM_CHOICE,
51 self::QT_MULTIPLE_CHOICE_SR,
52 self::QT_MULTIPLE_CHOICE_MR,
57 self::QT_ORDERING_HORIZONTAL,
97 public function setIdent(
string $a_ident): void
99 $this->ident = $a_ident;
109 $this->title = $a_title;
119 if (preg_match(
"/(.*?)\=(.*)/", $a_comment, $matches)) {
121 switch ($matches[1]) {
122 case "ILIAS Version":
123 $this->ilias_version = $matches[2];
126 $this->questiontype = $matches[2];
129 $this->author = $matches[2] ??
'';
143 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $a_duration, $matches)) {
162 $this->questiontext = $a_questiontext;
172 $this->resprocessing[] = $a_resprocessing;
177 $this->itemfeedback[] = $a_itemfeedback;
182 $this->maxattempts = $a_maxattempts;
192 $this->label = $a_label;
202 $this->xmllang = $a_xmllang;
212 $this->presentation = $a_presentation;
222 $this->questiontype = $a_questiontype;
235 $this->presentationitem[] = $a_presentationitem;
240 if (in_array($this->questiontype, self::VALID_QUESTION_TYPES)) {
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":
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;
268 if (!$this->presentation) {
269 return self::QT_UNKNOWN;
271 foreach ($this->presentation->order as $entry) {
272 if (
'response' !== $entry[
"type"]) {
275 $result = $this->
typeFromResponse($this->presentation->response[$entry[
"index"]]);
276 if ($result !==
null) {
280 if ($this->questiontype ===
'') {
281 return self::QT_UNKNOWN;
289 $this->author = $a_author;
304 $this->iliasSourceVersion = $iliasSourceVersion ??
'';
319 $this->suggested_solutions[] = [
"solution" => $a_solution,
"gap_index" => $a_gap_index];
327 $this->itemmetadata[] = $a_metadata;
337 foreach ($this->itemmetadata as $metadata) {
338 if ($metadata[
"label"] === $a_label) {
339 return $metadata[
"entry"];
364 default:
return null;
const VALID_QUESTION_TYPES
setIdent(string $a_ident)
setIliasSourceNic(?string $iliasSourceNic)
getMetadataEntry(string $a_label)
typeFromResponse(ilQTIResponse $response)
string $iliasSourceVersion
ilQTIMaterial $questiontext
setMaxattempts(string $a_maxattempts)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setIliasSourceVersion(?string $iliasSourceVersion)
const R_CARDINALITY_SINGLE
setPresentation(ilQTIPresentation $a_presentation)
array $suggested_solutions
ilQTIPresentation $presentation
setXmllang(string $a_xmllang)
const QT_MULTIPLE_CHOICE_SR
const R_CARDINALITY_MULTIPLE
setQuestiontext(ilQTIMaterial $a_questiontext)
const R_CARDINALITY_ORDERED
setAuthor(string $a_author)
setLabel(string $a_label)
setComment(string $a_comment)
const QT_MULTIPLE_CHOICE_MR
setDuration(string $a_duration)
setQuestiontype(string $a_questiontype)
addResprocessing(ilQTIResprocessing $a_resprocessing)
addItemfeedback(ilQTIItemfeedback $a_itemfeedback)
addMetadata(array $a_metadata)
setTitle(string $a_title)
addSuggestedSolution(ilQTIMattext $a_solution, int $a_gap_index)
addPresentationitem($a_presentationitem)
const QT_ORDERING_HORIZONTAL