);");
}
+ if ($oldversion < 2003030302) {
+ table_column("quiz_questions", "", "defaultgrade", "INTEGER", "6", "UNSIGNED", "1", "NOT NULL", "image");
+ }
+
return true;
}
`name` varchar(255) NOT NULL default '',
`questiontext` text NOT NULL,
`image` varchar(255) NOT NULL default '',
+ `defaultgrade` INT UNSIGNED DEFAULT '1' NOT NULL,
`qtype` smallint(6) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='The quiz questions themselves';
choose integer NOT NULL default '4',
);");
}
+ if ($oldversion < 2003030302) {
+ table_column("quiz_questions", "", "defaultgrade", "INTEGER", "6", "UNSIGNED", "1", "NOT NULL", "image");
+ }
return true;
}
name varchar(255) NOT NULL default '',
questiontext text NOT NULL default '',
image varchar(255) NOT NULL default '',
+ defaultgrade integer NOT NULL default '1'
qtype integer NOT NULL default '0'
);
# --------------------------------------------------------
}
}
$questions[] = $key;
- $modform->grades[$key] = QUIZ_DEFAULT_SCORE;
+
+ $questionrecord = get_record("quiz_questions", "id", $key);
+ if (!empty($questionrecord->defaultgrade)) {
+ $modform->grades[$key] = $questionrecord->defaultgrade;
+ } else {
+ $modform->grades[$key] = 1;
+ }
}
}
if (!empty($questions)) {
$question->feedback[] = "";
$question->usecase = 0; // Ignore case
+ $question->defaultgrade = 1;
$question->image = ""; // No images with this format
return $question;
$question->feedback[$key] = "";
}
+ $question->defaultgrade = 1;
$question->single = 1; // Only one answer is allowed
$question->image = ""; // No images with this format
return $question;
if (!empty($form->createrandom)) { /// Create a number of random questions
+ $rm->choose = 4; /// Always 4, for now.
$rm->category = $category->id;
$rm->questiontext = get_string("randommatchintro", "quiz");
$rm->image = "";
$rm->qtype = RANDOMMATCH;
- $rm->choose = 4; /// Always 4, for now.
+ $rm->defaultgrade = $rm->choose;
echo "<hr>";
for ($i=1; $i<=$form->createrandom; $i++) {
$rm->name = get_string("randommatch", "quiz") . " $i ($rm->choose $strquestions)";
+ $db->debug = true;
if (!$rm->id = insert_record("quiz_questions", $rm)) {
error("Could not insert new question!");
}
define("QUIZ_PICTURE_DEFAULT_HEIGHT", "200");
-define("QUIZ_DEFAULT_SCORE", "1");
-
/// FUNCTIONS ///////////////////////////////////////////////////////////////////
function quiz_add_instance($quiz) {
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003022303; // The (date) version of this module
+$module->version = 2003030302; // The (date) version of this module
$module->cron = 0; // How often should cron check this module (seconds)?
?>