From 3f5633df1140dad0543f9d62702e9473e073849f Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 1 May 2008 12:21:55 +0000 Subject: [PATCH] MDL-14406 Ensure 'length' field for description type questions is 0 and that default for all questions is 0 Merged from STABLE_19 --- question/format.php | 4 ++++ question/format/gift/format.php | 2 ++ question/format/xml/format.php | 2 ++ 3 files changed, 8 insertions(+) diff --git a/question/format.php b/question/format.php index b8fad63be8f03..32dabeccb0843 100644 --- a/question/format.php +++ b/question/format.php @@ -392,6 +392,7 @@ function create_category_path($catpath, $delimiter='/') { } return $category; } + /** * Return complete file within an array, one item per line * @param string filename name of file @@ -474,6 +475,7 @@ function defaultquestion() { $question->incorrectfeedback = ''; $question->answernumbering = 'abc'; $question->penalty = 0.1; + $question->length = 1; // this option in case the questiontypes class wants // to know where the data came from @@ -550,6 +552,7 @@ function importimagefile( $path, $base64 ) { return $newfile; } + /******************* * EXPORT FUNCTIONS *******************/ @@ -703,6 +706,7 @@ function exportprocess() { fclose($fh); return true; } + /** * get the category as a path (e.g., tom/dick/harry) * @param int id the id of the most nested catgory diff --git a/question/format/gift/format.php b/question/format/gift/format.php index fc144b5dc2c70..506efa5076567 100755 --- a/question/format/gift/format.php +++ b/question/format/gift/format.php @@ -277,6 +277,8 @@ function readquestion($lines) { switch ($question->qtype) { case DESCRIPTION: + $question->defaultgrade = 0; + $question->length = 0; return $question; break; case ESSAY: diff --git a/question/format/xml/format.php b/question/format/xml/format.php index e2e77039e54c1..6d1f3e4ee5de7 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -302,6 +302,8 @@ function import_description( $question ) { $qo = $this->import_headers( $question ); // header parts particular to shortanswer $qo->qtype = DESCRIPTION; + $qo->defaultgrade = 0; + $qo->length = 0; return $qo; }