3 declare(strict_types=1);
80 public function setIdent(
string $a_ident): void
82 $this->ident = $a_ident;
90 public function setTitle(
string $a_title): void
92 $this->title = $a_title;
102 if (preg_match(
"/(.*?)\=(.*)/", $a_comment, $matches)) {
104 switch ($matches[1]) {
105 case "ILIAS Version":
106 $this->ilias_version = $matches[2];
109 $this->questiontype = $matches[2];
112 $this->author = $matches[2] ??
'';
126 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $a_duration, $matches)) {
127 $this->duration = array(
145 $this->questiontext = $a_questiontext;
155 $this->resprocessing[] = $a_resprocessing;
160 $this->itemfeedback[] = $a_itemfeedback;
165 $this->maxattempts = $a_maxattempts;
175 $this->label = $a_label;
185 $this->xmllang = $a_xmllang;
195 $this->presentation = $a_presentation;
205 $this->questiontype = $a_questiontype;
218 $this->presentationitem[] = $a_presentationitem;
223 switch ($this->questiontype) {
224 case "ORDERING QUESTION":
225 return self::QT_ORDERING;
226 case "KPRIM CHOICE QUESTION":
227 return self::QT_KPRIM_CHOICE;
228 case "LONG MENU QUESTION":
229 return self::QT_LONG_MENU;
230 case "SINGLE CHOICE QUESTION":
231 return self::QT_MULTIPLE_CHOICE_SR;
232 case "MULTIPLE CHOICE QUESTION":
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;
247 if (!$this->presentation) {
248 return self::QT_UNKNOWN;
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) {
258 if (strlen($this->questiontype) == 0) {
259 return self::QT_UNKNOWN;
267 $this->author = $a_author;
282 $this->iliasSourceVersion = $iliasSourceVersion ??
'';
297 $this->suggested_solutions[] = array(
"solution" => $a_solution,
"gap_index" => $a_gap_index);
305 $this->itemmetadata[] = $a_metadata;
315 foreach ($this->itemmetadata as $metadata) {
316 if ($metadata[
"label"] === $a_label) {
317 return $metadata[
"entry"];
342 default:
return null;
setIdent(string $a_ident)
setIliasSourceNic(?string $iliasSourceNic)
getMetadataEntry(string $a_label)
typeFromResponse(ilQTIResponse $response)
string $iliasSourceVersion
ilQTIMaterial $questiontext
setMaxattempts(string $a_maxattempts)
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