### Eclipse Workspace Patch 1.0 #P moodle-HEAD Index: question/format.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/format.php,v retrieving revision 1.35 diff -u -r1.35 format.php --- question/format.php 17 Sep 2007 11:01:53 -0000 1.35 +++ question/format.php 3 Dec 2007 03:06:22 -0000 @@ -12,6 +12,7 @@ var $displayerrors = true; var $category = NULL; + var $questions = array(); var $course = NULL; var $filename = ''; var $matchgrades = 'error'; @@ -47,6 +48,16 @@ } /** + * Set the specific questions to export. Should not include questions with + * parents (sub questions of cloze question type). + * Only used for question export. + * @param array of question objects + */ + function setQuestions( $questions ) { + $this->questions = $questions; + } + + /** * set the course class variable * @param course object Moodle course variable */ @@ -586,7 +597,11 @@ // get the questions (from database) in this category // only get q's with no parents (no cloze subquestions specifically) - $questions = get_questions_category( $this->category, true ); + if ($this->category){ + $questions = get_questions_category( $this->category, true ); + } else { + $questions = $this->questions; + } notify( get_string('exportingquestions','quiz') ); $count = 0; @@ -640,11 +655,11 @@ // continue path for following error checks $course = $this->course; - $continuepath = "$CFG->wwwroot/question/export.php?courseid=$course->id"; + $continuepath = "$CFG->wwwroot/question/export.php?courseid=$course->id"; // did we actually process anything if ($count==0) { - print_error( 'noquestions','quiz',$continuepath ); + print_error( 'noquestions','quiz',$continuepath ); } // final pre-process on exported data