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 $question->fromXML($this->item, $this->qpl_id, $this->tst_id, $this->tst_object, $this->question_counter, $this->import_mapping);
1265 if ($this->material)
1267 $mat = $this->material->getMaterial(0);
1268 if ((strcmp($mat[
"type"],
"mattext") == 0) && (strcmp($mat[
"material"]->getLabel(),
"suggested_solution") == 0))
1270 $this->item->addSuggestedSolution($mat[
"material"], $this->gap_index);
1272 if ($this->in_objectives)
1274 $this->objectives->addMaterial($this->material);
1276 else if (($this->render_type != NULL) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"render_hotspot") == 0))
1278 $this->render_type->addMaterial($this->material);
1280 else if (count($this->flow_mat) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"flow_mat") == 0))
1282 $this->flow_mat[count($this->flow_mat)-1]->addMaterial($this->material);
1284 else if ($this->itemfeedback != NULL)
1286 $this->itemfeedback->addMaterial($this->material);
1288 else if ($this->response_label != NULL)
1290 $this->response_label->addMaterial($this->material);
1292 else if ($this->response != NULL)
1294 if ($this->response->hasRendering())
1296 $this->response->setMaterial2($this->material);
1300 $this->response->setMaterial1($this->material);
1303 elseif (($this->in_presentation) && (!$this->in_response))
1305 if (!is_object($this->item->getQuestiontext()))
1307 $this->item->setQuestiontext($this->material);
1309 $this->presentation->addMaterial($this->material);
1311 else if ($this->presentation != NULL)
1313 $this->presentation->addMaterial($this->material);
1314 if ($this->item != NULL)
1316 $this->item->addPresentationitem($this->material);
1320 $this->material = NULL;
1323 if ($this->material != NULL)
1325 if ($this->matimage != NULL)
1327 $this->material->addMatimage($this->matimage);
1330 $this->matimage = NULL;
1335 $this->mattext->setContent(
'<br />');
1336 $this->material->addMattext($this->mattext);
1337 $this->mattext = NULL;
1339 case "resprocessing":
1340 if ($this->item != NULL)
1342 $this->item->addResprocessing($this->resprocessing);
1344 $this->resprocessing = NULL;
1347 if ($this->material != NULL)
1349 $this->material->addMattext($this->mattext);
1351 $this->mattext = NULL;
1354 if ($this->material != NULL)
1356 $this->material->addMatapplet($this->matapplet);
1358 $this->matapplet = NULL;
1361 $this->depth[$a_xml_parser]--;
1369 switch ($this->parser_mode)
1385 if ($this->do_nothing)
return;
1386 $this->characterbuffer .= $a_data;
1388 switch ($this->qti_element)
1391 $this->metadata[
"label"] = $a_data;
1394 $this->metadata[
"entry"] = $a_data;
1396 case "response_label":
1397 if ($this->response_label != NULL)
1399 $this->response_label->setContent($a_data);
1403 if ($this->setvar != NULL)
1405 $this->setvar->setContent($a_data);
1408 case "displayfeedback":
1409 if ($this->displayfeedback != NULL)
1411 $this->displayfeedback->setContent($a_data);
1421 case "varsubstring":
1422 if ($this->responsevar != NULL)
1424 $this->responsevar->setContent($a_data);
1428 if (strlen($a_data))
1430 if ($this->decvar != NULL)
1432 $this->decvar->setContent($a_data);
1437 if ($this->mattext != NULL)
1439 $this->mattext->setContent($a_data);
1443 if ($this->matapplet != NULL)
1445 $this->matapplet->setContent($a_data);
1449 if ($this->matimage != NULL)
1451 $this->matimage->setContent($a_data);
1455 switch ($this->
getParent($a_xml_parser))
1464 $this->item->setDuration($a_data);
1469 switch ($this->
getParent($a_xml_parser))
1472 $this->item->setComment($a_data);
1475 $this->assessment->setComment($a_data);
1482 $this->sametag = TRUE;
1490 switch (strtolower($a_name))
1492 case "questestinterop":
1493 $this->verifyroot =
true;
1495 case "qtimetadatafield":
1496 $this->verifymetadatafield = 1;
1499 $this->verifyfieldlabeltext =
"";
1500 if ($this->verifymetadatafield == 1) $this->verifyfieldlabel = 1;
1503 $this->verifyfieldentrytext =
"";
1504 if ($this->verifymetadatafield == 1) $this->verifyfieldentry = 1;
1508 if (is_array($a_attribs))
1510 foreach ($a_attribs as $attribute => $value)
1512 switch (strtolower($attribute))
1520 array_push($this->founditems, array(
"title" =>
"$title",
"type" =>
"",
"ident" => $a_attribs[
"ident"]));
1522 case "response_lid":
1523 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1526 if (is_array($a_attribs))
1528 foreach ($a_attribs as $attribute => $value)
1530 switch (strtolower($attribute))
1532 case "rcardinality":
1533 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1534 switch (strtolower($value))
1543 $this->founditems[count($this->founditems)-1][
"type"] =
QT_ORDERING;
1552 case "response_str":
1553 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1556 if (is_array($a_attribs))
1558 foreach ($a_attribs as $attribute => $value)
1560 switch (strtolower($attribute))
1562 case "rcardinality":
1563 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1564 switch (strtolower($value))
1567 $this->founditems[count($this->founditems)-1][
"type"] =
QT_CLOZE;
1570 $this->founditems[count($this->founditems)-1][
"type"] =
QT_TEXT;
1580 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1582 $this->founditems[count($this->founditems)-1][
"type"] =
QT_IMAGEMAP;
1585 case "response_num":
1586 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1588 $this->founditems[count($this->founditems)-1][
"type"] =
QT_NUMERIC;
1591 case "response_grp":
1592 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1594 $this->founditems[count($this->founditems)-1][
"type"] =
QT_MATCHING;
1599 $this->verifyqticomment = 1;
1601 case "presentation":
1602 if (is_array($a_attribs))
1604 foreach ($a_attribs as $attribute => $value)
1606 switch (strtolower($attribute))
1609 $this->founditems[count($this->founditems)-1][
"title"] = $value;
1623 switch (strtolower($a_name))
1627 $this->verifyqticomment = 0;
1629 case "qtimetadatafield":
1630 $this->verifymetadatafield = 0;
1631 if (strcmp($this->verifyfieldlabeltext,
"QUESTIONTYPE") == 0)
1637 $this->verifyfieldlabel = 0;
1640 $this->verifyfieldentry = 0;
1650 if ($this->verifyqticomment == 1)
1652 if (preg_match(
"/Questiontype\=(.*)/", $a_data, $matches))
1654 if (count($this->founditems))
1656 $this->founditems[count($this->founditems)-1][
"type"] = $matches[1];
1660 else if ($this->verifyfieldlabel == 1)
1662 $this->verifyfieldlabeltext = $a_data;
1664 else if ($this->verifyfieldentry == 1)
1666 $this->verifyfieldentrytext = $a_data;
1681 if (!is_array($this->import_mapping))
1700 $xmlContent = file_get_contents($this->xml_file);
1702 file_put_contents($this->xml_file, $xmlContent);
1717 for($i = 0x00, $max = 0x08; $i <= $max; $i += 0x01)
1719 $needles[] =
"&#{$i};";
1721 for($i = 0x0b, $max = 0x0c; $i <= $max; $i += 0x01)
1723 $needles[] =
"&#{$i};";
1725 for($i = 0x0e, $max = 0x1f; $i <= $max; $i += 0x01)
1727 $needles[] =
"&#{$i};";
1729 for($i = 0xd800, $max = 0xdfff; $i <= $max; $i += 0x0001)
1731 $needles[] =
"&#{$i};";
1733 for($i = 0xfffe, $max = 0xffff; $i <= $max; $i += 0x0001)
1735 $needles[] =
"&#{$i};";
1737 $reg =
'/('.implode(
'|', $needles).
')/';
1738 $xmlContent = preg_replace($reg,
'', $xmlContent);