ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilQTIParser Class Reference
+ Inheritance diagram for ilQTIParser:
+ Collaboration diagram for ilQTIParser:

Public Member Functions

 ilQTIParser ($a_xml_file, $a_mode=IL_MO_PARSE_QTI, $a_qpl_id=0, $a_import_idents="")
 Constructor.
 setTestObject (&$a_tst_object)
 setParserMode ($a_mode=IL_MO_PARSE_QTI)
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private
 startParsing ()
 stores xml data in array
 getParent ($a_xml_parser)
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element
 handlerParseBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element parser
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element
 handlerParseEndTag ($a_xml_parser, $a_name)
 handler for end of element parser
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data
 handlerParseCharacterData ($a_xml_parser, $a_data)
 handler for character data
 handlerVerifyBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element verification
 handlerVerifyEndTag ($a_xml_parser, $a_name)
 handler for end of element verification
 handlerVerifyCharacterData ($a_xml_parser, $a_data)
 handler for character data verification
getFoundItems ()
 getImportMapping ()
 get array of new created questions for import id
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file= '', $throwException=false)
 Constructor setup ILIAS global object public.
 setXMLContent ($a_xml_content)
 getXMLContent ()
 getInputType ()
 createParser ()
 create parser
 setOptions ($a_xml_parser)
 set parser options
 openXMLFile ()
 open xml file
 parse ($a_xml_parser, $a_fp=null)
 parse xml file
 freeParser ($a_xml_parser)
 free xml parser handle
 setThrowException ($throwException)
 set error handling
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor.
 _PEAR ()
 Destructor (the emulated type of...).
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them.
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes.
 isError ($data, $code=null)
 Tell whether a value is a PEAR error.
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled.
 expectError ($code= '*')
 This method is used to tell which errors you expect to get.
 popExpect ()
 This method pops one element off the expected error codes stack.
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available.
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack.
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied.
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options.
 staticPushErrorHandling ($mode, $options=null)
 staticPopErrorHandling ()
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack.
 popErrorHandling ()
 Pop the last error handler used.
 loadExtension ($ext)
 OS independant PHP extension load.

Data Fields

 $lng
 $hasRootElement
 $path
 $items
 $item
 $depth
 $qti_element
 $in_presentation
 $in_response
 $render_type
 $response_label
 $material
 $matimage
 $response
 $resprocessing
 $outcomes
 $decvar
 $respcondition
 $setvar
 $displayfeedback
 $itemfeedback
 $flow_mat
 $flow
 $presentation
 $mattext
 $sametag
 $characterbuffer
 $conditionvar
 $parser_mode
 $import_idents
 $qpl_id
 $tst_id
 $tst_object
 $do_nothing
 $gap_index
 $assessments
 $assessment
 $assessmentcontrol
 $objectives
 $in_assessment = FALSE
 $section
 $import_mapping
 $question_counter = 1
 $in_itemmetadata
 $in_objectives = FALSE
 $founditems = array()
 $verifyroot = false
 $verifyqticomment = 0
 $verifymetadatafield = 0
 $verifyfieldlabel = 0
 $verifyfieldlabeltext = ""
 $verifyfieldentry = 0
 $verifyfieldentrytext = ""
- Data Fields inherited from ilSaxParser
 $input_type = null
 $xml_content = ''
 $ilias
 $lng
 $xml_file
 $throwException = false
- Data Fields inherited from PEAR
 $_debug = false
 $_default_error_mode = null
 $_default_error_options = null
 $_default_error_handler = ''
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()

Additional Inherited Members

- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle

Detailed Description

Definition at line 38 of file class.ilQTIParser.php.

Member Function Documentation

& ilQTIParser::getFoundItems ( )

Definition at line 1638 of file class.ilQTIParser.php.

References $founditems.

{
}
ilQTIParser::getImportMapping ( )

get array of new created questions for import id

Definition at line 1647 of file class.ilQTIParser.php.

References $import_mapping.

{
if (!is_array($this->import_mapping))
{
return array();
}
else
{
}
}
ilQTIParser::getParent (   $a_xml_parser)

Definition at line 203 of file class.ilQTIParser.php.

Referenced by handlerParseCharacterData(), and handlerParseEndTag().

{
if ($this->depth[$a_xml_parser] > 0)
{
return $this->path[$this->depth[$a_xml_parser]-1];
}
else
{
return "";
}
}

+ Here is the caller graph for this function:

ilQTIParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 218 of file class.ilQTIParser.php.

References handlerParseBeginTag(), handlerVerifyBeginTag(), IL_MO_PARSE_QTI, and IL_MO_VERIFY_QTI.

{
switch ($this->parser_mode)
{
$this->handlerParseBeginTag($a_xml_parser, $a_name, $a_attribs);
break;
$this->handlerVerifyBeginTag($a_xml_parser, $a_name, $a_attribs);
break;
}
}

+ Here is the call graph for this function:

ilQTIParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 1335 of file class.ilQTIParser.php.

References handlerParseCharacterData(), handlerVerifyCharacterData(), IL_MO_PARSE_QTI, and IL_MO_VERIFY_QTI.

{
switch ($this->parser_mode)
{
$this->handlerParseCharacterData($a_xml_parser, $a_data);
break;
$this->handlerVerifyCharacterData($a_xml_parser, $a_data);
break;
}
}

+ Here is the call graph for this function:

ilQTIParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 988 of file class.ilQTIParser.php.

References handlerParseEndTag(), handlerVerifyEndTag(), IL_MO_PARSE_QTI, and IL_MO_VERIFY_QTI.

{
switch ($this->parser_mode)
{
$this->handlerParseEndTag($a_xml_parser, $a_name);
break;
$this->handlerVerifyEndTag($a_xml_parser, $a_name);
break;
}
}

+ Here is the call graph for this function:

ilQTIParser::handlerParseBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element parser

Definition at line 234 of file class.ilQTIParser.php.

References RESPONSEVAR_EQUAL, RESPONSEVAR_GT, RESPONSEVAR_GTE, RESPONSEVAR_INSIDE, RESPONSEVAR_LT, RESPONSEVAR_LTE, RESPONSEVAR_SUBSET, RESPONSEVAR_SUBSTRING, RT_RESPONSE_GRP, RT_RESPONSE_LID, RT_RESPONSE_NUM, RT_RESPONSE_STR, and RT_RESPONSE_XY.

Referenced by handlerBeginTag().

{
if ($this->do_nothing) return;
$this->sametag = FALSE;
$this->characterbuffer = "";
$this->depth[$a_xml_parser]++;
$this->path[$this->depth[$a_xml_parser]] = strtolower($a_name);
$this->qti_element = $a_name;
switch (strtolower($a_name))
{
case "assessment":
include_once ("./Services/QTI/classes/class.ilQTIAssessment.php");
$this->assessment =& $this->assessments[array_push($this->assessments, new ilQTIAssessment())-1];
$this->in_assessment = TRUE;
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "title":
$this->assessment->setTitle($value);
break;
case "ident":
$this->assessment->setIdent($value);
break;
}
}
}
break;
case "assessmentcontrol":
include_once ("./Services/QTI/classes/class.ilQTIAssessmentcontrol.php");
$this->assessmentcontrol = new ilQTIAssessmentcontrol();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "solutionswitch":
$this->assessmentcontrol->setSolutionswitch($value);
break;
case "hintswitch":
$this->assessmentcontrol->setHintswitch($value);
break;
case "feedbackswitch":
$this->assessmentcontrol->setFeedbackswitch($value);
break;
}
}
}
break;
case "objectives":
include_once ("./Services/QTI/classes/class.ilQTIObjectives.php");
$this->objectives = new ilQTIObjectives();
$this->in_objectives = TRUE;
break;
case "section":
include_once ("./Services/QTI/classes/class.ilQTISection.php");
$this->section = new ilQTISection();
break;
case "itemmetadata":
$this->in_itemmetadata = TRUE;
break;
case "qtimetadatafield":
$this->metadata = array("label" => "", "entry" => "");
break;
case "flow":
include_once ("./Services/QTI/classes/class.ilQTIFlow.php");
$this->flow++;
break;
case "flow_mat":
include_once ("./Services/QTI/classes/class.ilQTIFlowMat.php");
array_push($this->flow_mat, new ilQTIFlowMat());
break;
case "itemfeedback":
include_once ("./Services/QTI/classes/class.ilQTIItemfeedback.php");
$this->itemfeedback = new ilQTIItemfeedback();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "ident":
$this->itemfeedback->setIdent($value);
break;
case "view":
$this->itemfeedback->setView($value);
break;
}
}
}
break;
case "displayfeedback":
include_once ("./Services/QTI/classes/class.ilQTIDisplayfeedback.php");
$this->displayfeedback = new ilQTIDisplayfeedback();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "feedbacktype":
$this->displayfeedback->setFeedbacktype($value);
break;
case "linkrefid":
$this->displayfeedback->setLinkrefid($value);
break;
}
}
}
break;
case "setvar":
include_once ("./Services/QTI/classes/class.ilQTISetvar.php");
$this->setvar = new ilQTISetvar();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "action":
$this->setvar->setAction($value);
break;
case "varname":
$this->setvar->setVarname($value);
break;
}
}
}
break;
case "conditionvar":
include_once ("./Services/QTI/classes/class.ilQTIConditionvar.php");
$this->conditionvar = new ilQTIConditionvar();
break;
case "not":
if ($this->conditionvar != NULL)
{
$this->conditionvar->addNot();
}
break;
case "and":
if ($this->conditionvar != NULL)
{
$this->conditionvar->addAnd();
}
break;
case "or":
if ($this->conditionvar != NULL)
{
$this->conditionvar->addOr();
}
break;
case "varequal":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_EQUAL);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "case":
$this->responsevar->setCase($value);
break;
case "respident":
$this->responsevar->setRespident($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "varlt":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_LT);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "respident":
$this->responsevar->setRespident($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "varlte":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_LTE);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "respident":
$this->responsevar->setRespident($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "vargt":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_GT);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "respident":
$this->responsevar->setRespident($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "vargte":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_GTE);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "respident":
$this->responsevar->setRespident($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "varsubset":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_SUBSET);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "respident":
$this->responsevar->setRespident($value);
break;
case "setmatch":
$this->responsevar->setSetmatch($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "varinside":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_INSIDE);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "respident":
$this->responsevar->setRespident($value);
break;
case "areatype":
$this->responsevar->setAreatype($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "varsubstring":
include_once("./Services/QTI/classes/class.ilQTIResponseVar.php");
$this->responsevar = new ilQTIResponseVar(RESPONSEVAR_SUBSTRING);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "case":
$this->responsevar->setCase($value);
break;
case "respident":
$this->responsevar->setRespident($value);
break;
case "index":
$this->responsevar->setIndex($value);
break;
}
}
}
break;
case "respcondition":
include_once("./Services/QTI/classes/class.ilQTIRespcondition.php");
$this->respcondition = new ilQTIRespcondition();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "continue":
$this->respcondition->setContinue($value);
break;
case "title":
$this->respcondition->setTitle($value);
break;
}
}
}
break;
case "outcomes":
include_once("./Services/QTI/classes/class.ilQTIOutcomes.php");
$this->outcomes = new ilQTIOutcomes();
break;
case "decvar":
include_once("./Services/QTI/classes/class.ilQTIDecvar.php");
$this->decvar = new ilQTIDecvar();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "varname":
$this->decvar->setVarname($value);
break;
case "vartype":
$this->decvar->setVartype($value);
break;
case "defaultval":
$this->decvar->setDefaultval($value);
break;
case "minvalue":
$this->decvar->setMinvalue($value);
break;
case "maxvalue":
$this->decvar->setMaxvalue($value);
break;
case "members":
$this->decvar->setMembers($value);
break;
case "cutvalue":
$this->decvar->setCutvalue($value);
break;
}
}
}
break;
case "matimage":
include_once("./Services/QTI/classes/class.ilQTIMatimage.php");
$this->matimage = new ilQTIMatimage();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "imagtype":
$this->matimage->setImagetype($value);
break;
case "label":
$this->matimage->setLabel($value);
break;
case "height":
$this->matimage->setHeight($value);
break;
case "width":
$this->matimage->setWidth($value);
break;
case "uri":
$this->matimage->setUri($value);
break;
case "embedded":
$this->matimage->setEmbedded($value);
break;
case "x0":
$this->matimage->setX0($value);
break;
case "y0":
$this->matimage->setY0($value);
break;
case "entityref":
$this->matimage->setEntityref($value);
break;
}
}
}
break;
case "material":
include_once("./Services/QTI/classes/class.ilQTIMaterial.php");
$this->material = new ilQTIMaterial();
$this->material->setFlow($this->flow);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "label":
$this->material->setLabel($value);
break;
}
}
}
break;
case "mattext":
include_once ("./Services/QTI/classes/class.ilQTIMattext.php");
$this->mattext = new ilQTIMattext();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "texttype":
$this->mattext->setTexttype($value);
break;
case "label":
$this->mattext->setLabel($value);
break;
case "charset":
$this->mattext->setCharset($value);
break;
case "uri":
$this->mattext->setUri($value);
break;
case "xml:space":
$this->mattext->setXmlspace($value);
break;
case "xml:lang":
$this->mattext->setXmllang($value);
break;
case "entityref":
$this->mattext->setEntityref($value);
break;
case "height":
$this->mattext->setHeight($value);
break;
case "width":
$this->mattext->setWidth($value);
break;
case "x0":
$this->mattext->setX0($value);
break;
case "y0":
$this->mattext->setY0($value);
break;
}
}
}
break;
case "matapplet":
include_once ("./Services/QTI/classes/class.ilQTIMatapplet.php");
$this->matapplet = New ilQTIMatapplet();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "label":
$this->matapplet->setLabel($value);
break;
case "uri":
$this->matapplet->setUri($value);
break;
case "y0":
$this->matapplet->setY0($value);
break;
case "height":
$this->matapplet->setHeight($value);
break;
case "width":
$this->matapplet->setWidth($value);
break;
case "x0":
$this->matapplet->setX0($value);
break;
case "embedded":
$this->matapplet->setEmbedded($value);
break;
case "entityref":
$this->matapplet->setEntityref($value);
break;
}
}
}
break;
case "questestinterop":
$this->hasRootElement = TRUE;
break;
case "qticomment":
break;
case "objectbank":
// not implemented yet
break;
case "section":
if ($this->assessment != NULL)
{
$this->assessment->addSection($this->section);
}
$this->section = NULL;
break;
case "presentation":
$this->in_presentation = TRUE;
include_once ("./Services/QTI/classes/class.ilQTIPresentation.php");
$this->presentation = new ilQTIPresentation();
break;
case "response_label":
if ($this->render_type != NULL)
{
include_once("./Services/QTI/classes/class.ilQTIResponseLabel.php");
$this->response_label = new ilQTIResponseLabel();
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "rshuffle":
$this->response_label->setRshuffle($value);
break;
case "rarea":
$this->response_label->setRarea($value);
break;
case "rrange":
$this->response_label->setRrange($value);
break;
case "labelrefid":
$this->response_label->setLabelrefid($value);
break;
case "ident":
$this->response_label->setIdent($value);
break;
case "match_group":
$this->response_label->setMatchGroup($value);
break;
case "match_max":
$this->response_label->setMatchMax($value);
break;
}
}
}
break;
case "render_choice":
if ($this->in_response)
{
include_once("./Services/QTI/classes/class.ilQTIRenderChoice.php");
$this->render_type = new ilQTIRenderChoice();
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "shuffle":
$this->render_type->setShuffle($value);
break;
}
}
}
break;
case "render_hotspot":
if ($this->in_response)
{
include_once("./Services/QTI/classes/class.ilQTIRenderHotspot.php");
$this->render_type = new ilQTIRenderHotspot();
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "showdraw":
$this->render_type->setShuffle($value);
break;
case "minnumber":
$this->render_type->setMinnumber($value);
break;
case "maxnumber":
$this->render_type->setMaxnumber($value);
break;
}
}
}
break;
case "render_fib":
if ($this->in_response)
{
include_once("./Services/QTI/classes/class.ilQTIRenderFib.php");
$this->render_type = new ilQTIRenderFib();
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "encoding":
$this->render_type->setEncoding($value);
break;
case "fibtype":
$this->render_type->setFibtype($value);
break;
case "rows":
$this->render_type->setRows($value);
break;
case "maxchars":
$this->render_type->setMaxchars($value);
break;
case "prompt":
$this->render_type->setPrompt($value);
break;
case "columns":
$this->render_type->setColumns($value);
break;
case "charset":
$this->render_type->setCharset($value);
break;
case "maxnumber":
$this->render_type->setMaxnumber($value);
break;
case "minnumber":
$this->render_type->setMinnumber($value);
break;
}
}
}
break;
case "response_lid":
// Ordering Terms and Definitions or
// Ordering Terms and Pictures or
// Multiple choice single response or
// Multiple choice multiple response
case "response_xy":
// Imagemap question
case "response_str":
// Close question
case "response_num":
case "response_grp":
// Matching terms and definitions
// Matching terms and images
include_once "./Services/QTI/classes/class.ilQTIResponse.php";
switch (strtolower($a_name))
{
case "response_lid":
$response_type = RT_RESPONSE_LID;
break;
case "response_xy":
$response_type = RT_RESPONSE_XY;
break;
case "response_str":
$response_type = RT_RESPONSE_STR;
break;
case "response_num":
$response_type = RT_RESPONSE_NUM;
break;
case "response_grp":
$response_type = RT_RESPONSE_GRP;
break;
}
$this->in_response = TRUE;
$this->response = new ilQTIResponse($response_type);
$this->response->setFlow($this->flow);
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "ident":
$this->response->setIdent($value);
break;
case "rtiming":
$this->response->setRTiming($value);
break;
case "rcardinality":
$this->response->setRCardinality($value);
break;
case "numtype":
$this->response->setNumtype($value);
break;
}
}
}
break;
case "item":
include_once("./Services/QTI/classes/class.ilQTIItem.php");
$this->gap_index = 0;
$this->item =& $this->items[array_push($this->items, new ilQTIItem())-1];
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "ident":
$this->item->setIdent($value);
if (count($this->import_idents) > 0)
{
if (!in_array($value, $this->import_idents))
{
$this->do_nothing = TRUE;
}
}
break;
case "title":
$this->item->setTitle($value);
break;
}
}
}
break;
case "resprocessing":
include_once("./Services/QTI/classes/class.ilQTIResprocessing.php");
$this->resprocessing = new ilQTIResprocessing();
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "scoremodel":
$this->resprocessing->setScoremodel($value);
break;
}
}
}
break;
}
}

+ Here is the caller graph for this function:

ilQTIParser::handlerParseCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 1351 of file class.ilQTIParser.php.

References $characterbuffer, and getParent().

Referenced by handlerCharacterData().

{
if ($this->do_nothing) return;
$this->characterbuffer .= $a_data;
switch ($this->qti_element)
{
case "fieldlabel":
$this->metadata["label"] = $a_data;
break;
case "fieldentry":
$this->metadata["entry"] = $a_data;
break;
case "response_label":
if ($this->response_label != NULL)
{
$this->response_label->setContent($a_data);
}
break;
case "setvar":
if ($this->setvar != NULL)
{
$this->setvar->setContent($a_data);
}
break;
case "displayfeedback":
if ($this->displayfeedback != NULL)
{
$this->displayfeedback->setContent($a_data);
}
break;
case "varequal":
case "varlt":
case "varlte":
case "vargt":
case "vargte":
case "varsubset":
case "varinside":
case "varsubstring":
if ($this->responsevar != NULL)
{
$this->responsevar->setContent($a_data);
}
break;
case "decvar":
if (strlen($a_data))
{
if ($this->decvar != NULL)
{
$this->decvar->setContent($a_data);
}
}
break;
case "mattext":
if ($this->mattext != NULL)
{
$this->mattext->setContent($a_data);
}
break;
case "matapplet":
if ($this->matapplet != NULL)
{
$this->matapplet->setContent($a_data);
}
break;
case "matimage":
if ($this->matimage != NULL)
{
$this->matimage->setContent($a_data);
}
break;
case "duration":
switch ($this->getParent($a_xml_parser))
{
case "assessment":
// to be done
break;
case "section":
// to be done
break;
case "item":
$this->item->setDuration($a_data);
break;
}
break;
case "qticomment":
switch ($this->getParent($a_xml_parser))
{
case "item":
$this->item->setComment($a_data);
break;
case "assessment":
$this->assessment->setComment($a_data);
break;
default:
break;
}
break;
}
$this->sametag = TRUE;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilQTIParser::handlerParseEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element parser

Definition at line 1004 of file class.ilQTIParser.php.

References $flow_mat, $ilDB, $presentation, assQuestion\_includeClass(), elseif(), and getParent().

Referenced by handlerEndTag().

{
if (($this->do_nothing) && (strcmp(strtolower($a_name), "item") != 0)) return;
switch (strtolower($a_name))
{
case "assessment":
if (is_object($this->tst_object))
{
$this->tst_object->fromXML($this->assessment);
}
$this->in_assessment = FALSE;
break;
case "assessmentcontrol":
$this->assessment->addAssessmentcontrol($this->assessmentcontrol);
$this->assessmentcontrol = NULL;
break;
case "objectives":
if (strcmp(strtolower($this->getParent($a_xml_parser)), "assessment") == 0)
{
$this->assessment->addObjectives($this->objectives);
}
$this->in_objectives = FALSE;
break;
case "itemmetadata":
$this->in_itemmetadata = FALSE;
break;
case "qtimetadatafield":
// handle only specific ILIAS metadata
switch ($this->metadata["label"])
{
case "ILIAS_VERSION":
break;
case "QUESTIONTYPE":
if ($this->item != NULL)
{
$this->item->setQuestiontype($this->metadata["entry"]);
}
break;
case "AUTHOR":
if ($this->item != NULL)
{
$this->item->setAuthor($this->metadata["entry"]);
}
default:
if ($this->item != NULL)
{
$this->item->addMetadata($this->metadata);
}
break;
}
if ($this->in_assessment)
{
$this->assessment->addQtiMetadata($this->metadata);
}
$this->metadata = array("label" => "", "entry" => "");
break;
case "flow":
$this->flow--;
break;
case "flow_mat":
if (count($this->flow_mat))
{
$flow_mat = array_pop($this->flow_mat);
if (count($this->flow_mat))
{
$this->flow_mat[count($this->flow_mat)-1]->addFlow_mat($flow_mat);
}
else if ($this->itemfeedback != NULL)
{
$this->itemfeedback->addFlow_mat($flow_mat);
}
else if ($this->response_label != NULL)
{
$this->response_label->addFlow_mat($flow_mat);
}
}
break;
case "itemfeedback":
if ($this->item != NULL)
{
if ($this->itemfeedback != NULL)
{
$this->item->addItemfeedback($this->itemfeedback);
}
}
$this->itemfeedback = NULL;
break;
case "displayfeedback":
if ($this->respcondition != NULL)
{
if ($this->displayfeedback != NULL)
{
$this->respcondition->addDisplayfeedback($this->displayfeedback);
}
}
$this->displayfeedback = NULL;
break;
case "setvar":
if ($this->respcondition != NULL)
{
if ($this->setvar != NULL)
{
$this->respcondition->addSetvar($this->setvar);
}
}
$this->setvar = NULL;
break;
case "conditionvar":
if ($this->respcondition != NULL)
{
$this->respcondition->setConditionvar($this->conditionvar);
}
$this->conditionvar = NULL;
break;
case "varequal":
case "varlt":
case "varlte":
case "vargt":
case "vargte":
case "varsubset":
case "varinside":
case "varsubstring":
if ($this->conditionvar != NULL)
{
if ($this->responsevar != NULL)
{
$this->conditionvar->addResponseVar($this->responsevar);
}
}
$this->responsevar = NULL;
break;
case "respcondition":
if ($this->resprocessing != NULL)
{
$this->resprocessing->addRespcondition($this->respcondition);
}
$this->respcondition = NULL;
break;
case "outcomes":
if ($this->resprocessing != NULL)
{
$this->resprocessing->setOutcomes($this->outcomes);
}
$this->outcomes = NULL;
break;
case "decvar":
if ($this->outcomes != NULL)
{
$this->outcomes->addDecvar($this->decvar);
}
$this->decvar = NULL;
break;
case "presentation":
$this->in_presentation = FALSE;
if ($this->presentation != NULL)
{
if ($this->item != NULL)
{
$this->item->setPresentation($this->presentation);
}
}
$this->presentation = NULL;
break;
case "response_label":
if ($this->render_type != NULL)
{
$this->render_type->addResponseLabel($this->response_label);
$this->response_label = NULL;
}
break;
case "render_choice":
case "render_hotspot":
case "render_fib":
if ($this->in_response)
{
if ($this->response != NULL)
{
if ($this->render_type != NULL)
{
$this->response->setRenderType($this->render_type);
$this->render_type = NULL;
}
}
}
break;
case "response_lid":
case "response_xy":
case "response_str":
case "response_num":
case "response_grp":
$this->gap_index++;
if ($this->presentation != NULL)
{
if ($this->response != NULL)
{
$this->presentation->addResponse($this->response);
if ($this->item != NULL)
{
$this->item->addPresentationitem($this->response);
}
}
}
$this->response = NULL;
$this->in_response = FALSE;
break;
case "item":
if ($this->do_nothing)
{
$this->do_nothing = FALSE;
return;
}
if (strlen($this->item->getQuestionType()))
{
// this is an ILIAS QTI question
}
else
{
// this is a QTI question which wasn't generated by ILIAS
}
global $ilDB;
global $ilUser;
// save the item directly to save memory
// the database id's of the created items are exported. if the import fails
// ILIAS can delete the already imported items
// problems: the object id of the parent questionpool is not yet known. must be set later
// the complete flag must be calculated?
$qt = $this->item->determineQuestionType();
$presentation = $this->item->getPresentation();
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = new $qt();
$question->fromXML($this->item, $this->qpl_id, $this->tst_id, $this->tst_object, $this->question_counter, $this->import_mapping);
break;
case "material":
if ($this->material)
{
$mat = $this->material->getMaterial(0);
if ((strcmp($mat["type"], "mattext") == 0) && (strcmp($mat["material"]->getLabel(), "suggested_solution") == 0))
{
$this->item->addSuggestedSolution($mat["material"], $this->gap_index);
}
if ($this->in_objectives)
{
$this->objectives->addMaterial($this->material);
}
else if (($this->render_type != NULL) && (strcmp(strtolower($this->getParent($a_xml_parser)), "render_hotspot") == 0))
{
$this->render_type->addMaterial($this->material);
}
else if (count($this->flow_mat) && (strcmp(strtolower($this->getParent($a_xml_parser)), "flow_mat") == 0))
{
$this->flow_mat[count($this->flow_mat)-1]->addMaterial($this->material);
}
else if ($this->itemfeedback != NULL)
{
$this->itemfeedback->addMaterial($this->material);
}
else if ($this->response_label != NULL)
{
$this->response_label->addMaterial($this->material);
}
else if ($this->response != NULL)
{
if ($this->response->hasRendering())
{
$this->response->setMaterial2($this->material);
}
else
{
$this->response->setMaterial1($this->material);
}
}
elseif (($this->in_presentation) && (!$this->in_response))
{
if (!is_object($this->item->getQuestiontext()))
{
$this->item->setQuestiontext($this->material);
}
$this->presentation->addMaterial($this->material);
}
else if ($this->presentation != NULL)
{
$this->presentation->addMaterial($this->material);
if ($this->item != NULL)
{
$this->item->addPresentationitem($this->material);
}
}
}
$this->material = NULL;
break;
case "matimage";
if ($this->material != NULL)
{
if ($this->matimage != NULL)
{
$this->material->addMatimage($this->matimage);
}
}
$this->matimage = NULL;
break;
case "resprocessing":
if ($this->item != NULL)
{
$this->item->addResprocessing($this->resprocessing);
}
$this->resprocessing = NULL;
break;
case "mattext":
if ($this->material != NULL)
{
$this->material->addMattext($this->mattext);
}
$this->mattext = NULL;
break;
case "matapplet":
if ($this->material != NULL)
{
$this->material->addMatapplet($this->matapplet);
}
$this->matapplet = NULL;
break;
}
$this->depth[$a_xml_parser]--;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilQTIParser::handlerVerifyBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element verification

Definition at line 1456 of file class.ilQTIParser.php.

References $title, QT_CLOZE, QT_IMAGEMAP, QT_MATCHING, QT_MULTIPLE_CHOICE_MR, QT_MULTIPLE_CHOICE_SR, QT_NUMERIC, QT_ORDERING, and QT_TEXT.

Referenced by handlerBeginTag().

{
switch (strtolower($a_name))
{
case "questestinterop":
$this->verifyroot = true;
break;
case "qtimetadatafield":
$this->verifymetadatafield = 1;
break;
case "fieldlabel":
$this->verifyfieldlabeltext = "";
if ($this->verifymetadatafield == 1) $this->verifyfieldlabel = 1;
break;
case "fieldentry":
$this->verifyfieldentrytext = "";
if ($this->verifymetadatafield == 1) $this->verifyfieldentry = 1;
break;
case "item":
$title = "";
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "title":
$title = $value;
break;
}
}
}
array_push($this->founditems, array("title" => "$title", "type" => "", "ident" => $a_attribs["ident"]));
break;
case "response_lid":
if (strlen($this->founditems[count($this->founditems)-1]["type"]) == 0)
{
// test for non ILIAS generated question types
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "rcardinality":
include_once "./Services/QTI/classes/class.ilQTIItem.php";
switch (strtolower($value))
{
case "single":
$this->founditems[count($this->founditems)-1]["type"] = QT_MULTIPLE_CHOICE_SR;
break;
case "multiple":
$this->founditems[count($this->founditems)-1]["type"] = QT_MULTIPLE_CHOICE_MR;
break;
case "ordered":
$this->founditems[count($this->founditems)-1]["type"] = QT_ORDERING;
break;
}
break;
}
}
}
}
break;
case "response_str":
if (strlen($this->founditems[count($this->founditems)-1]["type"]) == 0)
{
// test for non ILIAS generated question types
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "rcardinality":
include_once "./Services/QTI/classes/class.ilQTIItem.php";
switch (strtolower($value))
{
case "single":
$this->founditems[count($this->founditems)-1]["type"] = QT_CLOZE;
break;
case "ordered":
$this->founditems[count($this->founditems)-1]["type"] = QT_TEXT;
break;
}
break;
}
}
}
}
break;
case "response_xy":
if (strlen($this->founditems[count($this->founditems)-1]["type"]) == 0)
{
$this->founditems[count($this->founditems)-1]["type"] = QT_IMAGEMAP;
}
break;
case "response_num":
if (strlen($this->founditems[count($this->founditems)-1]["type"]) == 0)
{
$this->founditems[count($this->founditems)-1]["type"] = QT_NUMERIC;
}
break;
case "response_grp":
if (strlen($this->founditems[count($this->founditems)-1]["type"]) == 0)
{
$this->founditems[count($this->founditems)-1]["type"] = QT_MATCHING;
}
break;
case "qticomment":
// check for "old" ILIAS qti format (not well formed)
$this->verifyqticomment = 1;
break;
case "presentation":
if (is_array($a_attribs))
{
foreach ($a_attribs as $attribute => $value)
{
switch (strtolower($attribute))
{
case "label":
$this->founditems[count($this->founditems)-1]["title"] = $value;
break;
}
}
}
break;
}
}

+ Here is the caller graph for this function:

ilQTIParser::handlerVerifyCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data verification

Definition at line 1616 of file class.ilQTIParser.php.

Referenced by handlerCharacterData().

{
if ($this->verifyqticomment == 1)
{
if (preg_match("/Questiontype\=(.*)/", $a_data, $matches))
{
if (count($this->founditems))
{
$this->founditems[count($this->founditems)-1]["type"] = $matches[1];
}
}
}
else if ($this->verifyfieldlabel == 1)
{
$this->verifyfieldlabeltext = $a_data;
}
else if ($this->verifyfieldentry == 1)
{
$this->verifyfieldentrytext = $a_data;
}
}

+ Here is the caller graph for this function:

ilQTIParser::handlerVerifyEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element verification

Definition at line 1589 of file class.ilQTIParser.php.

References $verifyfieldentrytext.

Referenced by handlerEndTag().

{
switch (strtolower($a_name))
{
case "qticomment":
// check for "old" ILIAS qti format (not well formed)
$this->verifyqticomment = 0;
break;
case "qtimetadatafield":
$this->verifymetadatafield = 0;
if (strcmp($this->verifyfieldlabeltext, "QUESTIONTYPE") == 0)
{
$this->founditems[count($this->founditems)-1]["type"] = $this->verifyfieldentrytext;
}
break;
case "fieldlabel":
$this->verifyfieldlabel = 0;
break;
case "fieldentry":
$this->verifyfieldentry = 0;
break;
}
}

+ Here is the caller graph for this function:

ilQTIParser::ilQTIParser (   $a_xml_file,
  $a_mode = IL_MO_PARSE_QTI,
  $a_qpl_id = 0,
  $a_import_idents = "" 
)

Constructor.

Parameters
string$a_xml_filexml file
integer$a_modeParser mode IL_MO_PARSE_QTI | IL_MO_VERIFY_QTI public

Definition at line 103 of file class.ilQTIParser.php.

References $lng, ilSaxParser\ilSaxParser(), and setParserMode().

{
global $lng;
$this->setParserMode($a_mode);
parent::ilSaxParser($a_xml_file);
$this->qpl_id = $a_qpl_id;
$this->import_idents = array();
if (is_array($a_import_idents))
{
$this->import_idents =& $a_import_idents;
}
$this->lng =& $lng;
$this->hasRootElement = FALSE;
$this->import_mapping = array();
$this->assessments = array();
$this->assessment = NULL;
$this->section = NULL;
$this->path = array();
$this->items = array();
$this->item = NULL;
$this->depth = array();
$this->do_nothing = FALSE;
$this->qti_element = "";
$this->in_presentation = FALSE;
$this->in_objectives = FALSE;
$this->in_reponse = FALSE;
$this->render_type = NULL;
$this->render_hotspot = NULL;
$this->response_label = NULL;
$this->material = NULL;
$this->response = NULL;
$this->assessmentcontrol = NULL;
$this->objectives = NULL;
$this->matimage = NULL;
$this->resprocessing = NULL;
$this->outcomes = NULL;
$this->decvar = NULL;
$this->respcondition = NULL;
$this->setvar = NULL;
$this->displayfeedback = NULL;
$this->itemfeedback = NULL;
$this->flow_mat = array();
$this->question_counter = 1;
$this->flow = 0;
$this->gap_index = 0;
$this->presentation = NULL;
$this->mattext = NULL;
$this->matapplet = NULL;
$this->sametag = FALSE;
$this->in_assessment = FALSE;
$this->characterbuffer = "";
$this->metadata = array("label" => "", "entry" => "");
}

+ Here is the call graph for this function:

ilQTIParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class private

Reimplemented from ilSaxParser.

Definition at line 189 of file class.ilQTIParser.php.

{
xml_set_object($a_xml_parser,$this);
xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
}
ilQTIParser::setParserMode (   $a_mode = IL_MO_PARSE_QTI)

Definition at line 170 of file class.ilQTIParser.php.

Referenced by ilQTIParser().

{
$this->parser_mode = $a_mode;
$this->founditems = array();
$this->verifyroot = false;
$this->verifyqticomment = 0;
$this->verifymetadatafield = 0;
$this->verifyfieldlabel = 0;
$this->verifyfieldentry = 0;
$this->verifyfieldlabeltext = "";
$this->verifyfieldentrytext = "";
$this->question_counter = 1;
}

+ Here is the caller graph for this function:

ilQTIParser::setTestObject ( $a_tst_object)

Definition at line 161 of file class.ilQTIParser.php.

{
$this->tst_object =& $a_tst_object;
if (is_object($a_tst_object))
{
$this->tst_id = $this->tst_object->getId();
}
}
ilQTIParser::startParsing ( )

stores xml data in array

private

Exceptions
ilSaxParserExceptionor ILIAS Error

Reimplemented from ilSaxParser.

Definition at line 196 of file class.ilQTIParser.php.

{
$this->question_counter = 1;
return FALSE;
}

Field Documentation

ilQTIParser::$assessment

Definition at line 76 of file class.ilQTIParser.php.

ilQTIParser::$assessmentcontrol

Definition at line 77 of file class.ilQTIParser.php.

ilQTIParser::$assessments

Definition at line 75 of file class.ilQTIParser.php.

ilQTIParser::$characterbuffer

Definition at line 66 of file class.ilQTIParser.php.

Referenced by handlerParseCharacterData().

ilQTIParser::$conditionvar

Definition at line 67 of file class.ilQTIParser.php.

ilQTIParser::$decvar

Definition at line 56 of file class.ilQTIParser.php.

ilQTIParser::$depth

Definition at line 45 of file class.ilQTIParser.php.

ilQTIParser::$displayfeedback

Definition at line 59 of file class.ilQTIParser.php.

ilQTIParser::$do_nothing

Definition at line 73 of file class.ilQTIParser.php.

ilQTIParser::$flow

Definition at line 62 of file class.ilQTIParser.php.

ilQTIParser::$flow_mat

Definition at line 61 of file class.ilQTIParser.php.

Referenced by handlerParseEndTag().

ilQTIParser::$founditems = array()

Definition at line 86 of file class.ilQTIParser.php.

Referenced by getFoundItems().

ilQTIParser::$gap_index

Definition at line 74 of file class.ilQTIParser.php.

ilQTIParser::$hasRootElement

Definition at line 41 of file class.ilQTIParser.php.

ilQTIParser::$import_idents

Definition at line 69 of file class.ilQTIParser.php.

ilQTIParser::$import_mapping

Definition at line 81 of file class.ilQTIParser.php.

Referenced by getImportMapping().

ilQTIParser::$in_assessment = FALSE

Definition at line 79 of file class.ilQTIParser.php.

ilQTIParser::$in_itemmetadata

Definition at line 83 of file class.ilQTIParser.php.

ilQTIParser::$in_objectives = FALSE

Definition at line 84 of file class.ilQTIParser.php.

ilQTIParser::$in_presentation

Definition at line 47 of file class.ilQTIParser.php.

ilQTIParser::$in_response

Definition at line 48 of file class.ilQTIParser.php.

ilQTIParser::$item

Definition at line 44 of file class.ilQTIParser.php.

ilQTIParser::$itemfeedback

Definition at line 60 of file class.ilQTIParser.php.

ilQTIParser::$items

Definition at line 43 of file class.ilQTIParser.php.

ilQTIParser::$lng

Definition at line 40 of file class.ilQTIParser.php.

Referenced by ilQTIParser().

ilQTIParser::$material

Definition at line 51 of file class.ilQTIParser.php.

ilQTIParser::$matimage

Definition at line 52 of file class.ilQTIParser.php.

ilQTIParser::$mattext

Definition at line 64 of file class.ilQTIParser.php.

ilQTIParser::$objectives

Definition at line 78 of file class.ilQTIParser.php.

ilQTIParser::$outcomes

Definition at line 55 of file class.ilQTIParser.php.

ilQTIParser::$parser_mode

Definition at line 68 of file class.ilQTIParser.php.

ilQTIParser::$path

Definition at line 42 of file class.ilQTIParser.php.

ilQTIParser::$presentation

Definition at line 63 of file class.ilQTIParser.php.

Referenced by handlerParseEndTag().

ilQTIParser::$qpl_id

Definition at line 70 of file class.ilQTIParser.php.

ilQTIParser::$qti_element

Definition at line 46 of file class.ilQTIParser.php.

ilQTIParser::$question_counter = 1

Definition at line 82 of file class.ilQTIParser.php.

ilQTIParser::$render_type

Definition at line 49 of file class.ilQTIParser.php.

ilQTIParser::$respcondition

Definition at line 57 of file class.ilQTIParser.php.

ilQTIParser::$response

Definition at line 53 of file class.ilQTIParser.php.

ilQTIParser::$response_label

Definition at line 50 of file class.ilQTIParser.php.

ilQTIParser::$resprocessing

Definition at line 54 of file class.ilQTIParser.php.

ilQTIParser::$sametag

Definition at line 65 of file class.ilQTIParser.php.

ilQTIParser::$section

Definition at line 80 of file class.ilQTIParser.php.

ilQTIParser::$setvar

Definition at line 58 of file class.ilQTIParser.php.

ilQTIParser::$tst_id

Definition at line 71 of file class.ilQTIParser.php.

ilQTIParser::$tst_object

Definition at line 72 of file class.ilQTIParser.php.

ilQTIParser::$verifyfieldentry = 0

Definition at line 92 of file class.ilQTIParser.php.

ilQTIParser::$verifyfieldentrytext = ""

Definition at line 93 of file class.ilQTIParser.php.

Referenced by handlerVerifyEndTag().

ilQTIParser::$verifyfieldlabel = 0

Definition at line 90 of file class.ilQTIParser.php.

ilQTIParser::$verifyfieldlabeltext = ""

Definition at line 91 of file class.ilQTIParser.php.

ilQTIParser::$verifymetadatafield = 0

Definition at line 89 of file class.ilQTIParser.php.

ilQTIParser::$verifyqticomment = 0

Definition at line 88 of file class.ilQTIParser.php.

ilQTIParser::$verifyroot = false

Definition at line 87 of file class.ilQTIParser.php.


The documentation for this class was generated from the following file: