Location: PHPKode > projects > Ps and Qs: Processing QTI using PHP > qti-eb/functionsfiles/generatetemplatefunctions.php
<?php

header("Content-type: text/plain");

/*
TEMPLATE for a functions file which works with the event-based QTI parser.

The basic plan:
For EVERY possible element in the QTI file (whether you're interested in it or not)
you need to define three functions. For element 'foo' you ned to define:
qtiEbStartfoo($attrs, $context)
qtiEbStopfoo($context)
qtiEbDatafoo($context)

*/

$possibletags = array(

'and',
'altmaterial', 
'assessfeedback', 
'assessment',
'assessmentcontrol', 
'assessproc_extension', 
'conditionvar', 
'decvar', 
'displayfeedback', 
'duration', 
'fieldentry',
'fieldlabel',
'flow', 
'flow_label', 
'flow_mat', 
'hint', 
'hintmaterial', 
'interpretvar', 
'item', 
'itemcontrol', 
'itemfeedback', 
'itemmetadata', 
'itempostcondition', 
'itemprecondition', 
'itemproc_extension', 
'itemref', 
'itemrubric', 
'mat_extension', 
'matapplet', 
'matapplication', 
'mataudio', 
'matbreak', 
'matemtext', 
'material', 
'material_ref',
'matimage', 
'matref', 
'mattext', 
'matvideo', 
'not',
'objectbank',
'objectives', 
'or',
'order',
'other',
'outcomes', 
'outcomes_processing', 
'presentation', 
'presentation_material', 
'qmd_itemtype',
'qmd_levelofdifficulty',
'qmd_maximumscore',
'qmd_minimumscore',
'qmd_topic',
'qticomment',
'qtimetadata', 
'qtimetadatafield', 
'questestinterop', 
'reference', 
'render_choice', 
'render_fib', 
'render_hotspot', 
'render_slider', 
'respcondition', 
'response_extension', 
'response_grp', 
'response_label', 
'response_lid', 
'response_num', 
'response_str', 
'response_xy', 
'resprocessing', 
'rubric', 
'section',
'sectioncontrol', 
'sectionfeedback', 
'sectionpostcondition', 
'sectionprecondition', 
'sectionproc_extension', 
'sectionref', 
'selection',
'selection_ordering', 
'sequence_parameter',
'setvar', 
'solution', 
'solutionmaterial',
'unanswered',
'varequal',
'varinside',
'varlt',
'varlte',
'vargt',
'vargte',
'varsubset',
'varsubstring'

);

foreach($possibletags as $v)
{
  echo "
// \"$v\":
function qtiEbStart$v(\$attrs, \$context)
{
  global \$functionsmemory;
}
function qtiEbData$v(\$context, \$data)
{
  global \$functionsmemory;
}
function qtiEbStop$v(\$context)
{
  global \$functionsmemory;
}
// ...end \"$v\"

";
}

?>
Return current item: Ps and Qs: Processing QTI using PHP