Versioning of questions: when editing questions the teacher is told about the quizzes in which the question is used and is asked whether to replace them with the new version or not. If there are already attempts at a question than the original version is always kept in the database for audit purposes. More details at http://moodle.org/mod/forum/discuss.php?d=16479

This commit is contained in:
gustav_delius
2005-03-03 15:17:45 +00:00
parent e163bf2d33
commit c6bfdec3fc
17 changed files with 373 additions and 66 deletions
+5
View File
@@ -10,6 +10,7 @@ $string['addquestionstoquiz'] = 'Add questions to current quiz';
$string['addrandom1'] = ' Add ';
$string['addrandom2'] = 'random questions ';
$string['addselectedtoquiz'] = 'Add selected to quiz';
$string['affectedstudents'] = 'Affected $a';
$string['aiken'] = 'Aiken format';
$string['allinone'] = 'Unlimited';
$string['allowreview'] = 'Allow review';
@@ -150,6 +151,7 @@ $string['link'] = 'Link';
$string['listitems'] = 'Listing of Items in Quiz';
$string['literal'] = 'Literal';
$string['loguniform'] = 'digits, from a loguniform distribution';
$string['makecopy'] = 'Save as new question';
$string['marks'] = 'Marks';
$string['match'] = 'Matching';
$string['matchanswer'] = 'Matching answer';
@@ -231,6 +233,8 @@ $string['regrade'] = 'Regrade all attempts';
$string['regradecomplete'] = 'All attempts have been regraded';
$string['regradecount'] = '$a->changed out of $a->attempt grades were changed';
$string['relative'] = 'Relative';
$string['replace'] = 'Replace';
$string['replacementoptions'] = 'Replace in';
$string['reviewnever'] = 'Never allow review';
$string['reviewafter'] = 'Allow review after quiz is closed';
$string['reviewbefore'] = 'Allow review while quiz is open';
@@ -263,6 +267,7 @@ $string['shortanswer'] = 'Short Answer';
$string['show'] = 'Show';
$string['showcorrectanswer'] = 'In feedback, show correct answers?';
$string['showfeedback'] = 'After answering, show feedback?';
$string['showhidden'] = 'Also show hidden questions';
$string['shuffleanswers'] = 'Shuffle answers';
$string['shufflequestions'] = 'Shuffle questions';
$string['significantfiguresformat'] = 'significant figures';
+14
View File
@@ -314,6 +314,20 @@ function quiz_upgrade($oldversion) {
table_column("quiz", "", "decimalpoints", "integer", "4", "", "2", "not null", "grademethod");
}
if($oldversion < 2005022800) {
table_column('quiz_questions', '', 'hidden', 'integer', '1', 'unsigned', '0', 'not null', 'version');
table_column('quiz_responses', '', 'originalquestion', 'integer', '10', 'unsigned', '0', 'not null', 'question');
modify_database ('', "CREATE TABLE `prefix_quiz_question_version` (
`id` int(10) unsigned NOT NULL auto_increment,
`quiz` int(10) unsigned NOT NULL default '0',
`oldquestion` int(10) unsigned NOT NULL default '0',
`newquestion` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
`timestamp` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='The mapping between old and new versions of a question';");
}
return true;
}
+17
View File
@@ -290,6 +290,21 @@ CREATE TABLE `prefix_quiz_question_grades` (
) TYPE=MyISAM COMMENT='The grade for a question in a quiz';
# --------------------------------------------------------
#
# Table structure for table `quiz_question_version`
#
CREATE TABLE `prefix_quiz_question_version` (
`id` int(10) unsigned NOT NULL auto_increment,
`quiz` int(10) unsigned NOT NULL default '0',
`oldquestion` int(10) unsigned NOT NULL default '0',
`newquestion` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
`timestamp` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='The mapping between old and new versions of a question';
# --------------------------------------------------------
#
# Table structure for table `quiz_questions`
#
@@ -305,6 +320,7 @@ CREATE TABLE `prefix_quiz_questions` (
`qtype` smallint(6) NOT NULL default '0',
`stamp` varchar(255) NOT NULL default '',
`version` int(10) NOT NULL default '1',
`hidden` int(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `category` (`category`)
) TYPE=MyISAM COMMENT='The quiz questions themselves';
@@ -331,6 +347,7 @@ CREATE TABLE `prefix_quiz_responses` (
`id` int(10) unsigned NOT NULL auto_increment,
`attempt` int(10) unsigned NOT NULL default '0',
`question` int(10) unsigned NOT NULL default '0',
`originalquestion` int(10) unsigned NOT NULL default '0',
`answer` text NOT NULL default '',
`grade` varchar(10) NOT NULL default '0.0',
PRIMARY KEY (`id`),
+12
View File
@@ -299,6 +299,18 @@ function quiz_upgrade($oldversion) {
table_column("quiz", "", "decimalpoints", "integer", "4", "", "2", "not null", "grademethod");
}
if($oldversion < 2005022800) {
table_column('quiz_questions', '', 'hidden', 'integer', '1', 'unsigned', '0', 'not null', 'version');
table_column('quiz_responses', '', 'originalquestion', 'integer', '10', 'unsigned', '0', 'not null', 'question');
modify_database ('', "CREATE TABLE prefix_quiz_question_version (
id SERIAL PRIMARY KEY,
quiz integer NOT NULL default '0',
oldquestion integer NOT NULL default '0',
newquestion integer NOT NULL default '0',
userid integer NOT NULL default '0',
timestamp integer NOT NULL default '0');");
}
return true;
}
+17 -1
View File
@@ -202,6 +202,20 @@ CREATE INDEX prefix_quiz_question_grades_question_idx ON prefix_quiz_question_gr
# --------------------------------------------------------
#
# Table structure for table `quiz_question_version`
#
CREATE TABLE prefix_quiz_question_version (
id SERIAL PRIMARY KEY,
quiz integer NOT NULL default '0',
oldquestion integer NOT NULL default '0',
newquestion integer NOT NULL default '0',
userid integer NOT NULL default '0',
timestamp integer NOT NULL default '0'
);
# --------------------------------------------------------
#
# Table structure for table quiz_questions
#
@@ -216,7 +230,8 @@ CREATE TABLE prefix_quiz_questions (
defaultgrade integer NOT NULL default '1',
qtype integer NOT NULL default '0',
stamp varchar(255) NOT NULL default '',
version integer NOT NULL default '1'
version integer NOT NULL default '1',
hidden integer NOT NULL default '0'
);
CREATE INDEX prefix_quiz_questions_category_idx ON prefix_quiz_questions (category);
@@ -243,6 +258,7 @@ CREATE TABLE prefix_quiz_responses (
id SERIAL PRIMARY KEY,
attempt integer NOT NULL default '0',
question integer NOT NULL default '0',
originalquestion integer NOT NULL default '0',
answer text NOT NULL default '',
grade varchar(10) NOT NULL default '0.0'
);
+8 -4
View File
@@ -177,8 +177,9 @@
$modform->category = $cat;
}
if (isset($_REQUEST['recurse'])) { /// coming from checkbox below category selection form
$modform->recurse = $recurse;
if(isset($_REQUEST['displayoptions'])) {
$modform->recurse = isset($_REQUEST['recurse']) ? 1 : 0;
$modform->showhidden = isset($_REQUEST['showhidden']);
}
/// all commands have been dealt with, now print the page
@@ -190,6 +191,9 @@
if (!isset($modform->recurse)) {
$modform->recurse = 1;
}
if (!isset($modform->showhidden)) {
$modform->showhidden = false;
}
$SESSION->modform = $modform;
@@ -258,14 +262,14 @@
// non-quiz-specific column
print_simple_box_start("center", "100%");
// starts with category selection form
quiz_print_category_form($course, $modform->category, $modform->recurse);
quiz_print_category_form($course, $modform->category, $modform->recurse, $modform->showhidden);
print_simple_box_end();
print_spacer(5,1);
// continues with list of questions
print_simple_box_start("center", "100%");
quiz_print_cat_question_list($modform->category,
isset($modform->instance), $modform->recurse, $page, $perpage);
isset($modform->instance), $modform->recurse, $page, $perpage, $modform->showhidden);
print_simple_box_end();
if (!isset($modform->instance)) {
print_continue("index.php?id=$modform->course");
+132 -12
View File
@@ -149,7 +149,7 @@ class quiz_default_questiontype {
exit;
}
redirect("edit.php");
return $question;
}
/// Convenience function that is used within the question types only
@@ -345,6 +345,97 @@ class quiz_default_questiontype {
// No options by default
return false;
}
function print_replacement_options($question, $course, $quizid='0') {
// This function is used near the end of the question edit forms in all questiontypes
// It prints the table of quizzes in which the question is used
// containing the checkboxes to allow the teacher to replace the old question version
// no need to display replacement options if the question is new
if(empty($question->id)) {
return true;
}
// get quizzes using the question (using the question_grades table)
$quizlist = array();
if(!$grades = get_records('quiz_question_grades', 'question', $question->id)) {
$grades = array();
}
foreach($grades as $grade) {
$quizlist[$grade->quiz] = $grade->quiz;
}
$quizlist = implode(',', $quizlist);
if(empty($quizlist) or !$quizzes = get_records_list('quiz', 'id', $quizlist)) {
$quizzes = array();
}
// do the printing
if(count($quizzes) > 0) {
// print the table
$strquizname = get_string('modulename', 'quiz');
$strdoreplace = get_string('replace', 'quiz');
$straffectedstudents = get_string('affectedstudents', 'quiz', $course->students);
echo "<tr valign=\"top\">\n";
echo "<td align=\"right\"><b>".get_string("replacementoptions", "quiz").":</b></td>\n";
echo "<td align=\"left\">\n";
echo "<table cellpadding=\"5\" align=\"left\" class=\"generalbox\" width=\"100%\">\n";
echo "<tr>\n";
echo "<th align=\"left\" valign=\"top\" nowrap=\"nowrap\" class=\"generaltableheader c0\">$strquizname</th>\n";
echo "<th align=\"center\" valign=\"top\" nowrap=\"nowrap\" class=\"generaltableheader c0\">$strdoreplace</th>\n";
echo "<th align=\"left\" valign=\"top\" nowrap=\"nowrap\" class=\"generaltableheader c0\">$straffectedstudents</th>\n";
echo "</tr>\n";
foreach($quizzes as $quiz) {
// work out whethere it should be checked by default
$checked = '';
if((int)$quizid === (int)$quiz->id
or empty($quiz->usercount)) {
$checked = "checked=\"checked\"";
}
// find how many different students have already attempted this quiz
$students = array();
if($attempts = get_records('quiz_attempts', 'quiz', $quiz->id)) {
foreach($attempts as $attempt) {
if (!isteacher($course->id, $attempt->userid) // Ignore teacher attempts
and record_exists('quiz_responses', 'attempt', $attempt->id, 'question', $question->id, 'originalquestion', 0)) {
$students[$attempt->userid] = 1;
}
}
}
$studentcount = count($students);
$strstudents = $studentcount === 1 ? $course->student : $course->students;
echo "<tr>\n";
echo "<td align=\"left\" class=\"generaltablecell c0\">$quiz->name</td>\n";
echo "<td align=\"center\" class=\"generaltablecell c0\"><input name=\"q{$quiz->id}replace\" type=\"checkbox\" ".$checked." /></td>\n";
echo "<td align=\"left\" class=\"generaltablecell c0\">".(($studentcount) ? $studentcount.' '.$strstudents : '-')."</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
}
echo "</td></tr>\n";
}
function print_question_form_end($question, $submitscript='') {
// This function is used at the end of the question edit forms in all questiontypes
// It prints the submit buttons and the standard hidden form fields
global $USER;
echo '<tr valign="top">
<td colspan="2" align="center">
<input type="submit" '.$submitscript.' value="'.get_string('savechanges').'" /> ';
if ($question->id) {
echo '<input type="submit" name="makecopy" '.$submitscript.' value="'.get_string("makecopy", "quiz").'" /> ';
}
echo '<input type="submit" name="cancel" value="'.get_string("cancel").'" />
<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />
<input type="hidden" name="id" value="'.$question->id.'" />
<input type="hidden" name="qtype" value="'.$question->qtype.'" />';
// The following hidden field indicates that the versioning code should be turned on, i.e.,
// that old versions should be kept if necessary
echo '<input type="hidden" name="versioning" value="on" />
</td></tr>';
}
}
quiz_load_questiontypes();
@@ -960,7 +1051,7 @@ function quiz_get_category_menu($courseid, $published=false) {
return $catmenu;
}
function quiz_print_category_form($course, $current, $recurse=1) {
function quiz_print_category_form($course, $current, $recurse=1, $showhidden=false) {
/// Prints a form to choose categories
/// Make sure the default category exists for this course
@@ -998,14 +1089,22 @@ function quiz_print_category_form($course, $current, $recurse=1) {
echo "<input type=\"submit\" value=\"$streditcats\" />";
echo "</form>";
echo '</td></tr></table>';
echo '<form method="get" action="edit.php" name="recurse">';
print_string('recurse', 'quiz');
echo '<input type="hidden" name="recurse" value="0">';
echo '<form method="post" action="edit.php" name="displayoptions">';
echo '<input type="hidden" name="displayoptions" value="true">';
echo '<input type="checkbox" name="recurse" value="1"';
if ($recurse) {
echo ' checked="checked"';
}
echo ' onclick="document.recurse.submit(); return true;">';
echo ' onchange="document.displayoptions.submit(); return true;" />';
print_string('recurse', 'quiz');
// hide-feature
echo '<br />';
echo '<input type="checkbox" name="showhidden"';
if ($showhidden) {
echo ' checked="checked"';
}
echo ' onchange="document.displayoptions.submit(); return true;" />';
print_string('showhidden', 'quiz');
echo '</form>';
}
@@ -1222,7 +1321,7 @@ function quiz_print_question_list($questionlist, $grades, $allowdelete=true) {
}
function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=1, $page, $perpage) {
function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=1, $page, $perpage, $showhidden=false) {
// Prints the table of questions in a category with interactions
global $QUIZ_QUESTION_TYPE, $USER;
@@ -1239,7 +1338,7 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
$strquestionname = get_string("questionname", "quiz");
$strdelete = get_string("delete");
$stredit = get_string("edit");
$strcopy = get_string("copy");
$straddselectedtoquiz = get_string("addselectedtoquiz", "quiz");
$strtype = get_string("type", "quiz");
$strcreatemultiple = get_string("createmultiple", "quiz");
@@ -1298,7 +1397,9 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
$categorylist = ($recurse) ? quiz_categorylist($category->id) : $category->id;
if (!$questions = get_records_select('quiz_questions', "category IN ($categorylist) AND qtype != '".RANDOM."'", 'qtype, name ASC', '*', $page*$perpage, $perpage)) {
// hide-feature
$showhidden = $showhidden ? '' : " AND hidden = '0'";
if (!$questions = get_records_select('quiz_questions', "category IN ($categorylist) AND qtype != '".RANDOM."'$showhidden", 'qtype, name ASC', '*', $page*$perpage, $perpage)) {
echo "<p align=\"center\">";
print_string("noquestions", "quiz");
echo "</p>";
@@ -1341,8 +1442,18 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
src=\"../../pix/t/preview.gif\" border=\"0\" alt=\"$strpreview\" /></a>&nbsp;";
echo "<a title=\"$stredit\" href=\"question.php?id=$question->id\"><img
src=\"../../pix/t/edit.gif\" border=\"0\" alt=\"$stredit\" /></a>&nbsp;";
echo "<a title=\"$strcopy\" href=\"question.php?id=$question->id&amp;copy=true\"><img
src=\"../../pix/t/copy.gif\" border=\"0\" alt=\"$strcopy\" /></a>";
// hide-feature
if($question->hidden) {
$strhideshow = get_string("show");
$imghideshow = "show.gif";
$hideshow = 0;
} else {
$strhideshow = get_string("hide");
$imghideshow = "hide.gif";
$hideshow = 1;
}
echo "<a title=\"$strhideshow\" href=\"question.php?id=$question->id&amp;hide=$hideshow&amp;sesskey=$USER->sesskey\"><img
src=\"../../pix/t/$imghideshow\" border=\"0\" alt=\"$strhideshow\" /></a>";
echo "</td>\n";
}
echo "</tr>\n";
@@ -1369,7 +1480,7 @@ function quiz_print_cat_question_list($categoryid, $quizselected=true, $recurse=
echo '<form method="post" action="multiple.php">';
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
print_string('addrandom1', 'quiz');
choose_from_menu($randomcount, 'randomcreate', '10', '');
choose_from_menu($randomcount, 'randomcreate', '1', '');
print_string('addrandom2', 'quiz');
// Don't offer the option to change the grade
//choose_from_menu($randomcount, 'randomgrade', '1', '');
@@ -1897,4 +2008,13 @@ function quizzes_question_used( $id, $published=false, $courseid=0 ) {
}
return $beingused;
}
function quiz_parse_fieldname($name, $nameprefix='question') {
$reg = array();
if(preg_match("/q(\\d+)(\w+)/", $name, $reg)) {
return array('mode' => $reg[2], 'id' => (int)$reg[1]);
} else {
return false;
}
}
?>
+131 -12
View File
@@ -1,5 +1,14 @@
<?php // $Id$
/// For creating and editing quiz questions.
/* Responsibilities of question.php
* - create new question (category, qtype)
* - edit question (id, contextquiz (o))
* - delete question from quiz (delete, sesskey)
* - delete question (in two steps)
* - if question is in use: display this conflict (allow to hide the question?)
* - else: confirm deletion and delete from database (sesskey, id, delete, confirm)
* - cancel (cancel)
* (o) = optional
*/
require_once("../../config.php");
require_once("locallib.php");
@@ -10,7 +19,18 @@
$qtype = optional_param('qtype');
$category = optional_param('category');
$copy = optional_param('copy', false); // true if a copy of the question should be created
$contextquiz = optional_param('contextquiz'); // the quiz from which this question is being edited
if (isset($_REQUEST['cancel'])) {
redirect("edit.php");
}
if(!empty($id) && isset($_REQUEST['hide']) && confirm_sesskey()) {
if(!set_field('quiz_questions', 'hidden', $_REQUEST['hide'], 'id', $id)) {
error("Faild to hide the question.");
}
redirect('edit.php');
}
if ($id) {
if (! $question = get_record("quiz_questions", "id", $id)) {
@@ -29,7 +49,7 @@
$qtype = $question->qtype;
} else if ($category) {
} else if ($category) { // only for creating new questions
if (! $category = get_record("quiz_categories", "id", $category)) {
error("This wasn't a valid category!");
}
@@ -57,7 +77,7 @@
}
$strquizzes = get_string('modulenameplural', 'quiz');
$streditingquestion = ($copy) ? get_string('copyingquestion', 'quiz') : get_string('editingquestion', 'quiz');
$streditingquestion = get_string('editingquestion', 'quiz');
if (isset($SESSION->modform->instance)) {
$strediting = '<a href="edit.php">'.get_string('editingquiz', 'quiz').'</a> -> '.
$streditingquestion;
@@ -114,7 +134,110 @@
}
if ($form = data_submitted() and confirm_sesskey()) {
$question = $QUIZ_QTYPES[$qtype]->save_question($question, $form, $course);
if (isset($form->versioning)) { // use new code that
// handles whether to overwrite or copy a question and keeps
// track of the versions in the quiz_question_version table
// $replaceinquiz is an array with the ids of all quizzes in which the teacher has chosen to replace the old version
$replaceinquiz = array();
foreach($form as $key => $val) {
if ($tmp = quiz_parse_fieldname($key, 'q')) {
if ($tmp['mode'] == 'replace') {
$replaceinquiz[$tmp['id']] = $tmp['id'];
unset($form->$key);
}
}
}
// $quizlist is an array with the ids of quizzes which use this question
$quizlist = array();
if ($grades = get_records('quiz_question_grades', 'question', $form->id)) {
foreach($grades as $grade) {
$quizlist[$grade->quiz] = $grade->quiz;
}
}
// Logic to determine whether old version should be overwritten
$makecopy = isset($form->makecopy) || (!$form->id); unset($form->makecopy);
$noresponses = $makecopy || !(record_exists('quiz_responses', 'question', $form->id) or
record_exists('quiz_responses', 'originalquestion', $form->id)); // Should be improved once the preview flag exists so that teacher preview responses are not taken into account
$notused = $makecopy || !record_exists('quiz_question_grades', 'question', $form->id);
$replaceinall = ($quizlist == $replaceinquiz); // question is being replaced in all quizzes
$replaceold = (!$makecopy && $noresponses && ($notused || $replaceinall));
if (!$replaceold) { // create a new question
$oldquestion = clone($question);
if (!$makecopy) {
$oldquestion->hidden = 1;
if (!set_field("quiz_questions", 'hidden', 1, 'id', $question->id)) {
error("Could not hide question!");
}
}
unset($question->id);
}
unset($makecopy, $noresponses, $notused, $replaceinall, $replaceold);
$question = $QUIZ_QTYPES[$qtype]->save_question($question, $form, $course);
if(!isset($question->id)) {
error("Failed to save the question!");
}
if(isset($oldquestion->id)) {
// create version entries for different quizzes
$version = new object();
$version->oldquestion = $oldquestion->id;
$version->newquestion = $question->id;
$version->userid = $USER->id; // field still needs to be added to table
$version->timestamp = time();
foreach($replaceinquiz as $qid) {
$version->quiz = $qid;
if(!insert_record("quiz_question_version", $version)) {
error("Could not store version information of question $oldquestion->id in quiz $qid!");
}
}
/// now update the question references in the quizzes
$quizzes = implode(',', $replaceinquiz);
if (empty($quizzes) || !$quizzes = get_records_list("quiz", "id", $quizzes)) {
$quizzes = array();
}
foreach($quizzes as $quiz) {
$questionlist = ",$quiz->questions,"; // a little hack with the commas here. not nice but effective
$questionlist = str_replace(",$oldquestion->id,", ",$question->id,", $questionlist);
$questionlist = substr($questionlist, 1, -1); // and get rid of the surrounding commas again
if (!set_field("quiz", 'questions', $questionlist, 'id', $quiz->id)) {
error("Could not update questionlist in quiz $quiz->id!");
}
// the quiz_question_grades table needs to be updated too (aah, the joys of duplication :)
if (!set_field('quiz_question_grades', 'question', $question->id, 'quiz', $quiz->id, 'question', $oldquestion->id)) {
error("Could not update question grade!");
}
if (isset($SESSION->modform) && (int)$SESSION->modform->instance === (int)$quiz->id) {
$SESSION->modform->questions = $questionlist;
$SESSION->modform->grades[$question->id] = $SESSION->modform->grades[$oldquestion->id];
unset($SESSION->modform->grades[$oldquestion->id]);
}
}
// fix responses
if ($attempts = get_records_list('quiz_attempts', 'quiz', implode(',', $replaceinquiz))) {
foreach ($attempts as $attempt) {
if (!set_field('quiz_responses', 'originalquestion', $oldquestion->id, 'attempt', $attempt->id, 'question', $oldquestion->id)
or !set_field('quiz_responses', 'question', $question->id, 'attempt', $attempt->id, 'question', $oldquestion->id)) {
error("Could not point responses to new question");
}
}
}
}
redirect("edit.php");
} else { // use the old code which simply overwrites old versions
$question = $QUIZ_QTYPES[$qtype]->save_question($question, $form, $course);
}
}
$grades = array(1,0.9,0.8,0.75,0.70,0.66666,0.60,0.50,0.40,0.33333,0.30,0.25,0.20,0.16666,0.10,0.05,0);
@@ -165,14 +288,10 @@
$defaultformat = FORMAT_MOODLE;
}
if ($copy) {
print_heading(get_string('copyingfrom', 'quiz', $question->name));
// clear question id so that the data is saved to a new question
$question->id = '';
$question->name .= '_copy';
}
echo '<br />';
print_simple_box_start('center');
require('questiontypes/'.$QUIZ_QTYPES[$qtype]->name().'/editquestion.php');
print_simple_box_end();
if ($usehtmleditor) {
use_html_editor('questiontext');
+4 -4
View File
@@ -81,11 +81,11 @@
</tr>
<?php
}
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
@@ -41,11 +41,13 @@
?>
</td>
</tr>
<?php
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="hidden" name="defaultgrade" value="<?php p($question->defaultgrade) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
@@ -166,7 +166,7 @@ class quiz_embedded_cloze_qtype extends quiz_default_questiontype {
exit;
}
redirect("edit.php");
return $question;
}
function convert_to_response_answer_field($questionresponse) {
@@ -123,13 +123,11 @@
<?php
} /// End of loop, printing answers
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
@@ -132,13 +132,12 @@ for ($i=1; $i<count($units); $i++) {
</tr>
<?php
} /// END for
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question, 'onclick="return determineMinAndMax();"');
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="submit" onclick="return determineMinAndMax();" value="<?php print_string("savechanges") ?>" />
</center>
</form>
<script language="javascript" type="text/javascript">
@@ -2,14 +2,14 @@
<center>
<table cellpadding="5">
<tr valign="top">
<td align="right"><p><b><?php print_string("category", "quiz") ?>:</b></p></td>
<td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
<td>
<?php echo $categories[$question->category]; ?>
<input type="hidden" name="category" value="<?php echo "$question->category"; ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("questionname", "quiz") ?>:</b></p></td>
<td align="right"><b><?php print_string("questionname", "quiz") ?>:</b></td>
<td>
<?php
if (empty($question->name)) {
@@ -21,9 +21,9 @@
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("introduction", "quiz") ?>:</b></p>
<td align="right"><b><?php print_string("introduction", "quiz") ?>:</b>
<br />
<p><font size="1">
<font size="1">
<?php
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
@@ -31,7 +31,7 @@
helpbutton("text", get_string("helptext"), "moodle", true, true);
}
?>
</font></p>
</font>
</td>
<td>
<?php if (isset($err["questiontext"])) {
@@ -59,7 +59,7 @@
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("randomsamatchnumber", "quiz") ?>:</b></p></td>
<td align="right"><b><?php print_string("randomsamatchnumber", "quiz") ?>:</b></td>
<td>
<?php
if ($numberavailable < 2) {
@@ -78,10 +78,10 @@
?>
</td>
</tr>
<?php
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
@@ -115,10 +115,10 @@
<?php
}
?>
<?php
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
@@ -83,10 +83,11 @@
<textarea name="feedbackfalse" rows="2" cols="50"><?php p($false->feedback) ?></textarea>
</td>
</tr>
<?php
$QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
$QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey; ?>" />
<input type="hidden" name="id" value="<?php p($question->id) ?>" />
<input type="hidden" name="qtype" value="<?php p($question->qtype) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
</center>
</form>
+1 -1
View File
@@ -5,7 +5,7 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021601; // The (date) version of this module
$module->version = 2005022800; // The (date) version of this module
$module->requires = 2005021600; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?