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 if (count($this->import_idents) > 0)
967 if (!in_array($value, $this->import_idents))
969 $this->do_nothing = TRUE;
974 $this->item->setTitle($value);
977 $this->item->setMaxattempts($value);
983 case "resprocessing":
984 include_once(
"./Services/QTI/classes/class.ilQTIResprocessing.php");
986 if (is_array($a_attribs))
988 foreach ($a_attribs as $attribute => $value)
990 switch (strtolower($attribute))
993 $this->resprocessing->setScoremodel($value);
1007 switch ($this->parser_mode)
1023 if (($this->do_nothing) && (strcmp(strtolower($a_name),
"item") != 0))
return;
1024 switch (strtolower($a_name))
1027 if (is_object($this->tst_object))
1029 $this->tst_object->fromXML($this->assessment);
1031 $this->in_assessment = FALSE;
1033 case "assessmentcontrol":
1034 $this->assessment->addAssessmentcontrol($this->assessmentcontrol);
1035 $this->assessmentcontrol = NULL;
1038 if (strcmp(strtolower($this->
getParent($a_xml_parser)),
"assessment") == 0)
1040 $this->assessment->addObjectives($this->objectives);
1042 $this->in_objectives = FALSE;
1044 case 'presentation_material':
1045 $this->assessment->setPresentationMaterial($this->prensentation_material);
1046 $this->in_prensentation_material = FALSE;
1048 case "itemmetadata":
1049 $this->in_itemmetadata = FALSE;
1051 case "qtimetadatafield":
1053 switch ($this->metadata[
"label"])
1055 case "ILIAS_VERSION":
1057 case "QUESTIONTYPE":
1058 if ($this->item != NULL)
1060 $this->item->setQuestiontype($this->metadata[
"entry"]);
1064 if ($this->item != NULL)
1066 $this->item->setAuthor($this->metadata[
"entry"]);
1069 if ($this->item != NULL)
1071 $this->item->addMetadata($this->metadata);
1075 if ($this->in_assessment)
1077 $this->assessment->addQtiMetadata($this->metadata);
1079 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
1085 if (count($this->flow_mat))
1088 if (count($this->flow_mat))
1090 $this->flow_mat[count($this->flow_mat)-1]->addFlow_mat(
$flow_mat);
1092 else if($this->in_prensentation_material)
1094 $this->prensentation_material->addFlowMat(
$flow_mat);
1096 else if ($this->itemfeedback != NULL)
1098 $this->itemfeedback->addFlow_mat(
$flow_mat);
1100 else if ($this->response_label != NULL)
1102 $this->response_label->addFlow_mat(
$flow_mat);
1106 case "itemfeedback":
1107 if ($this->item != NULL)
1109 if ($this->itemfeedback != NULL)
1111 $this->item->addItemfeedback($this->itemfeedback);
1114 $this->itemfeedback = NULL;
1116 case "displayfeedback":
1117 if ($this->respcondition != NULL)
1119 if ($this->displayfeedback != NULL)
1121 $this->respcondition->addDisplayfeedback($this->displayfeedback);
1124 $this->displayfeedback = NULL;
1127 if ($this->respcondition != NULL)
1129 if ($this->setvar != NULL)
1131 $this->respcondition->addSetvar($this->setvar);
1134 $this->setvar = NULL;
1136 case "conditionvar":
1137 if ($this->respcondition != NULL)
1139 $this->respcondition->setConditionvar($this->conditionvar);
1141 $this->conditionvar = NULL;
1150 case "varsubstring":
1151 if ($this->conditionvar != NULL)
1153 if ($this->responsevar != NULL)
1155 $this->conditionvar->addResponseVar($this->responsevar);
1158 $this->responsevar = NULL;
1160 case "respcondition":
1161 if ($this->resprocessing != NULL)
1163 $this->resprocessing->addRespcondition($this->respcondition);
1165 $this->respcondition = NULL;
1168 if ($this->resprocessing != NULL)
1170 $this->resprocessing->setOutcomes($this->outcomes);
1172 $this->outcomes = NULL;
1175 if ($this->outcomes != NULL)
1177 $this->outcomes->addDecvar($this->decvar);
1179 $this->decvar = NULL;
1181 case "presentation":
1182 $this->in_presentation = FALSE;
1183 if ($this->presentation != NULL)
1185 if ($this->item != NULL)
1187 $this->item->setPresentation($this->presentation);
1190 $this->presentation = NULL;
1192 case "response_label":
1193 if ($this->render_type != NULL)
1195 $this->render_type->addResponseLabel($this->response_label);
1196 $this->response_label = NULL;
1199 case "render_choice":
1200 case "render_hotspot":
1202 if ($this->in_response)
1204 if ($this->response != NULL)
1206 if ($this->render_type != NULL)
1208 $this->response->setRenderType($this->render_type);
1209 $this->render_type = NULL;
1214 case "response_lid":
1216 case "response_str":
1217 case "response_num":
1218 case "response_grp":
1220 if ($this->presentation != NULL)
1222 if ($this->response != NULL)
1224 $this->presentation->addResponse($this->response);
1225 if ($this->item != NULL)
1227 $this->item->addPresentationitem($this->response);
1231 $this->response = NULL;
1232 $this->in_response = FALSE;
1235 if ($this->do_nothing)
1237 $this->do_nothing = FALSE;
1240 if (strlen($this->item->getQuestionType()))
1256 $qt = $this->item->determineQuestionType();
1259 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1261 $question =
new $qt();
1262 $fbt = str_replace(
'ass',
'ilAss', $qt).
'Feedback';
1263 $question->feedbackOBJ =
new $fbt(
1266 $question->fromXML($this->item, $this->qpl_id, $this->tst_id, $this->tst_object, $this->question_counter, $this->import_mapping);
1269 if ($this->material)
1271 $mat = $this->material->getMaterial(0);
1272 if ((strcmp($mat[
"type"],
"mattext") == 0) && (strcmp($mat[
"material"]->getLabel(),
"suggested_solution") == 0))
1274 $this->item->addSuggestedSolution($mat[
"material"], $this->gap_index);
1276 if ($this->in_objectives)
1278 $this->objectives->addMaterial($this->material);
1280 else if (($this->render_type != NULL) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"render_hotspot") == 0))
1282 $this->render_type->addMaterial($this->material);
1284 else if (count($this->flow_mat) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"flow_mat") == 0))
1286 $this->flow_mat[count($this->flow_mat)-1]->addMaterial($this->material);
1288 else if ($this->itemfeedback != NULL)
1290 $this->itemfeedback->addMaterial($this->material);
1292 else if ($this->response_label != NULL)
1294 $this->response_label->addMaterial($this->material);
1296 else if ($this->response != NULL)
1298 if ($this->response->hasRendering())
1300 $this->response->setMaterial2($this->material);
1304 $this->response->setMaterial1($this->material);
1307 elseif (($this->in_presentation) && (!$this->in_response))
1309 if (!is_object($this->item->getQuestiontext()))
1311 $this->item->setQuestiontext($this->material);
1313 $this->presentation->addMaterial($this->material);
1315 else if ($this->presentation != NULL)
1317 $this->presentation->addMaterial($this->material);
1318 if ($this->item != NULL)
1320 $this->item->addPresentationitem($this->material);
1324 $this->material = NULL;
1327 if ($this->material != NULL)
1329 if ($this->matimage != NULL)
1331 $this->material->addMatimage($this->matimage);
1334 $this->matimage = NULL;
1339 $this->mattext->setContent(
'<br />');
1340 $this->material->addMattext($this->mattext);
1341 $this->mattext = NULL;
1343 case "resprocessing":
1344 if ($this->item != NULL)
1346 $this->item->addResprocessing($this->resprocessing);
1348 $this->resprocessing = NULL;
1351 if ($this->material != NULL)
1353 $this->material->addMattext($this->mattext);
1355 $this->mattext = NULL;
1358 if ($this->material != NULL)
1360 $this->material->addMatapplet($this->matapplet);
1362 $this->matapplet = NULL;
1365 $this->depth[$a_xml_parser]--;
1373 switch ($this->parser_mode)
1389 if ($this->do_nothing)
return;
1390 $this->characterbuffer .= $a_data;
1392 switch ($this->qti_element)
1395 $this->metadata[
"label"] = $a_data;
1398 $this->metadata[
"entry"] = $a_data;
1400 case "response_label":
1401 if ($this->response_label != NULL)
1403 $this->response_label->setContent($a_data);
1407 if ($this->setvar != NULL)
1409 $this->setvar->setContent($a_data);
1412 case "displayfeedback":
1413 if ($this->displayfeedback != NULL)
1415 $this->displayfeedback->setContent($a_data);
1425 case "varsubstring":
1426 if ($this->responsevar != NULL)
1428 $this->responsevar->setContent($a_data);
1432 if (strlen($a_data))
1434 if ($this->decvar != NULL)
1436 $this->decvar->setContent($a_data);
1441 if ($this->mattext != NULL)
1443 $this->mattext->setContent($a_data);
1447 if ($this->matapplet != NULL)
1449 $this->matapplet->setContent($a_data);
1453 if ($this->matimage != NULL)
1455 $this->matimage->setContent($a_data);
1459 switch ($this->
getParent($a_xml_parser))
1468 $this->item->setDuration($a_data);
1473 switch ($this->
getParent($a_xml_parser))
1476 $this->item->setComment($a_data);
1479 $this->assessment->setComment($a_data);
1486 $this->sametag = TRUE;
1494 switch (strtolower($a_name))
1496 case "questestinterop":
1497 $this->verifyroot =
true;
1499 case "qtimetadatafield":
1500 $this->verifymetadatafield = 1;
1503 $this->verifyfieldlabeltext =
"";
1504 if ($this->verifymetadatafield == 1) $this->verifyfieldlabel = 1;
1507 $this->verifyfieldentrytext =
"";
1508 if ($this->verifymetadatafield == 1) $this->verifyfieldentry = 1;
1512 if (is_array($a_attribs))
1514 foreach ($a_attribs as $attribute => $value)
1516 switch (strtolower($attribute))
1524 array_push($this->founditems, array(
"title" =>
"$title",
"type" =>
"",
"ident" => $a_attribs[
"ident"]));
1526 case "response_lid":
1527 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1530 if (is_array($a_attribs))
1532 foreach ($a_attribs as $attribute => $value)
1534 switch (strtolower($attribute))
1536 case "rcardinality":
1537 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1538 switch (strtolower($value))
1547 $this->founditems[count($this->founditems)-1][
"type"] =
QT_ORDERING;
1556 case "response_str":
1557 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1560 if (is_array($a_attribs))
1562 foreach ($a_attribs as $attribute => $value)
1564 switch (strtolower($attribute))
1566 case "rcardinality":
1567 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1568 switch (strtolower($value))
1571 $this->founditems[count($this->founditems)-1][
"type"] =
QT_CLOZE;
1574 $this->founditems[count($this->founditems)-1][
"type"] =
QT_TEXT;
1584 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1586 $this->founditems[count($this->founditems)-1][
"type"] =
QT_IMAGEMAP;
1589 case "response_num":
1590 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1592 $this->founditems[count($this->founditems)-1][
"type"] =
QT_NUMERIC;
1595 case "response_grp":
1596 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1598 $this->founditems[count($this->founditems)-1][
"type"] =
QT_MATCHING;
1603 $this->verifyqticomment = 1;
1605 case "presentation":
1606 if (is_array($a_attribs))
1608 foreach ($a_attribs as $attribute => $value)
1610 switch (strtolower($attribute))
1613 $this->founditems[count($this->founditems)-1][
"title"] = $value;
1627 switch (strtolower($a_name))
1631 $this->verifyqticomment = 0;
1633 case "qtimetadatafield":
1634 $this->verifymetadatafield = 0;
1635 if (strcmp($this->verifyfieldlabeltext,
"QUESTIONTYPE") == 0)
1641 $this->verifyfieldlabel = 0;
1644 $this->verifyfieldentry = 0;
1654 if ($this->verifyqticomment == 1)
1656 if (preg_match(
"/Questiontype\=(.*)/", $a_data, $matches))
1658 if (count($this->founditems))
1660 $this->founditems[count($this->founditems)-1][
"type"] = $matches[1];
1664 else if ($this->verifyfieldlabel == 1)
1666 $this->verifyfieldlabeltext = $a_data;
1668 else if ($this->verifyfieldentry == 1)
1670 $this->verifyfieldentrytext = $a_data;
1685 if (!is_array($this->import_mapping))
1704 $xmlContent = file_get_contents($this->xml_file);
1706 file_put_contents($this->xml_file, $xmlContent);
1721 for($i = 0x00, $max = 0x08; $i <= $max; $i += 0x01)
1723 $needles[] =
"&#{$i};";
1725 for($i = 0x0b, $max = 0x0c; $i <= $max; $i += 0x01)
1727 $needles[] =
"&#{$i};";
1729 for($i = 0x0e, $max = 0x1f; $i <= $max; $i += 0x01)
1731 $needles[] =
"&#{$i};";
1733 for($i = 0xd800, $max = 0xdfff; $i <= $max; $i += 0x0001)
1735 $needles[] =
"&#{$i};";
1737 for($i = 0xfffe, $max = 0xffff; $i <= $max; $i += 0x0001)
1739 $needles[] =
"&#{$i};";
1741 $reg =
'/('.implode(
'|', $needles).
')/';
1742 $xmlContent = preg_replace($reg,
'', $xmlContent);