19declare(strict_types=1);
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":
247 case "KPRIM CHOICE QUESTION":
249 case "LONG MENU QUESTION":
251 case "SINGLE CHOICE QUESTION":
253 case "MULTIPLE CHOICE QUESTION":
255 case "MATCHING QUESTION":
257 case "CLOZE QUESTION":
259 case "IMAGE MAP QUESTION":
261 case "TEXT QUESTION":
263 case "NUMERIC QUESTION":
265 case "TEXTSUBSET QUESTION":
268 if (!$this->presentation) {
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 ===
'') {
289 $this->author = $a_author;
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 QT_MULTIPLE_CHOICE_MR
addMetadata(array $a_metadata)
setPresentation(ilQTIPresentation $a_presentation)
const QT_MULTIPLE_CHOICE_SR
setAuthor(string $a_author)
const VALID_QUESTION_TYPES
setQuestiontext(ilQTIMaterial $a_questiontext)
setIdent(string $a_ident)
setQuestiontype(string $a_questiontype)
setComment(string $a_comment)
setLabel(string $a_label)
ilQTIMaterial $questiontext
array $suggested_solutions
addItemfeedback(ilQTIItemfeedback $a_itemfeedback)
const QT_ORDERING_HORIZONTAL
setTitle(string $a_title)
string $iliasSourceVersion
addResprocessing(ilQTIResprocessing $a_resprocessing)
getMetadataEntry(string $a_label)
setXmllang(string $a_xmllang)
setDuration(string $a_duration)
setIliasSourceVersion(?string $iliasSourceVersion)
addPresentationitem($a_presentationitem)
addSuggestedSolution(ilQTIMattext $a_solution, int $a_gap_index)
ilQTIPresentation $presentation
setMaxattempts(string $a_maxattempts)
typeFromResponse(ilQTIResponse $response)
setIliasSourceNic(?string $iliasSourceNic)
const R_CARDINALITY_MULTIPLE
const R_CARDINALITY_SINGLE
const R_CARDINALITY_ORDERED