24 include_once(
"./Services/Xml/classes/class.ilSaxParser.php");
25 include_once
'Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/class.ilAssQuestionTypeList.php';
27 define (
"IL_MO_PARSE_QTI", 1);
28 define (
"IL_MO_VERIFY_QTI", 2);
145 parent::ilSaxParser($a_xml_file);
147 $this->qpl_id = $a_qpl_id;
148 $this->import_idents = array();
149 if (is_array($a_import_idents))
151 $this->import_idents =& $a_import_idents;
155 $this->hasRootElement = FALSE;
156 $this->import_mapping = array();
157 $this->assessments = array();
159 $this->section = NULL;
160 $this->path = array();
161 $this->items = array();
163 $this->depth = array();
164 $this->do_nothing = FALSE;
165 $this->qti_element =
"";
166 $this->in_presentation = FALSE;
167 $this->in_objectives = FALSE;
168 $this->in_reponse = FALSE;
169 $this->render_type = NULL;
170 $this->render_hotspot = NULL;
171 $this->response_label = NULL;
172 $this->material = NULL;
173 $this->response = NULL;
174 $this->assessmentcontrol = NULL;
175 $this->objectives = NULL;
176 $this->matimage = NULL;
177 $this->resprocessing = NULL;
178 $this->outcomes = NULL;
179 $this->decvar = NULL;
180 $this->respcondition = NULL;
181 $this->setvar = NULL;
182 $this->displayfeedback = NULL;
183 $this->itemfeedback = NULL;
184 $this->flow_mat = array();
185 $this->question_counter = 1;
187 $this->gap_index = 0;
188 $this->presentation = NULL;
189 $this->mattext = NULL;
190 $this->matapplet = NULL;
191 $this->sametag = FALSE;
192 $this->in_assessment = FALSE;
193 $this->characterbuffer =
"";
194 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
199 $this->tst_object =& $a_tst_object;
200 if (is_object($a_tst_object))
202 $this->tst_id = $this->tst_object->getId();
208 $this->parser_mode = $a_mode;
209 $this->founditems = array();
210 $this->verifyroot =
false;
211 $this->verifyqticomment = 0;
212 $this->verifymetadatafield = 0;
213 $this->verifyfieldlabel = 0;
214 $this->verifyfieldentry = 0;
215 $this->verifyfieldlabeltext =
"";
216 $this->verifyfieldentrytext =
"";
217 $this->question_counter = 1;
227 xml_set_object($a_xml_parser,$this);
228 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
229 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
234 $this->question_counter = 1;
235 parent::startParsing();
241 if ($this->depth[$a_xml_parser] > 0)
243 return $this->path[$this->depth[$a_xml_parser]-1];
256 switch ($this->parser_mode)
272 if ($this->do_nothing)
return;
273 $this->sametag = FALSE;
274 $this->characterbuffer =
"";
275 $this->depth[$a_xml_parser]++;
276 $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
277 $this->qti_element = $a_name;
279 switch (strtolower($a_name))
282 include_once (
"./Services/QTI/classes/class.ilQTIAssessment.php");
284 $this->in_assessment = TRUE;
285 if (is_array($a_attribs))
287 foreach ($a_attribs as $attribute => $value)
289 switch (strtolower($attribute))
301 case "assessmentcontrol":
302 include_once (
"./Services/QTI/classes/class.ilQTIAssessmentcontrol.php");
304 if (is_array($a_attribs))
306 foreach ($a_attribs as $attribute => $value)
308 switch (strtolower($attribute))
310 case "solutionswitch":
311 $this->assessmentcontrol->setSolutionswitch($value);
314 $this->assessmentcontrol->setHintswitch($value);
316 case "feedbackswitch":
317 $this->assessmentcontrol->setFeedbackswitch($value);
324 include_once (
"./Services/QTI/classes/class.ilQTIObjectives.php");
326 $this->in_objectives = TRUE;
328 case 'presentation_material':
329 require_once
'Services/QTI/classes/class.ilQTIPresentationMaterial.php';
331 $this->in_prensentation_material = TRUE;
334 include_once (
"./Services/QTI/classes/class.ilQTISection.php");
338 $this->in_itemmetadata = TRUE;
340 case "qtimetadatafield":
341 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
344 include_once (
"./Services/QTI/classes/class.ilQTIFlow.php");
348 include_once (
"./Services/QTI/classes/class.ilQTIFlowMat.php");
352 include_once (
"./Services/QTI/classes/class.ilQTIItemfeedback.php");
354 if (is_array($a_attribs))
356 foreach ($a_attribs as $attribute => $value)
358 switch (strtolower($attribute))
361 $this->itemfeedback->setIdent($value);
364 $this->itemfeedback->setView($value);
370 case "displayfeedback":
371 include_once (
"./Services/QTI/classes/class.ilQTIDisplayfeedback.php");
373 if (is_array($a_attribs))
375 foreach ($a_attribs as $attribute => $value)
377 switch (strtolower($attribute))
380 $this->displayfeedback->setFeedbacktype($value);
383 $this->displayfeedback->setLinkrefid($value);
390 include_once (
"./Services/QTI/classes/class.ilQTISetvar.php");
392 if (is_array($a_attribs))
394 foreach ($a_attribs as $attribute => $value)
396 switch (strtolower($attribute))
399 $this->setvar->setAction($value);
402 $this->setvar->setVarname($value);
409 include_once (
"./Services/QTI/classes/class.ilQTIConditionvar.php");
413 if ($this->conditionvar != NULL)
415 $this->conditionvar->addNot();
419 if ($this->conditionvar != NULL)
421 $this->conditionvar->addAnd();
425 if ($this->conditionvar != NULL)
427 $this->conditionvar->addOr();
431 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
433 if (is_array($a_attribs))
435 foreach ($a_attribs as $attribute => $value)
437 switch (strtolower($attribute))
440 $this->responsevar->setCase($value);
443 $this->responsevar->setRespident($value);
446 $this->responsevar->setIndex($value);
453 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
455 if (is_array($a_attribs))
457 foreach ($a_attribs as $attribute => $value)
459 switch (strtolower($attribute))
462 $this->responsevar->setRespident($value);
465 $this->responsevar->setIndex($value);
472 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
474 if (is_array($a_attribs))
476 foreach ($a_attribs as $attribute => $value)
478 switch (strtolower($attribute))
481 $this->responsevar->setRespident($value);
484 $this->responsevar->setIndex($value);
491 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
493 if (is_array($a_attribs))
495 foreach ($a_attribs as $attribute => $value)
497 switch (strtolower($attribute))
500 $this->responsevar->setRespident($value);
503 $this->responsevar->setIndex($value);
510 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
512 if (is_array($a_attribs))
514 foreach ($a_attribs as $attribute => $value)
516 switch (strtolower($attribute))
519 $this->responsevar->setRespident($value);
522 $this->responsevar->setIndex($value);
529 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
531 if (is_array($a_attribs))
533 foreach ($a_attribs as $attribute => $value)
535 switch (strtolower($attribute))
538 $this->responsevar->setRespident($value);
541 $this->responsevar->setSetmatch($value);
544 $this->responsevar->setIndex($value);
551 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
553 if (is_array($a_attribs))
555 foreach ($a_attribs as $attribute => $value)
557 switch (strtolower($attribute))
560 $this->responsevar->setRespident($value);
563 $this->responsevar->setAreatype($value);
566 $this->responsevar->setIndex($value);
573 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
575 if (is_array($a_attribs))
577 foreach ($a_attribs as $attribute => $value)
579 switch (strtolower($attribute))
582 $this->responsevar->setCase($value);
585 $this->responsevar->setRespident($value);
588 $this->responsevar->setIndex($value);
594 case "respcondition":
595 include_once(
"./Services/QTI/classes/class.ilQTIRespcondition.php");
597 if (is_array($a_attribs))
599 foreach ($a_attribs as $attribute => $value)
601 switch (strtolower($attribute))
604 $this->respcondition->setContinue($value);
607 $this->respcondition->setTitle($value);
614 include_once(
"./Services/QTI/classes/class.ilQTIOutcomes.php");
618 include_once(
"./Services/QTI/classes/class.ilQTIDecvar.php");
620 if (is_array($a_attribs))
622 foreach ($a_attribs as $attribute => $value)
624 switch (strtolower($attribute))
627 $this->decvar->setVarname($value);
630 $this->decvar->setVartype($value);
633 $this->decvar->setDefaultval($value);
636 $this->decvar->setMinvalue($value);
639 $this->decvar->setMaxvalue($value);
642 $this->decvar->setMembers($value);
645 $this->decvar->setCutvalue($value);
652 include_once(
"./Services/QTI/classes/class.ilQTIMatimage.php");
654 if (is_array($a_attribs))
656 foreach ($a_attribs as $attribute => $value)
658 switch (strtolower($attribute))
661 $this->matimage->setImagetype($value);
664 $this->matimage->setLabel($value);
667 $this->matimage->setHeight($value);
670 $this->matimage->setWidth($value);
673 $this->matimage->setUri($value);
676 $this->matimage->setEmbedded($value);
679 $this->matimage->setX0($value);
682 $this->matimage->setY0($value);
685 $this->matimage->setEntityref($value);
690 if (!$this->matimage->getEmbedded() && strlen($this->matimage->getUri()))
692 $this->matimage->setContent(@file_get_contents(dirname($this->xml_file) .
'/'. $this->matimage->getUri()));
696 include_once(
"./Services/QTI/classes/class.ilQTIMaterial.php");
698 $this->material->setFlow($this->flow);
699 if (is_array($a_attribs))
701 foreach ($a_attribs as $attribute => $value)
703 switch (strtolower($attribute))
706 $this->material->setLabel($value);
713 include_once (
"./Services/QTI/classes/class.ilQTIMattext.php");
715 if (is_array($a_attribs))
717 foreach ($a_attribs as $attribute => $value)
719 switch (strtolower($attribute))
722 $this->mattext->setTexttype($value);
725 $this->mattext->setLabel($value);
728 $this->mattext->setCharset($value);
731 $this->mattext->setUri($value);
734 $this->mattext->setXmlspace($value);
737 $this->mattext->setXmllang($value);
740 $this->mattext->setEntityref($value);
743 $this->mattext->setHeight($value);
746 $this->mattext->setWidth($value);
749 $this->mattext->setX0($value);
752 $this->mattext->setY0($value);
759 include_once (
"./Services/QTI/classes/class.ilQTIMatapplet.php");
761 if (is_array($a_attribs))
763 foreach ($a_attribs as $attribute => $value)
765 switch (strtolower($attribute))
768 $this->matapplet->setLabel($value);
771 $this->matapplet->setUri($value);
774 $this->matapplet->setY0($value);
777 $this->matapplet->setHeight($value);
780 $this->matapplet->setWidth($value);
783 $this->matapplet->setX0($value);
786 $this->matapplet->setEmbedded($value);
789 $this->matapplet->setEntityref($value);
795 case "questestinterop":
796 $this->hasRootElement = TRUE;
806 $this->
assessment->addSection($this->section);
808 $this->section = NULL;
811 $this->in_presentation = TRUE;
812 include_once (
"./Services/QTI/classes/class.ilQTIPresentation.php");
815 case "response_label":
816 if ($this->render_type != NULL)
818 include_once(
"./Services/QTI/classes/class.ilQTIResponseLabel.php");
820 foreach ($a_attribs as $attribute => $value)
822 switch (strtolower($attribute))
825 $this->response_label->setRshuffle($value);
828 $this->response_label->setRarea($value);
831 $this->response_label->setRrange($value);
834 $this->response_label->setLabelrefid($value);
837 $this->response_label->setIdent($value);
840 $this->response_label->setMatchGroup($value);
843 $this->response_label->setMatchMax($value);
849 case "render_choice":
850 if ($this->in_response)
852 include_once(
"./Services/QTI/classes/class.ilQTIRenderChoice.php");
854 foreach ($a_attribs as $attribute => $value)
856 switch (strtolower($attribute))
859 $this->render_type->setShuffle($value);
865 case "render_hotspot":
866 if ($this->in_response)
868 include_once(
"./Services/QTI/classes/class.ilQTIRenderHotspot.php");
870 foreach ($a_attribs as $attribute => $value)
872 switch (strtolower($attribute))
875 $this->render_type->setShuffle($value);
878 $this->render_type->setMinnumber($value);
881 $this->render_type->setMaxnumber($value);
888 if ($this->in_response)
890 include_once(
"./Services/QTI/classes/class.ilQTIRenderFib.php");
892 foreach ($a_attribs as $attribute => $value)
894 switch (strtolower($attribute))
897 $this->render_type->setEncoding($value);
900 $this->render_type->setFibtype($value);
903 $this->render_type->setRows($value);
906 $this->render_type->setMaxchars($value);
909 $this->render_type->setPrompt($value);
912 $this->render_type->setColumns($value);
915 $this->render_type->setCharset($value);
918 $this->render_type->setMaxnumber($value);
921 $this->render_type->setMinnumber($value);
940 include_once
"./Services/QTI/classes/class.ilQTIResponse.php";
941 switch (strtolower($a_name))
959 $this->in_response = TRUE;
961 $this->response->setFlow($this->flow);
962 if (is_array($a_attribs))
964 foreach ($a_attribs as $attribute => $value)
966 switch (strtolower($attribute))
969 $this->response->setIdent($value);
972 $this->response->setRTiming($value);
975 $this->response->setRCardinality($value);
978 $this->response->setNumtype($value);
985 include_once(
"./Services/QTI/classes/class.ilQTIItem.php");
986 $this->gap_index = 0;
987 $this->item =& $this->items[array_push($this->items,
new ilQTIItem())-1];
988 if (is_array($a_attribs))
990 foreach ($a_attribs as $attribute => $value)
992 switch (strtolower($attribute))
995 $this->item->setIdent($value);
996 $this->item->setIliasSourceNic(
1001 $this->do_nothing =
true;
1003 elseif (count($this->import_idents) > 0)
1005 if (!in_array($value, $this->import_idents))
1007 $this->do_nothing = TRUE;
1012 $this->item->setTitle($value);
1015 $this->item->setMaxattempts($value);
1021 case "resprocessing":
1022 include_once(
"./Services/QTI/classes/class.ilQTIResprocessing.php");
1024 if (is_array($a_attribs))
1026 foreach ($a_attribs as $attribute => $value)
1028 switch (strtolower($attribute))
1031 $this->resprocessing->setScoremodel($value);
1045 switch ($this->parser_mode)
1061 if (($this->do_nothing) && (strcmp(strtolower($a_name),
"item") != 0))
return;
1062 switch (strtolower($a_name))
1065 if (is_object($this->tst_object))
1067 $this->tst_object->fromXML($this->
assessment);
1069 $this->in_assessment = FALSE;
1071 case "assessmentcontrol":
1072 $this->
assessment->addAssessmentcontrol($this->assessmentcontrol);
1073 $this->assessmentcontrol = NULL;
1076 if (strcmp(strtolower($this->
getParent($a_xml_parser)),
"assessment") == 0)
1078 $this->
assessment->addObjectives($this->objectives);
1080 $this->in_objectives = FALSE;
1082 case 'presentation_material':
1083 $this->
assessment->setPresentationMaterial($this->prensentation_material);
1084 $this->in_prensentation_material = FALSE;
1086 case "itemmetadata":
1087 $this->in_itemmetadata = FALSE;
1089 case "qtimetadatafield":
1091 switch ($this->metadata[
"label"])
1093 case "ILIAS_VERSION":
1094 if ($this->item != NULL)
1096 $this->item->setIliasSourceVersion(
1101 case "QUESTIONTYPE":
1102 if ($this->item != NULL)
1104 $this->item->setQuestiontype($this->metadata[
"entry"]);
1108 if ($this->item != NULL)
1110 $this->item->setAuthor($this->metadata[
"entry"]);
1113 if ($this->item != NULL)
1115 $this->item->addMetadata($this->metadata);
1119 if ($this->in_assessment)
1121 $this->
assessment->addQtiMetadata($this->metadata);
1123 $this->metadata = array(
"label" =>
"",
"entry" =>
"");
1129 if (count($this->flow_mat))
1131 $flow_mat = array_pop($this->flow_mat);
1132 if (count($this->flow_mat))
1134 $this->flow_mat[count($this->flow_mat)-1]->addFlow_mat($flow_mat);
1136 else if($this->in_prensentation_material)
1138 $this->prensentation_material->addFlowMat($flow_mat);
1140 else if ($this->itemfeedback != NULL)
1142 $this->itemfeedback->addFlow_mat($flow_mat);
1144 else if ($this->response_label != NULL)
1146 $this->response_label->addFlow_mat($flow_mat);
1150 case "itemfeedback":
1151 if ($this->item != NULL)
1153 if ($this->itemfeedback != NULL)
1155 $this->item->addItemfeedback($this->itemfeedback);
1158 $this->itemfeedback = NULL;
1160 case "displayfeedback":
1161 if ($this->respcondition != NULL)
1163 if ($this->displayfeedback != NULL)
1165 $this->respcondition->addDisplayfeedback($this->displayfeedback);
1168 $this->displayfeedback = NULL;
1171 if ($this->respcondition != NULL)
1173 if ($this->setvar != NULL)
1175 $this->respcondition->addSetvar($this->setvar);
1178 $this->setvar = NULL;
1180 case "conditionvar":
1181 if ($this->respcondition != NULL)
1183 $this->respcondition->setConditionvar($this->conditionvar);
1185 $this->conditionvar = NULL;
1194 case "varsubstring":
1195 if ($this->conditionvar != NULL)
1197 if ($this->responsevar != NULL)
1199 $this->conditionvar->addResponseVar($this->responsevar);
1202 $this->responsevar = NULL;
1204 case "respcondition":
1205 if ($this->resprocessing != NULL)
1207 $this->resprocessing->addRespcondition($this->respcondition);
1209 $this->respcondition = NULL;
1212 if ($this->resprocessing != NULL)
1214 $this->resprocessing->setOutcomes($this->outcomes);
1216 $this->outcomes = NULL;
1219 if ($this->outcomes != NULL)
1221 $this->outcomes->addDecvar($this->decvar);
1223 $this->decvar = NULL;
1225 case "presentation":
1226 $this->in_presentation = FALSE;
1227 if ($this->presentation != NULL)
1229 if ($this->item != NULL)
1231 $this->item->setPresentation($this->presentation);
1234 $this->presentation = NULL;
1236 case "response_label":
1237 if ($this->render_type != NULL)
1239 $this->render_type->addResponseLabel($this->response_label);
1240 $this->response_label = NULL;
1243 case "render_choice":
1244 case "render_hotspot":
1246 if ($this->in_response)
1248 if ($this->response != NULL)
1250 if ($this->render_type != NULL)
1252 $this->response->setRenderType($this->render_type);
1253 $this->render_type = NULL;
1258 case "response_lid":
1260 case "response_str":
1261 case "response_num":
1262 case "response_grp":
1264 if ($this->presentation != NULL)
1266 if ($this->response != NULL)
1268 $this->presentation->addResponse($this->response);
1269 if ($this->item != NULL)
1271 $this->item->addPresentationitem($this->response);
1275 $this->response = NULL;
1276 $this->in_response = FALSE;
1279 if ($this->do_nothing)
1281 $this->do_nothing = FALSE;
1284 if (strlen($this->item->getQuestionType()))
1300 $qt = $this->item->determineQuestionType();
1301 $presentation = $this->item->getPresentation();
1308 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1310 $question =
new $qt();
1311 $fbt = str_replace(
'ass',
'ilAss', $qt).
'Feedback';
1312 $question->feedbackOBJ =
new $fbt(
1315 $question->fromXML($this->item, $this->qpl_id, $this->tst_id, $this->tst_object, $this->question_counter, $this->import_mapping);
1318 if ($this->material)
1320 $mat = $this->material->getMaterial(0);
1321 if ((strcmp($mat[
"type"],
"mattext") == 0) && (strcmp($mat[
"material"]->getLabel(),
"suggested_solution") == 0))
1323 $this->item->addSuggestedSolution($mat[
"material"], $this->gap_index);
1325 if ($this->in_objectives)
1327 $this->objectives->addMaterial($this->material);
1329 else if (($this->render_type != NULL) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"render_hotspot") == 0))
1331 $this->render_type->addMaterial($this->material);
1333 else if (count($this->flow_mat) && (strcmp(strtolower($this->
getParent($a_xml_parser)),
"flow_mat") == 0))
1335 $this->flow_mat[count($this->flow_mat)-1]->addMaterial($this->material);
1337 else if ($this->itemfeedback != NULL)
1339 $this->itemfeedback->addMaterial($this->material);
1341 else if ($this->response_label != NULL)
1343 $this->response_label->addMaterial($this->material);
1345 else if ($this->response != NULL)
1347 if ($this->response->hasRendering())
1349 $this->response->setMaterial2($this->material);
1353 $this->response->setMaterial1($this->material);
1356 elseif (($this->in_presentation) && (!$this->in_response))
1358 if (!is_object($this->item->getQuestiontext()))
1360 $this->item->setQuestiontext($this->material);
1362 $this->presentation->addMaterial($this->material);
1364 else if ($this->presentation != NULL)
1366 $this->presentation->addMaterial($this->material);
1367 if ($this->item != NULL)
1369 $this->item->addPresentationitem($this->material);
1373 $this->material = NULL;
1382 if( $this->
virusDetected($this->matimage->getRawContent()) )
1387 require_once
'Services/QTI/classes/class.ilQtiMatImageSecurity.php';
1389 $matImageSecurity->sanitizeLabel();
1391 if( !$matImageSecurity->validate() )
1396 $this->material->addMatimage($this->matimage);
1397 $this->matimage = NULL;
1403 $this->mattext->setContent(
'<br />');
1404 $this->material->addMattext($this->mattext);
1405 $this->mattext = NULL;
1407 case "resprocessing":
1408 if ($this->item != NULL)
1410 $this->item->addResprocessing($this->resprocessing);
1412 $this->resprocessing = NULL;
1415 if ($this->material != NULL)
1417 $this->material->addMattext($this->mattext);
1419 $this->mattext = NULL;
1422 if ($this->material != NULL)
1424 $this->material->addMatapplet($this->matapplet);
1426 $this->matapplet = NULL;
1429 $this->depth[$a_xml_parser]--;
1437 switch ($this->parser_mode)
1453 if ($this->do_nothing)
return;
1454 $this->characterbuffer .= $a_data;
1456 switch ($this->qti_element)
1459 $this->metadata[
"label"] = $a_data;
1462 $this->metadata[
"entry"] = $a_data;
1464 case "response_label":
1465 if ($this->response_label != NULL)
1467 $this->response_label->setContent($a_data);
1471 if ($this->setvar != NULL)
1473 $this->setvar->setContent($a_data);
1476 case "displayfeedback":
1477 if ($this->displayfeedback != NULL)
1479 $this->displayfeedback->setContent($a_data);
1489 case "varsubstring":
1490 if ($this->responsevar != NULL)
1492 $this->responsevar->setContent($a_data);
1496 if (strlen($a_data))
1498 if ($this->decvar != NULL)
1500 $this->decvar->setContent($a_data);
1505 if ($this->mattext != NULL)
1507 $this->mattext->setContent($a_data);
1511 if ($this->matapplet != NULL)
1513 $this->matapplet->setContent($a_data);
1517 if ($this->matimage != NULL)
1519 $this->matimage->setContent($a_data);
1523 switch ($this->
getParent($a_xml_parser))
1532 $this->item->setDuration($a_data);
1537 switch ($this->
getParent($a_xml_parser))
1540 $this->item->setComment($a_data);
1550 $this->sametag = TRUE;
1558 switch (strtolower($a_name))
1560 case "questestinterop":
1561 $this->verifyroot =
true;
1563 case "qtimetadatafield":
1564 $this->verifymetadatafield = 1;
1567 $this->verifyfieldlabeltext =
"";
1568 if ($this->verifymetadatafield == 1) $this->verifyfieldlabel = 1;
1571 $this->verifyfieldentrytext =
"";
1572 if ($this->verifymetadatafield == 1) $this->verifyfieldentry = 1;
1576 if (is_array($a_attribs))
1578 foreach ($a_attribs as $attribute => $value)
1580 switch (strtolower($attribute))
1588 array_push($this->founditems, array(
"title" =>
"$title",
"type" =>
"",
"ident" => $a_attribs[
"ident"]));
1590 case "response_lid":
1591 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1594 if (is_array($a_attribs))
1596 foreach ($a_attribs as $attribute => $value)
1598 switch (strtolower($attribute))
1600 case "rcardinality":
1601 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1602 switch (strtolower($value))
1611 $this->founditems[count($this->founditems)-1][
"type"] =
QT_ORDERING;
1620 case "response_str":
1621 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1624 if (is_array($a_attribs))
1626 foreach ($a_attribs as $attribute => $value)
1628 switch (strtolower($attribute))
1630 case "rcardinality":
1631 include_once
"./Services/QTI/classes/class.ilQTIItem.php";
1632 switch (strtolower($value))
1635 $this->founditems[count($this->founditems)-1][
"type"] =
QT_CLOZE;
1638 $this->founditems[count($this->founditems)-1][
"type"] =
QT_TEXT;
1648 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1650 $this->founditems[count($this->founditems)-1][
"type"] =
QT_IMAGEMAP;
1653 case "response_num":
1654 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1656 $this->founditems[count($this->founditems)-1][
"type"] =
QT_NUMERIC;
1659 case "response_grp":
1660 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
1662 $this->founditems[count($this->founditems)-1][
"type"] =
QT_MATCHING;
1667 $this->verifyqticomment = 1;
1669 case "presentation":
1670 if (is_array($a_attribs))
1672 foreach ($a_attribs as $attribute => $value)
1674 switch (strtolower($attribute))
1677 $this->founditems[count($this->founditems)-1][
"title"] = $value;
1691 switch (strtolower($a_name))
1695 $this->verifyqticomment = 0;
1697 case "qtimetadatafield":
1698 $this->verifymetadatafield = 0;
1699 if (strcmp($this->verifyfieldlabeltext,
"QUESTIONTYPE") == 0)
1705 $this->verifyfieldlabel = 0;
1708 $this->verifyfieldentry = 0;
1718 if ($this->verifyqticomment == 1)
1720 if (preg_match(
"/Questiontype\=(.*)/", $a_data, $matches))
1722 if (count($this->founditems))
1724 $this->founditems[count($this->founditems)-1][
"type"] = $matches[1];
1728 else if ($this->verifyfieldlabel == 1)
1730 $this->verifyfieldlabeltext = $a_data;
1732 else if ($this->verifyfieldentry == 1)
1734 $this->verifyfieldentrytext = $a_data;
1749 if (!is_array($this->import_mapping))
1763 return parent::setXMLContent($a_xml_content);
1768 $xmlContent = file_get_contents($this->xml_file);
1770 file_put_contents($this->xml_file, $xmlContent);
1772 return parent::openXMLFile();
1779 if( preg_match(
'/^(\d+\.\d+\.\d+) .*$/', $versionDateString, $matches) )
1791 if( preg_match(
'/^il_(\d+?)_qst_\d+$/', $itemIdent, $matches) )
1809 for($i = 0x00, $max = 0x08; $i <= $max; $i += 0x01)
1811 $needles[] =
"&#{$i};";
1813 for($i = 0x0b, $max = 0x0c; $i <= $max; $i += 0x01)
1815 $needles[] =
"&#{$i};";
1817 for($i = 0x0e, $max = 0x1f; $i <= $max; $i += 0x01)
1819 $needles[] =
"&#{$i};";
1821 for($i = 0xd800, $max = 0xdfff; $i <= $max; $i += 0x0001)
1823 $needles[] =
"&#{$i};";
1825 for($i = 0xfffe, $max = 0xffff; $i <= $max; $i += 0x0001)
1827 $needles[] =
"&#{$i};";
1829 $reg =
'/('.implode(
'|', $needles).
')/';
1830 $xmlContent = preg_replace($reg,
'', $xmlContent);
1837 if( !$this->material )
1842 if( !$this->matimage )
1852 require_once
'Services/VirusScanner/classes/class.ilVirusScannerFactory.php';
1860 return (
bool)$vs->scanBuffer($buffer);
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
Class ilQTIPresentationMaterial.
fetchSourceNicFromItemIdent($itemIdent)
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
handlerParseCharacterData($a_xml_parser, $a_data)
handler for character data
const RESPONSEVAR_SUBSTRING
$in_prensentation_material
setXMLContent($a_xml_content)
fetchNumericVersionFromVersionDateString($versionDateString)
const QT_MULTIPLE_CHOICE_SR
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
static isImportable($questionTypeTag)
handlerVerifyEndTag($a_xml_parser, $a_name)
handler for end of element verification
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
ilQTIParser($a_xml_file, $a_mode=IL_MO_PARSE_QTI, $a_qpl_id=0, $a_import_idents="")
Constructor.
setTestObject(&$a_tst_object)
handlerVerifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element verification
setParserMode($a_mode=IL_MO_PARSE_QTI)
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
handlerParseEndTag($a_xml_parser, $a_name)
handler for end of element parser
cleanInvalidXmlChars($xmlContent)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerVerifyCharacterData($a_xml_parser, $a_data)
handler for character data verification
& _getInstance()
Constructor public.
getImportMapping()
get array of new created questions for import id
const QT_MULTIPLE_CHOICE_MR
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
setIgnoreItemsEnabled($ignoreItemsEnabled)
handlerParseBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element parser