From: thepurpleblob <thepurpleblob>
Date: Wed, 28 Mar 2007 11:58:44 +0000 (+0000)
Subject: A couple of changes to Pierre's calculated question import/export
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5fd8f999d3226f8a892b1d50109481f8e8da9048;p=moodle.git

A couple of changes to Pierre's calculated question import/export
export_process and import_process flags now apply to all questions
and what looked like a development print_r has been commented out.
---

diff --git a/question/editlib.php b/question/editlib.php
index c8b518a805..0ecd24aa3f 100644
--- a/question/editlib.php
+++ b/question/editlib.php
@@ -22,9 +22,10 @@ define('DEFAULT_QUESTIONS_PER_PAGE', 20);
 * @param int $category category number
 * @param bool $noparent if true only questions with NO parent will be selected
 * @param bool $recurse include subdirectories
+* @param bool $export set true if this is called by questionbank export
 * @author added by Howard Miller June 2004
 */
-function get_questions_category( $category, $noparent=false, $recurse=true ) {
+function get_questions_category( $category, $noparent=false, $recurse=true, $export=true ) {
 
     global $QTYPES;
 
@@ -51,6 +52,7 @@ function get_questions_category( $category, $noparent=false, $recurse=true ) {
         // iterate through questions, getting stuff we need
         foreach($questions as $question) {
             $questiontype = $QTYPES[$question->qtype];
+            $question->export_process = $export;
             $questiontype->get_question_options( $question );
             $qresults[] = $question;
         }
@@ -394,4 +396,4 @@ function question_list($course, $categoryid, $quizid=0,
     echo "</form>\n";
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/question/format.php b/question/format.php
index 94ad5f62b3..5619926b40 100644
--- a/question/format.php
+++ b/question/format.php
@@ -314,6 +314,10 @@ class qformat_default {
         $question->partiallycorrectfeedback = '';
         $question->incorrectfeedback = '';
 
+        // this option in case the questiontypes class wants
+        // to know where the data came from
+        $question->export_process = true;
+
         return $question;
     }
 
diff --git a/question/format/xml/format.php b/question/format/xml/format.php
index 5b98c489b2..c4b4e6cda1 100755
--- a/question/format/xml/format.php
+++ b/question/format/xml/format.php
@@ -529,9 +529,7 @@ class qformat_xml extends qformat_default {
           } 
         }
                 
-                echo "<pre>loaded qo";print_r($qo);echo "</pre>";
-
-        $qo->import_process = true ; // flag for question_save_options()
+                // echo "<pre>loaded qo";print_r($qo);echo "</pre>";
 
         return $qo;
     }