From 42e5993199e5991cb7d101901f59cf8a8980eba7 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Mon, 13 Feb 2006 14:46:26 +0000 Subject: [PATCH] Added initialisation method for question object. Permits setting of default values for required (but not imported) database fields. Bug #4752 --- mod/quiz/format.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mod/quiz/format.php b/mod/quiz/format.php index 4954c416b1c..ae3605e18e5 100644 --- a/mod/quiz/format.php +++ b/mod/quiz/format.php @@ -138,6 +138,21 @@ class quiz_default_format { } + function defaultquestion() { + // returns an "empty" question + // Somewhere to specify question parameters that are not handled + // by import but are required db fields. + // This should not be overridden. + $question = new stdClass(); + $question->shuffleanswers = 0; + $question->defaultgrade = 1; + $question->image = ""; + $question->usecase = 0; + $question->multiplier = array(); + + return $question; + } + function readquestion($lines) { /// Given an array of lines known to define a question in /// this format, this function converts it into a question