From a4514d91de3b0dde2948e346c5a3681ac981c124 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 19 Sep 2006 13:35:42 +0000 Subject: [PATCH] Renamed new commentary feature to 'general feedback'. --- .../{commentary.html => generalfeedback.html} | 10 +++++----- lang/en_utf8/help/quiz/index.html | 2 +- lang/en_utf8/quiz.php | 2 +- mod/quiz/db/migrate2utf8.php | 6 +++--- mod/quiz/db/mysql.php | 16 ++++++++++------ mod/quiz/db/mysql.sql | 2 +- mod/quiz/db/postgres7.php | 16 ++++++++++------ mod/quiz/db/postgres7.sql | 2 +- mod/quiz/lib.php | 14 +++++++------- mod/quiz/locallib.php | 10 +++++----- mod/quiz/reviewoptions.html | 8 ++++---- mod/quiz/version.php | 2 +- question/backuplib.php | 2 +- question/format/xml/format.php | 16 ++++++++-------- question/question.php | 4 ++-- question/restorelib.php | 6 +++--- question/type/editquestionstart.html | 10 +++++----- question/type/question.html | 6 +++--- question/type/questiontype.php | 14 +++++++------- theme/standard/styles_layout.css | 2 +- 20 files changed, 79 insertions(+), 71 deletions(-) rename lang/en_utf8/help/quiz/{commentary.html => generalfeedback.html} (50%) diff --git a/lang/en_utf8/help/quiz/commentary.html b/lang/en_utf8/help/quiz/generalfeedback.html similarity index 50% rename from lang/en_utf8/help/quiz/commentary.html rename to lang/en_utf8/help/quiz/generalfeedback.html index 46e0b178f5..6080223f12 100644 --- a/lang/en_utf8/help/quiz/commentary.html +++ b/lang/en_utf8/help/quiz/generalfeedback.html @@ -1,14 +1,14 @@ -

Question commentary

+

Question general feedback

-

Question commentary is some text that gets shown to the +

Question general feedback is some text that gets shown to the student after they have attempted the question. Unlike feedback, which depends on the question type and what response the student gave, -the same commentary text is shown to all students.

+the same general feedback text is shown to all students.

-

You can control when commentary is shown to students using +

You can control when general feedback is shown to students using the "Students may review:" check-boxes on the quiz editing form.

-

You can use the commentary to give students some background +

You can use the general feedback to give students some background to what knownledge the question was testing. Or to give them a link to more information they can use if they did not understand the questions.

\ No newline at end of file diff --git a/lang/en_utf8/help/quiz/index.html b/lang/en_utf8/help/quiz/index.html index 412e0eb6c1..6a85a4eb4a 100644 --- a/lang/en_utf8/help/quiz/index.html +++ b/lang/en_utf8/help/quiz/index.html @@ -8,7 +8,6 @@
  • Calculated questions
  • Categories
  • Question Categories
  • -
  • Question commentary
  • Correct answers
  • Creating multiple quizzes
  • Decimal digits
  • @@ -17,6 +16,7 @@
  • Each attempt builds on the last
  • Embedded Answers (Cloze)
  • +
  • Question general feedback
  • Grading method
  • Importing questions
  • Importing Aiken format files
  • diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index c8c03d1960..b327222d02 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -83,7 +83,6 @@ $string['close'] = 'Close window'; $string['closepreview'] = 'Close preview'; $string['closereview'] = 'Close review'; $string['comment'] = 'Comment'; -$string['commentary'] = 'Commentary'; $string['commentorgrade'] = 'Make comment or override grade'; $string['completedon'] = 'Completed on'; $string['confirmclose'] = 'You are about to close this attempt. Once you close the attempt you will no longer be able to change your answers.'; @@ -203,6 +202,7 @@ $string['functiontakesnoargs'] = 'The function $a does not take any arguments'; $string['functiontakesonearg'] = 'The function $a must have exactly one argument'; $string['functiontakesoneortwoargs'] = 'The function $a must have either one or two arguments'; $string['functiontakestwoargs'] = 'The function $a must have exactly two arguments'; +$string['generalfeedback'] = 'General feedback'; $string['generatevalue'] = 'Generate a new value between'; $string['geometric'] = 'Geometric'; $string['gift'] = 'GIFT format'; diff --git a/mod/quiz/db/migrate2utf8.php b/mod/quiz/db/migrate2utf8.php index 282b05bc2a..0bbfaca1cc 100755 --- a/mod/quiz/db/migrate2utf8.php +++ b/mod/quiz/db/migrate2utf8.php @@ -354,7 +354,7 @@ function migrate2utf8_question_questiontext($recordid){ return $result; } -function migrate2utf8_question_commentarytext($recordid){ +function migrate2utf8_question_generalfeedback($recordid){ global $CFG, $globallang; /// Some trivial checks @@ -393,11 +393,11 @@ function migrate2utf8_question_commentarytext($recordid){ /// Convert the text if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) { - $result = utfconvert($quizquestions->commentarytext, $fromenc); + $result = utfconvert($quizquestions->generalfeedback, $fromenc); $newquizquestion = new object; $newquizquestion->id = $recordid; - $newquizquestion->commentarytext = $result; + $newquizquestion->generalfeedback = $result; update_record('question',$newquizquestion); } /// And finally, just return the converted field diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index 2d6dd99e3b..1cc905b302 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -1100,16 +1100,16 @@ function quiz_upgrade($oldversion) { } if ($oldversion < 2006081000) { - // Add a column to the the question table to store the question commentary. + // Add a column to the the question table to store the question general feedback. $success = $success && table_column('question', '', 'commentarytext', 'text', '', '', '', 'not null', 'image'); - // Adjust the quiz review options so that commentary is displayed whenever feedback is. + // Adjust the quiz review options so that general feedback is displayed whenever feedback is. $success = $success && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' . - '(review & ~' . QUIZ_REVIEW_COMMENTARY . ') | ' . // Clear any existing junk from the commenary bits. - '((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the commentary bits to be the same as the feedback ones. + '(review & ~' . QUIZ_REVIEW_GENERALFEEDBACK . ') | ' . // Clear any existing junk from the commenary bits. + '((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the general feedback bits to be the same as the feedback ones. // Same adjustment to the defaults for new quizzes. - $success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_COMMENTARY) | + $success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_GENERALFEEDBACK) | (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK) << 3)); } @@ -1137,7 +1137,11 @@ function quiz_upgrade($oldversion) { } if ($success && $oldversion < 2006091900) { - $success = $success && table_column('question_dataset_items', 'number', 'itemnumber', 'text', '', '', ''); + $success = $success && table_column('question_dataset_items', 'number', 'itemnumber', 'integer'); + } + + if ($success && $oldversion < 2006091901) { + $success = $success && table_column('question', 'commentarytext', 'generalfeedback', 'text', '', '', ''); } return $success; diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index 2b14cce152..bac5c73c7e 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -134,7 +134,7 @@ CREATE TABLE prefix_question ( questiontext text NOT NULL, questiontextformat tinyint(2) NOT NULL default '0', image varchar(255) NOT NULL default '', - commentarytext text NOT NULL, + generalfeedback text NOT NULL, defaultgrade int(10) unsigned NOT NULL default '1', penalty float NOT NULL default '0.1', qtype varchar(20) NOT NULL default '', diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index 5037ae2703..d5d9d8754d 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -1422,16 +1422,16 @@ function quiz_upgrade($oldversion) { } if ($oldversion < 2006081000) { - // Add a column to the the question table to store the question commentary. + // Add a column to the the question table to store the question general feedback. $success = $success && table_column('question', '', 'commentarytext', 'text', '', '', '', 'not null', 'image'); - // Adjust the quiz review options so that commentary is displayed whenever feedback is. + // Adjust the quiz review options so that general feedback is displayed whenever feedback is. $success = $success && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' . - '(review & ~' . QUIZ_REVIEW_COMMENTARY . ') | ' . // Clear any existing junk from the commenary bits. - '((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the commentary bits to be the same as the feedback ones. + '(review & ~' . QUIZ_REVIEW_GENERALFEEDBACK . ') | ' . // Clear any existing junk from the commenary bits. + '((review & ' . QUIZ_REVIEW_FEEDBACK . ') * 8)'); // Set the general feedback bits to be the same as the feedback ones. // Same adjustment to the defaults for new quizzes. - $success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_COMMENTARY) | + $success = $success && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_GENERALFEEDBACK) | (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK) << 3)); } @@ -1459,7 +1459,11 @@ function quiz_upgrade($oldversion) { } if ($success && $oldversion < 2006091900) { - $success = $success && table_column('question_dataset_items', 'number', 'itemnumber', 'text', '', '', ''); + $success = $success && table_column('question_dataset_items', 'number', 'itemnumber', 'integer'); + } + + if ($success && $oldversion < 2006091901) { + $success = $success && table_column('question', 'commentarytext', 'generalfeedback', 'text', '', '', ''); } return $success; diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql index 02b04664ad..143f6d1e7c 100644 --- a/mod/quiz/db/postgres7.sql +++ b/mod/quiz/db/postgres7.sql @@ -128,7 +128,7 @@ CREATE TABLE prefix_question ( questiontext text NOT NULL default '', questiontextformat integer NOT NULL default '0', image varchar(255) NOT NULL default '', - commentarytext text NOT NULL default '', + generalfeedback text NOT NULL default '', defaultgrade integer NOT NULL default '1', penalty real NOT NULL default '0.1', qtype varchar(20) NOT NULL default '0', diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index be9229a097..dbf04a2fbd 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -40,7 +40,7 @@ define('QUIZ_REVIEW_ANSWERS', 8*0x1041); // Show correct answers // Some handling of worked solutions is already in the code but not yet fully supported // and not switched on in the user interface. define('QUIZ_REVIEW_SOLUTIONS', 16*0x1041); // Show solutions -define('QUIZ_REVIEW_COMMENTARY', 32*0x1041); // Show commentary +define('QUIZ_REVIEW_GENERALFEEDBACK', 32*0x1041); // Show general feedback /**#@-*/ /** @@ -625,16 +625,16 @@ function quiz_process_options(&$quiz) { unset($quiz->solutionsclosed); } - if (isset($quiz->commentaryimmediately)) { - $review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY); + if (isset($quiz->generalfeedbackimmediately)) { + $review += (QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY); unset($quiz->solutionsimmediately); } - if (isset($quiz->commentaryopen)) { - $review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_OPEN); + if (isset($quiz->generalfeedbackopen)) { + $review += (QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN); unset($quiz->solutionsopen); } - if (isset($quiz->commentaryclosed)) { - $review += (QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_CLOSED); + if (isset($quiz->generalfeedbackclosed)) { + $review += (QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED); unset($quiz->solutionsclosed); } diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 365af7172c..b2d8a27c10 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -619,8 +619,8 @@ function quiz_get_renderoptions($reviewoptions, $state) { // Show correct responses in readonly mode if the quiz allows it $options->correct_responses = $options->readonly && ($reviewoptions & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY); - // Show commentary if the question has been graded and the quiz allows it. - $options->commentary = question_state_is_graded($state) && ($reviewoptions & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY); + // Show general feedback if the question has been graded and the quiz allows it. + $options->generalfeedback = question_state_is_graded($state) && ($reviewoptions & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY); // Always show responses and scores $options->responses = true; @@ -639,7 +639,7 @@ function quiz_get_renderoptions($reviewoptions, $state) { * normally the context for the quiz module instance. * * @return object an object with boolean fields responses, scores, feedback, - * correct_responses, solutions and commentary + * correct_responses, solutions and general feedback */ function quiz_get_reviewoptions($quiz, $attempt, $context=null) { @@ -656,7 +656,7 @@ function quiz_get_reviewoptions($quiz, $attempt, $context=null) { $options->feedback = true; $options->correct_responses = true; $options->solutions = false; - $options->commentary = true; + $options->generalfeedback = true; // Show a link to the comment box only for closed attempts if ($attempt->timefinish) { @@ -675,7 +675,7 @@ function quiz_get_reviewoptions($quiz, $attempt, $context=null) { $options->feedback = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_FEEDBACK) ? 1 : 0; $options->correct_responses = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_ANSWERS) ? 1 : 0; $options->solutions = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_SOLUTIONS) ? 1 : 0; - $options->commentary = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_COMMENTARY) ? 1 : 0; + $options->generalfeedback = ($quiz->review & $quiz_state_mask & QUIZ_REVIEW_GENERALFEEDBACK) ? 1 : 0; } return $options; diff --git a/mod/quiz/reviewoptions.html b/mod/quiz/reviewoptions.html index ac3f5fc0f5..fcbc483f34 100644 --- a/mod/quiz/reviewoptions.html +++ b/mod/quiz/reviewoptions.html @@ -16,7 +16,7 @@ - + @@ -40,7 +40,7 @@ --> - review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> /> + review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY) ? 'checked="checked"' : '' ?> /> @@ -62,7 +62,7 @@ --> - review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> /> + review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN) ? 'checked="checked"' : '' ?> /> @@ -84,7 +84,7 @@ --> - review & QUIZ_REVIEW_COMMENTARY & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> /> + review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED) ? 'checked="checked"' : '' ?> /> diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 47cd36e42f..d1f9bad56c 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -5,7 +5,7 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006091900; // The (date) version of this module +$module->version = 2006091901; // The (date) version of this module $module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? diff --git a/question/backuplib.php b/question/backuplib.php index 5a42ae43cb..1555f916b9 100644 --- a/question/backuplib.php +++ b/question/backuplib.php @@ -142,7 +142,7 @@ fwrite ($bf,full_tag("QUESTIONTEXT",6,false,$question->questiontext)); fwrite ($bf,full_tag("QUESTIONTEXTFORMAT",6,false,$question->questiontextformat)); fwrite ($bf,full_tag("IMAGE",6,false,$question->image)); - fwrite ($bf,full_tag("COMMENTARYTEXT",6,false,$question->commentarytext)); + fwrite ($bf,full_tag("GENERALFEEDBACK",6,false,$question->generalfeedback)); fwrite ($bf,full_tag("DEFAULTGRADE",6,false,$question->defaultgrade)); fwrite ($bf,full_tag("PENALTY",6,false,$question->penalty)); fwrite ($bf,full_tag("QTYPE",6,false,$question->qtype)); diff --git a/question/format/xml/format.php b/question/format/xml/format.php index d1583dbb17..5b8972b241 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -112,10 +112,10 @@ class qformat_xml extends qformat_default { $image_base64 = stripslashes( trim( $question['#']['image_base64'][0]['#'] ) ); $image = $this->importimagefile( $image, $image_base64 ); } - if (array_key_exists('commentarytext', $question['#'])) { - $commentarytext = $this->import_text( $question['#']['commentarytext'][0]['#']['text'] ); + if (array_key_exists('generalfeedback', $question['#'])) { + $generalfeedback = $this->import_text( $question['#']['generalfeedback'][0]['#']['text'] ); } else { - $commentarytext = ''; + $generalfeedback = ''; } if (!empty($question['#']['defaultgrade'][0]['#'])) { $qo->defaultgrade = $question['#']['defaultgrade'][0]['#']; @@ -127,7 +127,7 @@ class qformat_xml extends qformat_default { $qo->questiontext = $qtext; $qo->questiontextformat = $this->trans_format( $qformat ); $qo->image = ((!empty($image)) ? $image : ''); - $qo->commentarytext = $commentarytext; + $qo->generalfeedback = $generalfeedback; $qo->penalty = $penalty; return $qo; @@ -646,7 +646,7 @@ class qformat_xml extends qformat_default { $name_text = $this->writetext( $question->name ); $qtformat = $this->get_format($question->questiontextformat); $question_text = $this->writetext( $question->questiontext ); - $commentary_text = $this->writetext( $question->commentarytext ); + $generalfeedback = $this->writetext( $question->generalfeedback ); $expout .= " \n"; $expout .= " $name_text\n"; $expout .= " \n"; @@ -654,9 +654,9 @@ class qformat_xml extends qformat_default { $expout .= " \n"; $expout .= " {$question->image}\n"; $expout .= $this->writeimage($question->image); - $expout .= " \n"; - $expout .= $commentary_text; - $expout .= " \n"; + $expout .= " \n"; + $expout .= $generalfeedback; + $expout .= " \n"; $expout .= " {$question->defaultgrade}\n"; $expout .= " {$question->penalty}\n"; $expout .= " {$question->hidden}\n"; diff --git a/question/question.php b/question/question.php index 70072e06d8..d42e17b20b 100644 --- a/question/question.php +++ b/question/question.php @@ -283,8 +283,8 @@ if (!isset($question->defaultgrade)) { $question->defaultgrade = 1; } - if (empty($question->commentarytext)) { - $question->commentarytext = ""; + if (empty($question->generalfeedback)) { + $question->generalfeedback = ""; } // Set up some Richtext editing if necessary diff --git a/question/restorelib.php b/question/restorelib.php index 0481a2ca56..d8c0c63786 100644 --- a/question/restorelib.php +++ b/question/restorelib.php @@ -190,10 +190,10 @@ $question->questiontext = backup_todb($que_info['#']['QUESTIONTEXT']['0']['#']); $question->questiontextformat = backup_todb($que_info['#']['QUESTIONTEXTFORMAT']['0']['#']); $question->image = backup_todb($que_info['#']['IMAGE']['0']['#']); - if (array_key_exists('COMMENTARYTEXT', $que_info['#'])) { - $question->commentarytext = backup_todb($que_info['#']['COMMENTARYTEXT']['0']['#']); + if (array_key_exists('GENERALFEEDBACK', $que_info['#'])) { + $question->generalfeedback = backup_todb($que_info['#']['GENERALFEEDBACK']['0']['#']); } else { - $question->commentarytext = ''; + $question->generalfeedback = ''; } $question->defaultgrade = backup_todb($que_info['#']['DEFAULTGRADE']['0']['#']); $question->penalty = backup_todb($que_info['#']['PENALTY']['0']['#']); diff --git a/question/type/editquestionstart.html b/question/type/editquestionstart.html index 810c49b16c..d1144454fc 100644 --- a/question/type/editquestionstart.html +++ b/question/type/editquestionstart.html @@ -100,19 +100,19 @@ ?> - : + :


    "; } - print_textarea(false, 10, 60, 630, 200, "commentarytext", $question->commentarytext); + print_textarea(false, 10, 60, 630, 200, "generalfeedback", $question->generalfeedback); ?> diff --git a/question/type/question.html b/question/type/question.html index 0e61c0de47..96c89ccef7 100644 --- a/question/type/question.html +++ b/question/type/question.html @@ -30,9 +30,9 @@ -
    - + if ($generalfeedback) { ?> +
    +
    diff --git a/question/type/questiontype.php b/question/type/questiontype.php index f7143b98c8..77a166ab7a 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -107,10 +107,10 @@ class default_questiontype { $question->image = $form->image; } - if (empty($form->commentarytext)) { - $question->commentarytext = ''; + if (empty($form->generalfeedback)) { + $question->generalfeedback = ''; } else { - $question->commentarytext = trim($form->commentarytext); + $question->generalfeedback = trim($form->generalfeedback); } if (empty($question->name)) { @@ -535,9 +535,9 @@ class default_questiontype { $editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true); } - $commentary = ''; - if ($isgraded && $options->commentary) { - $commentary = $this->format_text($question->commentarytext, + $generalfeedback = ''; + if ($isgraded && $options->generalfeedback) { + $generalfeedback = $this->format_text($question->generalfeedback, $question->questiontextformat, $cmoptions); } @@ -1069,7 +1069,7 @@ class default_questiontype { /** * Print the start of the question editing form, including the question category, - * questionname, questiontext, image, defaultgrade, penalty and commentary fields. + * questionname, questiontext, image, defaultgrade, penalty and generalfeedback fields. * * Three of the fields, image, defaultgrade, penalty, are optional, and * can be removed from the from using the $hidefields argument. diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 09620ef687..947228ea47 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -1283,7 +1283,7 @@ body#message-messages { .que .grading, .que .comment, .que .commentlink, -.que .commentary, +.que .generalfeedback, .que .history { float: right; margin: 5px; -- 2.39.5