diff --git a/lang/en/help/quiz/shuffleanswers.html b/lang/en/help/quiz/shuffleanswers.html new file mode 100644 index 00000000000..3039cbb3fc5 --- /dev/null +++ b/lang/en/help/quiz/shuffleanswers.html @@ -0,0 +1,13 @@ +
Shuffle answers
+ +If you enable this option, then the order of answers within + each question will be randinly shuffled each time a student + attempts this quiz.
+ +Of course, this only applies to questions that have multiple + answers displayed, such as Multiple Choice, or Matching Questions.
+ +The intention is simply to make it a little harder for students + to copy from each other.
+ +This option is not related to the use of Random Questions.
diff --git a/lang/en/help/quiz/shufflequestions.html b/lang/en/help/quiz/shufflequestions.html new file mode 100644 index 00000000000..45c8ef5b54f --- /dev/null +++ b/lang/en/help/quiz/shufflequestions.html @@ -0,0 +1,11 @@ +Shuffle questions
+ +If you enable this option, then the order of questions in + the quiz will be randomly shuffled each time a student attempts + the quiz.
+ +This is not related to the use of Random Questions, this is only + about the displayed order of questions.
+ +The intention is to make it a little harder for students to copy from + each other.
diff --git a/lang/en/quiz.php b/lang/en/quiz.php index 9947ea5d37f..0c3b7859975 100644 --- a/lang/en/quiz.php +++ b/lang/en/quiz.php @@ -118,6 +118,8 @@ $string['shortanswer'] = "Short Answer"; $string['show'] = "Show"; $string['showfeedback'] = "After answering, show feedback?"; $string['showcorrectanswer'] = "In feedback, show correct answers?"; +$string['shuffleanswers'] = "Shuffle answers"; +$string['shufflequestions'] = "Shuffle questions"; $string['time'] = "Time"; $string['timetaken'] = "Time taken"; $string['timecompleted'] = "Completed"; diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index b73b912de1d..37eeaa6d193 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -53,6 +53,7 @@ function quiz_upgrade($oldversion) { if ($oldversion < 2003030303) { table_column("quiz_questions", "", "defaultgrade", "INTEGER", "6", "UNSIGNED", "1", "NOT NULL", "image"); } + if ($oldversion < 2003032601) { execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_answers` ADD INDEX(question) "); execute_sql(" ALTER TABLE `{$CFG->prefix}quiz_attempts` ADD INDEX(quiz) "); @@ -86,6 +87,11 @@ function quiz_upgrade($oldversion) { );"); } + if ($oldversion < 2003040901) { + table_column("quiz", "", "shufflequestions", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "review"); + table_column("quiz", "", "shuffleanswers", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "shufflequestions"); + } + return true; } diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index 90030d04c04..1ccd6ef9b6a 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -25,6 +25,8 @@ CREATE TABLE `prefix_quiz` ( `correctanswers` tinyint(4) NOT NULL default '1', `grademethod` tinyint(4) NOT NULL default '1', `review` tinyint(4) NOT NULL default '0', + `shufflequestions` tinyint(4) NOT NULL default '0', + `shuffleanswers` tinyint(4) NOT NULL default '0', `questions` text NOT NULL, `sumgrades` int(10) NOT NULL default '0', `grade` int(10) NOT NULL default '0', diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index eac41b021bd..dac1dc2ca1f 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -47,6 +47,11 @@ function quiz_upgrade($oldversion) { modify_database ("", "CREATE INDEX question_quiz_multichoice_idx ON prefix_quiz_multichoice (question);"); } + if ($oldversion < 2003040901) { + table_column("quiz", "", "shufflequestions", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "review"); + table_column("quiz", "", "shuffleanswers", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "shufflequestions"); + } + return true; } diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql index 33293c025d6..0dbd67f0cc9 100644 --- a/mod/quiz/db/postgres7.sql +++ b/mod/quiz/db/postgres7.sql @@ -25,6 +25,8 @@ CREATE TABLE prefix_quiz ( correctanswers integer NOT NULL default '1', grademethod integer NOT NULL default '1', review integer NOT NULL default '0', + shufflequestions integer NOT NULL default '0', + shuffleanswers integer NOT NULL default '0', questions text NOT NULL default '', sumgrades integer NOT NULL default '0', grade integer NOT NULL default '0', diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index bde77c2c9a6..8091ad56fb8 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -397,7 +397,7 @@ function quiz_print_question_icon($question, $editlink=true) { function quiz_print_question($number, $question, $grade, $courseid, $feedback=NULL, $response=NULL, $actualgrade=NULL, $correct=NULL, - $realquestion=NULL) { + $realquestion=NULL, $shuffleanswers=false) { /// Prints a quiz question, any format /// $question is provided as an object @@ -417,9 +417,7 @@ function quiz_print_question($number, $question, $grade, $courseid, echo "$grade $strmarks
"; } print_spacer(1,100); - echo ""; - quiz_print_question_icon($question, false); - echo "
print_string("shufflequestions", "quiz") ?>: |
+ + + $options = array(); + $options[0] = get_string("no"); + $options[1] = get_string("yes"); + choose_from_menu($options, "shufflequestions", "$form->shufflequestions", ""); + helpbutton("shufflequestions", get_string("shufflequestions","quiz"), "quiz"); + ?> + | +
print_string("shuffleanswers", "quiz") ?>: |
+ + + $options = array(); + $options[0] = get_string("no"); + $options[1] = get_string("yes"); + choose_from_menu($options, "shuffleanswers", "$form->shuffleanswers", ""); + helpbutton("shuffleanswers", get_string("shuffleanswers","quiz"), "quiz"); + ?> + | +
print_string("maximumgrade") ?>: |
diff --git a/mod/quiz/version.php b/mod/quiz/version.php index c462022cb7f..9283b57bd61 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 = 2003033100; // The (date) version of this module +$module->version = 2003040901; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? ?> |