From: pichetp Date: Thu, 29 Mar 2007 09:09:16 +0000 (+0000) Subject: integrate the new $question->export_process parameter for export X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c9e4ba362db4524eeaa9fb0f50498fa96275add3;p=moodle.git integrate the new $question->export_process parameter for export --- diff --git a/question/format/xml/format.php b/question/format/xml/format.php index c4b4e6cda1..07b84c69be 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -991,12 +991,12 @@ class qformat_xml extends qformat_default { } //echo "
 question calc";print_r($question);echo "
"; //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 "
 question defs";print_r($question_datasetdefs);echo "
"; //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 .= "\n"; - foreach ($question_datasetdefs as $def) { + foreach ($question->options->datasets as $def) { $expout .= "\n"; $expout .= " ".$this->writetext($def->status)."\n"; $expout .= " ".$this->writetext($def->name)."\n"; diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index 94218aa789..d914b62a21 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -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)) {