}
}
+ if ($oldversion < 2004021300) {
+ table_column("quiz_questions", "", "questiontextformat", "integer", "2", "", "0", "not null", "questiontext");
+ }
+
return true;
}
`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',
}
}
+ if ($oldversion < 2004021300) {
+ table_column("quiz_questions", "", "questiontextformat", "integer", "2", "", "0", "not null", "questiontext");
+ }
+
return true;
}
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',
<?php if (isset($err["name"])) formerr($err["name"]); ?>\r
</TD>\r
</TR>\r
-<TR valign=top>\r
- <TD align=right><P><B><?php print_string("question", "quiz") ?>:</B></P></TD>\r
- <TD>\r
+<tr valign=top>\r
+ <td align="right"><p><b><?php print_string("question", "quiz") ?>:</b></p>\r
+ <br />\r
+ <br />\r
+ <br />\r
+ <p><font SIZE="1">\r
+ <?php\r
+ if ($usehtmleditor) {\r
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);\r
+ } else {\r
+ helpbutton("text", get_string("helptext"), "moodle", true, true);\r
+ }\r
+ ?>\r
+ </font></p>\r
+ </td>\r
+ <td>\r
<?php if (isset($err["questiontext"])) {\r
formerr($err["questiontext"]); \r
- echo "<BR />";\r
+ echo "<br />";\r
}\r
+\r
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);\r
- if ($usehtmleditor) {\r
- helpbutton("richtext", get_string("helprichtext"), "moodle");\r
+\r
+ if ($usehtmleditor) { /// Trying this out for a while\r
+ echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';\r
} else {\r
- helpbutton("text", get_string("helptext"), "moodle");\r
+ echo "<div align=right>";\r
+ print_string("formattexttype");\r
+ echo ": ";\r
+ if (!$question->questiontextformat) {\r
+ $question->questiontextformat = FORMAT_MOODLE;\r
+ }\r
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");\r
+ helpbutton("textformat", get_string("helpformatting"));\r
+ echo "</div>";\r
}\r
?>\r
- </TD>\r
-</TR>\r
+ </td>\r
+</tr>\r
<TR valign=top>\r
<TD align=right><P><B><?php print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
if ($question->qtype == DESCRIPTION) { // Special case question - has no answers etc
echo '<p align="center">';
- 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 '</p>';
return true;
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]\"";
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 = "";
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 "<table align=\"right\">";
echo "<tr><td valign=\"top\">$stranswer: </td><td>";
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);
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
// 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)) {
<?php if (isset($err["name"])) formerr($err["name"]); ?>\r
</TD>\r
</TR>\r
-<TR valign=top>\r
- <TD align=right><P><B><?php print_string("question", "quiz") ?>:</B></P></TD>\r
- <TD>\r
+<tr valign=top>\r
+ <td align="right"><p><b><?php print_string("question", "quiz") ?>:</b></p>\r
+ <br />\r
+ <br />\r
+ <br />\r
+ <p><font SIZE="1">\r
+ <?php\r
+ if ($usehtmleditor) {\r
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);\r
+ } else {\r
+ helpbutton("text", get_string("helptext"), "moodle", true, true);\r
+ }\r
+ ?>\r
+ </font></p>\r
+ </td>\r
+ <td>\r
<?php if (isset($err["questiontext"])) {\r
formerr($err["questiontext"]); \r
- echo "<BR />";\r
+ echo "<br />";\r
}\r
+\r
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);\r
- if ($usehtmleditor) {\r
- helpbutton("richtext", get_string("helprichtext"), "moodle");\r
+\r
+ if ($usehtmleditor) { /// Trying this out for a while\r
+ echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';\r
} else {\r
- helpbutton("text", get_string("helptext"), "moodle");\r
+ echo "<div align=right>";\r
+ print_string("formattexttype");\r
+ echo ": ";\r
+ if (!$question->questiontextformat) {\r
+ $question->questiontextformat = FORMAT_MOODLE;\r
+ }\r
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");\r
+ helpbutton("textformat", get_string("helpformatting"));\r
+ echo "</div>";\r
}\r
?>\r
- </TD>\r
-</TR>\r
+ </td>\r
+</tr>\r
<TR valign=top>\r
<TD align=right><P><B><?php print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
<?php if (isset($err["name"])) formerr($err["name"]); ?>\r
</TD>\r
</TR>\r
-<TR valign=top>\r
- <TD align=right><P><B><?php print_string("question", "quiz") ?>:</B></P></TD>\r
- <TD>\r
+<tr valign=top>\r
+ <td align="right"><p><b><?php print_string("question", "quiz") ?>:</b></p>\r
+ <br />\r
+ <br />\r
+ <br />\r
+ <p><font SIZE="1">\r
+ <?php\r
+ if ($usehtmleditor) {\r
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);\r
+ } else {\r
+ helpbutton("text", get_string("helptext"), "moodle", true, true);\r
+ }\r
+ ?>\r
+ </font></p>\r
+ </td>\r
+ <td>\r
<?php if (isset($err["questiontext"])) {\r
formerr($err["questiontext"]); \r
- echo "<BR />";\r
+ echo "<br />";\r
}\r
+\r
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);\r
- if ($usehtmleditor) {\r
- helpbutton("richtext", get_string("helprichtext"), "moodle");\r
+\r
+ if ($usehtmleditor) { /// Trying this out for a while\r
+ echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';\r
} else {\r
- helpbutton("text", get_string("helptext"), "moodle");\r
+ echo "<div align=right>";\r
+ print_string("formattexttype");\r
+ echo ": ";\r
+ if (!$question->questiontextformat) {\r
+ $question->questiontextformat = FORMAT_MOODLE;\r
+ }\r
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");\r
+ helpbutton("textformat", get_string("helpformatting"));\r
+ echo "</div>";\r
}\r
?>\r
- </TD>\r
-</TR>\r
+ </td>\r
+</tr>\r
<TR valign=top>\r
<TD align=right><P><B><?php print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
<?php if (isset($err["name"])) formerr($err["name"]); ?>
</TD>
</TR>
-<TR valign=top>
- <TD align=right><P><B><?php print_string("question", "quiz") ?>:</B></P></TD>
- <TD>
+<tr valign=top>
+ <td align="right"><p><b><?php print_string("question", "quiz") ?>:</b></p>
+ <br />
+ <br />
+ <br />
+ <p><font SIZE="1">
+ <?php
+ if ($usehtmleditor) {
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
+ } else {
+ helpbutton("text", get_string("helptext"), "moodle", true, true);
+ }
+ ?>
+ </font></p>
+ </td>
+ <td>
<?php if (isset($err["questiontext"])) {
formerr($err["questiontext"]);
- echo "<BR />";
+ echo "<br />";
}
+
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 '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';
} else {
- helpbutton("text", get_string("helptext"), "moodle");
+ echo "<div align=right>";
+ 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 "</div>";
}
?>
- </TD>
-</TR>
+ </td>
+</tr>
<TR valign=top>
<TD align=right><P><B><?php print_string("imagedisplay", "quiz") ?>:</B></P></TD>
<TD>
// 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 = "";
<?php if (isset($err["name"])) formerr($err["name"]); ?>\r
</TD>\r
</TR>\r
-<TR valign=top>\r
- <TD align=right><P><B><?php print_string("introduction", "quiz") ?>:</B></P></TD>\r
- <TD>\r
+<tr valign=top>\r
+ <td align=right><p><b><?php print_string("introduction", "quiz") ?>:</b></p></td>\r
+ <br />\r
+ <br />\r
+ <br />\r
+ <p><font SIZE="1">\r
+ <?php\r
+ if ($usehtmleditor) {\r
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);\r
+ } else {\r
+ helpbutton("text", get_string("helptext"), "moodle", true, true);\r
+ }\r
+ ?>\r
+ </font></p>\r
+ </td>\r
+ <td>\r
<?php if (isset($err["questiontext"])) {\r
formerr($err["questiontext"]); \r
- echo "<BR />";\r
+ echo "<br />";\r
}\r
+\r
if (empty($question->questiontext)) {\r
$question->questiontext = get_string("randomsamatchintro", "quiz");\r
}\r
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);\r
- if ($usehtmleditor) {\r
- helpbutton("richtext", get_string("helprichtext"), "moodle");\r
+\r
+ if ($usehtmleditor) { /// Trying this out for a while\r
+ echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';\r
} else {\r
- helpbutton("text", get_string("helptext"), "moodle");\r
+ echo "<div align=right>";\r
+ print_string("formattexttype");\r
+ echo ": ";\r
+ if (!$question->questiontextformat) {\r
+ $question->questiontextformat = FORMAT_MOODLE;\r
+ }\r
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");\r
+ helpbutton("textformat", get_string("helpformatting"));\r
+ echo "</div>";\r
}\r
?>\r
- </TD>\r
-</TR>\r
+ </td>\r
+</tr>\r
<TR valign=top>\r
<TD align=right><P><B><?php print_string("randomsamatchnumber", "quiz") ?>:</B></P></TD>\r
<TD>\r
<?php if (isset($err["name"])) formerr($err["name"]); ?>\r
</TD>\r
</TR>\r
-<TR valign=top>\r
- <TD align=right><P><B><?php print_string("question", "quiz") ?>:</B></P></TD>\r
- <TD>\r
+<tr valign=top>\r
+ <td align="right"><p><b><?php print_string("question", "quiz") ?>:</b></p>\r
+ <br />\r
+ <br />\r
+ <br />\r
+ <p><font SIZE="1">\r
+ <?php\r
+ if ($usehtmleditor) {\r
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);\r
+ } else {\r
+ helpbutton("text", get_string("helptext"), "moodle", true, true);\r
+ }\r
+ ?>\r
+ </font></p>\r
+ </td>\r
+ <td>\r
<?php if (isset($err["questiontext"])) {\r
formerr($err["questiontext"]); \r
- echo "<BR />";\r
+ echo "<br />";\r
}\r
+\r
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);\r
- if ($usehtmleditor) {\r
- helpbutton("richtext", get_string("helprichtext"), "moodle");\r
+\r
+ if ($usehtmleditor) { /// Trying this out for a while\r
+ echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';\r
} else {\r
- helpbutton("text", get_string("helptext"), "moodle");\r
+ echo "<div align=right>";\r
+ print_string("formattexttype");\r
+ echo ": ";\r
+ if (!$question->questiontextformat) {\r
+ $question->questiontextformat = FORMAT_MOODLE;\r
+ }\r
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");\r
+ helpbutton("textformat", get_string("helpformatting"));\r
+ echo "</div>";\r
}\r
?>\r
- </TD>\r
-</TR>\r
+ </td>\r
+</tr>\r
<TR valign=top>\r
<TD align=right><P><B><?php print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
<?php if (isset($err["name"])) formerr($err["name"]); ?>\r
</TD>\r
</TR>\r
-<TR valign=top>\r
- <TD align=right><P><B><?php print_string("question", "quiz") ?>:</B></P></TD>\r
- <TD>\r
+<tr valign=top>\r
+ <td align="right"><p><b><?php print_string("question", "quiz") ?>:</b></p>\r
+ <br />\r
+ <br />\r
+ <br />\r
+ <p><font SIZE="1">\r
+ <?php\r
+ if ($usehtmleditor) {\r
+ helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);\r
+ } else {\r
+ helpbutton("text", get_string("helptext"), "moodle", true, true);\r
+ }\r
+ ?>\r
+ </font></p>\r
+ </td>\r
+ <td>\r
<?php if (isset($err["questiontext"])) {\r
formerr($err["questiontext"]); \r
- echo "<BR />";\r
+ echo "<br />";\r
}\r
+\r
print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);\r
- if ($usehtmleditor) {\r
- helpbutton("richtext", get_string("helprichtext"), "moodle");\r
+\r
+ if ($usehtmleditor) { /// Trying this out for a while\r
+ echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'">';\r
} else {\r
- helpbutton("text", get_string("helptext"), "moodle");\r
+ echo "<div align=right>";\r
+ print_string("formattexttype");\r
+ echo ": ";\r
+ if (!$question->questiontextformat) {\r
+ $question->questiontextformat = FORMAT_MOODLE;\r
+ }\r
+ choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");\r
+ helpbutton("textformat", get_string("helpformatting"));\r
+ echo "</div>";\r
}\r
?>\r
- </TD>\r
-</TR>\r
+ </td>\r
+</tr>\r
<TR valign=top>\r
<TD align=right><P><B><?php print_string("imagedisplay", "quiz") ?>:</B></P></TD>\r
<TD>\r
// 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)?