24 include_once(
"./Services/Xml/classes/class.ilSaxParser.php");
26 define (
"IL_MO_PARSE_QTI", 1);
27 define (
"IL_MO_VERIFY_QTI", 2);
120 $this->qpl_id = $a_qpl_id;
121 $this->import_idents = array();
122 if (is_array($a_import_idents))
124 $this->import_idents =& $a_import_idents;
128 $this->hasRootElement = FALSE;
129 $this->import_mapping = array();
130 $this->assessments = array();
131 $this->assessment = NULL;
132 $this->section = NULL;
133 $this->path = array();
134 $this->items = array();
136 $this->depth = array();
137 $this->do_nothing = FALSE;
138 $this->qti_element =
"";
139 $this->in_presentation = FALSE;
140 $this->in_objectives = FALSE;
141 $this->in_reponse = FALSE;
142 $this->render_type = NULL;
143 $this->render_hotspot = NULL;
144 $this->response_label = NULL;
145 $this->material = NULL;
146 $this->response = NULL;
147 $this->assessmentcontrol = NULL;
148 $this->objectives = NULL;
149 $this->matimage = NULL;
150 $this->resprocessing = NULL;
151 $this->outcomes = NULL;
152 $this->decvar = NULL;
153 $this->respcondition = NULL;
154 $this->setvar = NULL;
155 $this->displayfeedback = NULL;
156 $this->itemfeedback = NULL;
157 $this->flow_mat = array();
158 $this->question_counter = 1;
160 $this->gap_index = 0;
161 $this->presentation = NULL;
162 $this->mattext = NULL;
163 $this->matapplet = NULL;
164 $this->sametag = FALSE;
165 $this->in_assessment = FALSE;
166 $this->characterbuffer =
"";
167 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
172 $this->tst_object =& $a_tst_object;
173 if (is_object($a_tst_object))
175 $this->tst_id = $this->tst_object->getId();
181 $this->parser_mode = $a_mode;
182 $this->founditems = array();
183 $this->verifyroot =
false;
184 $this->verifyqticomment = 0;
185 $this->verifymetadatafield = 0;
186 $this->verifyfieldlabel = 0;
187 $this->verifyfieldentry = 0;
188 $this->verifyfieldlabeltext =
"";
189 $this->verifyfieldentrytext =
"";
190 $this->question_counter = 1;
200 xml_set_object($a_xml_parser,$this);
201 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
202 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
207 $this->question_counter = 1;
214 if ($this->depth[$a_xml_parser] > 0)
216 return $this->path[$this->depth[$a_xml_parser]-1];
229 switch ($this->parser_mode)
245 if ($this->do_nothing)
return;
246 $this->sametag = FALSE;
247 $this->characterbuffer =
"";
248 $this->depth[$a_xml_parser]++;
249 $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
250 $this->qti_element = $a_name;
252 switch (strtolower($a_name))
255 include_once (
"./Services/QTI/classes/class.ilQTIAssessment.php");
256 $this->assessment =& $this->assessments[array_push($this->assessments,
new ilQTIAssessment())-1];
257 $this->in_assessment = TRUE;
258 if (is_array($a_attribs))
260 foreach ($a_attribs as $attribute => $value)
262 switch (strtolower($attribute))
265 $this->assessment->setTitle($value);
268 $this->assessment->setIdent($value);
274 case "assessmentcontrol":
275 include_once (
"./Services/QTI/classes/class.ilQTIAssessmentcontrol.php");
277 if (is_array($a_attribs))
279 foreach ($a_attribs as $attribute => $value)
281 switch (strtolower($attribute))
283 case "solutionswitch":
284 $this->assessmentcontrol->setSolutionswitch($value);
287 $this->assessmentcontrol->setHintswitch($value);
289 case "feedbackswitch":
290 $this->assessmentcontrol->setFeedbackswitch($value);
297 include_once (
"./Services/QTI/classes/class.ilQTIObjectives.php");
299 $this->in_objectives = TRUE;
301 case 'presentation_material':
302 require_once
'Services/QTI/classes/class.ilQTIPresentationMaterial.php';
304 $this->in_prensentation_material = TRUE;
307 include_once (
"./Services/QTI/classes/class.ilQTISection.php");
311 $this->in_itemmetadata = TRUE;
313 case "qtimetadatafield":
314 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
317 include_once (
"./Services/QTI/classes/class.ilQTIFlow.php");
321 include_once (
"./Services/QTI/classes/class.ilQTIFlowMat.php");
325 include_once (
"./Services/QTI/classes/class.ilQTIItemfeedback.php");
327 if (is_array($a_attribs))
329 foreach ($a_attribs as $attribute => $value)
331 switch (strtolower($attribute))
334 $this->itemfeedback->setIdent($value);
337 $this->itemfeedback->setView($value);
343 case "displayfeedback":
344 include_once (
"./Services/QTI/classes/class.ilQTIDisplayfeedback.php");
346 if (is_array($a_attribs))
348 foreach ($a_attribs as $attribute => $value)
350 switch (strtolower($attribute))
353 $this->displayfeedback->setFeedbacktype($value);
356 $this->displayfeedback->setLinkrefid($value);
363 include_once (
"./Services/QTI/classes/class.ilQTISetvar.php");
365 if (is_array($a_attribs))
367 foreach ($a_attribs as $attribute => $value)
369 switch (strtolower($attribute))
372 $this->setvar->setAction($value);
375 $this->setvar->setVarname($value);
382 include_once (
"./Services/QTI/classes/class.ilQTIConditionvar.php");
386 if ($this->conditionvar != NULL)
388 $this->conditionvar->addNot();
392 if ($this->conditionvar != NULL)
394 $this->conditionvar->addAnd();
398 if ($this->conditionvar != NULL)
400 $this->conditionvar->addOr();
404 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
406 if (is_array($a_attribs))
408 foreach ($a_attribs as $attribute => $value)
410 switch (strtolower($attribute))
413 $this->responsevar->setCase($value);
416 $this->responsevar->setRespident($value);
419 $this->responsevar->setIndex($value);
426 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
428 if (is_array($a_attribs))
430 foreach ($a_attribs as $attribute => $value)
432 switch (strtolower($attribute))
435 $this->responsevar->setRespident($value);
438 $this->responsevar->setIndex($value);
445 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
447 if (is_array($a_attribs))
449 foreach ($a_attribs as $attribute => $value)
451 switch (strtolower($attribute))
454 $this->responsevar->setRespident($value);
457 $this->responsevar->setIndex($value);
464 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
466 if (is_array($a_attribs))
468 foreach ($a_attribs as $attribute => $value)
470 switch (strtolower($attribute))
473 $this->responsevar->setRespident($value);
476 $this->responsevar->setIndex($value);
483 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
485 if (is_array($a_attribs))
487 foreach ($a_attribs as $attribute => $value)
489 switch (strtolower($attribute))
492 $this->responsevar->setRespident($value);
495 $this->responsevar->setIndex($value);
502 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
504 if (is_array($a_attribs))
506 foreach ($a_attribs as $attribute => $value)
508 switch (strtolower($attribute))
511 $this->responsevar->setRespident($value);
514 $this->responsevar->setSetmatch($value);
517 $this->responsevar->setIndex($value);
524 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
526 if (is_array($a_attribs))
528 foreach ($a_attribs as $attribute => $value)
530 switch (strtolower($attribute))
533 $this->responsevar->setRespident($value);
536 $this->responsevar->setAreatype($value);
539 $this->responsevar->setIndex($value);
546 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
548 if (is_array($a_attribs))
550 foreach ($a_attribs as $attribute => $value)
552 switch (strtolower($attribute))
555 $this->responsevar->setCase($value);
558 $this->responsevar->setRespident($value);
561 $this->responsevar->setIndex($value);
567 case "respcondition":
568 include_once(
"./Services/QTI/classes/class.ilQTIRespcondition.php");
570 if (is_array($a_attribs))
572 foreach ($a_attribs as $attribute => $value)
574 switch (strtolower($attribute))
577 $this->respcondition->setContinue($value);
580 $this->respcondition->setTitle($value);
587 include_once(
"./Services/QTI/classes/class.ilQTIOutcomes.php");
591 include_once(
"./Services/QTI/classes/class.ilQTIDecvar.php");
593 if (is_array($a_attribs))
595 foreach ($a_attribs as $attribute => $value)
597 switch (strtolower($attribute))
600 $this->decvar->setVarname($value);
603 $this->decvar->setVartype($value);
606 $this->decvar->setDefaultval($value);
609 $this->decvar->setMinvalue($value);
612 $this->decvar->setMaxvalue($value);
615 $this->decvar->setMembers($value);
618 $this->decvar->setCutvalue($value);
625 include_once(
"./Services/QTI/classes/class.ilQTIMatimage.php");
627 if (is_array($a_attribs))
629 foreach ($a_attribs as $attribute => $value)
631 switch (strtolower($attribute))
634 $this->matimage->setImagetype($value);
637 $this->matimage->setLabel($value);
640 $this->matimage->setHeight($value);
643 $this->matimage->setWidth($value);
646 $this->matimage->setUri($value);
649 $this->matimage->setEmbedded($value);
652 $this->matimage->setX0($value);
655 $this->matimage->setY0($value);
658 $this->matimage->setEntityref($value);
665 include_once(
"./Services/QTI/classes/class.ilQTIMaterial.php");
667 $this->material->setFlow($this->flow);
668 if (is_array($a_attribs))
670 foreach ($a_attribs as $attribute => $value)
672 switch (strtolower($attribute))
675 $this->material->setLabel($value);
682 include_once (
"./Services/QTI/classes/class.ilQTIMattext.php");
684 if (is_array($a_attribs))
686 foreach ($a_attribs as $attribute => $value)
688 switch (strtolower($attribute))
691 $this->mattext->setTexttype($value);
694 $this->mattext->setLabel($value);
697 $this->mattext->setCharset($value);
700 $this->mattext->setUri($value);
703 $this->mattext->setXmlspace($value);
706 $this->mattext->setXmllang($value);
709 $this->mattext->setEntityref($value);
712 $this->mattext->setHeight($value);
715 $this->mattext->setWidth($value);
718 $this->mattext->setX0($value);
721 $this->mattext->setY0($value);
728 include_once (
"./Services/QTI/classes/class.ilQTIMatapplet.php");
730 if (is_array($a_attribs))
732 foreach ($a_attribs as $attribute => $value)
734 switch (strtolower($attribute))
737 $this->matapplet->setLabel($value);
740 $this->matapplet->setUri($value);
743 $this->matapplet->setY0($value);
746 $this->matapplet->setHeight($value);
749 $this->matapplet->setWidth($value);
752 $this->matapplet->setX0($value);
755 $this->matapplet->setEmbedded($value);
758 $this->matapplet->setEntityref($value);
764 case "questestinterop":
765 $this->hasRootElement = TRUE;
773 if ($this->assessment != NULL)
775 $this->assessment->addSection($this->section);
777 $this->section = NULL;
780 $this->in_presentation = TRUE;
781 include_once (
"./Services/QTI/classes/class.ilQTIPresentation.php");
784 case "response_label":
785 if ($this->render_type != NULL)
787 include_once(
"./Services/QTI/classes/class.ilQTIResponseLabel.php");
789 foreach ($a_attribs as $attribute => $value)
791 switch (strtolower($attribute))
794 $this->response_label->setRshuffle($value);
797 $this->response_label->setRarea($value);
800 $this->response_label->setRrange($value);
803 $this->response_label->setLabelrefid($value);
806 $this->response_label->setIdent($value);
809 $this->response_label->setMatchGroup($value);
812 $this->response_label->setMatchMax($value);
818 case "render_choice":
819 if ($this->in_response)
821 include_once(
"./Services/QTI/classes/class.ilQTIRenderChoice.php");
823 foreach ($a_attribs as $attribute => $value)
825 switch (strtolower($attribute))
828 $this->render_type->setShuffle($value);
834 case "render_hotspot":
835 if ($this->in_response)
837 include_once(
"./Services/QTI/classes/class.ilQTIRenderHotspot.php");
839 foreach ($a_attribs as $attribute => $value)
841 switch (strtolower($attribute))
844 $this->render_type->setShuffle($value);
847 $this->render_type->setMinnumber($value);
850 $this->render_type->setMaxnumber($value);
857 if ($this->in_response)
859 include_once(
"./Services/QTI/classes/class.ilQTIRenderFib.php");
861 foreach ($a_attribs as $attribute => $value)
863 switch (strtolower($attribute))
866 $this->render_type->setEncoding($value);
869 $this->render_type->setFibtype($value);
872 $this->render_type->setRows($value);
875 $this->render_type->setMaxchars($value);
878 $this->render_type->setPrompt($value);
881 $this->render_type->setColumns($value);
884 $this->render_type->setCharset($value);
887 $this->render_type->setMaxnumber($value);
890 $this->render_type->setMinnumber($value);
909 include_once
"./Services/QTI/classes/class.ilQTIResponse.php";
910 switch (strtolower($a_name))
928 $this->in_response = TRUE;
930 $this->response->setFlow($this->flow);
931 if (is_array($a_attribs))
933 foreach ($a_attribs as $attribute => $value)
935 switch (strtolower($attribute))
938 $this->response->setIdent($value);
941 $this->response->setRTiming($value);
944 $this->response->setRCardinality($value);
947 $this->response->setNumtype($value);
954 include_once(
"./Services/QTI/classes/class.ilQTIItem.php");
955 $this->gap_index = 0;
956 $this->item =& $this->items[array_push($this->items,
new ilQTIItem())-1];
957 if (is_array($a_attribs))
959 foreach ($a_attribs as $attribute => $value)
961 switch (strtolower($attribute))
964 $this->item->setIdent($value);
965 $this->item->setIliasSourceNic(
968 if (count($this->import_idents) > 0)
970 if (!in_array($value, $this->import_idents))
972 $this->do_nothing = TRUE;
977 $this->item->setTitle($value);
980 $this->item->setMaxattempts($value);
986 case "resprocessing":
987 include_once(
"./Services/QTI/classes/class.ilQTIResprocessing.php");
989 if (is_array($a_attribs))
991 foreach ($a_attribs as $attribute => $value)
993 switch (strtolower($attribute))
996 $this->resprocessing->setScoremodel($value);
1010 switch ($this->parser_mode)
1026 if (($this->do_nothing) && (strcmp(strtolower($a_name),
"item") != 0))
return;
1027 switch (strtolower($a_name))
1030 if (is_object($this->tst_object))
1032 $this->tst_object->fromXML($this->assessment);
1034 $this->in_assessment = FALSE;
1036 case "assessmentcontrol":
1037 $this->assessment->addAssessmentcontrol($this->assessmentcontrol);
1038 $this->assessmentcontrol = NULL;
1041 if (strcmp(strtolower($this->
getParent($a_xml_parser)),
"assessment") == 0)
1043 $this->assessment->addObjectives($this->objectives);
1045 $this->in_objectives = FALSE;
1047 case 'presentation_material':
1048 $this->assessment->setPresentationMaterial($this->prensentation_material);
1049 $this->in_prensentation_material = FALSE;
1051 case "itemmetadata":
1052 $this->in_itemmetadata = FALSE;
1054 case "qtimetadatafield":
1056 switch ($this->metadata[
"label"])
1058 case "ILIAS_VERSION":
1059 if ($this->item != NULL)
1061 $this->item->setIliasSourceVersion(
1066 case "QUESTIONTYPE":
1067 if ($this->item != NULL)
1069 $this->item->setQuestiontype($this->metadata[
"entry"]);
1073 if ($this->item != NULL)
1075 $this->item->setAuthor($this->metadata[
"entry"]);
1078 if ($this->item != NULL)
1080 $this->item->addMetadata($this->metadata);
1084 if ($this->in_assessment)
1086 $this->assessment->addQtiMetadata($this->metadata);
1088 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
1094 if (count($this->flow_mat))
1097 if (count($this->flow_mat))
1099 $this->flow_mat[count($this->flow_mat)-1]->addFlow_mat(
$flow_mat);
1101 else if($this->in_prensentation_material)
1103 $this->prensentation_material->addFlowMat(
$flow_mat);
1105 else if ($this->itemfeedback != NULL)
1107 $this->itemfeedback->addFlow_mat(
$flow_mat);
1109 else if ($this->response_label != NULL)
1111 $this->response_label->addFlow_mat(
$flow_mat);
1115 case "itemfeedback":
1116 if ($this->item != NULL)
1118 if ($this->itemfeedback != NULL)
1120 $this->item->addItemfeedback($this->itemfeedback);
1123 $this->itemfeedback = NULL;
1125 case "displayfeedback":
1126 if ($this->respcondition != NULL)
1128 if ($this->displayfeedback != NULL)
1130 $this->respcondition->addDisplayfeedback($this->displayfeedback);
1133 $this->displayfeedback = NULL;
1136 if ($this->respcondition != NULL)
1138 if ($this->setvar != NULL)
1140 $this->respcondition->addSetvar($this->setvar);
1143 $this->setvar = NULL;
1145 case "conditionvar":
1146 if ($this->respcondition != NULL)
1148 $this->respcondition->setConditionvar($this->conditionvar);
1150 $this->conditionvar = NULL;
1159 case "varsubstring":
1160 if ($this->conditionvar != NULL)
1162 if ($this->responsevar != NULL)
1164 $this->conditionvar->addResponseVar($this->responsevar);
1167 $this->responsevar = NULL;
1169 case "respcondition":
1170 if ($this->resprocessing != NULL)
1172 $this->resprocessing->addRespcondition($this->respcondition);
1174 $this->respcondition = NULL;
1177 if ($this->resprocessing != NULL)
1179 $this->resprocessing->setOutcomes($this->outcomes);
1181 $this->outcomes = NULL;
1184 if ($this->outcomes != NULL)
1186 $this->outcomes->addDecvar($this->decvar);
1188 $this->decvar = NULL;
1190 case "presentation":
1191 $this->in_presentation = FALSE;
1192 if ($this->presentation != NULL)
1194 if ($this->item != NULL)
1196 $this->item->setPresentation($this->presentation);
1199 $this->presentation = NULL;
1201 case "response_label":
1202 if ($this->render_type != NULL)
1204 $this->render_type->addResponseLabel($this->response_label);
1205 $this->response_label = NULL;
1208 case "render_choice":
1209 case "render_hotspot":
1211 if ($this->in_response)
1213 if ($this->response != NULL)
1215 if ($this->render_type != NULL)
1217 $this->response->setRenderType($this->render_type);
1218 $this->render_type = NULL;
1223 case "response_lid":
1225 case "response_str":
1226 case "response_num":
1227 case "response_grp":
1229 if ($this->presentation != NULL)
1231 if ($this->response != NULL)
1233 $this->presentation->addResponse($this->response);
1234 if ($this->item != NULL)
1236 $this->item->addPresentationitem($this->response);
1240 $this->response = NULL;
1241 $this->in_response = FALSE;
1244 if ($this->do_nothing)
1246 $this->do_nothing = FALSE;
1249 if (strlen($this->item->getQuestionType()))
1265 $qt = $this->item->determineQuestionType();
1268 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1270 $question =
new $qt();
1271 $fbt = str_replace(
'ass',
'ilAss', $qt).
'Feedback';
1272 $question->feedbackOBJ =
new $fbt(
1275 $question->fromXML($this->item, $this->qpl_id, $this->tst_id, $this->tst_object, $this->question_counter, $this->import_mapping);
1278 if ($this->material)
1280 $mat = $this->material->getMaterial(0);
1281 if ((strcmp($mat[
"type"],
"mattext") == 0) && (strcmp($mat[
"material"]->getLabel(),
"suggested_solution") == 0))
1283 $this->item->addSuggestedSolution($mat[
"material"], $this->gap_index);
1285 if ($this->in_objectives)
1287 $this->objectives->addMaterial($this->material);
1289 else if (($this->render_type != NULL) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"render_hotspot") == 0))
1291 $this->render_type->addMaterial($this->material);
1293 else if (count($this->flow_mat) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"flow_mat") == 0))
1295 $this->flow_mat[count($this->flow_mat)-1]->addMaterial($this->material);
1297 else if ($this->itemfeedback != NULL)
1299 $this->itemfeedback->addMaterial($this->material);
1301 else if ($this->response_label != NULL)
1303 $this->response_label->addMaterial($this->material);
1305 else if ($this->response != NULL)
1307 if ($this->response->hasRendering())
1309 $this->response->setMaterial2($this->material);
1313 $this->response->setMaterial1($this->material);
1316 elseif (($this->in_presentation) && (!$this->in_response))
1318 if (!is_object($this->item->getQuestiontext()))
1320 $this->item->setQuestiontext($this->material);
1322 $this->presentation->addMaterial($this->material);
1324 else if ($this->presentation != NULL)
1326 $this->presentation->addMaterial($this->material);
1327 if ($this->item != NULL)
1329 $this->item->addPresentationitem($this->material);
1333 $this->material = NULL;
1336 if ($this->material != NULL)
1338 if ($this->matimage != NULL)
1340 $this->material->addMatimage($this->matimage);
1343 $this->matimage = NULL;
1348 $this->mattext->setContent(
'<br />');
1349 $this->material->addMattext($this->mattext);
1350 $this->mattext = NULL;
1352 case "resprocessing":
1353 if ($this->item != NULL)
1355 $this->item->addResprocessing($this->resprocessing);
1357 $this->resprocessing = NULL;
1360 if ($this->material != NULL)
1362 $this->material->addMattext($this->mattext);
1364 $this->mattext = NULL;
1367 if ($this->material != NULL)
1369 $this->material->addMatapplet($this->matapplet);
1371 $this->matapplet = NULL;
1374 $this->depth[$a_xml_parser]--;
1382 switch ($this->parser_mode)
1398 if ($this->do_nothing)
return;
1399 $this->characterbuffer .= $a_data;
1401 switch ($this->qti_element)
1404 $this->metadata[
"label"] = $a_data;
1407 $this->metadata[
"entry"] = $a_data;
1409 case "response_label":
1410 if ($this->response_label != NULL)
1412 $this->response_label->setContent($a_data);
1416 if ($this->setvar != NULL)
1418 $this->setvar->setContent($a_data);
1421 case "displayfeedback":
1422 if ($this->displayfeedback != NULL)
1424 $this->displayfeedback->setContent($a_data);
1434 case "varsubstring":
1435 if ($this->responsevar != NULL)
1437 $this->responsevar->setContent($a_data);
1441 if (strlen($a_data))
1443 if ($this->decvar != NULL)
1445 $this->decvar->setContent($a_data);
1450 if ($this->mattext != NULL)
1452 $this->mattext->setContent($a_data);
1456 if ($this->matapplet != NULL)
1458 $this->matapplet->setContent($a_data);
1462 if ($this->matimage != NULL)
1464 $this->matimage->setContent($a_data);
1468 switch ($this->
getParent($a_xml_parser))
1477 $this->item->setDuration($a_data);
1482 switch ($this->
getParent($a_xml_parser))
1485 $this->item->setComment($a_data);
1488 $this->assessment->setComment($a_data);
1495 $this->sametag = TRUE;
1503 switch (strtolower($a_name))
1505 case "questestinterop":
1506 $this->verifyroot =
true;
1508 case "qtimetadatafield":
1509 $this->verifymetadatafield = 1;
1512 $this->verifyfieldlabeltext =
"";
1513 if ($this->verifymetadatafield == 1) $this->verifyfieldlabel = 1;
1516 $this->verifyfieldentrytext =
"";
1517 if ($this->verifymetadatafield == 1) $this->verifyfieldentry = 1;
1521 if (is_array($a_attribs))
1523 foreach ($a_attribs as $attribute => $value)
1525 switch (strtolower($attribute))
1533 array_push($this->founditems, array(
"title" =>
"$title",
"type" =>
"",
"ident" => $a_attribs[
"ident"]));
1535 case "response_lid":
1536 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1539 if (is_array($a_attribs))
1541 foreach ($a_attribs as $attribute => $value)
1543 switch (strtolower($attribute))
1545 case "rcardinality":
1546 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1547 switch (strtolower($value))
1556 $this->founditems[count($this->founditems)-1][
"type"] =
QT_ORDERING;
1565 case "response_str":
1566 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1569 if (is_array($a_attribs))
1571 foreach ($a_attribs as $attribute => $value)
1573 switch (strtolower($attribute))
1575 case "rcardinality":
1576 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1577 switch (strtolower($value))
1580 $this->founditems[count($this->founditems)-1][
"type"] =
QT_CLOZE;
1583 $this->founditems[count($this->founditems)-1][
"type"] =
QT_TEXT;
1593 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1595 $this->founditems[count($this->founditems)-1][
"type"] =
QT_IMAGEMAP;
1598 case "response_num":
1599 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1601 $this->founditems[count($this->founditems)-1][
"type"] =
QT_NUMERIC;
1604 case "response_grp":
1605 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1607 $this->founditems[count($this->founditems)-1][
"type"] =
QT_MATCHING;
1612 $this->verifyqticomment = 1;
1614 case "presentation":
1615 if (is_array($a_attribs))
1617 foreach ($a_attribs as $attribute => $value)
1619 switch (strtolower($attribute))
1622 $this->founditems[count($this->founditems)-1][
"title"] = $value;
1636 switch (strtolower($a_name))
1640 $this->verifyqticomment = 0;
1642 case "qtimetadatafield":
1643 $this->verifymetadatafield = 0;
1644 if (strcmp($this->verifyfieldlabeltext,
"QUESTIONTYPE") == 0)
1650 $this->verifyfieldlabel = 0;
1653 $this->verifyfieldentry = 0;
1663 if ($this->verifyqticomment == 1)
1665 if (preg_match(
"/Questiontype\=(.*)/", $a_data, $matches))
1667 if (count($this->founditems))
1669 $this->founditems[count($this->founditems)-1][
"type"] = $matches[1];
1673 else if ($this->verifyfieldlabel == 1)
1675 $this->verifyfieldlabeltext = $a_data;
1677 else if ($this->verifyfieldentry == 1)
1679 $this->verifyfieldentrytext = $a_data;
1694 if (!is_array($this->import_mapping))
1713 $xmlContent = file_get_contents($this->xml_file);
1715 file_put_contents($this->xml_file, $xmlContent);
1724 if( preg_match(
'/^(\d+\.\d+\.\d+) .*$/', $versionDateString, $matches) )
1736 if( preg_match(
'/^il_(\d+?)_qst_\d+$/', $itemIdent, $matches) )
1754 for($i = 0x00, $max = 0x08; $i <= $max; $i += 0x01)
1756 $needles[] =
"&#{$i};";
1758 for($i = 0x0b, $max = 0x0c; $i <= $max; $i += 0x01)
1760 $needles[] =
"&#{$i};";
1762 for($i = 0x0e, $max = 0x1f; $i <= $max; $i += 0x01)
1764 $needles[] =
"&#{$i};";
1766 for($i = 0xd800, $max = 0xdfff; $i <= $max; $i += 0x0001)
1768 $needles[] =
"&#{$i};";
1770 for($i = 0xfffe, $max = 0xffff; $i <= $max; $i += 0x0001)
1772 $needles[] =
"&#{$i};";
1774 $reg =
'/('.implode(
'|', $needles).
')/';
1775 $xmlContent = preg_replace($reg,
'', $xmlContent);