mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Renamed quiz_question_version to quiz_question_versions as suggested by Eloy in bug 2777
This commit is contained in:
parent
24357c7847
commit
1909875912
@ -13,7 +13,7 @@
|
||||
// | | | | |.......................................
|
||||
// | | | | | .
|
||||
// | | | | | .
|
||||
// quiz_attempts quiz_grades quiz_question_grades quiz_question_version | ----quiz_question_datasets---- .
|
||||
// quiz_attempts quiz_grades quiz_question_grades quiz_question_versions | ----quiz_question_datasets---- .
|
||||
// (UL,pk->id, fk->quiz) (UL,pk->id,fk->quiz) (CL,pk->id,fk->quiz) (CL,pk->id,fk->quiz) | | (CL,pk->id,fk->question, | .
|
||||
// | | . | | fk->dataset_definition) | .
|
||||
// | | . | | | .
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
// 2.-Standard module backup (Invoked via quiz_backup_mods). It includes this tables:
|
||||
// - quiz
|
||||
// - quiz_question_version
|
||||
// - quiz_question_versions
|
||||
// - quiz_question_grades
|
||||
// - quiz_attempts
|
||||
// - quiz_grades
|
||||
@ -654,7 +654,7 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
$quiz_question_versions = get_records("quiz_question_version","quiz",$quiz,"id");
|
||||
$quiz_question_versions = get_records("quiz_question_versions","quiz",$quiz,"id");
|
||||
//If there are question_versions
|
||||
if ($quiz_question_versions) {
|
||||
//Write start tag
|
||||
@ -662,7 +662,7 @@
|
||||
//Iterate over each question_version
|
||||
foreach ($quiz_question_versions as $que_ver) {
|
||||
//Start question version
|
||||
$status =fwrite ($bf,start_tag("QUESTION_VERSION",5,true));
|
||||
$status =fwrite ($bf,start_tag("QUESTION_VERSIONS",5,true));
|
||||
//Print question_version contents
|
||||
fwrite ($bf,full_tag("ID",6,false,$que_ver->id));
|
||||
fwrite ($bf,full_tag("OLDQUESTION",6,false,$que_ver->oldquestion));
|
||||
@ -670,7 +670,7 @@
|
||||
fwrite ($bf,full_tag("USERID",6,false,$que_ver->userid));
|
||||
fwrite ($bf,full_tag("TIMESTAMP",6,false,$que_ver->timestamp));
|
||||
//End question version
|
||||
$status =fwrite ($bf,end_tag("QUESTION_VERSION",5,true));
|
||||
$status =fwrite ($bf,end_tag("QUESTION_VERSIONS",5,true));
|
||||
}
|
||||
//Write end tag
|
||||
$status =fwrite ($bf,end_tag("QUESTION_VERSIONS",4,true));
|
||||
|
@ -332,6 +332,10 @@ function quiz_upgrade($oldversion) {
|
||||
execute_sql(" INSERT INTO {$CFG->prefix}log_display VALUES ('quiz', 'editquestions', 'quiz', 'name') ");
|
||||
}
|
||||
|
||||
if ($oldversion < 2005032300) {
|
||||
modify_database ('', 'ALTER TABLE prefix_quiz_question_version RENAME prefix_quiz_question_versions;');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -291,10 +291,10 @@ CREATE TABLE `prefix_quiz_question_grades` (
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `quiz_question_version`
|
||||
# Table structure for table `quiz_question_versions`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_quiz_question_version` (
|
||||
CREATE TABLE `prefix_quiz_question_versions` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`quiz` int(10) unsigned NOT NULL default '0',
|
||||
`oldquestion` int(10) unsigned NOT NULL default '0',
|
||||
|
@ -315,6 +315,10 @@ function quiz_upgrade($oldversion) {
|
||||
execute_sql(" INSERT INTO {$CFG->prefix}log_display VALUES ('quiz', 'editquestions', 'quiz', 'name') ");
|
||||
}
|
||||
|
||||
if ($oldversion < 2005032300) {
|
||||
modify_database ('', 'ALTER TABLE prefix_quiz_question_version RENAME prefix_quiz_question_versions;');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -203,10 +203,10 @@ CREATE INDEX prefix_quiz_question_grades_question_idx ON prefix_quiz_question_gr
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `quiz_question_version`
|
||||
# Table structure for table `quiz_question_versions`
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_quiz_question_version (
|
||||
CREATE TABLE prefix_quiz_question_versions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
quiz integer NOT NULL default '0',
|
||||
oldquestion integer NOT NULL default '0',
|
||||
|
@ -281,7 +281,7 @@ function quiz_get_participants($quizid) {
|
||||
//Get users from question_versions
|
||||
$us_versions = get_records_sql("SELECT DISTINCT u.id, u.id
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}quiz_question_version v
|
||||
{$CFG->prefix}quiz_question_versions v
|
||||
WHERE v.quiz = '$quizid' and
|
||||
u.id = v.userid");
|
||||
|
||||
|
@ -127,7 +127,7 @@
|
||||
|
||||
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
|
||||
// track of the versions in the quiz_question_versions table
|
||||
|
||||
// $replaceinquiz is an array with the ids of all quizzes in which the teacher has chosen to replace the old version
|
||||
$replaceinquiz = array();
|
||||
@ -187,7 +187,7 @@
|
||||
|
||||
foreach($replaceinquiz as $qid) {
|
||||
$version->quiz = $qid;
|
||||
if(!insert_record("quiz_question_version", $version)) {
|
||||
if(!insert_record("quiz_question_versions", $version)) {
|
||||
error("Could not store version information of question $oldquestionid in quiz $qid!");
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
// | | | | |.......................................
|
||||
// | | | | | .
|
||||
// | | | | | .
|
||||
// quiz_attempts quiz_grades quiz_question_grades quiz_question_version | ----quiz_question_datasets---- .
|
||||
// quiz_attempts quiz_grades quiz_question_grades quiz_question_versions | ----quiz_question_datasets---- .
|
||||
// (UL,pk->id, fk->quiz) (UL,pk->id,fk->quiz) (CL,pk->id,fk->quiz) (CL,pk->id,fk->quiz) | | (CL,pk->id,fk->question, | .
|
||||
// | | . | | fk->dataset_definition) | .
|
||||
// | | . | | | .
|
||||
@ -84,7 +84,7 @@
|
||||
|
||||
// 2.-Standard module restore (Invoked via quiz_restore_mods). It includes this tables:
|
||||
// - quiz
|
||||
// - quiz_question_version
|
||||
// - quiz_question_versions
|
||||
// - quiz_question_grades
|
||||
// - quiz_attempts
|
||||
// - quiz_grades
|
||||
@ -1452,7 +1452,7 @@
|
||||
$status = true;
|
||||
|
||||
//Get the quiz_question_versions array
|
||||
$versions = $info['MOD']['#']['QUESTION_VERSIONS']['0']['#']['QUESTION_VERSION'];
|
||||
$versions = $info['MOD']['#']['QUESTION_VERSIONS']['0']['#']['QUESTION_VERSIONS'];
|
||||
|
||||
//Iterate over question_versions
|
||||
for($i = 0; $i < sizeof($versions); $i++) {
|
||||
@ -1492,7 +1492,7 @@
|
||||
}
|
||||
|
||||
//The structure is equal to the db, so insert the quiz_question_versions
|
||||
$newid = insert_record ("quiz_question_version",$version);
|
||||
$newid = insert_record ("quiz_question_versions",$version);
|
||||
|
||||
//Do some output
|
||||
if (($i+1) % 10 == 0) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2005032000; // The (date) version of this module
|
||||
$module->version = 2005032300; // The (date) version of this module
|
||||
$module->requires = 2005021600; // Requires this Moodle version
|
||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user