diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index a0819761105..3acd83986cb 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -181,6 +181,10 @@ function quiz_upgrade($oldversion) { } } + if ($oldversion < 2004021300) { + table_column("quiz_questions", "", "questiontextformat", "integer", "2", "", "0", "not null", "questiontext"); + } + return true; } diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index 664bd7a2db3..5d7b6ca88a6 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -168,6 +168,7 @@ CREATE TABLE `prefix_quiz_questions` ( `category` int(10) NOT NULL default '0', `name` varchar(255) NOT NULL default '', `questiontext` text NOT NULL, + `questiontextformat` tinyint(2) NOT NULL default '0', `image` varchar(255) NOT NULL default '', `defaultgrade` INT UNSIGNED DEFAULT '1' NOT NULL, `qtype` smallint(6) NOT NULL default '0', diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index 6997247cd08..7a51e5baa9e 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -136,6 +136,10 @@ function quiz_upgrade($oldversion) { } } + if ($oldversion < 2004021300) { + table_column("quiz_questions", "", "questiontextformat", "integer", "2", "", "0", "not null", "questiontext"); + } + return true; } diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql index b83cbd122d6..4a065901276 100644 --- a/mod/quiz/db/postgres7.sql +++ b/mod/quiz/db/postgres7.sql @@ -181,6 +181,7 @@ CREATE TABLE prefix_quiz_questions ( category integer NOT NULL default '0', name varchar(255) NOT NULL default '', questiontext text NOT NULL default '', + questiontextformat integer NOT NULL default '0', image varchar(255) NOT NULL default '', defaultgrade integer NOT NULL default '1', qtype integer NOT NULL default '0', diff --git a/mod/quiz/description.html b/mod/quiz/description.html index 050d12f3214..5e1382d0452 100644 --- a/mod/quiz/description.html +++ b/mod/quiz/description.html @@ -14,22 +14,45 @@ -
:
:
++ +
+:
'; - echo format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + echo format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); quiz_print_possible_question_image($quizid, $question); echo '
'; return true; @@ -563,7 +563,7 @@ function quiz_print_question($number, $question, $grade, $quizid, case SHORTANSWER: case NUMERICAL: - echo format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + echo format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); quiz_print_possible_question_image($quizid, $question); if ($response) { $value = "value=\"$response[0]\""; @@ -596,7 +596,7 @@ function quiz_print_question($number, $question, $grade, $quizid, if (!$false->answer) { $false->answer = get_string("false", "quiz"); } - echo format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + echo format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); quiz_print_possible_question_image($quizid, $question); $truechecked = ""; @@ -639,7 +639,7 @@ function quiz_print_question($number, $question, $grade, $quizid, if (!$answers = get_records_list("quiz_answers", "id", $options->answers)) { notify("Error: Missing question answers!"); } - echo format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + echo format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); quiz_print_possible_question_image($quizid, $question); echo "| $stranswer: | "; @@ -692,7 +692,7 @@ function quiz_print_question($number, $question, $grade, $quizid, notify("Error: Missing subquestions for this question!"); } if (!empty($question->questiontext)) { - echo format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + echo format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); } quiz_print_possible_question_image($quizid, $question); @@ -741,7 +741,7 @@ function quiz_print_question($number, $question, $grade, $quizid, if (!$options = get_record("quiz_randomsamatch", "question", $question->id)) { notify("Error: Missing question options!"); } - echo format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + echo format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); quiz_print_possible_question_image($quizid, $question); /// First, get all the questions available @@ -826,7 +826,7 @@ function quiz_print_question($number, $question, $grade, $quizid, // For this question type, we better print the image on top: quiz_print_possible_question_image($quizid, $question); - $qtextremaining = format_text($question->questiontext, FORMAT_HTML, NULL, $courseid); + $qtextremaining = format_text($question->questiontext, $question->questiontextformat, NULL, $courseid); // The regex will recognize text snippets of type {#X} where the X can be any text not containg } or white-space characters. while (ereg('\{#([^[:space:]}]*)}', $qtextremaining, $regs)) { diff --git a/mod/quiz/match.html b/mod/quiz/match.html index 69ecfcf011c..39723701f2f 100644 --- a/mod/quiz/match.html +++ b/mod/quiz/match.html @@ -14,22 +14,45 @@ |
: |
- + |
: ++ + + + + + |
+
";
+ echo " "; } + print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext); - if ($usehtmleditor) { - helpbutton("richtext", get_string("helprichtext"), "moodle"); + + if ($usehtmleditor) { /// Trying this out for a while + echo ''; } else { - helpbutton("text", get_string("helptext"), "moodle"); + echo " ";
+ print_string("formattexttype");
+ echo ": ";
+ if (!$question->questiontextformat) {
+ $question->questiontextformat = FORMAT_MOODLE;
+ }
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+ helpbutton("textformat", get_string("helpformatting"));
+ echo " ";
}
?>
- |
-
: |
diff --git a/mod/quiz/multichoice.html b/mod/quiz/multichoice.html index 379ab092dac..29ec71bce26 100644 --- a/mod/quiz/multichoice.html +++ b/mod/quiz/multichoice.html @@ -14,22 +14,45 @@ |
: |
- + |
: ++ + + + + + |
+
";
+ echo " "; } + print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext); - if ($usehtmleditor) { - helpbutton("richtext", get_string("helprichtext"), "moodle"); + + if ($usehtmleditor) { /// Trying this out for a while + echo ''; } else { - helpbutton("text", get_string("helptext"), "moodle"); + echo " ";
+ print_string("formattexttype");
+ echo ": ";
+ if (!$question->questiontextformat) {
+ $question->questiontextformat = FORMAT_MOODLE;
+ }
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+ helpbutton("textformat", get_string("helpformatting"));
+ echo " ";
}
?>
- |
-
: |
diff --git a/mod/quiz/numerical.html b/mod/quiz/numerical.html index 393f126c4f7..6a9b4f41daa 100644 --- a/mod/quiz/numerical.html +++ b/mod/quiz/numerical.html @@ -14,22 +14,45 @@ |
: |
- + |
: ++ + + + + + |
+
";
+ echo " "; } + print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext); - if ($usehtmleditor) { - helpbutton("richtext", get_string("helprichtext"), "moodle"); + + if ($usehtmleditor) { /// Trying this out for a while + echo ''; } else { - helpbutton("text", get_string("helptext"), "moodle"); + echo " ";
+ print_string("formattexttype");
+ echo ": ";
+ if (!$question->questiontextformat) {
+ $question->questiontextformat = FORMAT_MOODLE;
+ }
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+ helpbutton("textformat", get_string("helpformatting"));
+ echo " ";
}
?>
- |
-
: |
diff --git a/mod/quiz/question.php b/mod/quiz/question.php index d367411a85b..6af541209bb 100644 --- a/mod/quiz/question.php +++ b/mod/quiz/question.php @@ -102,8 +102,9 @@ // First, save the basic question itself - $question->name = $form->name; - $question->questiontext = $form->questiontext; + $question->name = $form->name; + $question->questiontext = $form->questiontext; + $question->questiontextformat = $form->questiontextformat; if (empty($form->image)) { $question->image = ""; diff --git a/mod/quiz/randomsamatch.html b/mod/quiz/randomsamatch.html index 5cb2c4bd7ac..e763e604cf5 100644 --- a/mod/quiz/randomsamatch.html +++ b/mod/quiz/randomsamatch.html @@ -20,25 +20,48 @@ |
: |
- + |
: |
+
";
+ echo " "; } + if (empty($question->questiontext)) { $question->questiontext = get_string("randomsamatchintro", "quiz"); } print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext); - if ($usehtmleditor) { - helpbutton("richtext", get_string("helprichtext"), "moodle"); + + if ($usehtmleditor) { /// Trying this out for a while + echo ''; } else { - helpbutton("text", get_string("helptext"), "moodle"); + echo " ";
+ print_string("formattexttype");
+ echo ": ";
+ if (!$question->questiontextformat) {
+ $question->questiontextformat = FORMAT_MOODLE;
+ }
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+ helpbutton("textformat", get_string("helpformatting"));
+ echo " ";
}
?>
- |
-
: |
diff --git a/mod/quiz/shortanswer.html b/mod/quiz/shortanswer.html index 1f799b37403..b17a15b6546 100644 --- a/mod/quiz/shortanswer.html +++ b/mod/quiz/shortanswer.html @@ -14,22 +14,45 @@ |
: |
- + |
: ++ + + + + + |
+
";
+ echo " "; } + print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext); - if ($usehtmleditor) { - helpbutton("richtext", get_string("helprichtext"), "moodle"); + + if ($usehtmleditor) { /// Trying this out for a while + echo ''; } else { - helpbutton("text", get_string("helptext"), "moodle"); + echo " ";
+ print_string("formattexttype");
+ echo ": ";
+ if (!$question->questiontextformat) {
+ $question->questiontextformat = FORMAT_MOODLE;
+ }
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+ helpbutton("textformat", get_string("helpformatting"));
+ echo " ";
}
?>
- |
-
: |
diff --git a/mod/quiz/truefalse.html b/mod/quiz/truefalse.html index 9ccef4b1748..614bb3c62bb 100644 --- a/mod/quiz/truefalse.html +++ b/mod/quiz/truefalse.html @@ -14,22 +14,45 @@ |
: |
- + |
: ++ + + + + + |
+
";
+ echo " "; } + print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext); - if ($usehtmleditor) { - helpbutton("richtext", get_string("helprichtext"), "moodle"); + + if ($usehtmleditor) { /// Trying this out for a while + echo ''; } else { - helpbutton("text", get_string("helptext"), "moodle"); + echo " ";
+ print_string("formattexttype");
+ echo ": ";
+ if (!$question->questiontextformat) {
+ $question->questiontextformat = FORMAT_MOODLE;
+ }
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
+ helpbutton("textformat", get_string("helpformatting"));
+ echo " ";
}
?>
- |
-
: |
diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 81810f6cca6..fab4cb0ee7a 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 = 2004020500; // The (date) version of this module +$module->version = 2004021300; // The (date) version of this module $module->requires = 2004013101; // Requires this Moodle version $module->cron = 0; // How often should cron check this module (seconds)? |