Exemplo n.º 1
0
 /**
  * Save 'calculation' question type to QTI XML
  * @param ST_Question_Calculation $question Reference to the question object
  * @author Adam Clarke, Rob Ingram, Simon Atack
  */
 function SaveEnhancedCalc(&$question)
 {
     if (!isset($configObject)) {
         $configObject = Config::get_instance();
     }
     $cfg_web_root = $configObject->get('cfg_web_root');
     require_once $cfg_web_root . '/plugins/questions/enhancedcalc/enhancedcalc.class.php';
     $enhancedcalc = new EnhancedCalc($configObject);
     $enhancedcalc->load($question);
     // replace all variables in leadin with randomly generated values
     $enhancedcalc->generate_variables();
     $real_answer = $enhancedcalc->get_real_answer();
     $enhancedcalc->add_to_useranswer('uans', $real_answer);
     $uansdata = $enhancedcalc->get_uans_data();
     $question->origleadin = $question->leadin;
     // format the text for the question
     $q_text = $enhancedcalc->replace_leadin(false);
     $question->feedback = $enhancedcalc->replace_vars($question->feedback);
     //echo $q_text."<BR>";
     $question->leadin = $q_text;
     list($headertext, $title) = $this->MakeQuestionHeader($question);
     $type = "Calculation";
     $ob = new OB();
     $ob->ClearAndSave();
     include "qti12/tmpl/enhancedcalc.php";
     $this->output .= $ob->GetContent();
     $ob->Restore();
 }