integrate the new $question->export_process parameter for export

This commit is contained in:
pichetp
2007-03-29 09:09:16 +00:00
parent a8d58c58e7
commit c9e4ba362d
2 changed files with 10 additions and 7 deletions
+3 -3
View File
@@ -991,12 +991,12 @@ class qformat_xml extends qformat_default {
}
//echo "<pre> question calc";print_r($question);echo "</pre>";
//First, we a new function to get all the data itmes in the database
$question_datasetdefs =$QTYPES['calculated']->get_datasets_for_export ($question->id);
// $question_datasetdefs =$QTYPES['calculated']->get_datasets_for_export ($question);
// echo "<pre> question defs";print_r($question_datasetdefs);echo "</pre>";
//If there are question_datasets
if (count($question_datasetdefs)) {// there should be
if( isset($question->options->datasets)&&count($question->options->datasets)){// there should be
$expout .= "<dataset_definitions>\n";
foreach ($question_datasetdefs as $def) {
foreach ($question->options->datasets as $def) {
$expout .= "<dataset_definition>\n";
$expout .= " <status>".$this->writetext($def->status)."</status>\n";
$expout .= " <name>".$this->writetext($def->name)."</name>\n";
+7 -4
View File
@@ -47,18 +47,21 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
$virtualqtype = $this->get_virtual_qtype();
$virtualqtype->get_numerical_units($question);
if( isset($question->export_process)&&$question->export_process){
$question->options->datasets = $this->get_datasets_for_export($question);
}
return true;
}
function get_datasets_for_export($questionid){
function get_datasets_for_export(&$question){
$datasetdefs = array();
if (!empty($questionid)) {
if (!empty($question->id)) {
global $CFG;
$sql = "SELECT i.*
FROM {$CFG->prefix}question_datasets d,
{$CFG->prefix}question_dataset_definitions i
WHERE d.question = '$questionid'
WHERE d.question = '$question->id'
AND d.datasetdefinition = i.id
";
if ($records = get_records_sql($sql)) {