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

$functionsmemory = array(); // Will store key->value pairs for things which want some persistence

// $functionsmemory['askconfidence'] = true;

$functionsmemory['view'] = strlen($setview) ? $setview : 'Candidate'; // Default view

$questiondisplaycount=0;
$sectiondisplaycount=0;


function shallWeSkip()
{
  global $functionsmemory;
  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(strlen($functionsmemory['choose']['assessment'])>0 && $functionsmemory['current']['assessment']!=$functionsmemory['choose']['assessment'])
    return true;
  if(strlen($functionsmemory['choose']['section'])>0 && $functionsmemory['current']['section']!=$functionsmemory['choose']['section'])
    return true;
  if(strlen($functionsmemory['choose']['item'])>0 && $functionsmemory['current']['item']!=$functionsmemory['choose']['item'])
    return true;
  if(strlen($functionsmemory['choose']['objectbank'])>0 && $functionsmemory['current']['objectbank']!=$functionsmemory['choose']['objectbank'])
    return true;
  return false;
}


// The following two functions are called before the start, and after the end, respectively,
//  of the QTI XML processing. Use them to wrap HTML around the whole output, for example.
function qtiEbVeryStart()
{
  global $submitted, $functionsmemory, $qtifilename; // In most cases $submitted will come from the webserver $_REQUEST data
  $functionsmemory['choose'] = $submitted['choose'];
  echo "\n<form method=\"post\" action=\"./\">\n";
  if(is_array($functionsmemory['choose']))
    foreach($functionsmemory['choose'] as $k=>$v)
      echo "\n<input type=\"hidden\" name=\"choose[" . htmlspecialchars($k) 
	         . "]\" value=\"" . htmlspecialchars($v) . "\" />";
  ?>
  <input type="hidden" name="action" value="process" />
  <input type="hidden" name="processorfile" value="gradeanswers.inc.php" />
  <input type="hidden" name="filetoload" value="<?php echo $qtifilename ?>" />
  <?php
}
function qtiEbVeryEnd()
{
  global $questiondisplaycount, $sectiondisplaycount;
  echo "<p align=\"center\"><input type=\"submit\" value=\"Submit your answer" 
       . (($questiondisplaycount>1 || $sectiondisplaycount>1)?'s':'') . "\" /></p>";
  echo "</form>";
}

// "and":
function qtiEbStartand($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataand($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopand($context)
{
  global $functionsmemory;
}
// ...end "and"


// "altmaterial":
function qtiEbStartaltmaterial($attrs, $context)
{
  global $functionsmemory;
  if($functionsmemory['displayaltmaterial']!=true)
    $functionsmemory['hidematerial'] = true;
}
function qtiEbDataaltmaterial($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopaltmaterial($context)
{
  global $functionsmemory;
  unset($functionsmemory['hidematerial']);
}
// ...end "altmaterial"


// "assessfeedback":
function qtiEbStartassessfeedback($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataassessfeedback($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopassessfeedback($context)
{
  global $functionsmemory;
}
// ...end "assessfeedback"


// "assessment":
function qtiEbStartassessment($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['current']['assessment'] = $attrs['ident'];

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  echo "<h1>Assessment $attrs[ident]</h1>";
}
function qtiEbDataassessment($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopassessment($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  unset($functionsmemory['current']['assessment']);
  echo "<hr noshade=\"noshade\" />";
}
// ...end "assessment"


// "assessmentcontrol":
function qtiEbStartassessmentcontrol($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataassessmentcontrol($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopassessmentcontrol($context)
{
  global $functionsmemory;
}
// ...end "assessmentcontrol"


// "assessproc_extension":
function qtiEbStartassessproc_extension($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataassessproc_extension($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopassessproc_extension($context)
{
  global $functionsmemory;
}
// ...end "assessproc_extension"


// "conditionvar":
function qtiEbStartconditionvar($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataconditionvar($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopconditionvar($context)
{
  global $functionsmemory;
}
// ...end "conditionvar"


// "decvar":
function qtiEbStartdecvar($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatadecvar($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopdecvar($context)
{
  global $functionsmemory;
}
// ...end "decvar"


// "displayfeedback":
function qtiEbStartdisplayfeedback($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatadisplayfeedback($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopdisplayfeedback($context)
{
  global $functionsmemory;
}
// ...end "displayfeedback"


// "duration":
function qtiEbStartduration($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataduration($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopduration($context)
{
  global $functionsmemory;
}
// ...end "duration"


// "fieldentry":
function qtiEbStartfieldentry($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatafieldentry($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopfieldentry($context)
{
  global $functionsmemory;
}
// ...end "fieldentry"


// "fieldlabel":
function qtiEbStartfieldlabel($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatafieldlabel($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopfieldlabel($context)
{
  global $functionsmemory;
}
// ...end "fieldlabel"


// "flow":
function qtiEbStartflow($attrs, $context)
{
  global $functionsmemory;
  echo "\n<div class=\"flow\">";
}
function qtiEbDataflow($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopflow($context)
{
  global $functionsmemory;
  echo "\n</div>";
}
// ...end "flow"


// "flow_label":
function qtiEbStartflow_label($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataflow_label($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopflow_label($context)
{
  global $functionsmemory;
}
// ...end "flow_label"


// "flow_mat":
function qtiEbStartflow_mat($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataflow_mat($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopflow_mat($context)
{
  global $functionsmemory;
}
// ...end "flow_mat"


// "hint":
function qtiEbStarthint($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatahint($context, $data)
{
  global $functionsmemory;
}
function qtiEbStophint($context)
{
  global $functionsmemory;
}
// ...end "hint"


// "hintmaterial":
function qtiEbStarthintmaterial($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatahintmaterial($context, $data)
{
  global $functionsmemory;
}
function qtiEbStophintmaterial($context)
{
  global $functionsmemory;
}
// ...end "hintmaterial"


// "interpretvar":
function qtiEbStartinterpretvar($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['materialcontext'] = 'itemfeedback';
}
function qtiEbDatainterpretvar($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopinterpretvar($context)
{
  global $functionsmemory;
  unset($functionsmemory['materialcontext']);
}
// ...end "interpretvar"


// "item":
function qtiEbStartitem($attrs, $context)
{
  global $functionsmemory, $questiondisplaycount;
  $functionsmemory['current']['item'] = $attrs['ident'];

  $questiondisplaycount++;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;
  echo "\n<fieldset style=\"margin: 10px; background:white;\"><legend style=\"background:white; border: 1px solid black;\"><strong>Item $questiondisplaycount</strong>"
             . (strlen($attrs['title'])>0 ? ': '.htmlspecialchars($attrs['title']):'')
			 . "<!-- ident: $attrs[ident] --></legend>";
}
function qtiEbDataitem($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitem($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  // The confidence-based-assessment element
  if($functionsmemory['askconfidence']==true)
  {
    echo "\n\n<div class=\"confidenceoptions\" style=\"border:1px solid gray; margin: 2px; text-align:right;\"><span style=\"color: rgb(102,102,102)\">Please select how confident you are in your answer:</span> "
	  . "\n  <label><input type=\"radio\" name=\"confidence[" . htmlspecialchars(str_replace('.','_',$functionsmemory['current']['item'])) . "]\" value=\"3\" />High</label>"
	  . "\n  <label><input type=\"radio\" name=\"confidence[" . htmlspecialchars(str_replace('.','_',$functionsmemory['current']['item'])) . "]\" value=\"2\" />Medium</label>"
	  . "\n  <label><input type=\"radio\" name=\"confidence[" . htmlspecialchars(str_replace('.','_',$functionsmemory['current']['item'])) . "]\" value=\"1\" checked=\"checked\" />Low</label>"
	  . "\n</div>";
  }

  unset($functionsmemory['current']['item']);
  echo "\n</fieldset>\n";
}
// ...end "item"


// "itemcontrol":
function qtiEbStartitemcontrol($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataitemcontrol($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemcontrol($context)
{
  global $functionsmemory;
}
// ...end "itemcontrol"


// "itemfeedback":
function qtiEbStartitemfeedback($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['materialcontext'] = 'itemfeedback';
}
function qtiEbDataitemfeedback($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemfeedback($context)
{
  global $functionsmemory;
  unset($functionsmemory['materialcontext']);
}
// ...end "itemfeedback"


// "itemmetadata":
function qtiEbStartitemmetadata($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataitemmetadata($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemmetadata($context)
{
  global $functionsmemory;
}
// ...end "itemmetadata"


// "itempostcondition":
function qtiEbStartitempostcondition($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataitempostcondition($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitempostcondition($context)
{
  global $functionsmemory;
}
// ...end "itempostcondition"


// "itemprecondition":
function qtiEbStartitemprecondition($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataitemprecondition($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemprecondition($context)
{
  global $functionsmemory;
}
// ...end "itemprecondition"


// "itemproc_extension":
function qtiEbStartitemproc_extension($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataitemproc_extension($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemproc_extension($context)
{
  global $functionsmemory;
}
// ...end "itemproc_extension"


// "itemref":
function qtiEbStartitemref($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataitemref($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemref($context)
{
  global $functionsmemory;
}
// ...end "itemref"


// "itemrubric":
function qtiEbStartitemrubric($attrs, $context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  $functionsmemory['materialcontext']='itemrubric';
  echo "<div class=\"itemrubric\" style=\"background: silver; border: 1px solid black; padding: 10px; margin: 10px; \" >";
}
function qtiEbDataitemrubric($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopitemrubric($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  unset($functionsmemory['materialcontext']);
  echo "</div>";
}
// ...end "itemrubric"


// "mat_extension":
function qtiEbStartmat_extension($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['displayaltmaterial'] = true; // Can't handle, so we want ALT stuff
}
function qtiEbDatamat_extension($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmat_extension($context)
{
  global $functionsmemory;
}
// ...end "mat_extension"


// "matapplet":
function qtiEbStartmatapplet($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['displayaltmaterial'] = true; // Can't handle, so we want ALT stuff
}
function qtiEbDatamatapplet($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmatapplet($context)
{
  global $functionsmemory;
}
// ...end "matapplet"


// "matapplication":
function qtiEbStartmatapplication($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['displayaltmaterial'] = true; // Can't handle, so we want ALT stuff
}
function qtiEbDatamatapplication($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmatapplication($context)
{
  global $functionsmemory;
}
// ...end "matapplication"


// "mataudio":
function qtiEbStartmataudio($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['displayaltmaterial'] = true; // Can't handle, so we want ALT stuff
}
function qtiEbDatamataudio($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmataudio($context)
{
  global $functionsmemory;
}
// ...end "mataudio"


// "matbreak":
function qtiEbStartmatbreak($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['displayaltmaterial'] = false;
  echo "<p class=\"matbreak\" />&nbsp;</p>";
}
function qtiEbDatamatbreak($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmatbreak($context)
{
  global $functionsmemory;
}
// ...end "matbreak"



// "matemtext":
function qtiEbStartmatemtext($attrs, $context)
{
  global $functionsmemory;
  qtiEbStartmattext($attrs, $context);
}
function qtiEbDatamatemtext($context, $data)
{
  global $functionsmemory;
  if($functionsmemory['materialcontext'] == 'interpretvar')
    return; // We're not interested in displaying interpretvar stuff - this is a plain old question-renderer!
  if($functionsmemory['materialcontext'] == 'itemfeedback')
    return; // We're not interested in displaying feedback or hints here - this is a plain old question-renderer!

  echo "\n\n<em>" . 
        ($functionsmemory['current']['mattexttype']=='text/html' ? $data : htmlspecialchars($data))
		. '</em>';
}
function qtiEbStopmatemtext($context)
{
  global $functionsmemory;
  qtiEbStopmattext($context);
}
// ...end "matemtext"


// "material":
function qtiEbStartmaterial($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatamaterial($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmaterial($context)
{
  global $functionsmemory;
}
// ...end "material"


// "material_ref":
function qtiEbStartmaterial_ref($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatamaterial_ref($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmaterial_ref($context)
{
  global $functionsmemory;
}
// ...end "material_ref"


// "matimage":
function qtiEbStartmatimage($attrs, $context)
{
  global $functionsmemory;

  $functionsmemory['displayaltmaterial'] = false;

  if($functionsmemory['hidematerial'] == true) return; // Used to hide "alt" material

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  if($functionsmemory['materialcontext'] == 'itemfeedback')
    return; // We're not interested in displaying feedback or hints here - this is a plain old question-renderer!
  echo "<img src=\"$attrs[uri]\" width=\"$attrs[width]\" height=\"$attrs[height]\" border=\"1\" />";
}
function qtiEbDatamatimage($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmatimage($context)
{
  global $functionsmemory;
}
// ...end "matimage"


// "matref":
function qtiEbStartmatref($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatamatref($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmatref($context)
{
  global $functionsmemory;
}
// ...end "matref"


// "mattext":
function qtiEbStartmattext($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['displayaltmaterial'] = false;
  $functionsmemory['current']['mattexttype'] = $attrs['texttype'];
}
function qtiEbDatamattext($context, $data)
{
  global $functionsmemory;

  if($functionsmemory['hidematerial'] == true) return; // Used to hide "alt" material

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  // echo "<strong>MATTEXT</strong>";
  if($functionsmemory['materialcontext'] == 'itemfeedback')
    return; // We're not interested in displaying feedback or hints here - this is a plain old question-renderer!

  // Test if this wants showing, based on who's looking
  if(!isset($functionsmemory['materialcontext-view']) ||
      $functionsmemory['materialcontext-view'] == 'All' ||
	  strpos($functionsmemory['materialcontext-view'],$functionsmemory['view'])!==false   )
    echo "\n\n" . 
        ($functionsmemory['current']['mattexttype']=='text/html' ? $data : htmlspecialchars($data))
		. '';
}
function qtiEbStopmattext($context)
{
  global $functionsmemory;
  unset($functionsmemory['current']['mattexttype']);
}
// ...end "mattext"


// "matvideo":
function qtiEbStartmatvideo($attrs, $context)
{
  global $functionsmemory;
  if($functionsmemory['hidematerial'] == true) return; // Used to hide "alt" material
  $functionsmemory['displayaltmaterial'] = true; // Can't handle, so we want ALT stuff
//  echo "<fieldset class=\"render_hotspot\" style=\"background:rgb(250,250,250); border: 2px solid black; margin: 5px;\" ><legend style=\"border: 1px solid black; background: rgb(255,204,204)\">QTI rendering warning: video material not supported!</legend>";
}
function qtiEbDatamatvideo($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopmatvideo($context)
{
  global $functionsmemory;
  if($functionsmemory['hidematerial'] == true) return; // Used to hide "alt" material
//  echo "</fieldset>";
}
// ...end "matvideo"


// "not":
function qtiEbStartnot($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatanot($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopnot($context)
{
  global $functionsmemory;
}
// ...end "not"


// "objectbank":
function qtiEbStartobjectbank($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['current']['objectbank'] = $attrs['ident'];
}
function qtiEbDataobjectbank($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopobjectbank($context)
{
  global $functionsmemory;
  unset($functionsmemory['current']['objectbank']);
}
// ...end "objectbank"


// "objectives":
function qtiEbStartobjectives($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['materialcontext'] = 'objectives';
  $functionsmemory['materialcontext-view'] = isset($attrs['view']) ? $attrs['view'] : 'All';

  // Test if this wants showing, based on who's looking
  if(!isset($functionsmemory['materialcontext-view']) ||
      $functionsmemory['materialcontext-view'] == 'All' ||
	  strpos($functionsmemory['materialcontext-view'],$functionsmemory['view'])!==false   )
    echo "\n<fieldset style=\"background:rgb(255,255,204); margin:20px 10px;\"><legend style=\"background:white; border: 1px solid black;\">Objectives</legend>";
}
function qtiEbDataobjectives($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopobjectives($context)
{
  global $functionsmemory;
  if(!isset($functionsmemory['materialcontext-view']) ||
      $functionsmemory['materialcontext-view'] == 'All' ||
	  strpos($functionsmemory['materialcontext-view'],$functionsmemory['view'])!==false   )
    echo "\n</fieldset>";
  unset($functionsmemory['materialcontext']);
  unset($functionsmemory['materialcontext-view']);
}
// ...end "objectives"

// "or":
function qtiEbStartor($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataor($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopor($context)
{
  global $functionsmemory;
}
// ...end "or"

// "order":
function qtiEbStartorder($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataorder($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoporder($context)
{
  global $functionsmemory;
}
// ...end "order"



// "other":
function qtiEbStartother($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataother($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopother($context)
{
  global $functionsmemory;
}
// ...end "other"


// "outcomes":
function qtiEbStartoutcomes($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataoutcomes($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopoutcomes($context)
{
  global $functionsmemory;
}
// ...end "outcomes"


// "outcomes_processing":
function qtiEbStartoutcomes_processing($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataoutcomes_processing($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopoutcomes_processing($context)
{
  global $functionsmemory;
}
// ...end "outcomes_processing"


// "presentation":
function qtiEbStartpresentation($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatapresentation($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoppresentation($context)
{
  global $functionsmemory;
}
// ...end "presentation"


// "presentation_material":
function qtiEbStartpresentation_material($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatapresentation_material($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoppresentation_material($context)
{
  global $functionsmemory;
}
// ...end "presentation_material"

// "qmd_itemtype":
function qtiEbStartqmd_itemtype($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_itemtype($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_itemtype($context)
{
  global $functionsmemory;
}
// ...end "qmd_itemtype"


// "qmd_levelofdifficulty":
function qtiEbStartqmd_levelofdifficulty($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_levelofdifficulty($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_levelofdifficulty($context)
{
  global $functionsmemory;
}
// ...end "qmd_levelofdifficulty"


// "qmd_maximumscore":
function qtiEbStartqmd_maximumscore($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_maximumscore($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_maximumscore($context)
{
  global $functionsmemory;
}
// ...end "qmd_maximumscore"


// "qmd_minimumscore":
function qtiEbStartqmd_minimumscore($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_minimumscore($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_minimumscore($context)
{
  global $functionsmemory;
}
// ...end "qmd_minimumscore"


// "qmd_status":
function qtiEbStartqmd_status($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_status($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_status($context)
{
  global $functionsmemory;
}
// ...end "qmd_status"


// "qmd_weighting":
function qtiEbStartqmd_weighting($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_weighting($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_weighting($context)
{
  global $functionsmemory;
}
// ...end "qmd_weighting"


// "qmd_toolvendor":
function qtiEbStartqmd_toolvendor($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_toolvendor($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_toolvendor($context)
{
  global $functionsmemory;
}
// ...end "qmd_toolvendor"


// "qmd_topic":
function qtiEbStartqmd_topic($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqmd_topic($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqmd_topic($context)
{
  global $functionsmemory;
}
// ...end "qmd_topic"


// "qticomment":
function qtiEbStartqticomment($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqticomment($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopqticomment($context)
{
  global $functionsmemory;
}
// ...end "qticomment"


// "qtimetadata":
function qtiEbStartqtimetadata($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqtimetadata($context, $data)
{
  global $functionsmemory;
}

function qtiEbStopqtimetadata($context)
{
  global $functionsmemory;
}
// ...end "qtimetadata"


// "qtimetadatafield":
function qtiEbStartqtimetadatafield($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataqtimetadatafield($context, $data)
{
  global $functionsmemory;
}

function qtiEbStopqtimetadatafield($context)
{
  global $functionsmemory;
}
// ...end "qtimetadatafield"


// "questestinterop":
function qtiEbStartquestestinterop($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataquestestinterop($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopquestestinterop($context)
{
  global $functionsmemory;
}
// ...end "questestinterop"


// "reference":
function qtiEbStartreference($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatareference($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopreference($context)
{
  global $functionsmemory;
}
// ...end "reference"


// "render_choice":
function qtiEbStartrender_choice($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['render'] = 'choice';
  $functionsmemory['renderchoicemultiple'] = $attrs['maxnumber']>1;
}
function qtiEbDatarender_choice($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoprender_choice($context)
{
  global $functionsmemory;
  unset($functionsmemory['render']);
  unset($functionsmemory['renderchoicemultiple']);
}
// ...end "render_choice"


// "render_fib":
function qtiEbStartrender_fib($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['current']['render_fib'] = $context[sizeof($context)-1];
  $functionsmemory['render'] = 'fib';
  // Bizarrely, it seems the best way to render this stuff seems to be at the STOP rather than at the START
}
function qtiEbDatarender_fib($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoprender_fib($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

//  print_r($context);

  if(!($functionsmemory['current']['render_fib']->attributes['rows']>1))
    echo "<input type=\"text\" name=\"" 
	          . str_replace('.','_',$context[sizeof($context)-1]->attributes['ident']) . "\" size=\"" 
			  . $functionsmemory['current']['render_fib']->attributes['columns'] . "\" maxlength=\"" 
			  . $functionsmemory['current']['render_fib']->attributes['maxchars'] . "\" />";
  else
    echo "<textarea name=\"" 
	          . str_replace('.','_',$context[sizeof($context)-1]->attributes['ident']) . "\" cols=\"" 
			  . ($functionsmemory['current']['render_fib']->attributes['columns']==0?10:$functionsmemory['current']['render_fib']->attributes['columns']) . "\" rows=\"" 
			  . $functionsmemory['current']['render_fib']->attributes['rows'] . "\" style=\"margin: 10px; \" /></textarea>";
  unset($functionsmemory['current']['render_fib']);
  unset($functionsmemory['render']);
}
// ...end "render_fib"


// "render_hotspot":
function qtiEbStartrender_hotspot($attrs, $context)
{
  global $functionsmemory;
  if(shallWeSkip()) return;
  echo "<fieldset class=\"render_hotspot\" style=\"background:rgb(250,250,250); border: 2px solid black; margin: 5px;\" ><legend style=\"border: 1px solid black; background: rgb(255,204,204)\">QTI rendering warning: HOTSPOT response type not supported!</legend>";

}
function qtiEbDatarender_hotspot($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoprender_hotspot($context)
{
  global $functionsmemory;
  if(shallWeSkip()) return;
  echo "</fieldset>";
}
// ...end "render_hotspot"


// "render_slider":
function qtiEbStartrender_slider($attrs, $context)
{
  global $functionsmemory;
  $startval = isset($attrs['startval']) ? $attrs['startval'] : $attrs['lowerbound'];
  $stepval = isset($attrs['stepval']) ? $attrs['stepval'] : 1;
  $lowerbound = intval($attrs['lowerbound']);
  $upperbound = intval($attrs['upperbound']);
  echo "\n<select name=\"" . htmlspecialchars(str_replace('.','_',$functionsmemory['response']['ident'])) 
                   . "\" class=\"render_slider\" size=\"10\">";
  for($i=$lowerbound; $i<=$upperbound; $i += $stepval)
    echo "\n  <option" . ($startval==$i?' selected="selected"':'') . ">$i</option>";
  echo "\n</select>";
}
function qtiEbDatarender_slider($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoprender_slider($context)
{
  global $functionsmemory;
}
// ...end "render_slider"


// "respcondition":
function qtiEbStartrespcondition($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatarespcondition($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoprespcondition($context)
{
  global $functionsmemory;
}
// ...end "respcondition"

// "response_extension":
function qtiEbStartresponse_extension($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataresponse_extension($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_extension($context)
{
  global $functionsmemory;
}
// ...end "response_extension"


// "response_grp":
function qtiEbStartresponse_grp($attrs, $context)
{
  global $functionsmemory;
  echo "<div class=\"response_grp\" id=\"$attrs[ident]\" style=\"padding: 5px;\">";
  $functionsmemory['response']=$attrs; // This should work for _lid, _num, _xy, etc.
}
function qtiEbDataresponse_grp($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_grp($context)
{
  global $functionsmemory;
  unset($functionsmemory['response']);
  echo "</div>";
}
// ...end "response_grp"


// "response_label":
function qtiEbStartresponse_label($attrs, $context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;


  echo "<label style=\"padding: 5px 15px;\">";
  if($functionsmemory['render']=='choice' && $functionsmemory['response']['rcardinality']=='Multiple')
    echo "\n<input type=\"checkbox\" name=\"" . str_replace('.','_',$functionsmemory['response']['ident']) . "[]\" value=\"$attrs[ident]\">\n";
  elseif($functionsmemory['render']=='choice')
    echo "\n<input type=\"radio\" name=\"" . str_replace('.','_',$functionsmemory['response']['ident']) . "\" value=\"$attrs[ident]\">\n";
  elseif($functionsmemory['render']=='fib')
    ; // Ignore - the render_fib element does the rendering, not the response_label
  else
    echo "<p>ERROR - Unrecognised &quot;response_label&quot; type in file.</p>";
}
function qtiEbDataresponse_label($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_label($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  echo "\n</label>";
}
// ...end "response_label"


// "response_lid":
function qtiEbStartresponse_lid($attrs, $context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  echo "<div class=\"response_lid\" id=\"$attrs[ident]\" style=\"padding: 5px;\">";
  $functionsmemory['response']=$attrs; // This should work for _lid, _num, _xy, etc.
  $functionsmemory['response_lid']=$attrs['ident'];
  $functionsmemory['response_lid_rcardinality']=$attrs['rcardinality'];
}
function qtiEbDataresponse_lid($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_lid($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  unset($functionsmemory['response']);
  unset($functionsmemory['response_lid']);
  echo "</div>";
}
// ...end "response_lid"


// "response_num":
function qtiEbStartresponse_num($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['response']=$attrs; // This should work for _lid, _num, _xy, etc.
}
function qtiEbDataresponse_num($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_num($context)
{
  global $functionsmemory;
  unset($functionsmemory['response']);
}
// ...end "response_num"


// "response_str":
function qtiEbStartresponse_str($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['response']=$attrs; // This should work for _lid, _num, _xy, etc.
}
function qtiEbDataresponse_str($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_str($context)
{
  global $functionsmemory;
  unset($functionsmemory['response']);
}
// ...end "response_str"


// "response_xy":
function qtiEbStartresponse_xy($attrs, $context)
{
  global $functionsmemory;
  $functionsmemory['response']=$attrs; // This should work for _lid, _num, _xy, etc.
  echo "\n<fieldset class=\"render_hotspot\" style=\"background:rgb(250,250,250); border: 2px solid black; margin: 5px;\" ><legend style=\"border: 1px solid black; background: rgb(255,204,204)\">QTI rendering warning: X-Y response type not supported!</legend>";
}
function qtiEbDataresponse_xy($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresponse_xy($context)
{
  global $functionsmemory;
  unset($functionsmemory['response']);
  echo "\n</fieldset>";
}
// ...end "response_xy"


// "resprocessing":
function qtiEbStartresprocessing($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataresprocessing($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopresprocessing($context)
{
  global $functionsmemory;
}
// ...end "resprocessing"


// "rubric":
function qtiEbStartrubric($attrs, $context)
{
  global $functionsmemory;

  $functionsmemory['materialcontext']='rubric';
  echo "<div class=\"rubric\" style=\"background: rgb(204,204,204); border: 1px solid black; padding: 10px;\" >";
}
function qtiEbDatarubric($context, $data)
{
  global $functionsmemory;
}
function qtiEbStoprubric($context)
{
  global $functionsmemory;
  unset($functionsmemory['materialcontext']);
  echo "</div>";
}
// ...end "rubric"


// "section":
function qtiEbStartsection($attrs, $context)
{
  global $functionsmemory, $sectiondisplaycount, $questiondisplaycount;
  $functionsmemory['current']['section'] = $attrs['ident'];

  $sectiondisplaycount++;
  $questiondisplaycount = 0;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;
  echo "<fieldset style=\"background:rgb(153,153,204); margin:20px 10px;\"><legend style=\"background:white; border: 1px solid black;\"><strong>Section $sectiondisplaycount</strong>"
             . (strlen($attrs['title'])>0 ? ': '.htmlspecialchars($attrs['title']):'')
			 . "<!-- ident: $attrs[ident] --></legend>";
}
function qtiEbDatasection($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsection($context)
{
  global $functionsmemory;

  // If we only want one WHATEVER and it's not the current WHATEVER, skip
  if(shallWeSkip()) return;

  unset($functionsmemory['current']['section']);

  echo "</fieldset>";
}
// ...end "section"


// "sectioncontrol":
function qtiEbStartsectioncontrol($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasectioncontrol($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsectioncontrol($context)
{
  global $functionsmemory;
}
// ...end "sectioncontrol"


// "sectionfeedback":
function qtiEbStartsectionfeedback($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasectionfeedback($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsectionfeedback($context)
{
  global $functionsmemory;
}
// ...end "sectionfeedback"


// "sectionpostcondition":
function qtiEbStartsectionpostcondition($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasectionpostcondition($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsectionpostcondition($context)
{
  global $functionsmemory;
}
// ...end "sectionpostcondition"


// "sectionprecondition":
function qtiEbStartsectionprecondition($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasectionprecondition($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsectionprecondition($context)
{
  global $functionsmemory;
}
// ...end "sectionprecondition"


// "sectionproc_extension":
function qtiEbStartsectionproc_extension($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasectionproc_extension($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsectionproc_extension($context)
{
  global $functionsmemory;
}
// ...end "sectionproc_extension"


// "sectionref":
function qtiEbStartsectionref($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasectionref($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsectionref($context)
{
  global $functionsmemory;
}
// ...end "sectionref"


// "selection":
function qtiEbStartselection($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataselection($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopselection($context)
{
  global $functionsmemory;
}
// ...end "selection"


// "selection_ordering":
function qtiEbStartselection_ordering($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataselection_ordering($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopselection_ordering($context)
{
  global $functionsmemory;
}
// ...end "selection_ordering"


// "sequence_parameter":
function qtiEbStartsequence_parameter($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasequence_parameter($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsequence_parameter($context)
{
  global $functionsmemory;
}
// ...end "sequence_parameter"


// "setvar":
function qtiEbStartsetvar($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasetvar($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsetvar($context)
{
  global $functionsmemory;
}
// ...end "setvar"


// "solution":
function qtiEbStartsolution($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasolution($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsolution($context)
{
  global $functionsmemory;
}
// ...end "solution"


// "solutionmaterial":
function qtiEbStartsolutionmaterial($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatasolutionmaterial($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopsolutionmaterial($context)
{
  global $functionsmemory;
}
// ...end "solutionmaterial"

// "varequal":
function qtiEbStartvarequal($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavarequal($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvarequal($context)
{
  global $functionsmemory;
}
// ...end "varequal"

// "varinside":
function qtiEbStartvarinside($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavarinside($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvarinside($context)
{
  global $functionsmemory;
}
// ...end "varinside"




// "unanswered":
function qtiEbStartunanswered($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDataunanswered($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopunanswered($context)
{
  global $functionsmemory;
}
// ...end "unanswered"


// "varlt":
function qtiEbStartvarlt($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavarlt($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvarlt($context)
{
  global $functionsmemory;
}
// ...end "varlt"


// "varlte":
function qtiEbStartvarlte($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavarlte($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvarlte($context)
{
  global $functionsmemory;
}
// ...end "varlte"


// "vargt":
function qtiEbStartvargt($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavargt($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvargt($context)
{
  global $functionsmemory;
}
// ...end "vargt"


// "vargte":
function qtiEbStartvargte($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavargte($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvargte($context)
{
  global $functionsmemory;
}
// ...end "vargte"


// "varsubset":
function qtiEbStartvarsubset($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavarsubset($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvarsubset($context)
{
  global $functionsmemory;
}
// ...end "varsubset"


// "varsubstring":
function qtiEbStartvarsubstring($attrs, $context)
{
  global $functionsmemory;
}
function qtiEbDatavarsubstring($context, $data)
{
  global $functionsmemory;
}
function qtiEbStopvarsubstring($context)
{
  global $functionsmemory;
}
// ...end "varsubstring"
?>
Return current item: Ps and Qs: Processing QTI using PHP