24 include_once(
"./classes/class.ilSaxParser.php");
 
   26 define (
"IL_MO_PARSE_QTI",  1);
 
   27 define (
"IL_MO_VERIFY_QTI", 2);
 
  111                 $this->qpl_id = $a_qpl_id;
 
  112                 $this->import_idents = array();
 
  113                 if (is_array($a_import_idents))
 
  115                         $this->import_idents =& $a_import_idents;
 
  119                 $this->hasRootElement = FALSE;
 
  120                 $this->import_mapping = array();
 
  121                 $this->assessments = array();
 
  122                 $this->assessment = NULL;
 
  123                 $this->section = NULL;
 
  124                 $this->path = array();
 
  125                 $this->items = array();
 
  127                 $this->depth = array();
 
  128                 $this->do_nothing = FALSE;
 
  129                 $this->qti_element = 
"";
 
  130                 $this->in_presentation = FALSE;
 
  131                 $this->in_objectives = FALSE;
 
  132                 $this->in_reponse = FALSE;
 
  133                 $this->render_type = NULL;
 
  134                 $this->render_hotspot = NULL;
 
  135                 $this->response_label = NULL;
 
  136                 $this->material = NULL;
 
  137                 $this->response = NULL;
 
  138                 $this->assessmentcontrol = NULL;
 
  139                 $this->objectives = NULL;
 
  140                 $this->matimage = NULL;
 
  141                 $this->resprocessing = NULL;
 
  142                 $this->outcomes = NULL;
 
  143                 $this->decvar = NULL;
 
  144                 $this->respcondition = NULL;
 
  145                 $this->setvar = NULL;
 
  146                 $this->displayfeedback = NULL;
 
  147                 $this->itemfeedback = NULL;
 
  148                 $this->flow_mat = array();
 
  149                 $this->question_counter = 1;
 
  151                 $this->gap_index = 0;
 
  152                 $this->presentation = NULL;
 
  153                 $this->mattext = NULL;
 
  154                 $this->matapplet = NULL;
 
  155                 $this->sametag = FALSE;
 
  156                 $this->in_assessment = FALSE;
 
  157                 $this->characterbuffer = 
"";
 
  158                 $this->metadata = array(
"label" => 
"", 
"entry" => 
"");
 
  163                 $this->tst_object =& $a_tst_object;
 
  164                 if (is_object($a_tst_object))
 
  166                         $this->tst_id = $this->tst_object->getId();
 
  172                 $this->parser_mode = $a_mode;
 
  173                 $this->founditems = array();
 
  174                 $this->verifyroot = 
false;
 
  175                 $this->verifyqticomment = 0;
 
  176                 $this->verifymetadatafield = 0;
 
  177                 $this->verifyfieldlabel = 0;
 
  178                 $this->verifyfieldentry = 0;
 
  179                 $this->verifyfieldlabeltext = 
"";
 
  180                 $this->verifyfieldentrytext = 
"";
 
  181                 $this->question_counter = 1;
 
  191                 xml_set_object($a_xml_parser,$this);
 
  192                 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
 
  193                 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
 
  198                 $this->question_counter = 1;
 
  205                 if ($this->depth[$a_xml_parser] > 0)
 
  207                         return $this->path[$this->depth[$a_xml_parser]-1];
 
  220                 switch ($this->parser_mode)
 
  236                 if ($this->do_nothing) 
return;
 
  237                 $this->sametag = FALSE;
 
  238                 $this->characterbuffer = 
"";
 
  239                 $this->depth[$a_xml_parser]++;
 
  240                 $this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
 
  241                 $this->qti_element = $a_name;
 
  243                 switch (strtolower($a_name))
 
  246                                 include_once (
"./Services/QTI/classes/class.ilQTIAssessment.php");
 
  247                                 $this->assessment =& $this->assessments[array_push($this->assessments, 
new ilQTIAssessment())-1];
 
  248                                 $this->in_assessment = TRUE;
 
  249                                 if (is_array($a_attribs))
 
  251                                         foreach ($a_attribs as $attribute => $value)
 
  253                                                 switch (strtolower($attribute))
 
  256                                                                 $this->assessment->setTitle($value);
 
  259                                                                 $this->assessment->setIdent($value);
 
  265                         case "assessmentcontrol":
 
  266                                 include_once (
"./Services/QTI/classes/class.ilQTIAssessmentcontrol.php");
 
  268                                 if (is_array($a_attribs))
 
  270                                         foreach ($a_attribs as $attribute => $value)
 
  272                                                 switch (strtolower($attribute))
 
  274                                                         case "solutionswitch":
 
  275                                                                 $this->assessmentcontrol->setSolutionswitch($value);
 
  278                                                                 $this->assessmentcontrol->setHintswitch($value);
 
  280                                                         case "feedbackswitch":
 
  281                                                                 $this->assessmentcontrol->setFeedbackswitch($value);
 
  288                                 include_once (
"./Services/QTI/classes/class.ilQTIObjectives.php");
 
  290                                 $this->in_objectives = TRUE;
 
  293                                 include_once (
"./Services/QTI/classes/class.ilQTISection.php");
 
  297                                 $this->in_itemmetadata = TRUE;
 
  299                         case "qtimetadatafield":
 
  300                                 $this->metadata = array(
"label" => 
"", 
"entry" => 
"");
 
  303                                 include_once (
"./Services/QTI/classes/class.ilQTIFlow.php");
 
  307                                 include_once (
"./Services/QTI/classes/class.ilQTIFlowMat.php");
 
  311                                 include_once (
"./Services/QTI/classes/class.ilQTIItemfeedback.php");
 
  313                                 if (is_array($a_attribs))
 
  315                                         foreach ($a_attribs as $attribute => $value)
 
  317                                                 switch (strtolower($attribute))
 
  320                                                                 $this->itemfeedback->setIdent($value);
 
  323                                                                 $this->itemfeedback->setView($value);
 
  329                         case "displayfeedback":
 
  330                                 include_once (
"./Services/QTI/classes/class.ilQTIDisplayfeedback.php");
 
  332                                 if (is_array($a_attribs))
 
  334                                         foreach ($a_attribs as $attribute => $value)
 
  336                                                 switch (strtolower($attribute))
 
  339                                                                 $this->displayfeedback->setFeedbacktype($value);
 
  342                                                                 $this->displayfeedback->setLinkrefid($value);
 
  349                                 include_once (
"./Services/QTI/classes/class.ilQTISetvar.php");
 
  351                                 if (is_array($a_attribs))
 
  353                                         foreach ($a_attribs as $attribute => $value)
 
  355                                                 switch (strtolower($attribute))
 
  358                                                                 $this->setvar->setAction($value);
 
  361                                                                 $this->setvar->setVarname($value);
 
  368                                 include_once (
"./Services/QTI/classes/class.ilQTIConditionvar.php");
 
  372                                 if ($this->conditionvar != NULL)
 
  374                                         $this->conditionvar->addNot();
 
  378                                 if ($this->conditionvar != NULL)
 
  380                                         $this->conditionvar->addAnd();
 
  384                                 if ($this->conditionvar != NULL)
 
  386                                         $this->conditionvar->addOr();
 
  390                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
 
  392                                 if (is_array($a_attribs))
 
  394                                         foreach ($a_attribs as $attribute => $value)
 
  396                                                 switch (strtolower($attribute))
 
  399                                                                 $this->responsevar->setCase($value);
 
  402                                                                 $this->responsevar->setRespident($value);
 
  405                                                                 $this->responsevar->setIndex($value);
 
  412                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
 
  414                                 if (is_array($a_attribs))
 
  416                                         foreach ($a_attribs as $attribute => $value)
 
  418                                                 switch (strtolower($attribute))
 
  421                                                                 $this->responsevar->setRespident($value);
 
  424                                                                 $this->responsevar->setIndex($value);
 
  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->setRespident($value);
 
  443                                                                 $this->responsevar->setIndex($value);
 
  450                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
 
  452                                 if (is_array($a_attribs))
 
  454                                         foreach ($a_attribs as $attribute => $value)
 
  456                                                 switch (strtolower($attribute))
 
  459                                                                 $this->responsevar->setRespident($value);
 
  462                                                                 $this->responsevar->setIndex($value);
 
  469                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
 
  471                                 if (is_array($a_attribs))
 
  473                                         foreach ($a_attribs as $attribute => $value)
 
  475                                                 switch (strtolower($attribute))
 
  478                                                                 $this->responsevar->setRespident($value);
 
  481                                                                 $this->responsevar->setIndex($value);
 
  488                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
 
  490                                 if (is_array($a_attribs))
 
  492                                         foreach ($a_attribs as $attribute => $value)
 
  494                                                 switch (strtolower($attribute))
 
  497                                                                 $this->responsevar->setRespident($value);
 
  500                                                                 $this->responsevar->setSetmatch($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->setAreatype($value);
 
  525                                                                 $this->responsevar->setIndex($value);
 
  532                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseVar.php");
 
  534                                 if (is_array($a_attribs))
 
  536                                         foreach ($a_attribs as $attribute => $value)
 
  538                                                 switch (strtolower($attribute))
 
  541                                                                 $this->responsevar->setCase($value);
 
  544                                                                 $this->responsevar->setRespident($value);
 
  547                                                                 $this->responsevar->setIndex($value);
 
  553                         case "respcondition":
 
  554                                 include_once(
"./Services/QTI/classes/class.ilQTIRespcondition.php");
 
  556                                 if (is_array($a_attribs))
 
  558                                         foreach ($a_attribs as $attribute => $value)
 
  560                                                 switch (strtolower($attribute))
 
  563                                                                 $this->respcondition->setContinue($value);
 
  566                                                                 $this->respcondition->setTitle($value);
 
  573                                 include_once(
"./Services/QTI/classes/class.ilQTIOutcomes.php");
 
  577                                 include_once(
"./Services/QTI/classes/class.ilQTIDecvar.php");
 
  579                                 if (is_array($a_attribs))
 
  581                                         foreach ($a_attribs as $attribute => $value)
 
  583                                                 switch (strtolower($attribute))
 
  586                                                                 $this->decvar->setVarname($value);
 
  589                                                                 $this->decvar->setVartype($value);
 
  592                                                                 $this->decvar->setDefaultval($value);
 
  595                                                                 $this->decvar->setMinvalue($value);
 
  598                                                                 $this->decvar->setMaxvalue($value);
 
  601                                                                 $this->decvar->setMembers($value);
 
  604                                                                 $this->decvar->setCutvalue($value);
 
  611                                 include_once(
"./Services/QTI/classes/class.ilQTIMatimage.php");
 
  613                                 if (is_array($a_attribs))
 
  615                                         foreach ($a_attribs as $attribute => $value)
 
  617                                                 switch (strtolower($attribute))
 
  620                                                                 $this->matimage->setImagetype($value);
 
  623                                                                 $this->matimage->setLabel($value);
 
  626                                                                 $this->matimage->setHeight($value);
 
  629                                                                 $this->matimage->setWidth($value);
 
  632                                                                 $this->matimage->setUri($value);
 
  635                                                                 $this->matimage->setEmbedded($value);
 
  638                                                                 $this->matimage->setX0($value);
 
  641                                                                 $this->matimage->setY0($value);
 
  644                                                                 $this->matimage->setEntityref($value);
 
  651                                 include_once(
"./Services/QTI/classes/class.ilQTIMaterial.php");
 
  653                                 $this->material->setFlow($this->flow);
 
  654                                 if (is_array($a_attribs))
 
  656                                         foreach ($a_attribs as $attribute => $value)
 
  658                                                 switch (strtolower($attribute))
 
  661                                                                 $this->material->setLabel($value);
 
  668                                 include_once (
"./Services/QTI/classes/class.ilQTIMattext.php");
 
  670                                 if (is_array($a_attribs))
 
  672                                         foreach ($a_attribs as $attribute => $value)
 
  674                                                 switch (strtolower($attribute))
 
  677                                                                 $this->mattext->setTexttype($value);
 
  680                                                                 $this->mattext->setLabel($value);
 
  683                                                                 $this->mattext->setCharset($value);
 
  686                                                                 $this->mattext->setUri($value);
 
  689                                                                 $this->mattext->setXmlspace($value);
 
  692                                                                 $this->mattext->setXmllang($value);
 
  695                                                                 $this->mattext->setEntityref($value);
 
  698                                                                 $this->mattext->setHeight($value);
 
  701                                                                 $this->mattext->setWidth($value);
 
  704                                                                 $this->mattext->setX0($value);
 
  707                                                                 $this->mattext->setY0($value);
 
  714                                 include_once (
"./Services/QTI/classes/class.ilQTIMatapplet.php");
 
  716                                 if (is_array($a_attribs))
 
  718                                         foreach ($a_attribs as $attribute => $value)
 
  720                                                 switch (strtolower($attribute))
 
  723                                                                 $this->matapplet->setLabel($value);
 
  726                                                                 $this->matapplet->setUri($value);
 
  729                                                                 $this->matapplet->setY0($value);
 
  732                                                                 $this->matapplet->setHeight($value);
 
  735                                                                 $this->matapplet->setWidth($value);
 
  738                                                                 $this->matapplet->setX0($value);
 
  741                                                                 $this->matapplet->setEmbedded($value);
 
  744                                                                 $this->matapplet->setEntityref($value);
 
  750                         case "questestinterop":
 
  751                                 $this->hasRootElement = TRUE;
 
  759                                 if ($this->assessment != NULL)
 
  761                                         $this->assessment->addSection($this->section);
 
  763                                 $this->section = NULL;
 
  766                                 $this->in_presentation = TRUE;
 
  767                                 include_once (
"./Services/QTI/classes/class.ilQTIPresentation.php");
 
  770                         case "response_label":
 
  771                                 if ($this->render_type != NULL)
 
  773                                 include_once(
"./Services/QTI/classes/class.ilQTIResponseLabel.php");
 
  775                                         foreach ($a_attribs as $attribute => $value)
 
  777                                                 switch (strtolower($attribute))
 
  780                                                                 $this->response_label->setRshuffle($value);
 
  783                                                                 $this->response_label->setRarea($value);
 
  786                                                                 $this->response_label->setRrange($value);
 
  789                                                                 $this->response_label->setLabelrefid($value);
 
  792                                                                 $this->response_label->setIdent($value);
 
  795                                                                 $this->response_label->setMatchGroup($value);
 
  798                                                                 $this->response_label->setMatchMax($value);
 
  804                         case "render_choice":
 
  805                                 if ($this->in_response)
 
  807                                         include_once(
"./Services/QTI/classes/class.ilQTIRenderChoice.php");
 
  809                                         foreach ($a_attribs as $attribute => $value)
 
  811                                                 switch (strtolower($attribute))
 
  814                                                                 $this->render_type->setShuffle($value);
 
  820                         case "render_hotspot":
 
  821                                 if ($this->in_response)
 
  823                                         include_once(
"./Services/QTI/classes/class.ilQTIRenderHotspot.php");
 
  825                                         foreach ($a_attribs as $attribute => $value)
 
  827                                                 switch (strtolower($attribute))
 
  830                                                                 $this->render_type->setShuffle($value);
 
  833                                                                 $this->render_type->setMinnumber($value);
 
  836                                                                 $this->render_type->setMaxnumber($value);
 
  843                                 if ($this->in_response)
 
  845                                         include_once(
"./Services/QTI/classes/class.ilQTIRenderFib.php");
 
  847                                         foreach ($a_attribs as $attribute => $value)
 
  849                                                 switch (strtolower($attribute))
 
  852                                                                 $this->render_type->setEncoding($value);
 
  855                                                                 $this->render_type->setFibtype($value);
 
  858                                                                 $this->render_type->setRows($value);
 
  861                                                                 $this->render_type->setMaxchars($value);
 
  864                                                                 $this->render_type->setPrompt($value);
 
  867                                                                 $this->render_type->setColumns($value);
 
  870                                                                 $this->render_type->setCharset($value);
 
  873                                                                 $this->render_type->setMaxnumber($value);
 
  876                                                                 $this->render_type->setMinnumber($value);
 
  895                                 include_once 
"./Services/QTI/classes/class.ilQTIResponse.php";
 
  896                                 switch (strtolower($a_name))
 
  914                                 $this->in_response = TRUE;
 
  916                                 $this->response->setFlow($this->flow);
 
  917                                 if (is_array($a_attribs))
 
  919                                         foreach ($a_attribs as $attribute => $value)
 
  921                                                 switch (strtolower($attribute))
 
  924                                                                 $this->response->setIdent($value);
 
  927                                                                 $this->response->setRTiming($value);
 
  930                                                                 $this->response->setRCardinality($value);
 
  933                                                                 $this->response->setNumtype($value);
 
  940                                 include_once(
"./Services/QTI/classes/class.ilQTIItem.php");
 
  941                                 $this->gap_index = 0;
 
  942                                 $this->item =& $this->items[array_push($this->items, 
new ilQTIItem())-1];
 
  943                                 if (is_array($a_attribs))
 
  945                                         foreach ($a_attribs as $attribute => $value)
 
  947                                                 switch (strtolower($attribute))
 
  950                                                                 $this->item->setIdent($value);
 
  951                                                                 if (count($this->import_idents) > 0)
 
  953                                                                         if (!in_array($value, $this->import_idents))
 
  955                                                                                 $this->do_nothing = TRUE;
 
  960                                                                 $this->item->setTitle($value);
 
  963                                                                 $this->item->setMaxattempts($value);
 
  969                         case "resprocessing":
 
  970                                 include_once(
"./Services/QTI/classes/class.ilQTIResprocessing.php");
 
  972                                 if (is_array($a_attribs))
 
  974                                         foreach ($a_attribs as $attribute => $value)
 
  976                                                 switch (strtolower($attribute))
 
  979                                                                 $this->resprocessing->setScoremodel($value);
 
  993                 switch ($this->parser_mode)
 
 1009                 if (($this->do_nothing) && (strcmp(strtolower($a_name), 
"item") != 0)) 
return;
 
 1010                 switch (strtolower($a_name))
 
 1013                                 if (is_object($this->tst_object))
 
 1015                                         $this->tst_object->fromXML($this->assessment);
 
 1017                                 $this->in_assessment = FALSE;
 
 1019                         case "assessmentcontrol":
 
 1020                                 $this->assessment->addAssessmentcontrol($this->assessmentcontrol);
 
 1021                                 $this->assessmentcontrol = NULL;
 
 1024                                 if (strcmp(strtolower($this->
getParent($a_xml_parser)), 
"assessment") == 0)
 
 1026                                         $this->assessment->addObjectives($this->objectives);
 
 1028                                 $this->in_objectives = FALSE;
 
 1030                         case "itemmetadata":
 
 1031                                 $this->in_itemmetadata = FALSE;
 
 1033                         case "qtimetadatafield":
 
 1035                                 switch ($this->metadata[
"label"])
 
 1037                                         case "ILIAS_VERSION":
 
 1039                                         case "QUESTIONTYPE":
 
 1040                                                 if ($this->item != NULL)
 
 1042                                                         $this->item->setQuestiontype($this->metadata[
"entry"]);
 
 1046                                                 if ($this->item != NULL)
 
 1048                                                         $this->item->setAuthor($this->metadata[
"entry"]);
 
 1051                                                 if ($this->item != NULL)
 
 1053                                                         $this->item->addMetadata($this->metadata);
 
 1057                                 if ($this->in_assessment)
 
 1059                                         $this->assessment->addQtiMetadata($this->metadata);
 
 1061                                 $this->metadata = array(
"label" => 
"", 
"entry" => 
"");
 
 1067                                 if (count($this->flow_mat))
 
 1070                                         if (count($this->flow_mat))
 
 1072                                                 $this->flow_mat[count($this->flow_mat)-1]->addFlow_mat(
$flow_mat);
 
 1074                                         else if ($this->itemfeedback != NULL)
 
 1076                                                 $this->itemfeedback->addFlow_mat(
$flow_mat);
 
 1078                                         else if ($this->response_label != NULL)
 
 1080                                                 $this->response_label->addFlow_mat(
$flow_mat);
 
 1084                         case "itemfeedback":
 
 1085                                 if ($this->item != NULL)
 
 1087                                         if ($this->itemfeedback != NULL)
 
 1089                                                 $this->item->addItemfeedback($this->itemfeedback);
 
 1092                                 $this->itemfeedback = NULL;
 
 1094                         case "displayfeedback":
 
 1095                                 if ($this->respcondition != NULL)
 
 1097                                         if ($this->displayfeedback != NULL)
 
 1099                                                 $this->respcondition->addDisplayfeedback($this->displayfeedback);
 
 1102                                 $this->displayfeedback = NULL;
 
 1105                                 if ($this->respcondition != NULL)
 
 1107                                         if ($this->setvar != NULL)
 
 1109                                                 $this->respcondition->addSetvar($this->setvar);
 
 1112                                 $this->setvar = NULL;
 
 1114                         case "conditionvar":
 
 1115                                 if ($this->respcondition != NULL)
 
 1117                                         $this->respcondition->setConditionvar($this->conditionvar);
 
 1119                                 $this->conditionvar = NULL;
 
 1128                         case "varsubstring":
 
 1129                                 if ($this->conditionvar != NULL)
 
 1131                                         if ($this->responsevar != NULL)
 
 1133                                                 $this->conditionvar->addResponseVar($this->responsevar);
 
 1136                                 $this->responsevar = NULL;
 
 1138                         case "respcondition":
 
 1139                                 if ($this->resprocessing != NULL)
 
 1141                                         $this->resprocessing->addRespcondition($this->respcondition);
 
 1143                                 $this->respcondition = NULL;
 
 1146                                 if ($this->resprocessing != NULL)
 
 1148                                         $this->resprocessing->setOutcomes($this->outcomes);
 
 1150                                 $this->outcomes = NULL;
 
 1153                                 if ($this->outcomes != NULL)
 
 1155                                         $this->outcomes->addDecvar($this->decvar);
 
 1157                                 $this->decvar = NULL;
 
 1159                         case "presentation":
 
 1160                                 $this->in_presentation = FALSE;
 
 1161                                 if ($this->presentation != NULL)
 
 1163                                         if ($this->item != NULL)
 
 1165                                                 $this->item->setPresentation($this->presentation);
 
 1168                                 $this->presentation = NULL;
 
 1170                         case "response_label":
 
 1171                                 if ($this->render_type != NULL)
 
 1173                                         $this->render_type->addResponseLabel($this->response_label);
 
 1174                                         $this->response_label = NULL;
 
 1177                         case "render_choice":
 
 1178                         case "render_hotspot":
 
 1180                                 if ($this->in_response)
 
 1182                                         if ($this->response != NULL)
 
 1184                                                 if ($this->render_type != NULL)
 
 1186                                                         $this->response->setRenderType($this->render_type);
 
 1187                                                         $this->render_type = NULL;
 
 1192                         case "response_lid":
 
 1194                         case "response_str":
 
 1195                         case "response_num":
 
 1196                         case "response_grp":
 
 1198                                 if ($this->presentation != NULL)
 
 1200                                         if ($this->response != NULL)
 
 1202                                                 $this->presentation->addResponse($this->response);
 
 1203                                                 if ($this->item != NULL)
 
 1205                                                         $this->item->addPresentationitem($this->response);
 
 1209                                 $this->response = NULL;
 
 1210                                 $this->in_response = FALSE;
 
 1213                                 if ($this->do_nothing)
 
 1215                                         $this->do_nothing = FALSE;
 
 1218                                 if (strlen($this->item->getQuestionType()))
 
 1234                                 $qt = $this->item->determineQuestionType();
 
 1237                                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1239                                 $question = 
new $qt();
 
 1240                                 $question->fromXML($this->item, $this->qpl_id, $this->tst_id, $this->tst_object, $this->question_counter, $this->import_mapping);
 
 1243                                 if ($this->material)
 
 1245                                         $mat = $this->material->getMaterial(0);
 
 1246                                         if ((strcmp($mat[
"type"], 
"mattext") == 0) && (strcmp($mat[
"material"]->getLabel(), 
"suggested_solution") == 0))
 
 1248                                                 $this->item->addSuggestedSolution($mat[
"material"], $this->gap_index);
 
 1250                                         if ($this->in_objectives)
 
 1252                                                 $this->objectives->addMaterial($this->material);
 
 1254                                         else if (($this->render_type != NULL) && (strcmp(strtolower($this->
getParent($a_xml_parser)), 
"render_hotspot") == 0))
 
 1256                                                 $this->render_type->addMaterial($this->material);
 
 1258                                         else if (count($this->flow_mat) && (strcmp(strtolower($this->
getParent($a_xml_parser)), 
"flow_mat") == 0))
 
 1260                                                 $this->flow_mat[count($this->flow_mat)-1]->addMaterial($this->material);
 
 1262                                         else if ($this->itemfeedback != NULL)
 
 1264                                                 $this->itemfeedback->addMaterial($this->material);
 
 1266                                         else if ($this->response_label != NULL)
 
 1268                                                 $this->response_label->addMaterial($this->material);
 
 1270                                         else if ($this->response != NULL)
 
 1272                                                 if ($this->response->hasRendering())
 
 1274                                                         $this->response->setMaterial2($this->material);
 
 1278                                                         $this->response->setMaterial1($this->material);
 
 1281                                         elseif (($this->in_presentation) && (!$this->in_response))
 
 1283                                                 if (!is_object($this->item->getQuestiontext()))
 
 1285                                                         $this->item->setQuestiontext($this->material);
 
 1287                                                 $this->presentation->addMaterial($this->material);
 
 1289                                         else if ($this->presentation != NULL)
 
 1291                                                 $this->presentation->addMaterial($this->material);
 
 1292                                                 if ($this->item != NULL)
 
 1294                                                         $this->item->addPresentationitem($this->material);
 
 1298                                 $this->material = NULL;
 
 1301                                 if ($this->material != NULL)
 
 1303                                         if ($this->matimage != NULL)
 
 1305                                                 $this->material->addMatimage($this->matimage);
 
 1308                                 $this->matimage = NULL;
 
 1310                         case "resprocessing":
 
 1311                                 if ($this->item != NULL)
 
 1313                                         $this->item->addResprocessing($this->resprocessing);
 
 1315                                 $this->resprocessing = NULL;
 
 1318                                 if ($this->material != NULL)
 
 1320                                         $this->material->addMattext($this->mattext);
 
 1322                                 $this->mattext = NULL;
 
 1325                                 if ($this->material != NULL)
 
 1327                                         $this->material->addMatapplet($this->matapplet);
 
 1329                                 $this->matapplet = NULL;
 
 1332                 $this->depth[$a_xml_parser]--;
 
 1340                 switch ($this->parser_mode)
 
 1356                 if ($this->do_nothing) 
return;
 
 1357                 $this->characterbuffer .= $a_data;
 
 1359                 switch ($this->qti_element)
 
 1362                                 $this->metadata[
"label"] = $a_data;
 
 1365                                 $this->metadata[
"entry"] = $a_data;
 
 1367                         case "response_label":
 
 1368                                 if ($this->response_label != NULL)
 
 1370                                         $this->response_label->setContent($a_data);
 
 1374                                 if ($this->setvar != NULL)
 
 1376                                         $this->setvar->setContent($a_data);
 
 1379                         case "displayfeedback":
 
 1380                                 if ($this->displayfeedback != NULL)
 
 1382                                         $this->displayfeedback->setContent($a_data);
 
 1392                         case "varsubstring":
 
 1393                                 if ($this->responsevar != NULL)
 
 1395                                         $this->responsevar->setContent($a_data);
 
 1399                                 if (strlen($a_data))
 
 1401                                         if ($this->decvar != NULL)
 
 1403                                                 $this->decvar->setContent($a_data);
 
 1408                                 if ($this->mattext != NULL)
 
 1410                                         $this->mattext->setContent($a_data);
 
 1414                                 if ($this->matapplet != NULL)
 
 1416                                         $this->matapplet->setContent($a_data);
 
 1420                                 if ($this->matimage != NULL)
 
 1422                                         $this->matimage->setContent($a_data);
 
 1426                                 switch ($this->
getParent($a_xml_parser))
 
 1435                                                 $this->item->setDuration($a_data);
 
 1440                                 switch ($this->
getParent($a_xml_parser))
 
 1443                                                 $this->item->setComment($a_data);
 
 1446                                                 $this->assessment->setComment($a_data);
 
 1453                 $this->sametag = TRUE;
 
 1461                 switch (strtolower($a_name))
 
 1463                         case "questestinterop":
 
 1464                                 $this->verifyroot = 
true;
 
 1466                         case "qtimetadatafield":
 
 1467                                 $this->verifymetadatafield = 1;
 
 1470                                 $this->verifyfieldlabeltext = 
"";
 
 1471                                 if ($this->verifymetadatafield == 1) $this->verifyfieldlabel = 1;
 
 1474                                 $this->verifyfieldentrytext = 
"";
 
 1475                                 if ($this->verifymetadatafield == 1) $this->verifyfieldentry = 1;
 
 1479                                 if (is_array($a_attribs))
 
 1481                                         foreach ($a_attribs as $attribute => $value)
 
 1483                                                 switch (strtolower($attribute))
 
 1491                                 array_push($this->founditems, array(
"title" => 
"$title", 
"type" => 
"", 
"ident" => $a_attribs[
"ident"]));
 
 1493                         case "response_lid":
 
 1494                                 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
 
 1497                                         if (is_array($a_attribs))
 
 1499                                                 foreach ($a_attribs as $attribute => $value)
 
 1501                                                         switch (strtolower($attribute))
 
 1503                                                                 case "rcardinality":
 
 1504                                                                         include_once 
"./Services/QTI/classes/class.ilQTIItem.php";
 
 1505                                                                         switch (strtolower($value))
 
 1514                                                                                         $this->founditems[count($this->founditems)-1][
"type"] = 
QT_ORDERING;
 
 1523                         case "response_str":
 
 1524                                 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
 
 1527                                         if (is_array($a_attribs))
 
 1529                                                 foreach ($a_attribs as $attribute => $value)
 
 1531                                                         switch (strtolower($attribute))
 
 1533                                                                 case "rcardinality":
 
 1534                                                                         include_once 
"./Services/QTI/classes/class.ilQTIItem.php";
 
 1535                                                                         switch (strtolower($value))
 
 1538                                                                                         $this->founditems[count($this->founditems)-1][
"type"] = 
QT_CLOZE;
 
 1541                                                                                         $this->founditems[count($this->founditems)-1][
"type"] = 
QT_TEXT;
 
 1551                                 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
 
 1553                                         $this->founditems[count($this->founditems)-1][
"type"] = 
QT_IMAGEMAP;
 
 1556                         case "response_num":
 
 1557                                 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
 
 1559                                         $this->founditems[count($this->founditems)-1][
"type"] = 
QT_NUMERIC;
 
 1562                         case "response_grp":
 
 1563                                 if (strlen($this->founditems[count($this->founditems)-1][
"type"]) == 0)
 
 1565                                         $this->founditems[count($this->founditems)-1][
"type"] = 
QT_MATCHING;
 
 1570                                 $this->verifyqticomment = 1;
 
 1572                         case "presentation":
 
 1573                                 if (is_array($a_attribs))
 
 1575                                         foreach ($a_attribs as $attribute => $value)
 
 1577                                                 switch (strtolower($attribute))
 
 1580                                                                 $this->founditems[count($this->founditems)-1][
"title"] = $value;
 
 1594                 switch (strtolower($a_name))
 
 1598                                 $this->verifyqticomment = 0;
 
 1600                         case "qtimetadatafield":
 
 1601                                 $this->verifymetadatafield = 0;
 
 1602                                 if (strcmp($this->verifyfieldlabeltext, 
"QUESTIONTYPE") == 0)
 
 1608                                 $this->verifyfieldlabel = 0;
 
 1611                                 $this->verifyfieldentry = 0;
 
 1621                 if ($this->verifyqticomment == 1)
 
 1623                         if (preg_match(
"/Questiontype\=(.*)/", $a_data, $matches))
 
 1625                                 if (count($this->founditems))
 
 1627                                         $this->founditems[count($this->founditems)-1][
"type"] = $matches[1];
 
 1631                 else if ($this->verifyfieldlabel == 1)
 
 1633                         $this->verifyfieldlabeltext = $a_data;
 
 1635                 else if ($this->verifyfieldentry == 1)
 
 1637                         $this->verifyfieldentrytext = $a_data;
 
 1652                 if (!is_array($this->import_mapping))